GEOS: ScaledNoder.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# ScaledNoder.h

    00001 /**********************************************************************
    00002  * $Id: ScaledNoder.h 2778 2009-12-03 19:44:00Z 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 // Forward declarations
    00034 namespace geos {
    00035         namespace geom {
    00036                 class Coordinate;
    00037                 class CoordinateSequence;
    00038         }
    00039         namespace noding {
    00040                 class SegmentString;
    00041         }
    00042 }
    00043
    00044 namespace geos {
    00045 namespace noding { // geos.noding
    00046
    00057 class GEOS_DLL ScaledNoder : public Noder { // , public geom::CoordinateFilter { // implements Noder
    00058
    00059 public:
    00060
    00061         bool isIntegerPrecision() { return (scaleFactor == 1.0); }
    00062
    00063         ScaledNoder(Noder& n, double nScaleFactor,
    00064                         double nOffsetX=0.0, double nOffsetY=0.0)
    00065                 :
    00066                 noder(n),
    00067                 scaleFactor(nScaleFactor),
    00068                 offsetX(nOffsetX),
    00069                 offsetY(nOffsetY),
    00070                 isScaled(nScaleFactor!=1.0)
    00071         {}
    00072
    00073         ~ScaledNoder();
    00074
    00075         std::vector<SegmentString*>* getNodedSubstrings() const;
    00076
    00077         void computeNodes(std::vector<SegmentString*>* inputSegStr);
    00078
    00079         //void filter(Coordinate& c);
    00080
    00081         void filter_ro(const geom::Coordinate* c)
    00082     {
    00083         ::geos::ignore_unused_variable_warning(c);
    00084         assert(0);
    00085     }
    00086
    00087         void filter_rw(geom::Coordinate* c) const;
    00088
    00089 private:
    00090
    00091         Noder& noder;
    00092
    00093         double scaleFactor;
    00094
    00095         double offsetX;
    00096
    00097         double offsetY;
    00098
    00099         bool isScaled;
    00100
    00101         void rescale(std::vector<SegmentString*>& segStrings) const;
    00102
    00103         void scale(std::vector<SegmentString*>& segStrings) const;
    00104
    00105         class Scaler;
    00106
    00107         class ReScaler;
    00108
    00109         friend class ScaledNoder::Scaler;
    00110
    00111         friend class ScaledNoder::ReScaler;
    00112
    00113     mutable std::vector<geom::CoordinateSequence*> newCoordSeq;
    00114
    00115     // Declare type as noncopyable
    00116     ScaledNoder(const ScaledNoder& other);
    00117     ScaledNoder& operator=(const ScaledNoder& rhs);
    00118 };
    00119
    00120 } // namespace geos.noding
    00121 } // namespace geos
    00122
    00123
    00124 //#ifdef GEOS_INLINE
    00125 //# include "geos/noding/ScaledNoder.inl"
    00126 //#endif
    00127
    00128 #endif // GEOS_NODING_SCALEDNODER_H
    00129
    00130 /**********************************************************************
    00131  * $Log$
    00132  * Revision 1.8  2006/06/19 23:33:03  strk
    00133  * Don't *require* CoordinateFilters to define both read-only and read-write methods.
    00134  *
    00135  * Revision 1.7  2006/05/04 06:36:00  strk
    00136  * Extended definition to take new CoordinateSequence tracking into account
    00137  *
    00138  * Revision 1.6  2006/05/03 15:04:33  strk
    00139  * removed reduntant port info
    00140  *
    00141  * Revision 1.5  2006/05/03 15:00:42  strk
    00142  * Fixed scale() function to remove repeated points *after* rounding. Added brief doxygen class description.
    00143  *
    00144  * Revision 1.4  2006/05/03 09:14:22  strk
    00145  * * source/operation/buffer/OffsetCurveSetBuilder.cpp: used auto_ptr to protect leaks of CoordinateSequence
    00146  * * source/noding/ScaledNoder.cpp, source/headers/geos/noding/ScaledNoder.h: ported JTS bugfix in scale method.
    00147  *
    00148  * Revision 1.3  2006/03/24 09:52:41  strk
    00149  * USE_INLINE => GEOS_INLINE
    00150  *
    00151  * Revision 1.2  2006/03/13 21:19:51  strk
    00152  * 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.
    00153  *
    00154  * Revision 1.1  2006/03/09 16:46:49  strk
    00155  * geos::geom namespace definition, first pass at headers split
    00156  *
    00157  **********************************************************************/
    00158