00001 /*************************************************************************** 00002 ** 00003 ** This file is part of QGpCoreTools. 00004 ** 00005 ** This library is free software; you can redistribute it and/or 00006 ** modify it under the terms of the GNU Lesser General Public 00007 ** License as published by the Free Software Foundation; either 00008 ** version 2.1 of the License, or (at your option) any later version. 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 Lesser General Public 00013 ** License for more details. 00014 ** 00015 ** You should have received a copy of the GNU Lesser General Public 00016 ** License along with this library; if not, write to the Free Software 00017 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ** 00019 ** See http://www.geopsy.org for more information. 00020 ** 00021 ** Created : 2007-02-20 00022 ** Authors : 00023 ** Marc Wathelet 00024 ** Marc Wathelet (LGIT, Grenoble, France) 00025 ** 00026 ***************************************************************************/ 00027 00028 #ifndef POINT1D_H 00029 #define POINT1D_H 00030 00031 #include "QGpCoreToolsDLLExport.h" 00032 #include "StringSection.h" 00033 #include "Trace.h" 00034 00035 namespace QGpCoreTools { 00036 00037 class CurvePointOptions; 00038 00039 class QGPCORETOOLS_EXPORT Point1D 00040 { 00041 public: 00042 Point1D() {_x=0.0;} 00043 Point1D(double x) {_x=x;} 00044 00045 bool operator<(const Point1D& p) const {return _x<p._x;} 00046 bool operator==(const Point1D& p) const {return _x==p._x;} 00047 00048 double x() const {return _x;} 00049 void setX(double x) {_x=x;} 00050 double y() const {return 0.0;} 00051 double y(const CurvePointOptions *) const {return 0.0;} 00052 void setY(double) {} 00053 void setY(double, const CurvePointOptions *) {} 00054 00055 void setValid(bool) {} 00056 bool isValid() const {return true;} 00057 00058 inline void interpole(double valX, const Point1D&, const Point1D&); 00059 void average(const Point1D&) {} 00060 00061 // I/O functions 00062 bool fromString(const StringSection& str); 00063 QString toString(int precision=6, char format='g') const; 00064 private: 00065 double _x; 00066 }; 00067 00068 inline void Point1D::interpole(double valX, const Point1D&, const Point1D&) 00069 { 00070 TRACE; 00071 setX(valX); 00072 } 00073 00074 } // namespace QGpCoreTools 00075 00076 #endif // POINT1D.H