22 #include <geos/export.h>
23 #include <geos/geom/Location.h>
24 #include <geos/geom/Position.h>
34 #pragma warning(disable: 4251)
84 location[Position::ON] = on;
85 location[Position::LEFT] = left;
86 location[Position::RIGHT] = right;
92 location.fill(Location::NONE);
93 location[Position::ON] = on;
96 TopologyLocation(
const TopologyLocation& gl)
97 : location(gl.location)
98 , locationSize(gl.locationSize)
101 TopologyLocation& operator= (
const TopologyLocation& gl)
103 location = gl.location;
104 locationSize = gl.locationSize;
108 Location get(std::size_t posIndex)
const
111 if(posIndex < locationSize) {
112 return location[posIndex];
114 return Location::NONE;
122 for(std::size_t i = 0; i < locationSize; ++i) {
123 if(location[i] != Location::NONE) {
135 for(std::size_t i = 0; i < locationSize; ++i) {
136 if(location[i] == Location::NONE) {
145 return location[locIndex] == le.location[locIndex];
150 return locationSize > 1;
155 return locationSize == 1;
160 if(locationSize <= 1) {
163 std::swap(location[Position::LEFT], location[Position::RIGHT]);
166 void setAllLocations(Location locValue)
168 location.fill(locValue);
172 void setAllLocationsIfNull(Location locValue)
174 for(std::size_t i = 0; i < locationSize; ++i) {
175 if(location[i] == Location::NONE) {
176 location[i] = locValue;
181 void setLocation(std::size_t locIndex, Location locValue)
183 location[locIndex] = locValue;
186 void setLocation(Location locValue)
188 setLocation(Position::ON, locValue);
191 const std::array<Location, 3>& getLocations()
const
196 void setLocations(Location on, Location left, Location right)
198 assert(locationSize >= 3);
199 location[Position::ON] = on;
200 location[Position::LEFT] = left;
201 location[Position::RIGHT] = right;
204 bool allPositionsEqual(Location loc)
const
206 for(std::size_t i = 0; i < locationSize; ++i) {
207 if(location[i] != loc) {
220 std::string toString()
const;
225 std::array<geom::Location, 3> location;
226 std::uint8_t locationSize;
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:60
bool isNull() const
Definition: TopologyLocation.h:120
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:81
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:133
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