DinverDCCore/ParamLayer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of DinverDCCore.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created : 2004-10-18
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (ULg, Liège, Belgium)
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef PARAMLAYER_H
00029 #define PARAMLAYER_H
00030 
00031 #include <DinverCore.h>
00032 #include <QGpCoreTools.h>
00033 #include <QGpCoreWave.h>
00034 
00035 #include "DinverDCCoreDLLExport.h"
00036 
00037 namespace DinverDCCore {
00038 
00039 class ParamProfile;
00040 class ParamGroundModel;
00041 
00042 class DINVERDCCORE_EXPORT ParamLayer : public XMLClass
00043 {
00044   TRANSLATIONS( "ParamLayer" )
00045 public:
00046   ParamLayer(const ParamLayer& o);
00047   ParamLayer(ParamProfile * profile, int index);
00048   ParamLayer(ParamProfile * profile, int index, double minValue, double maxValue, ParamProfile * linkedTo);
00049   ParamLayer(ParamProfile * profile, int index, double minValue, double maxValue, double minDepth, double maxDepth);
00050 
00051   virtual const QString& xml_tagName() const {return xmlParamLayerTag;}
00052   static const QString xmlParamLayerTag;
00053 
00054   enum Shape {Uniform, Linear, LinearIncrease, LinearDecrease, PowerLaw};
00055 
00056   ParamProfile * profile() const {return _profile;}
00057   void setProfile(ParamProfile * p) {_profile=p;}
00058 
00059   int index() const {return _index;}
00060   void setIndex(int i) {_index=i;}
00061 
00062   QString name() const;
00063   QString unit() const;
00064   static inline QString name(QString profileShortName, int index);
00065 
00066   Shape shape() const {return _shape;}
00067   void setShape(Shape s) {_shape=s;}
00068   bool isUniformShape() {return _shape==Uniform;}
00069 
00070   int nSubLayers() const {return _nSubLayers;}
00071   void setNSubLayers(int n) {_nSubLayers=n;}
00072 
00073   const QString& linkedTo() const {return _linkedTo;}
00074   void setLinkedTo(const QString& l) {_linkedTo=l;}
00075   void setLinkedTo();
00076   void setPtrLink(ParamLayer * layer) {_ptrLink=layer;}
00077   void setLinkedDepth(bool last, ParamLayer * prev, RealSpace& ps);
00078   bool isLinkedTo(ParamLayer * o);
00079 
00080   bool isDepth() const {return _isDepth;}
00081   void setDepth(bool d) {_isDepth=d;}
00082 
00083   bool isLastParamCondition() const {return _lastParamCondition;}
00084   void setLastParamCondition(bool c) {_lastParamCondition= c;}
00085 
00086   double topMinimumValue() const {return _topMin;}
00087   void setTopMinimumValue(double v) {_topMin=v;}
00088 
00089   double topMaximumValue() const {return _topMax;}
00090   void setTopMaximumValue(double v) {_topMax=v;}
00091 
00092   double bottomMinimumValue() const {return _bottomMin;}
00093   void setBottomMinimumValue(double v) {_bottomMin=v;}
00094 
00095   double bottomMaximumValue() const {return _bottomMax;}
00096   void setBottomMaximumValue(double v) {_bottomMax=v;}
00097 
00098   double minimumDepth() const {return _dhMin;}
00099   void setMinimumDepth(double v) {_dhMin=v;}
00100 
00101   double maximumDepth() const {return _dhMax;}
00102   void setMaximumDepth(double v) {_dhMax=v;}
00103 
00104   void setTopDepthIndex(int& index);
00105   int topDepthIndex() const {return _topDepthIndex;}
00106 
00107   double topDepth() const {return _finalTopDepth;}
00108   double bottomDepth() const {return _finalBottomDepth;}
00109   double fixedBottomDepth() const;
00110   void setFinalDepths(double& z);
00111   void setFinalProfileDepthsParam(Profile& profile, double & z);
00112   void setFinalProfileDepthsCondition(Profile& min, Profile& max, double & z);
00113   inline void setFinalProfileValuesParam(Profile& profile);
00114   inline void setFinalProfileValuesCondition(Profile& min, Profile& max);
00115 
00116   bool valueToParam(RealSpace& ps, const ParamGroundModel * groundModel);
00117   bool depthToParam(bool last, ParamLayer * prev, RealSpace& ps, const ParamGroundModel * groundModel);
00118   void collectValueParameters(QList<Parameter *>& params) const;
00119 
00120   Parameter * topParam() const {return _topP;}
00121   Parameter * bottomParam() const {return _bottomP;}
00122   Parameter * dhParam() const {return _dhP;}
00123 protected:
00124   double fixedThickness(ParamLayer *& ref);
00125   void setFinalProfileValues(Profile& profile, double topV, double bottomV);
00126 
00127   ParamProfile * _profile;
00128   int _index;
00129   Shape _shape;
00130   int _nSubLayers;
00131   double _topMin, _topMax, _bottomMin, _bottomMax;
00132 
00133   bool _lastParamCondition;
00134 
00135   QString _linkedTo;
00136   ParamLayer * _ptrLink;
00137   bool _isDepth;
00138   double _dhMin, _dhMax;
00139 
00140   Parameter * _topP, * _bottomP, * _dhP;
00141   int _topDepthIndex;
00142   double _finalTopDepth;
00143   double _finalBottomDepth;
00144 protected:
00145   virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00146   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00147   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00148 };
00149 
00150 inline QString ParamLayer::name(QString profileShortName, int index)
00151 {
00152   TRACE;
00153   return profileShortName+QString::number(index);
00154 }
00155 
00156 inline void ParamLayer::setFinalProfileValuesParam(Profile& profile)
00157 {
00158   TRACE;
00159   setFinalProfileValues(profile, _topP->realValue(), _bottomP->realValue());
00160 }
00161 
00162 inline void ParamLayer::setFinalProfileValuesCondition(Profile& min, Profile& max)
00163 {
00164   TRACE;
00165   setFinalProfileValues(min, _topMin, _bottomMin);
00166   setFinalProfileValues(max, _topMax, _bottomMax);
00167 }
00168 
00169 
00170 } // namespace DinverDCCore
00171 
00172 #endif // PARAMLAYER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines