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

- File List

# HotPixel.h

    00001 /**********************************************************************
    00002  * $Id: HotPixel.h 2777 2009-12-03 19:41:15Z 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/snapround/HotPixel.java rev. 1.3 (JTS-1.9)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_NODING_SNAPROUND_HOTPIXEL_H
    00021 #define GEOS_NODING_SNAPROUND_HOTPIXEL_H
    00022
    00023 #include <geos/export.h>
    00024
    00025 #include <geos/inline.h>
    00026
    00027 #include <geos/geom/Coordinate.h> // for composition
    00028 #include <geos/geom/Envelope.h> // for auto_ptr
    00029
    00030 // Forward declarations
    00031 namespace geos {
    00032         namespace geom {
    00033                 class Envelope;
    00034         }
    00035         namespace algorithm {
    00036                 class LineIntersector;
    00037         }
    00038         namespace noding {
    00039                 class NodedSegmentString;
    00040         }
    00041 }
    00042
    00043 namespace geos {
    00044 namespace noding { // geos::noding
    00045 namespace snapround { // geos::noding::snapround
    00046
    00058 class GEOS_DLL HotPixel {
    00059
    00060 private:
    00061
    00062         algorithm::LineIntersector& li;
    00063
    00064         geom::Coordinate pt;
    00065         const geom::Coordinate& originalPt;
    00066         geom::Coordinate ptScaled;
    00067
    00068         mutable geom::Coordinate p0Scaled;
    00069         mutable geom::Coordinate p1Scaled;
    00070
    00071         double scaleFactor;
    00072
    00073         double minx;
    00074         double maxx;
    00075         double miny;
    00076         double maxy;
    00077
    00085         std::vector<geom::Coordinate> corner;
    00086
    00088         mutable std::auto_ptr<geom::Envelope> safeEnv;
    00089
    00090         void initCorners(const geom::Coordinate& pt);
    00091
    00092         double scale(double val) const;
    00093
    00094         void copyScaled(const geom::Coordinate& p,
    00095                         geom::Coordinate& pScaled) const;
    00096
    00118         bool intersectsToleranceSquare(const geom::Coordinate& p0,
    00119                         const geom::Coordinate& p1) const;
    00120
    00121
    00136         bool intersectsPixelClosure(const geom::Coordinate& p0,
    00137                         const geom::Coordinate& p1);
    00138
    00139     // Declare type as noncopyable
    00140     HotPixel(const HotPixel& other);
    00141     HotPixel& operator=(const HotPixel& rhs);
    00142
    00143 public:
    00144
    00145         HotPixel(const geom::Coordinate& pt,
    00146                         double scaleFact,
    00147                         algorithm::LineIntersector& li);
    00148
    00152         const geom::Coordinate& getCoordinate() const { return originalPt; }
    00153
    00158         const geom::Envelope& getSafeEnvelope() const;
    00159
    00160         bool intersectsScaled(const geom::Coordinate& p0,
    00161                         const geom::Coordinate& p1) const;
    00162
    00163         bool intersects(const geom::Coordinate& p0,
    00164                         const geom::Coordinate& p1) const;
    00165
    00174         bool addSnappedNode(NodedSegmentString& segStr, size_t segIndex);
    00175
    00176 };
    00177
    00178
    00179
    00180 } // namespace geos::noding::snapround
    00181 } // namespace geos::noding
    00182 } // namespace geos
    00183
    00184 #ifdef GEOS_INLINE
    00185 # include "geos/noding/snapround/HotPixel.inl"
    00186 #endif
    00187
    00188 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
    00189
    00190 /**********************************************************************
    00191  * $Log$
    00192  * Revision 1.3  2006/05/03 17:50:49  strk
    00193  * Doxygen comments
    00194  *
    00195  * Revision 1.2  2006/03/24 09:52:41  strk
    00196  * USE_INLINE => GEOS_INLINE
    00197  *
    00198  * Revision 1.1  2006/03/14 12:55:56  strk
    00199  * Headers split: geomgraphindex.h, nodingSnapround.h
    00200  *
    00201  **********************************************************************/
    00202