GEOS  3.13.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 #pragma once
20 
21 #include <geos/export.h>
22 #include <geos/algorithm/PointLocator.h> // for composition
23 #include <geos/geom/Geometry.h> // for unique_ptr visibility of dtor
24 #include <geos/geom/MultiPoint.h> // for unique_ptr visibility of dtor
25 #include <geos/geom/Coordinate.h> // for use in vector
26 
27 #include <vector>
28 #include <memory> // for unique_ptr
29 
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33 #endif
34 
35 // Forward declarations
36 namespace geos {
37 namespace geom {
38 //class Geometry;
39 //class MultiPoint;
40 class LineString;
41 //class Coordinate;
42 }
43 }
44 
45 namespace geos {
46 namespace operation { // geos::operation
47 namespace overlay { // geos::operation::overlay
48 namespace validate { // geos::operation::overlay::validate
49 
51 //
52 class GEOS_DLL OffsetPointGenerator {
53 
54 public:
55 
56  OffsetPointGenerator(const geom::Geometry& geom, double offset);
57 
59  std::unique_ptr< std::vector<geom::Coordinate> > getPoints();
60 
61 private:
62 
63  const geom::Geometry& g;
64 
65  double offsetDistance;
66 
67  std::unique_ptr< std::vector<geom::Coordinate> > offsetPts;
68 
69  void extractPoints(const geom::LineString* line);
70 
71  void computeOffsets(const geom::Coordinate& p0,
72  const geom::Coordinate& p1);
73 
74  // Declare type as noncopyable
75  OffsetPointGenerator(const OffsetPointGenerator& other) = delete;
76  OffsetPointGenerator& operator=(const OffsetPointGenerator& rhs) = delete;
77 };
78 
79 } // namespace geos::operation::overlay::validate
80 } // namespace geos::operation::overlay
81 } // namespace geos::operation
82 } // namespace geos
83 
84 #ifdef _MSC_VER
85 #pragma warning(pop)
86 #endif
87 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Definition: LineString.h:65
Generates points offset from both sides of all segments in a geometry.
Definition: OffsetPointGenerator.h:52
std::unique_ptr< std::vector< geom::Coordinate > > getPoints()
Gets the computed offset points.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25