22 #include <geos/export.h>
23 #include <geos/geom/Location.h>
24 #include <geos/geom/Position.h>
34 #pragma warning(disable: 4251)
85 location[Position::ON] = on;
86 location[Position::LEFT] = left;
87 location[Position::RIGHT] = right;
93 location.fill(Location::NONE);
94 location[Position::ON] = on;
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) {
164 std::swap(location[Position::LEFT], location[Position::RIGHT]);
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;
187 void setLocation(Location locValue)
189 setLocation(Position::ON, locValue);
192 const std::array<Location, 3>& getLocations()
const
197 void setLocations(Location on, Location left, Location right)
199 assert(locationSize >= 3);
200 location[Position::ON] = on;
201 location[Position::LEFT] = left;
202 location[Position::RIGHT] = right;
205 bool allPositionsEqual(Location loc)
const
207 for(std::size_t i = 0; i < locationSize; ++i) {
208 if(location[i] != loc) {
221 std::string toString()
const;
226 std::array<geom::Location, 3> location;
227 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: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
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25