DinverDCCore/ParamProfile.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 ParamProfile_H
00029 #define ParamProfile_H
00030 
00031 #include <stdio.h>
00032 
00033 #include <DinverCore.h>
00034 #include <QGpCoreTools.h>
00035 #include <QGpCoreWave.h>
00036 
00037 #include "DinverDCCoreDLLExport.h"
00038 
00039 namespace DinverDCCore {
00040 
00041 class ParamLayer;
00042 class ParamGroundModel;
00043 
00044 typedef QList<ParamLayer *> LayerList;
00045 typedef QMap<QString,ParamLayer *> LayerMap;
00046 
00047 #define _minRaw _raw
00048 #define _minResampled _resampled
00049 
00050 class DINVERDCCORE_EXPORT ParamProfile  : public XMLClass
00051 {
00052   TRANSLATIONS( "ParamProfile" )
00053 public:
00054   enum Type {Param, Condition};
00055 
00056   ParamProfile();
00057   ParamProfile(const ParamProfile& o);
00058   ParamProfile(QString shortName, QString longName, QString unit,
00059                    double defaultMinimum, double defaultMaximum,
00060                    Type type, SimpleCondition::Type defaultCondition);
00061   virtual ~ParamProfile();
00062 
00063   bool hasGradient() const;
00064   Type type() const {return _type;}
00065   const QString& longName() const {return _longName;}
00066   const QString& shortName() const {return _shortName;}
00067   const QString& unit() const {return _unit;}
00068   double defaultMinimum() const {return _defaultMinimum;}
00069   double defaultMaximum() const {return _defaultMaximum;}
00070   SimpleCondition::Type defaultCondition() const {return _defaultCondition;}
00071 
00072   void insertLayer(int at, ParamLayer * layer);
00073   void addLayer(ParamLayer * layer) {_layers.append(layer);}
00074   ParamLayer * layer(int index) const {return _layers.at(index);}
00075 
00076   void collectDepthLinks(LayerMap& links);
00077   void setDepthLinks(const LayerMap& links);
00078   void setDepthLinkNames();
00079 
00080   bool toParam(RealSpace& ps, LayerMap& links, const ParamGroundModel * groundModel);
00081   void setLinkedDepth(RealSpace& ps);
00082   int nLayers() const {return _layers.count();}
00083   void initFinalProfile();
00084   void setFinalDepths(int fromLayer=0);
00085   void setFinalProfileDepths(int fromLayer=0);
00086   void setFinalProfileFrom(int layer=0);
00087   void setFinalProfileAt(int layer);
00088 
00089   const Profile& rawProfile() const {return _raw;}
00090   const Profile& minRawProfile() const {return _minRaw;}
00091   const Profile& maxRawProfile() const {return _maxRaw;}
00092 
00093   const Profile& resampledProfile() const {return _resampled;}
00094   Profile& resampledProfile() {return _resampled;}
00095   const Profile& minResampledProfile() const {return _minResampled;}
00096   Profile& minResampledProfile() {return _minResampled;}
00097   const Profile& maxResampledProfile() const {return _maxResampled;}
00098   Profile& maxResampledProfile() {return _maxResampled;}
00099 
00100   void collectDepths(QVector<double>& depths) const {_raw.collectDepths(depths);}
00101   inline void resampleProfile(QVector<double>& baseD);
00102   void writeReport(QDataStream& s) const {_resampled.writeReport(s);}
00103   void collectValueParameters(QList<Parameter *>& params) const;
00104   void pRaw() const;
00105   void pResampled() const;
00106   void pMaxRaw() const;
00107   void pMaxResampled() const;
00108 protected:
00109   QString _longName;
00110   QString _shortName;
00111   QString _unit;
00112   double _defaultMinimum, _defaultMaximum;
00113   SimpleCondition::Type _defaultCondition;
00114   Type _type;
00115 
00116   LayerList _layers;
00117 
00118   Profile _raw;
00119   Profile _resampled;
00120   Profile _maxRaw;
00121   Profile _maxResampled;
00122 protected:
00123   virtual const QString& xml_tagName() const {return xmlParamProfileTag;}
00124   static const QString xmlParamProfileTag;
00125   virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00126   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00127   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00128   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00129 };
00130 
00131 inline void ParamProfile::resampleProfile(QVector<double>& baseD)
00132 {
00133   TRACE;
00134   _resampled.resample(_raw, baseD);
00135   if(_type==Condition) _maxResampled.resample(_maxRaw, baseD);
00136 }
00137 
00138 } // namespace DinverDCCore
00139 
00140 #endif // PARAMPROFILE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines