# HotPixel.h

    00001 /**********************************************************************
    00002  * $Id: HotPixel.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/snapround/HotPixel.java rev. 1.2 (JTS-1.7)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_NODING_SNAPROUND_HOTPIXEL_H
    00021 #define GEOS_NODING_SNAPROUND_HOTPIXEL_H
    00022
    00023 #include <geos/inline.h>
    00024
    00025 #include <geos/geom/Coordinate.h> // for composition
    00026 #include <geos/geom/Envelope.h> // for auto_ptr
    00027
    00028 // Forward declarations
    00029 namespace geos {
    00030         namespace geom {
    00031                 class Envelope;
    00032         }
    00033         namespace algorithm {
    00034                 class LineIntersector;
    00035         }
    00036 }
    00037
    00038 namespace geos {
    00039 namespace noding { // geos::noding
    00040 namespace snapround { // geos::noding::snapround
    00041
    00053 class HotPixel {
    00054
    00055 private:
    00056
    00057         algorithm::LineIntersector& li;
    00058
    00059         geom::Coordinate pt;
    00060         const geom::Coordinate& originalPt;
    00061         geom::Coordinate ptScaled;
    00062
    00063         double scaleFactor;
    00064
    00065         double minx;
    00066         double maxx;
    00067         double miny;
    00068         double maxy;
    00069
    00077         std::vector<geom::Coordinate> corner;
    00078
    00080         mutable std::auto_ptr<geom::Envelope> safeEnv;
    00081
    00082         void initCorners(const geom::Coordinate& pt);
    00083
    00084         double scale(double val) const;
    00085
    00086         void copyScaled(const geom::Coordinate& p,
    00087                         geom::Coordinate& pScaled) const;
    00088
    00110         bool intersectsToleranceSquare(const geom::Coordinate& p0,
    00111                         const geom::Coordinate& p1) const;
    00112
    00113
    00128         bool intersectsPixelClosure(const geom::Coordinate& p0,
    00129                         const geom::Coordinate& p1);
    00130
    00131 public:
    00132
    00133         HotPixel(const geom::Coordinate& pt,
    00134                         double scaleFact,
    00135                         algorithm::LineIntersector& li);
    00136
    00140         const geom::Coordinate& getCoordinate() const { return originalPt; }
    00141
    00146         const geom::Envelope& getSafeEnvelope() const;
    00147
    00148         bool intersectsScaled(const geom::Coordinate& p0,
    00149                         const geom::Coordinate& p1) const;
    00150
    00151         bool intersects(const geom::Coordinate& p0,
    00152                         const geom::Coordinate& p1) const;
    00153
    00154
    00155 };
    00156
    00157
    00158
    00159 } // namespace geos::noding::snapround
    00160 } // namespace geos::noding
    00161 } // namespace geos
    00162
    00163 #ifdef GEOS_INLINE
    00164 # include "geos/noding/snapround/HotPixel.inl"
    00165 #endif
    00166
    00167 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
    00168
    00169 /**********************************************************************
    00170  * $Log$
    00171  * Revision 1.3  2006/05/03 17:50:49  strk
    00172  * Doxygen comments
    00173  *
    00174  * Revision 1.2  2006/03/24 09:52:41  strk
    00175  * USE_INLINE => GEOS_INLINE
    00176  *
    00177  * Revision 1.1  2006/03/14 12:55:56  strk
    00178  * Headers split: geomgraphindex.h, nodingSnapround.h
    00179  *
    00180  **********************************************************************/
    00181