Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

ScaledNoder.h

00001 /**********************************************************************
00002  * $Id: ScaledNoder.h 3255 2011-03-01 17:56:10Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006      Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: noding/ScaledNoder.java rev. 1.3 (JTS-1.7.1)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_NODING_SCALEDNODER_H
00021 #define GEOS_NODING_SCALEDNODER_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <cassert>
00026 #include <vector>
00027 
00028 #include <geos/inline.h>
00029 #include <geos/noding/Noder.h> // for inheritance
00030 //#include <geos/geom/CoordinateFilter.h> // for inheritance
00031 #include <geos/util.h>
00032 
00033 #ifdef _MSC_VER
00034 #pragma warning(push)
00035 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00036 #endif
00037 
00038 // Forward declarations
00039 namespace geos {
00040         namespace geom {
00041                 class Coordinate;
00042                 class CoordinateSequence;
00043         }
00044         namespace noding {
00045                 class SegmentString;
00046         }
00047 }
00048 
00049 namespace geos {
00050 namespace noding { // geos.noding
00051 
00062 class GEOS_DLL ScaledNoder : public Noder { // , public geom::CoordinateFilter { // implements Noder
00063 
00064 public:
00065 
00066         bool isIntegerPrecision() { return (scaleFactor == 1.0); }
00067 
00068         ScaledNoder(Noder& n, double nScaleFactor,
00069                         double nOffsetX=0.0, double nOffsetY=0.0)
00070                 :
00071                 noder(n),
00072                 scaleFactor(nScaleFactor),
00073                 offsetX(nOffsetX),
00074                 offsetY(nOffsetY),
00075                 isScaled(nScaleFactor!=1.0)
00076         {}
00077 
00078         ~ScaledNoder();
00079 
00080         std::vector<SegmentString*>* getNodedSubstrings() const;
00081 
00082         void computeNodes(std::vector<SegmentString*>* inputSegStr);
00083 
00084         //void filter(Coordinate& c);
00085 
00086         void filter_ro(const geom::Coordinate* c)
00087     {
00088         ::geos::ignore_unused_variable_warning(c);
00089         assert(0);
00090     }
00091 
00092         void filter_rw(geom::Coordinate* c) const;
00093 
00094 private:
00095 
00096         Noder& noder;
00097 
00098         double scaleFactor;
00099 
00100         double offsetX;
00101 
00102         double offsetY;
00103 
00104         bool isScaled;
00105 
00106         void rescale(std::vector<SegmentString*>& segStrings) const;
00107 
00108         void scale(std::vector<SegmentString*>& segStrings) const;
00109 
00110         class Scaler;
00111 
00112         class ReScaler;
00113 
00114         friend class ScaledNoder::Scaler;
00115 
00116         friend class ScaledNoder::ReScaler;
00117 
00118     mutable std::vector<geom::CoordinateSequence*> newCoordSeq;
00119 
00120     // Declare type as noncopyable
00121     ScaledNoder(const ScaledNoder& other);
00122     ScaledNoder& operator=(const ScaledNoder& rhs);
00123 };
00124 
00125 } // namespace geos.noding
00126 } // namespace geos
00127 
00128 #ifdef _MSC_VER
00129 #pragma warning(pop)
00130 #endif
00131 
00132 //#ifdef GEOS_INLINE
00133 //# include "geos/noding/ScaledNoder.inl"
00134 //#endif
00135 
00136 #endif // GEOS_NODING_SCALEDNODER_H
00137 
00138 /**********************************************************************
00139  * $Log$
00140  * Revision 1.8  2006/06/19 23:33:03  strk
00141  * Don't *require* CoordinateFilters to define both read-only and read-write methods.
00142  *
00143  * Revision 1.7  2006/05/04 06:36:00  strk
00144  * Extended definition to take new CoordinateSequence tracking into account
00145  *
00146  * Revision 1.6  2006/05/03 15:04:33  strk
00147  * removed reduntant port info
00148  *
00149  * Revision 1.5  2006/05/03 15:00:42  strk
00150  * Fixed scale() function to remove repeated points *after* rounding. Added brief doxygen class description.
00151  *
00152  * Revision 1.4  2006/05/03 09:14:22  strk
00153  * * source/operation/buffer/OffsetCurveSetBuilder.cpp: used auto_ptr to protect leaks of CoordinateSequence
00154  * * source/noding/ScaledNoder.cpp, source/headers/geos/noding/ScaledNoder.h: ported JTS bugfix in scale method.
00155  *
00156  * Revision 1.3  2006/03/24 09:52:41  strk
00157  * USE_INLINE => GEOS_INLINE
00158  *
00159  * Revision 1.2  2006/03/13 21:19:51  strk
00160  * Fixed bug in ScaledNoder scaling mechanism (hugly code, due to CoordinateSequence visitor pattern design). Tests are still failing so this possibly needs some other fix. Streamlined includes by implementation file.
00161  *
00162  * Revision 1.1  2006/03/09 16:46:49  strk
00163  * geos::geom namespace definition, first pass at headers split
00164  *
00165  **********************************************************************/
00166 

Generated on Sun Aug 21 23:21:01 2011 for GEOS by  doxygen 1.3.9.1