GEOS  3.8.0dev
OffsetPointGenerator.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  ***********************************************************************
14  *
15  * Last port: operation/overlay/validate/OffsetPointGenerator.java rev. 1.1 (JTS-1.10)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OP_OVERLAY_OFFSETPOINTGENERATOR_H
20 #define GEOS_OP_OVERLAY_OFFSETPOINTGENERATOR_H
21 
22 #include <geos/export.h>
23 #include <geos/algorithm/PointLocator.h> // for composition
24 #include <geos/geom/Geometry.h> // for unique_ptr visibility of dtor
25 #include <geos/geom/MultiPoint.h> // for unique_ptr visibility of dtor
26 #include <geos/geom/Coordinate.h> // for use in vector
27 
28 #include <vector>
29 #include <memory> // for unique_ptr
30 
31 #ifdef _MSC_VER
32 #pragma warning(push)
33 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34 #endif
35 
36 // Forward declarations
37 namespace geos {
38 namespace geom {
39 //class Geometry;
40 //class MultiPoint;
41 class LineString;
42 //class Coordinate;
43 }
44 }
45 
46 namespace geos {
47 namespace operation { // geos::operation
48 namespace overlay { // geos::operation::overlay
49 namespace validate { // geos::operation::overlay::validate
50 
52 //
53 class GEOS_DLL OffsetPointGenerator {
54 
55 public:
56 
57  OffsetPointGenerator(const geom::Geometry& geom, double offset);
58 
60  std::unique_ptr< std::vector<geom::Coordinate> > getPoints();
61 
62 private:
63 
64  const geom::Geometry& g;
65 
66  double offsetDistance;
67 
68  std::unique_ptr< std::vector<geom::Coordinate> > offsetPts;
69 
70  void extractPoints(const geom::LineString* line);
71 
72  void computeOffsets(const geom::Coordinate& p0,
73  const geom::Coordinate& p1);
74 
75  // Declare type as noncopyable
76  OffsetPointGenerator(const OffsetPointGenerator& other) = delete;
77  OffsetPointGenerator& operator=(const OffsetPointGenerator& rhs) = delete;
78 };
79 
80 } // namespace geos::operation::overlay::validate
81 } // namespace geos::operation::overlay
82 } // namespace geos::operation
83 } // namespace geos
84 
85 #ifdef _MSC_VER
86 #pragma warning(pop)
87 #endif
88 
89 #endif // ndef GEOS_OP_OVERLAY_OFFSETPOINTGENERATOR_H
Generates points offset from both sides of all segments in a geometry.
Definition: OffsetPointGenerator.h:53
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:187
Definition: LineString.h:69
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25