/usr/include/geos/noding/snapround/HotPixel.h is in libgeos-dev 3.2.2-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /**********************************************************************
* $Id: HotPixel.h 2777 2009-12-03 19:41:15Z mloskot $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: noding/snapround/HotPixel.java rev. 1.3 (JTS-1.9)
*
**********************************************************************/
#ifndef GEOS_NODING_SNAPROUND_HOTPIXEL_H
#define GEOS_NODING_SNAPROUND_HOTPIXEL_H
#include <geos/export.h>
#include <geos/inline.h>
#include <geos/geom/Coordinate.h> // for composition
#include <geos/geom/Envelope.h> // for auto_ptr
// Forward declarations
namespace geos {
namespace geom {
class Envelope;
}
namespace algorithm {
class LineIntersector;
}
namespace noding {
class NodedSegmentString;
}
}
namespace geos {
namespace noding { // geos::noding
namespace snapround { // geos::noding::snapround
/** \brief
* Implements a "hot pixel" as used in the Snap Rounding algorithm.
*
* A hot pixel contains the interior of the tolerance square and
* the boundary
* <b>minus</b> the top and right segments.
*
* The hot pixel operations are all computed in the integer domain
* to avoid rounding problems.
*
*/
class GEOS_DLL HotPixel {
private:
algorithm::LineIntersector& li;
geom::Coordinate pt;
const geom::Coordinate& originalPt;
geom::Coordinate ptScaled;
mutable geom::Coordinate p0Scaled;
mutable geom::Coordinate p1Scaled;
double scaleFactor;
double minx;
double maxx;
double miny;
double maxy;
/** \brief
* The corners of the hot pixel
*
* In the order:
* 1 0
* 2 3
*/
std::vector<geom::Coordinate> corner;
/// Owned by this class, constructed on demand
mutable std::auto_ptr<geom::Envelope> safeEnv;
void initCorners(const geom::Coordinate& pt);
double scale(double val) const;
void copyScaled(const geom::Coordinate& p,
geom::Coordinate& pScaled) const;
/** \brief
* Tests whether the segment p0-p1 intersects the hot pixel
* tolerance square.
*
* Because the tolerance square point set is partially open (along the
* top and right) the test needs to be more sophisticated than
* simply checking for any intersection. However, it
* can take advantage of the fact that because the hot pixel edges
* do not lie on the coordinate grid. It is sufficient to check
* if there is at least one of:
*
* - a proper intersection with the segment and any hot pixel edge
* - an intersection between the segment and both the left
* and bottom edges
* - an intersection between a segment endpoint and the hot
* pixel coordinate
*
* @param p0
* @param p1
* @return
*/
bool intersectsToleranceSquare(const geom::Coordinate& p0,
const geom::Coordinate& p1) const;
/** \brief
* Test whether the given segment intersects
* the closure of this hot pixel.
*
* This is NOT the test used in the standard snap-rounding
* algorithm, which uses the partially closed tolerance square
* instead.
* This routine is provided for testing purposes only.
*
* @param p0 the start point of a line segment
* @param p1 the end point of a line segment
* @return <code>true</code> if the segment intersects the
* closure of the pixel's tolerance square
*/
bool intersectsPixelClosure(const geom::Coordinate& p0,
const geom::Coordinate& p1);
// Declare type as noncopyable
HotPixel(const HotPixel& other);
HotPixel& operator=(const HotPixel& rhs);
public:
HotPixel(const geom::Coordinate& pt,
double scaleFact,
algorithm::LineIntersector& li);
/// \brief
/// Return reference to original Coordinate
/// (the one provided at construction time)
const geom::Coordinate& getCoordinate() const { return originalPt; }
/** \brief
* Returns a "safe" envelope that is guaranteed to contain
* the hot pixel. Keeps ownership of it.
*/
const geom::Envelope& getSafeEnvelope() const;
bool intersectsScaled(const geom::Coordinate& p0,
const geom::Coordinate& p1) const;
bool intersects(const geom::Coordinate& p0,
const geom::Coordinate& p1) const;
/**
* Adds a new node (equal to the snap pt) to the specified segment
* if the segment passes through the hot pixel
*
* @param segStr
* @param segIndex
* @return true if a node was added to the segment
*/
bool addSnappedNode(NodedSegmentString& segStr, size_t segIndex);
};
} // namespace geos::noding::snapround
} // namespace geos::noding
} // namespace geos
#ifdef GEOS_INLINE
# include "geos/noding/snapround/HotPixel.inl"
#endif
#endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
/**********************************************************************
* $Log$
* Revision 1.3 2006/05/03 17:50:49 strk
* Doxygen comments
*
* Revision 1.2 2006/03/24 09:52:41 strk
* USE_INLINE => GEOS_INLINE
*
* Revision 1.1 2006/03/14 12:55:56 strk
* Headers split: geomgraphindex.h, nodingSnapround.h
*
**********************************************************************/
|