QGpCoreTools/ConcentricSearch.h
Go to the documentation of this file.
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 : 2006-01-09
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef CONCENTRICSEARCH_H
00029 #define CONCENTRICSEARCH_H
00030 
00031 #include "Function2Search.h"
00032 #include "Angle.h"
00033 #include "QGpCoreToolsDLLExport.h"
00034 
00035 namespace QGpCoreTools {
00036 
00037 class AbstractFunction2;
00038 
00039 class QGPCORETOOLS_EXPORT ConcentricSearch : public Function2Search
00040 {
00041 public:
00042   ConcentricSearch();
00043   ~ConcentricSearch();
00044 
00045   void setGrid(double minR, double maxR, double dR);
00046   void setMaximumRadius(double maxR) {_rMax=maxR;}
00047   void setCenter(double x, double y) {_x=x; _y=y;}
00048   void setNoiseLevel(double nl) {_noiseLevel=nl;}
00049 
00050   double maximum(QAtomicInt * terminate=0);
00051   double maxX() const {return _maxX;}
00052   double maxY() const {return _maxY;}
00053   double maxRadius() const;
00054   Angle maxAngle() const {return Angle(_maxX-_x, _maxY-_y);}
00055   Angle maxAngle(double radius) const {return Angle(_maxX-_x, _maxY-_y, radius);}
00056   double r0() const;
00057   double dr() const {return _dr;}
00058 private:
00059   enum Segment {Top, Bottom, Left, Right};
00060   bool scanX(double min, double max, double y);
00061   bool scanY(double min, double max, double x);
00062   void crossRefineX(double x, double y, double dr);
00063   void crossRefineY(double x, double y, double dr);
00064 
00065   mutable QMutex _r0Mutex;
00066   double _r0, _dr, _rMax, _noiseLevel;
00067   Segment _segment;
00068   double _x,_y,_pos;
00069   double _precision;
00070   double _v1,_v2,_v3;
00071   double _maxValue,_maxX, _maxY;
00072 };
00073 
00074 } // namespace QGpCoreTools
00075 
00076 #endif // CONCENTRICSEARCH_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines