30 #define CIRCLE_RESOLUTION (double)10
46 laneStartPosition(-1),
58 myAdditional(nullptr) {
65 myAdditional(nullptr) {
73 myShapeRotations(shapeRotations),
74 myShapeLengths(shapeLengths),
76 myAdditional(nullptr) {
88 if ((startPos != -1) || (endPos != -1)) {
90 if ((startPos != -1) && (endPos != -1) && (endPos < startPos)) {
91 std::swap(startPos, endPos);
94 if (startPos <= POSITION_EPS) {
97 }
else if (endPos <= POSITION_EPS) {
100 }
else if (endPos < (shape.
length() - POSITION_EPS)) {
102 myShape = myShape.
splitAt(endPos).first;
104 }
else if (startPos >= (shape.
length() - POSITION_EPS)) {
107 }
else if (endPos == -1) {
109 myShape = myShape.
splitAt(startPos).second;
110 }
else if (endPos <= POSITION_EPS) {
113 }
else if (endPos >= (shape.
length() - POSITION_EPS)) {
115 myShape = myShape.
splitAt(startPos).second;
118 myShape = myShape.getSubpart(startPos, endPos);
123 myShape.push_front(extraFirstPosition);
127 myShape.push_back(extraLastPosition);
130 calculateShapeRotationsAndLengths();
139 myShape.push_back(position);
140 myShapeRotations.push_back(rotation);
151 if (posOverLane < 0) {
154 }
else if (posOverLane > laneLength) {
178 myAdditional = additional;
196 myShape.scaleRelative(scale);
198 for (
auto& shapeLength : myShapeLengths) {
199 shapeLength *= scale;
207 return myLane->getLaneShape();
208 }
else if (myAdditional) {
209 return myAdditional->getAdditionalGeometry().getShape();
216 const std::vector<double>&
219 return myLane->getShapeRotations();
220 }
else if (myAdditional) {
221 return myAdditional->getAdditionalGeometry().getShapeRotations();
223 return myShapeRotations;
228 const std::vector<double>&
231 return myLane->getShapeLengths();
232 }
else if (myAdditional) {
233 return myAdditional->getAdditionalGeometry().getShapeLengths();
235 return myShapeLengths;
243 myShapeRotations.clear();
244 myShapeLengths.clear();
247 myAdditional =
nullptr;
254 myShapeRotations.clear();
255 myShapeLengths.clear();
257 int numberOfSegments = (int)myShape.size() - 1;
259 if (numberOfSegments >= 0) {
261 myShapeRotations.reserve(numberOfSegments);
262 myShapeLengths.reserve(numberOfSegments);
264 for (
int i = 0; i < numberOfSegments; i++) {
276 mySettings(settings),
284 return mySettings.dottedContourSettings.firstInspectedColor;
287 return mySettings.dottedContourSettings.secondInspectedColor;
296 return mySettings.dottedContourSettings.firstFrontColor;
299 return mySettings.dottedContourSettings.secondFrontColor;
340 #if defined(_MSC_VER) && _MSC_VER == 1800
341 #pragma warning(push)
342 #pragma warning(disable: 4100)
345 myWidth(s.dottedContourSettings.segmentWidth) {
347 if (closeShape && (shape.size() > 2)) {
350 if (shape.size() > 1) {
352 for (
int i = 1; i < (int)shape.size(); i++) {
366 const DottedGeometry& topDottedGeometry,
const bool drawFirstExtrem,
367 const DottedGeometry& botDottedGeometry,
const bool drawLastExtrem) :
368 myWidth(s.dottedContourSettings.segmentWidth) {
373 if (drawFirstExtrem &&
381 if (drawLastExtrem &&
406 myDottedGeometrySegments.clear();
408 for (
int i = 1; i < (int)lane->
getLaneShape().size(); i++) {
412 for (
auto& segment : myDottedGeometrySegments) {
416 calculateShapeRotationsAndLengths();
425 myDottedGeometrySegments.clear();
427 if (closeShape && (shape.size() > 2)) {
430 if (shape.size() > 1) {
432 for (
int i = 1; i < (int)shape.size(); i++) {
433 myDottedGeometrySegments.push_back(
Segment({shape[i - 1], shape[i]}));
436 for (
auto& segment : myDottedGeometrySegments) {
440 calculateShapeRotationsAndLengths();
443 #if defined(_MSC_VER) && _MSC_VER == 1800
451 for (
auto& segment : myDottedGeometrySegments) {
453 for (
int i = 0; i < ((int)segment.shape.size() - 1); i++) {
458 segment.rotations.at(i),
459 segment.lengths.at(i),
460 myWidth, myWidth * segment.offset);
469 for (
auto& segment : myDottedGeometrySegments) {
471 for (
int i = 0; i < ((int)segment.shape.size() - 1); i++) {
476 segment.rotations.at(i),
477 segment.lengths.at(i),
478 myWidth, myWidth * segment.offset);
487 for (
auto& segment : myDottedGeometrySegments) {
488 segment.shape.move2side(value);
508 for (
auto& segment : myDottedGeometrySegments) {
509 segment.offset *= -1;
517 for (
auto& segment : myDottedGeometrySegments) {
519 int numberOfSegments = (int)segment.shape.size() - 1;
521 if (numberOfSegments >= 0) {
523 segment.rotations.reserve(numberOfSegments);
524 segment.lengths.reserve(numberOfSegments);
526 for (
int i = 0; i < numberOfSegments; i++) {
527 segment.rotations.push_back(
calculateRotation(segment.shape[i], segment.shape[i + 1]));
528 segment.lengths.push_back(
calculateLength(segment.shape[i], segment.shape[i + 1]));
542 myUseLaneShape(true) {
550 myUseLaneShape(false),
551 mySegmentGeometry(geometry) {
557 myNextLane(nextLane),
559 myUseLaneShape(false) {
566 myUseLaneShape =
false;
568 mySegmentGeometry.updateGeometry(geometry);
575 myUseLaneShape =
true;
577 mySegmentGeometry.updateGeometry(lane);
584 return myLane->getLane2laneConnections().getLane2laneGeometry(myNextLane).getShape();
585 }
else if (myUseLaneShape) {
586 return myLane->getLaneShape();
588 return mySegmentGeometry.getShape();
593 const std::vector<double>&
596 return myLane->getLane2laneConnections().getLane2laneGeometry(myNextLane).getShapeRotations();
597 }
else if (myUseLaneShape) {
598 return myLane->getShapeRotations();
600 return mySegmentGeometry.getShapeRotations();
605 const std::vector<double>&
608 return myLane->getLane2laneConnections().getLane2laneGeometry(myNextLane).getShapeLengths();
609 }
else if (myUseLaneShape) {
610 return myLane->getShapeLengths();
612 return mySegmentGeometry.getShapeLengths();
637 return (myNextLane ==
nullptr);
645 mySegmentIndex(segmentIndex),
647 myNextLane(nextLane) {
653 return mySegmentIndex;
748 b.
add(i.getShape().getBoxBoundary());
754 std::vector<GNEGeometry::SegmentGeometry::Segment>::const_iterator
760 std::vector<GNEGeometry::SegmentGeometry::Segment>::const_iterator
788 myFromLane(fromLane) {
795 const int numPoints = 5;
796 const int maximumLanes = 10;
798 myConnectionsMap.clear();
800 for (
const auto& outgoingEdge : myFromLane->getParentEdge()->getParentJunctions().back()->getGNEOutgoingEdges()) {
801 for (
const auto& outgoingLane : outgoingEdge->getLanes()) {
803 const NBEdge* NBEdgeFrom = myFromLane->getParentEdge()->getNBEdge();
804 const NBEdge* NBEdgeTo = outgoingLane->getParentEdge()->getNBEdge();
814 (
double) numPoints * (
double) NBEdgeFrom->
getNumLanes(),
815 (
double) numPoints * (
double) NBEdgeTo->
getNumLanes());
818 shape = {myFromLane->getLaneShape().back(), outgoingLane->getLaneShape().front()};
821 myConnectionsMap[outgoingLane].first.updateGeometry(shape);
822 if (myFromLane->getNet()->getViewNet()) {
823 myConnectionsMap[outgoingLane].second.updateDottedGeometry(myFromLane->getNet()->getViewNet()->getVisualisationSettings(), shape,
false);
832 return (myConnectionsMap.count(toLane) > 0);
838 return myConnectionsMap.at(toLane).first;
844 return myConnectionsMap.at(toLane).second;
849 myFromLane(nullptr) {
901 connectionsGeometries.clear();
902 symbolsPositionAndRotation.clear();
904 for (
const auto& edge : myHierarchicalElement->getChildEdges()) {
905 for (
const auto& lane : edge->getLanes()) {
910 for (
const auto& lane : myHierarchicalElement->getChildLanes()) {
914 for (
const auto& additional : myHierarchicalElement->getChildAdditionals()) {
916 if (additional->getPositionInView() != myHierarchicalElement->getPositionInView()) {
918 std::vector<Position> connectionShape;
919 const double A = std::abs(additional->getPositionInView().x() - myHierarchicalElement->getPositionInView().x());
920 const double B = std::abs(additional->getPositionInView().y() - myHierarchicalElement->getPositionInView().y());
922 connectionShape.push_back(additional->getPositionInView());
923 if (myHierarchicalElement->getPositionInView().x() > additional->getPositionInView().x()) {
924 if (myHierarchicalElement->getPositionInView().y() > additional->getPositionInView().y()) {
925 connectionShape.push_back(
Position(additional->getPositionInView().x() + A, additional->getPositionInView().y()));
927 connectionShape.push_back(
Position(additional->getPositionInView().x(), additional->getPositionInView().y() - B));
930 if (myHierarchicalElement->getPositionInView().y() > additional->getPositionInView().y()) {
931 connectionShape.push_back(
Position(additional->getPositionInView().x(), additional->getPositionInView().y() + B));
933 connectionShape.push_back(
Position(additional->getPositionInView().x() - A, additional->getPositionInView().y()));
936 connectionShape.push_back(myHierarchicalElement->getPositionInView());
942 connectionsGeometries.push_back(geometry);
946 for (
const auto& symbol : symbolsPositionAndRotation) {
948 std::vector<Position> connectionShape;
949 const double A = std::abs(symbol.getPosition().x() - myHierarchicalElement->getPositionInView().x());
950 const double B = std::abs(symbol.getPosition().y() - myHierarchicalElement->getPositionInView().y());
952 connectionShape.push_back(symbol.getPosition());
953 if (myHierarchicalElement->getPositionInView().x() > symbol.getPosition().x()) {
954 if (myHierarchicalElement->getPositionInView().y() > symbol.getPosition().y()) {
955 connectionShape.push_back(
Position(symbol.getPosition().x() + A, symbol.getPosition().y()));
957 connectionShape.push_back(
Position(symbol.getPosition().x(), symbol.getPosition().y() - B));
960 if (myHierarchicalElement->getPositionInView().y() > symbol.getPosition().y()) {
961 connectionShape.push_back(
Position(symbol.getPosition().x(), symbol.getPosition().y() + B));
963 connectionShape.push_back(
Position(symbol.getPosition().x() - A, symbol.getPosition().y()));
966 connectionShape.push_back(myHierarchicalElement->getPositionInView());
972 connectionsGeometries.push_back(geometry);
980 for (
const auto& connectionGeometry : connectionsGeometries) {
990 GLHelper::drawBoxLines(connectionGeometry.getShape(), connectionGeometry.getShapeRotations(), connectionGeometry.getShapeLengths(), exaggeration * 0.1);
1000 for (
const auto& connectionGeometry : connectionsGeometries) {
1027 return ((
double)atan2((second.
x() - first.
x()), (first.
y() - second.
y())) * (
double) 180.0 / (
double)
M_PI);
1041 if (startLane && endLane && (startLane == endLane) && (startPos != -1) && (endPos != -1)) {
1042 if (startPos >= endPos) {
1043 endPos = (startPos + POSITION_EPS);
1047 if ((startPos != -1) && startLane) {
1048 if (startPos < POSITION_EPS) {
1049 startPos = POSITION_EPS;
1056 if ((endPos != -1) && endLane) {
1057 if (endPos < POSITION_EPS) {
1058 endPos = POSITION_EPS;
1072 if (path.size() > 0) {
1074 if (path.size() == 1) {
1091 for (
int i = 0; i < (int)path.size(); i++) {
1093 const GNELane* lane = path.at(i).getLane();
1097 if ((path.at(i).getLane() == path.front().getLane()) && (extremeGeometry.
laneStartPosition != -1)) {
1106 }
else if ((lane == path.back().getLane()) && (extremeGeometry.
laneEndPosition != -1)) {
1121 if ((i + 1) < (
int)path.size()) {
1123 const GNELane* nextLane = path.at(i + 1).getLane();
1139 if ((segmentGeometry.
size() == 1) && (segmentGeometry.
front().
getLane() == lane)) {
1153 std::vector<GNEGeometry::SegmentGeometry::SegmentToUpdate> segmentsToUpdate;
1155 for (
auto segment = segmentGeometry.
begin(); segment != segmentGeometry.
end(); segment++) {
1156 if (segment->getLane() == lane) {
1158 const int index = (int)(segment - segmentGeometry.
begin());
1162 if (((segment + 1) != segmentGeometry.
end()) && (segment + 1)->getJunction()) {
1168 for (
const auto& segmentToUpdate : segmentsToUpdate) {
1170 if (segmentToUpdate.getLane()->getLaneShape().size() > 0) {
1172 if ((segmentToUpdate.getSegmentIndex() == 0) && (extremeGeometry.
laneStartPosition != -1)) {
1181 }
else if ((segmentToUpdate.getSegmentIndex() == (segmentGeometry.
size() - 1)) && (extremeGeometry.
laneEndPosition != -1)) {
1193 if (segmentToUpdate.getLane()->getLane2laneConnections().exist(segmentToUpdate.getNextLane())) {
1195 segmentGeometry.
updateLane2LaneSegment(segmentToUpdate.getSegmentIndex(), segmentToUpdate.getLane(), segmentToUpdate.getNextLane());
1215 glTranslated(posOverLane.
x(), posOverLane.
y(), 0);
1229 const RGBColor& geometryPointColor,
const RGBColor& textColor,
const double radius,
const double exaggeration) {
1233 const double exaggeratedRadio = (radius * exaggeration);
1235 const double exaggeratedRadioSquared = (exaggeratedRadio * exaggeratedRadio);
1237 for (
const auto& vertex : shape) {
1243 glTranslated(vertex.x(), vertex.y(), 0.2);
1262 }
else if ((vertex == shape.front()) && drawDetail) {
1269 }
else if ((vertex == shape.back()) && (shape.
isClosed() ==
false) && drawDetail) {
1285 const RGBColor& hintColor,
const double radius,
const double exaggeration) {
1291 const double exaggeratedRadio = (radius * exaggeration);
1293 const double distanceToShape = shape.
distance2D(mousePosition);
1295 const double squaredRadius = (radius * radius * exaggeration);
1299 for (
int i = 0; i < (int)shape.size(); i++) {
1301 if (shape[i].distanceSquaredTo2D(mousePosition) <= squaredRadius) {
1306 if ((distanceToShape < exaggeratedRadio) && (index == -1)) {
1310 const Position hintPos = shape.size() > 1 ? positionOverLane : shape[0];
1314 glTranslated(hintPos.
x(), hintPos.
y(), 0.2);
1328 const std::vector<double>& lengths,
const std::vector<RGBColor>& colors,
double width) {
1340 glTranslated(posOverLane.
x(), posOverLane.
y(), 0);
1346 }
else if (colors.size() > 0) {
1369 glTranslated(posOverLane.
x(), posOverLane.
y(), 0);
1395 DottedGeometry extremes(s, topDottedGeometry, drawFirstExtrem, botDottedGeometry, drawLastExtrem);
1405 dottedGeometryColor.
reset();
1418 dottedGeometryColor.
reset();
1433 if (edge->
getLanes().size() == 1) {
1456 DottedGeometry extremes(s, dottedGeometryTop, drawFrontExtreme, dottedGeometryBot, drawBackExtreme);
1466 dottedGeometryColor.
reset();
1479 dottedGeometryColor.
reset();
1495 if (exaggeration > 0) {
1536 if ((radius * exaggeration) < 2) {
1546 const double width,
const double height,
const double offsetX,
const double offsetY,
const double rot,
const double exaggeration) {
1550 shape.push_back(
Position(0 + width, 0 + height));
1551 shape.push_back(
Position(0 + width, 0 - height));
1552 shape.push_back(
Position(0 - width, 0 - height));
1553 shape.push_back(
Position(0 - width, 0 + height));
1555 shape.
add(offsetX, offsetY, 0);
1576 const double inc = 360 / (double)steps;
1578 for (
int i = 0; i <= steps; ++i) {
1580 vertexCircle.push_back(
Position(vertex.
x() * width, vertex.
y() * width));
1583 vertexCircle.
add(pos);
1584 return vertexCircle;
1591 glRotated((rot * -1) + 90, 0, 0, 1);
#define CIRCLE_RESOLUTION
@ NETWORK_MOVE
mode for moving network elements
@ GLO_DOTTEDCONTOUR_INSPECTED
dotted contour inspected element (used in NETEDIT)
@ GLO_DOTTEDCONTOUR_FRONT
dotted contour front element (used in NETEDIT)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
An Element which don't belongs to GNENet but has influency in the simulation.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
A road/street connecting two junctions (netedit-version)
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
class for pack all variables related with DottedGeometry color
DottedGeometryColor(const GUIVisualizationSettings &settings)
constructor
void reset()
rest Dotted Geometry Color
const RGBColor & getFrontColor()
get front color (and change flag)
void changeColor()
change color
const RGBColor & getInspectedColor()
get inspected color (and change flag)
class for pack all variables related with DottedGeometry
void moveShapeToSide(const double value)
move shape to side
double getWidth() const
get width
double myWidth
geometry width
void updateDottedGeometry(const GUIVisualizationSettings &s, const GNELane *lane)
update DottedGeometry (using lane shape)
void drawFrontDottedGeometry(DottedGeometryColor &dottedGeometryColor) const
draw front inspected dottedShape
void drawInspectedDottedGeometry(DottedGeometryColor &dottedGeometryColor) const
draw inspected dottedShape
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
std::vector< DottedGeometry::Segment > myDottedGeometrySegments
dotted element shape (note: It's centered in 0,0 due scaling)
DottedGeometry()
constructor
void setWidth(const double width)
change default width
void invertOffset()
invert offset of all segments
class for NETEDIT geometries over lanes
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
void scaleGeometry(const double scale)
scale geometry
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
const PositionVector & getShape() const
The shape of the additional element.
void clearGeometry()
clear geometry
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
double myRotation
rotation
double getRotation() const
get rotation
const GNELane * getLane() const
get lane
const Position & getPosition() const
get position
ConnectionGeometry()
default constructor
Position myPosition
position
void drawConnection(const GUIVisualizationSettings &s, const GNEAttributeCarrier *AC, const double exaggeration) const
draw connections between Parent and childrens
void update()
update Connection's geometry
GNEHierarchicalElement * myHierarchicalElement
pointer to hierarchical element parent
HierarchicalConnections(GNEHierarchicalElement *hierarchicalElement)
constructor
void drawDottedConnection(const DottedContourType type, const GUIVisualizationSettings &s, const double exaggeration) const
draw dotted connections between Parent and childrens
void updateLane2laneConnection()
update
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GNEGeometry::Geometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
const GNEGeometry::DottedGeometry & getLane2laneDottedGeometry(const GNELane *toLane) const
get lane2lane dotted geometry
Lane2laneConnection()
constructor
struct used for represent segments of element geometry
Segment(const GNELane *lane, const bool valid)
parameter constructor for lanes (geometry will be taked from lane)
const std::vector< double > & getShapeRotations() const
get lane/lane2lane shape rotations
const PositionVector & getShape() const
get lane/lane2lane shape
bool isLaneSegment() const
return true if this is a lane segment (i.e. myNextLane is nullptr)
const GNELane * getLane() const
lane (only for lane segments)
bool getValid() const
valid
const std::vector< double > & getShapeLengths() const
get lane/lane2lane shape lengths
const GNEJunction * getJunction() const
junction
void update(const Geometry &geometry)
update segment using geometry
struct used for represent segments that must be updated
int getSegmentIndex() const
get segment index
SegmentToUpdate(const int segmentIndex, const GNELane *lane, const GNELane *nextLane)
constructor
const GNELane * getLane() const
const GNELane * getNextLane() const
get lane segment (used for updating lane2lane segments)
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
const double halfWidth
Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
const GNEGeometry::DottedGeometry & getDottedLaneGeometry() const
get dotted lane geometry
const GNEGeometry::Lane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
The representation of a single edge during network building.
NBNode * getToNode() const
Returns the destination node of the edge.
int getNumLanes() const
Returns the number of lanes.
NBEdge * getTurnDestination(bool possibleDestination=false) const
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, NBNode *recordError=0, int shapeFlag=0) const
Compute a smooth curve between the given geometries.
const PositionVector & getShape() const
retrieve the junction shape
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
static const Position INVALID
used to indicate that a position is valid
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double x() const
Returns the x-position.
double y() const
Returns the y-position.
double length() const
Returns the length.
void rotate2D(double angle)
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
void add(double xoff, double yoff, double zoff)
void closePolygon()
ensures that the last position equals the first
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
std::pair< PositionVector, PositionVector > splitAt(double where, bool use2D=false) const
Returns the two lists made when this list vector is splitted at the given point.
void scaleRelative(double factor)
enlarges/shrinks the polygon by a factor based at the centroid
double area() const
Returns the area (0 for non-closed)
bool isClosed() const
check if PositionVector is closed
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Segment()
default constructor
struct for variables used in Geometry extremes
double laneEndPosition
arrival position over lane
Position viewEndPos
end position over view
double laneStartPosition
depart position over lane
Position viewStartPos
start position over view
ExtremeGeometry()
constructor
struct for pack all variables related with geometry of elemements divided in segments
void insertCustomSegment(const GNELane *lane, const Geometry &geometry, const bool valid)
insert custom segment
int size() const
number of segments
void updateCustomSegment(const int segmentIndex, const Geometry &geometry)
update custom segment
SegmentGeometry()
constructor
const Segment & back() const
back segment
std::vector< Segment >::const_iterator end() const
end iterator
const Position & getFirstPosition() const
get first position (or Invalid position if segments are empty)
const Position & getLastPosition() const
get first position (or Invalid position if segments are empty)
void updateLane2LaneSegment(const int segmentIndex, const GNELane *lane, const GNELane *nextLane)
update lane2Lane segment (used to avoid unnecessary calculation in calculatePartialShapeRotationsAndL...
void insertLaneSegment(const GNELane *lane, const bool valid)
insert entire lane segment (used to avoid unnecessary calculation in calculatePartialShapeRotationsAn...
std::vector< Segment > myShapeSegments
vector of segments that constitutes the shape
std::vector< Segment >::const_iterator begin() const
begin iterator
double getFirstRotation() const
get first rotation (or Invalid position if segments are empty)
const Segment & front() const
front segment
void clearSegmentGeometry()
clear element geometry
void insertLane2LaneSegment(const GNELane *currentLane, const GNELane *nextLane, const bool valid)
insert entire lane2lane segment (used to avoid unnecessary calculation in calculatePartialShapeRotati...
Boundary getBoxBoundary() const
Returns a boundary enclosing all segments.
static void drawDottedContourClosedShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double exaggeration)
draw dotted contour for the given closed shape (used by Juctions, shapes and TAZs)
static void drawGeometryPoints(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration)
draw geometry points
static void drawDottedContourLane(const DottedContourType type, const GUIVisualizationSettings &s, const DottedGeometry &dottedGeometry, const double width, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given dottedGeometry (used by lanes, routes, etc.)
static double calculateRotation(const Position &first, const Position &second)
return angle between two points (used in geometric calculations)
static void adjustStartPosGeometricPath(double &startPos, const GNELane *startLane, double &endPos, const GNELane *endLane)
adjust start and end positions in geometric path
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration)
draw dotted contour for the given shape (used by additionals)
static PositionVector getVertexCircleAroundPosition(const Position &pos, const double width, const int steps=8)
get a circle around the given position
static void calculateLaneGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEPathElements::PathElement > &path, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between lanes
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
static PositionVector myCircleCoords
Storage for precomputed sin/cos-values describing a circle.
static void updateGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const GNELane *lane, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between edges
static void drawDottedContourEdge(const DottedContourType type, const GUIVisualizationSettings &s, const GNEEdge *edge, const bool drawFrontExtreme, const bool drawBackExtreme)
draw dotted contour for the given dottedGeometries (used by edges)
static void drawSegmentGeometry(const GNEViewNet *viewNet, const SegmentGeometry::Segment &segment, const double width)
draw geometry segment
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
static void drawMovingHint(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
static void drawDottedContourCircle(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double radius, const double exaggeration)
draw dotted contour for the given Position and radius (used by Juctions and POIs)
static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
static int angleLookup(const double angleDeg)
normalize angle for lookup in myCircleCoords
static double calculateLength(const Position &first, const Position &second)
return length between two points (used in geometric calculations)
static void drawLaneGeometry(const GNEViewNet *viewNet, const PositionVector &shape, const std::vector< double > &rotations, const std::vector< double > &lengths, const std::vector< RGBColor > &colors, double width)
draw lane geometry (use their own function due colors)
NetworkEditMode networkEditMode
the current Network edit mode
bool editingElevation() const
check if we're editing elevation
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const RGBColor childConnections
color for child connections between parents and child elements
static const double geometryPointsText
details for Geometry Points Texts
static const double segmentWidth
width of dotted contour segments
static const double segmentLength
length of dotted contour segments