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

# ScaledNoder.h

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