22#include <geos/export.h>
23#include <geos/geom/Location.h>
24#include <geos/geom/Position.h>
34#pragma warning(disable: 4251)
63class GEOS_DLL TopologyLocation {
67 friend std::ostream& operator<< (std::ostream&,
const TopologyLocation&);
69 TopologyLocation() =
default;
93 location.fill(Location::NONE);
97 TopologyLocation(
const TopologyLocation& gl)
98 : location(gl.location)
99 , locationSize(gl.locationSize)
102 TopologyLocation& operator= (
const TopologyLocation& gl)
104 location = gl.location;
105 locationSize = gl.locationSize;
109 Location get(std::size_t posIndex)
const
112 if(posIndex < locationSize) {
113 return location[posIndex];
115 return Location::NONE;
123 for(std::size_t i = 0; i < locationSize; ++i) {
124 if(location[i] != Location::NONE) {
136 for(std::size_t i = 0; i < locationSize; ++i) {
137 if(location[i] == Location::NONE) {
146 return location[locIndex] == le.location[locIndex];
151 return locationSize > 1;
156 return locationSize == 1;
161 if(locationSize <= 1) {
167 void setAllLocations(
Location locValue)
169 location.fill(locValue);
173 void setAllLocationsIfNull(
Location locValue)
175 for(std::size_t i = 0; i < locationSize; ++i) {
176 if(location[i] == Location::NONE) {
177 location[i] = locValue;
182 void setLocation(std::size_t locIndex,
Location locValue)
184 location[locIndex] = locValue;
192 const std::array<Location, 3>& getLocations()
const
199 assert(locationSize >= 3);
205 bool allPositionsEqual(
Location loc)
const
207 for(std::size_t i = 0; i < locationSize; ++i) {
208 if(location[i] != loc) {
219 void merge(
const TopologyLocation& gl);
221 std::string toString()
const;
226 std::array<geom::Location, 3> location;
227 std::uint8_t locationSize;
@ LEFT
An indicator that a Location is to the left of a GraphComponent.
Definition Position.h:50
@ ON
An indicator that a Location is on a GraphComponent.
Definition Position.h:44
@ RIGHT
An indicator that a Location is to the right of a GraphComponent.
Definition Position.h:56
A Position indicates the position of a Location relative to a graph component (Node,...
Definition Position.h:37
A TopologyLocation is the labelling of a GraphComponent's topological relationship to a single Geomet...
Definition TopologyLocation.h:63
bool isNull() const
Definition TopologyLocation.h:121
TopologyLocation(Location on, Location left, Location right)
Constructs a TopologyLocation specifying how points on, to the left of, and to the right of some Grap...
Definition TopologyLocation.h:82
void merge(const TopologyLocation &gl)
merge updates only the UNDEF attributes of this object with the attributes of another.
bool isAnyNull() const
Definition TopologyLocation.h:134
Location
Constants representing the location of a point relative to a geometry.
Definition Location.h:32
Contains classes that implement topology graphs.
Definition Depth.h:31
Basic namespace for all GEOS functionalities.
Definition geos.h:39