23#include <geos/export.h>
24#include <geos/geom/Location.h>
25#include <geos/geomgraph/TopologyLocation.h>
61 friend std::ostream& operator<< (std::ostream&,
const Label&);
71 for(uint32_t i = 0; i < 2; i++) {
72 lineLabel.setLocation(i, label.getLocation(i));
96 assert(geomIndex < 2);
97 elt[geomIndex].setLocation(onLoc);
136 elt[geomIndex].setLocations(onLoc, leftLoc, rightLoc);
140 operator=(
const Label& l)
161 for(
int i = 0; i < 2; i++) {
162 elt[i].merge(lbl.elt[i]);
166 int getGeometryCount()
const
169 if(!elt[0].isNull()) {
172 if(!elt[1].isNull()) {
178 geom::Location getLocation(uint32_t geomIndex, uint32_t posIndex)
const
180 assert(geomIndex < 2);
181 return elt[geomIndex].get(posIndex);
186 assert(geomIndex < 2);
187 return elt[geomIndex].get(Position::ON);
190 void setLocation(uint32_t geomIndex, uint32_t posIndex,
geom::Location location)
192 assert(geomIndex < 2);
193 elt[geomIndex].setLocation(posIndex, location);
198 assert(geomIndex < 2);
199 elt[geomIndex].setLocation(Position::ON, location);
204 assert(geomIndex < 2);
205 elt[geomIndex].setAllLocations(location);
208 void setAllLocationsIfNull(uint32_t geomIndex,
geom::Location location)
210 assert(geomIndex < 2);
211 elt[geomIndex].setAllLocationsIfNull(location);
216 setAllLocationsIfNull(0, location);
217 setAllLocationsIfNull(1, location);
220 bool isNull(uint32_t geomIndex)
const
222 assert(geomIndex < 2);
223 return elt[geomIndex].isNull();
228 return elt[0].isNull() && elt[1].isNull();
231 bool isAnyNull(uint32_t geomIndex)
const
233 assert(geomIndex < 2);
234 return elt[geomIndex].isAnyNull();
239 return elt[0].isArea() || elt[1].isArea();
242 bool isArea(uint32_t geomIndex)
const
244 assert(geomIndex < 2);
245 return elt[geomIndex].isArea();
248 bool isLine(uint32_t geomIndex)
const
250 assert(geomIndex < 2);
251 return elt[geomIndex].isLine();
254 bool isEqualOnSide(
const Label& lbl, uint32_t side)
const
256 return elt[0].isEqualOnSide(lbl.elt[0], side)
257 && elt[1].isEqualOnSide(lbl.elt[1], side);
260 bool allPositionsEqual(uint32_t geomIndex,
geom::Location loc)
const
262 assert(geomIndex < 2);
263 return elt[geomIndex].allPositionsEqual(loc);
271 assert(geomIndex < 2);
272 if(elt[geomIndex].isArea()) {
277 std::string toString()
const;
285std::ostream& operator<< (std::ostream&,
const Label&);
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition: Label.h:57
Label(geom::Location onLoc)
Construct a Label with a single location for both Geometries.
Definition: Label.h:80
Label(geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc)
Construct a Label with On, Left and Right locations for both Geometries.
Definition: Label.h:105
void merge(const Label &lbl)
Merge this label with another one.
Definition: Label.h:159
Label(uint32_t geomIndex, geom::Location onLoc)
Construct a Label with the location specified for the given Geometry.
Definition: Label.h:92
Label()
Initialize both locations to Location::NONE.
Definition: Label.h:121
static Label toLineLabel(const Label &label)
Converts a Label to a Line label (that is, one with no side Locations)
Definition: Label.h:68
Label(const Label &l)
Copy ctor.
Definition: Label.h:111
Label(uint32_t geomIndex, geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc)
Construct a Label with On, Left and Right locations for the given Geometries. Initialize the location...
Definition: Label.h:132
void toLine(uint32_t geomIndex)
Converts one GeometryLocation to a Line location.
Definition: Label.h:269
A TopologyLocation is the labelling of a GraphComponent's topological relationship to a single Geomet...
Definition: TopologyLocation.h:62
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:32
Basic namespace for all GEOS functionalities.
Definition: geos.h:39