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;
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