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

HotPixel.h

00001 /**********************************************************************
00002  * $Id: HotPixel.h 2556 2009-06-06 22:22:28Z strk $
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 public:
00140 
00141         HotPixel(const geom::Coordinate& pt,
00142                         double scaleFact,
00143                         algorithm::LineIntersector& li);
00144 
00148         const geom::Coordinate& getCoordinate() const { return originalPt; }
00149 
00154         const geom::Envelope& getSafeEnvelope() const;
00155 
00156         bool intersectsScaled(const geom::Coordinate& p0,
00157                         const geom::Coordinate& p1) const;
00158 
00159         bool intersects(const geom::Coordinate& p0,
00160                         const geom::Coordinate& p1) const;
00161  
00170         bool addSnappedNode(NodedSegmentString& segStr, size_t segIndex);
00171 
00172 };
00173 
00174 
00175 
00176 } // namespace geos::noding::snapround
00177 } // namespace geos::noding
00178 } // namespace geos
00179 
00180 #ifdef GEOS_INLINE
00181 # include "geos/noding/snapround/HotPixel.inl"
00182 #endif
00183 
00184 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
00185 
00186 /**********************************************************************
00187  * $Log$
00188  * Revision 1.3  2006/05/03 17:50:49  strk
00189  * Doxygen comments
00190  *
00191  * Revision 1.2  2006/03/24 09:52:41  strk
00192  * USE_INLINE => GEOS_INLINE
00193  *
00194  * Revision 1.1  2006/03/14 12:55:56  strk
00195  * Headers split: geomgraphindex.h, nodingSnapround.h
00196  *
00197  **********************************************************************/
00198 

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4