23 #include <geos/export.h>
24 #include <geos/geom/Location.h>
25 #include <geos/geomgraph/TopologyLocation.h>
62 friend std::ostream& operator<< (std::ostream&,
const Label&);
72 for(uint32_t i = 0; i < 2; i++) {
73 lineLabel.setLocation(i, label.getLocation(i));
97 assert(geomIndex < 2);
98 elt[geomIndex].setLocation(onLoc);
137 elt[geomIndex].setLocations(onLoc, leftLoc, rightLoc);
141 operator=(
const Label& l)
162 for(
int i = 0; i < 2; i++) {
163 elt[i].merge(lbl.elt[i]);
167 int getGeometryCount()
const
170 if(!elt[0].isNull()) {
173 if(!elt[1].isNull()) {
179 geom::Location getLocation(uint32_t geomIndex, uint32_t posIndex)
const
181 assert(geomIndex < 2);
182 return elt[geomIndex].get(posIndex);
187 assert(geomIndex < 2);
188 return elt[geomIndex].get(Position::ON);
191 void setLocation(uint32_t geomIndex, uint32_t posIndex,
geom::Location location)
193 assert(geomIndex < 2);
194 elt[geomIndex].setLocation(posIndex, location);
199 assert(geomIndex < 2);
200 elt[geomIndex].setLocation(Position::ON, location);
205 assert(geomIndex < 2);
206 elt[geomIndex].setAllLocations(location);
209 void setAllLocationsIfNull(uint32_t geomIndex,
geom::Location location)
211 assert(geomIndex < 2);
212 elt[geomIndex].setAllLocationsIfNull(location);
217 setAllLocationsIfNull(0, location);
218 setAllLocationsIfNull(1, location);
221 bool isNull(uint32_t geomIndex)
const
223 assert(geomIndex < 2);
224 return elt[geomIndex].isNull();
229 return elt[0].isNull() && elt[1].isNull();
232 bool isAnyNull(uint32_t geomIndex)
const
234 assert(geomIndex < 2);
235 return elt[geomIndex].isAnyNull();
240 return elt[0].isArea() || elt[1].isArea();
243 bool isArea(uint32_t geomIndex)
const
245 assert(geomIndex < 2);
246 return elt[geomIndex].isArea();
249 bool isLine(uint32_t geomIndex)
const
251 assert(geomIndex < 2);
252 return elt[geomIndex].isLine();
255 bool isEqualOnSide(
const Label& lbl, uint32_t side)
const
257 return elt[0].isEqualOnSide(lbl.elt[0], side)
258 && elt[1].isEqualOnSide(lbl.elt[1], side);
261 bool allPositionsEqual(uint32_t geomIndex,
geom::Location loc)
const
263 assert(geomIndex < 2);
264 return elt[geomIndex].allPositionsEqual(loc);
272 assert(geomIndex < 2);
273 if(elt[geomIndex].isArea()) {
278 std::string toString()
const;
286 std::ostream& operator<< (std::ostream&,
const Label&);
A Position indicates the position of a Location relative to a graph component (Node,...
Definition: Position.h:37
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:81
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:106
void merge(const Label &lbl)
Merge this label with another one.
Definition: Label.h:160
Label(uint32_t geomIndex, geom::Location onLoc)
Construct a Label with the location specified for the given Geometry.
Definition: Label.h:93
Label()
Initialize both locations to Location::NONE.
Definition: Label.h:122
static Label toLineLabel(const Label &label)
Converts a Label to a Line label (that is, one with no side Locations)
Definition: Label.h:69
Label(const Label &l)
Copy ctor.
Definition: Label.h:112
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:133
void toLine(uint32_t geomIndex)
Converts one GeometryLocation to a Line location.
Definition: Label.h:270
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:32
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25