GEOS  3.9.0dev
Label.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: geomgraph/Label.java r428 (JTS-1.12+)
17  *
18  **********************************************************************/
19 
20 
21 #ifndef GEOS_GEOMGRAPH_LABEL_H
22 #define GEOS_GEOMGRAPH_LABEL_H
23 
24 #include <geos/export.h>
25 #include <geos/geom/Location.h>
26 #include <geos/geomgraph/TopologyLocation.h>
27 
28 #include <geos/inline.h>
29 
30 #include <iosfwd> // for operator<<
31 
32 namespace geos {
33 namespace geomgraph { // geos.geomgraph
34 
59 class GEOS_DLL Label {
60 
61 public:
62 
63  friend std::ostream& operator<< (std::ostream&, const Label&);
64 
70  static Label toLineLabel(const Label& label);
71 
75  Label(geom::Location onLoc);
76 
84  Label(int geomIndex, geom::Location onLoc);
85 
91  Label(geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc);
92 
94  Label(const Label& l);
95 
96  Label& operator= (const Label& l);
97 
103  Label();
104 
111  Label(int geomIndex, geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc);
112 
113  void flip();
114 
115  geom::Location getLocation(int geomIndex, int posIndex) const;
116 
117  geom::Location getLocation(int geomIndex) const;
118 
119  void setLocation(int geomIndex, int posIndex, geom::Location location);
120 
121  void setLocation(int geomIndex, geom::Location location);
122 
123  void setAllLocations(int geomIndex, geom::Location location);
124 
125  void setAllLocationsIfNull(int geomIndex, geom::Location location);
126 
127  void setAllLocationsIfNull(geom::Location location);
128 
135  void merge(const Label& lbl);
136 
137  int getGeometryCount() const;
138 
139  bool isNull() const;
140 
141  bool isNull(int geomIndex) const;
142 
143  bool isAnyNull(int geomIndex) const;
144 
145  bool isArea() const;
146 
147  bool isArea(int geomIndex) const;
148 
149  bool isLine(int geomIndex) const;
150 
151  bool isEqualOnSide(const Label& lbl, int side) const;
152 
153  bool allPositionsEqual(int geomIndex, geom::Location loc) const;
154 
158  void toLine(int geomIndex);
159 
160  std::string toString() const;
161 
162 private:
163 
164  TopologyLocation elt[2];
165 };
166 
167 std::ostream& operator<< (std::ostream&, const Label&);
168 
169 } // namespace geos.geomgraph
170 } // namespace geos
171 
172 
173 #ifdef GEOS_INLINE
174 # include "geos/geomgraph/Label.inl"
175 #endif
176 
177 #endif // ifndef GEOS_GEOMGRAPH_LABEL_H
178 
A TopologyLocation is the labelling of a GraphComponent's topological relationship to a single Geomet...
Definition: TopologyLocation.h:60
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition: Label.h:59
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26