Eclipse SUMO - Simulation of Urban MObility
GUIGeometry Class Reference

#include <GUIGeometry.h>

Collaboration diagram for GUIGeometry:
[legend]

Public Member Functions

const PositionVectorgetShape () const
 The shape of the additional element. More...
 
const std::vector< double > & getShapeLengths () const
 The lengths of the single shape parts. More...
 
const std::vector< double > & getShapeRotations () const
 The rotations of the single shape parts. More...
 
 GUIGeometry ()
 default constructor More...
 
 GUIGeometry (const PositionVector &shape)
 parameter constructor More...
 
 GUIGeometry (const PositionVector &shape, const std::vector< double > &shapeRotations, const std::vector< double > &shapeLengths)
 parameter constructor More...
 
void moveGeometryToSide (const double amount)
 move current shape to side More...
 
void scaleGeometry (const double scale)
 scale geometry More...
 
void updateGeometry (const PositionVector &shape)
 update entire geometry More...
 
void updateGeometry (const PositionVector &shape, const double posOverShape, const double lateralOffset)
 update geometry (using a shape, a position over shape and a lateral offset) More...
 
void updateGeometry (const PositionVector &shape, double beginTrimPosition, const Position &extraFirstPosition, double endTrimPosition, const Position &extraLastPosition)
 update geometry (using a shape to be trimmed) More...
 
void updateGeometry (const PositionVector &shape, double starPosOverShape, double endPosOverShape, const double lateralOffset)
 update geometry (using a shape, a starPos over shape, a endPos and a lateral offset) More...
 
void updateSinglePosGeometry (const Position &position, const double rotation)
 update position and rotation More...
 

Static Public Member Functions

calculation functions
static double calculateRotation (const Position &first, const Position &second)
 return angle between two points (used in geometric calculations) More...
 
static double calculateLength (const Position &first, const Position &second)
 return length between two points (used in geometric calculations) More...
 
static void adjustStartPosGeometricPath (double &startPos, const PositionVector &startLaneShape, double &endPos, const PositionVector &endLaneShape)
 adjust start and end positions in geometric path More...
 
draw functions
static void drawGeometry (const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
 draw geometry More...
 
static void drawGeometry (const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const std::vector< RGBColor > &colors, const double width, double offset=0)
 draw colored geometry More...
 
static void drawContourGeometry (const GUIGeometry &geometry, const double width, const bool drawExtremes=false)
 draw contour geometry More...
 
static void drawGeometryPoints (const GUIVisualizationSettings::Detail d, const PositionVector &shape, const RGBColor &color, const double radius, const double exaggeration, const bool editingElevation)
 draw geometry points More...
 
static void drawParentLine (const GUIVisualizationSettings &s, const Position &parent, const Position &child, const RGBColor &color, const bool drawEntire, const double lineWidth)
 draw line between parent and children (used in netedit) More...
 
static void drawChildLine (const GUIVisualizationSettings &s, const Position &child, const Position &parent, const RGBColor &color, const bool drawEntire, const double lineWidth)
 draw line between child and parent (used in netedit) More...
 
static PositionVector getVertexCircleAroundPosition (const Position &pos, const double width, const int steps=8)
 get a circle around the given position More...
 
static void rotateOverLane (const double rot)
 rotate over lane (used by Lock icons, detector logos, etc.) More...
 

Protected Member Functions

void calculateShapeRotationsAndLengths ()
 calculate shape rotations and lengths More...
 
void clearGeometry ()
 clear geometry More...
 

Protected Attributes

PositionVector myShape
 element shape More...
 
std::vector< double > myShapeLengths
 The lengths of the shape (note: Always size = myShape.size()-1) More...
 
std::vector< double > myShapeRotations
 The rotations of the shape (note: Always size = myShape.size()-1) More...
 

Static Private Member Functions

static int angleLookup (const double angleDeg)
 normalize angle for lookup in myCircleCoords More...
 

Static Private Attributes

static PositionVector myCircleCoords
 Storage for precomputed sin/cos-values describing a circle. More...
 

Detailed Description

Definition at line 31 of file GUIGeometry.h.

Constructor & Destructor Documentation

◆ GUIGeometry() [1/3]

GUIGeometry::GUIGeometry ( )

default constructor

Definition at line 39 of file GUIGeometry.cpp.

◆ GUIGeometry() [2/3]

GUIGeometry::GUIGeometry ( const PositionVector shape)

parameter constructor

Definition at line 43 of file GUIGeometry.cpp.

References calculateShapeRotationsAndLengths().

◆ GUIGeometry() [3/3]

GUIGeometry::GUIGeometry ( const PositionVector shape,
const std::vector< double > &  shapeRotations,
const std::vector< double > &  shapeLengths 
)

parameter constructor

Definition at line 50 of file GUIGeometry.cpp.

Member Function Documentation

◆ adjustStartPosGeometricPath()

void GUIGeometry::adjustStartPosGeometricPath ( double &  startPos,
const PositionVector startLaneShape,
double &  endPos,
const PositionVector endLaneShape 
)
static

adjust start and end positions in geometric path

Definition at line 235 of file GUIGeometry.cpp.

References PositionVector::length().

◆ angleLookup()

int GUIGeometry::angleLookup ( const double  angleDeg)
staticprivate

normalize angle for lookup in myCircleCoords

Definition at line 543 of file GUIGeometry.cpp.

References CIRCLE_RESOLUTION, and myCircleCoords.

Referenced by getVertexCircleAroundPosition().

Here is the caller graph for this function:

◆ calculateLength()

double GUIGeometry::calculateLength ( const Position first,
const Position second 
)
static

return length between two points (used in geometric calculations)

Definition at line 228 of file GUIGeometry.cpp.

References Position::distanceTo2D().

Referenced by GUIDottedGeometry::calculateShapeRotationsAndLengths(), and calculateShapeRotationsAndLengths().

Here is the caller graph for this function:

◆ calculateRotation()

double GUIGeometry::calculateRotation ( const Position first,
const Position second 
)
static

return angle between two points (used in geometric calculations)

Definition at line 221 of file GUIGeometry.cpp.

References M_PI, Position::x(), and Position::y().

Referenced by GUIDottedGeometry::calculateShapeRotationsAndLengths(), calculateShapeRotationsAndLengths(), and GNELane::drawArrows().

Here is the caller graph for this function:

◆ calculateShapeRotationsAndLengths()

void GUIGeometry::calculateShapeRotationsAndLengths ( )
protected

calculate shape rotations and lengths

Definition at line 563 of file GUIGeometry.cpp.

References calculateLength(), calculateRotation(), myShape, myShapeLengths, and myShapeRotations.

Referenced by GUIGeometry(), and updateGeometry().

Here is the caller graph for this function:

◆ clearGeometry()

void GUIGeometry::clearGeometry ( )
protected

clear geometry

Definition at line 554 of file GUIGeometry.cpp.

References myShape, myShapeLengths, and myShapeRotations.

Referenced by updateGeometry(), and updateSinglePosGeometry().

Here is the caller graph for this function:

◆ drawChildLine()

◆ drawContourGeometry()

void GUIGeometry::drawContourGeometry ( const GUIGeometry geometry,
const double  width,
const bool  drawExtremes = false 
)
static

draw contour geometry

Definition at line 314 of file GUIGeometry.cpp.

References PositionVector::append(), PositionVector::closePolygon(), GLHelper::drawBoxLines(), getShape(), PositionVector::move2side(), and PositionVector::reverse().

Referenced by GNELaneAreaDetector::drawE2PartialJunction().

Here is the caller graph for this function:

◆ drawGeometry() [1/2]

void GUIGeometry::drawGeometry ( const GUIVisualizationSettings::Detail  d,
const GUIGeometry geometry,
const double  width,
double  offset = 0 
)
static

draw geometry

Definition at line 269 of file GUIGeometry.cpp.

References GLHelper::drawBoxLines(), GLHelper::drawLine(), GUIVisualizationSettings::GeometryBoxLines, GUIVisualizationSettings::GeometryBoxSimpleLine, getShape(), getShapeLengths(), and getShapeRotations().

Referenced by GNELaneAreaDetector::drawE2(), GNELaneAreaDetector::drawE2PartialJunction(), GNELaneAreaDetector::drawE2PartialLane(), GNEBusStop::drawGL(), GNEChargingStation::drawGL(), GNEContainerStop::drawGL(), GNEParkingArea::drawGL(), GNERouteProbe::drawGL(), GNETAZ::drawGL(), GNEVaporizer::drawGL(), GNETAZRelData::drawGL(), GNEInternalLane::drawGL(), GNEJunction::drawJunctionAsShape(), GNEOverheadWire::drawJunctionPartialGL(), GNEVehicle::drawJunctionPartialGL(), GNELane::drawLane(), GNELane::drawLaneAsRailway(), GNEOverheadWire::drawLanePartialGL(), GNEEdgeData::drawLanePartialGL(), GNEVehicle::drawLanePartialGL(), GNENeteditAttributes::drawLaneReference(), GNELane::drawMarkingsAndBoundings(), GNEDemandElementPlan::drawPlanGL(), GNEDemandElementPlan::drawPlanJunctionPartial(), GNEDemandElementPlan::drawPlanLanePartial(), GNEPoly::drawPolygon(), GNEPoly::drawPolygonContour(), GNERoute::drawRoutePartialJunction(), GNERoute::drawRoutePartialLane(), GNELane::drawSelectedLane(), GNELane::drawShapeEdited(), GNEStopPlan::drawStopOverEdge(), GNEStopPlan::drawStopOverStoppingPlace(), GNEStop::drawStopOverStoppingPlace(), GNEEdge::drawTAZElements(), and GNEViewNet::drawTemporalJunction().

Here is the caller graph for this function:

◆ drawGeometry() [2/2]

void GUIGeometry::drawGeometry ( const GUIVisualizationSettings::Detail  d,
const GUIGeometry geometry,
const std::vector< RGBColor > &  colors,
const double  width,
double  offset = 0 
)
static

◆ drawGeometryPoints()

void GUIGeometry::drawGeometryPoints ( const GUIVisualizationSettings::Detail  d,
const PositionVector shape,
const RGBColor color,
const double  radius,
const double  exaggeration,
const bool  editingElevation 
)
static

◆ drawParentLine()

void GUIGeometry::drawParentLine ( const GUIVisualizationSettings s,
const Position parent,
const Position child,
const RGBColor color,
const bool  drawEntire,
const double  lineWidth 
)
static

◆ getShape()

const PositionVector & GUIGeometry::getShape ( ) const

The shape of the additional element.

Definition at line 203 of file GUIGeometry.cpp.

References myShape.

Referenced by GNEContour::buildContourEdge(), GNEAdditional::calculateContourPolygons(), GNECrossing::calculateCrossingContour(), GNELane::calculateLaneContour(), GNEStoppingPlace::calculateStoppingPlaceContour(), GNEAdditional::drawAdditionalID(), GNEAdditional::drawAdditionalName(), GNELane::drawArrows(), GNEEntryExitDetector::drawBody(), GNEConnection::drawConnection(), GNEConnection::drawConnectionArrows(), drawContourGeometry(), GNECrossing::drawCrossing(), GNECrossing::drawCrossingDetailed(), GNELane::drawDirectionIndicators(), GNEDetector::drawE1DetectorLogo(), GNEDetector::drawE1Shape(), GNELaneAreaDetector::drawE2(), GNEDetector::drawE2DetectorLogo(), GNELaneAreaDetector::drawE2PartialJunction(), GNELaneAreaDetector::drawE2PartialLane(), GNEEntryExitDetector::drawE3Logo(), GNEConnection::drawEdgeValues(), GNEEntryExitDetector::drawEntryLogo(), drawGeometry(), GNEStop::drawGeometryPoints(), GNEPoly::drawGeometryPoints(), GNEAccess::drawGL(), GNEBusStop::drawGL(), GNECalibrator::drawGL(), GNEChargingStation::drawGL(), GNEContainerStop::drawGL(), GNEEntryExitDetector::drawGL(), GNEInductionLoopDetector::drawGL(), GNEInstantInductionLoopDetector::drawGL(), GNELaneAreaDetector::drawGL(), GNEParkingArea::drawGL(), GNERouteProbe::drawGL(), GNETAZ::drawGL(), GNEVaporizer::drawGL(), GNEVariableSpeedSignSymbol::drawGL(), GNETAZRelData::drawGL(), GNEStop::drawGL(), GNEVehicle::drawGL(), GNEConnection::drawGL(), GNECrossing::drawGL(), GNEInternalLane::drawGL(), GNEPoly::drawGL(), GNELaneAreaDetector::drawJunctionPartialGL(), GNEOverheadWire::drawJunctionPartialGL(), GNERoute::drawJunctionPartialGL(), GNEVehicle::drawJunctionPartialGL(), GNELane::drawLane(), GNELane::drawLane2LaneConnections(), GNELane::drawLaneAsRailway(), GNELaneAreaDetector::drawLanePartialGL(), GNEOverheadWire::drawLanePartialGL(), GNERoute::drawLanePartialGL(), GNEVehicle::drawLanePartialGL(), GNENeteditAttributes::drawLaneReference(), GNEStoppingPlace::drawLines(), GNELane::drawLinkNo(), GNELane::drawMarkingsAndBoundings(), GNELane::drawOverlappedRoutes(), GNEDemandElementPlan::drawPlanJunctionPartial(), GNEDemandElementPlan::drawPlanLanePartial(), GNEPoly::drawPolygon(), GNEPoly::drawPolygonNameAndType(), GNERoute::drawRoutePartialJunction(), GNELane::drawShapeEdited(), GNEStoppingPlace::drawSign(), GNEStopPlan::drawStopOverEdge(), GNEStop::drawStopOverLane(), GNEStopPlan::drawStopOverStoppingPlace(), GNEStop::drawStopOverStoppingPlace(), GNEConsecutiveSelector::drawTemporalConsecutiveLanePath(), GNEPathCreator::drawTemporalRoute(), GNEPlanCreator::drawTemporalRoute(), GNELane::drawTLSLinkNo(), GNEVariableSpeedSignSymbol::drawVSSSymbol(), GNETAZRelData::getCenteringBoundary(), GNEStop::getCenteringBoundary(), GNEVehicle::getCenteringBoundary(), GNELane::getColorValue(), GNEConnection::getConnectionShape(), GNELane::getLaneShapeLength(), GNEStop::getMoveOperation(), GNEConnection::getMoveOperation(), GNEAdditional::getMoveOperationMultiLane(), GNEAdditional::getMoveOperationSingleLane(), GNEDemandElementPlan::getPlanPositionInView(), GNEAdditional::getPopUpMenu(), GNELane::getPopUpMenu(), GNEAccess::getPositionInView(), GNECalibrator::getPositionInView(), GNEDetector::getPositionInView(), GNEOverheadWire::getPositionInView(), GNERerouterSymbol::getPositionInView(), GNERouteProbe::getPositionInView(), GNEStoppingPlace::getPositionInView(), GNEVaporizer::getPositionInView(), GNEVariableSpeedSignSymbol::getPositionInView(), GNEVehicle::getPositionInView(), GNENetHelper::AttributeCarriers::isNetworkElementAroundShape(), GNELane::setFunctionalColor(), GNELane::setMultiColor(), GNEMultiEntryExitDetector::updateCenteringBoundary(), GNERerouter::updateCenteringBoundary(), GNETractionSubstation::updateCenteringBoundary(), GNEVariableSpeedSign::updateCenteringBoundary(), GNEBusStop::updateGeometry(), GNEChargingStation::updateGeometry(), GNEContainerStop::updateGeometry(), GNEParkingArea::updateGeometry(), GNETAZRelData::updateGeometry(), and GNELane::updateGeometry().

◆ getShapeLengths()

const std::vector< double > & GUIGeometry::getShapeLengths ( ) const

The lengths of the single shape parts.

Definition at line 215 of file GUIGeometry.cpp.

References myShapeLengths.

Referenced by GNECrossing::checkDrawCrossing(), GNEConnection::drawConnection(), GNECrossing::drawCrossingDetailed(), GNELane::drawDirectionIndicators(), drawGeometry(), GNELane::drawLaneAsRailway(), GNELane::drawMarkingsAndBoundings(), GNEStop::drawStopOverLane(), and GNELane::getShapeLengths().

Here is the caller graph for this function:

◆ getShapeRotations()

◆ getVertexCircleAroundPosition()

PositionVector GUIGeometry::getVertexCircleAroundPosition ( const Position pos,
const double  width,
const int  steps = 8 
)
static

get a circle around the given position

Definition at line 513 of file GUIGeometry.cpp.

References PositionVector::add(), angleLookup(), CIRCLE_RESOLUTION, DEG2RAD, myCircleCoords, Position::x(), and Position::y().

Referenced by GNEContour::buildContourCircle(), and GNEContour::drawDottedContourGeometryPoints().

Here is the caller graph for this function:

◆ moveGeometryToSide()

void GUIGeometry::moveGeometryToSide ( const double  amount)

move current shape to side

Definition at line 185 of file GUIGeometry.cpp.

References PositionVector::move2side(), and myShape.

Referenced by GNEOverheadWire::drawJunctionPartialGL(), and GNEOverheadWire::drawLanePartialGL().

Here is the caller graph for this function:

◆ rotateOverLane()

void GUIGeometry::rotateOverLane ( const double  rot)
static

◆ scaleGeometry()

void GUIGeometry::scaleGeometry ( const double  scale)

scale geometry

Definition at line 192 of file GUIGeometry.cpp.

References myShape, myShapeLengths, and PositionVector::scaleRelative().

◆ updateGeometry() [1/4]

void GUIGeometry::updateGeometry ( const PositionVector shape)

update entire geometry

Definition at line 59 of file GUIGeometry.cpp.

References calculateShapeRotationsAndLengths(), clearGeometry(), and myShape.

Referenced by GNEAdditional::calculatePerpendicularLine(), GNEJunction::drawJunctionAsShape(), GNELaneAreaDetector::drawLanePartialGL(), GNEOverheadWire::drawLanePartialGL(), GNERoute::drawLanePartialGL(), GNEVehicle::drawLanePartialGL(), GNENeteditAttributes::drawLaneReference(), GNEDemandElementPlan::drawPlanLanePartial(), GNEViewNet::drawTemporalJunction(), GNEAdditional::getMoveOperationMultiLane(), GNETAZ::setMoveShape(), GNEPoly::setMoveShape(), GNEStoppingPlace::setStoppingPlaceGeometry(), GNEDemandElement::updateDemandElementGeometry(), GNEDemandElement::updateDemandElementSpreadGeometry(), GNEAccess::updateGeometry(), GNECalibrator::updateGeometry(), GNEContainerStop::updateGeometry(), GNEEntryExitDetector::updateGeometry(), GNEInductionLoopDetector::updateGeometry(), GNEInstantInductionLoopDetector::updateGeometry(), GNELaneAreaDetector::updateGeometry(), GNERerouterSymbol::updateGeometry(), GNETAZ::updateGeometry(), GNEVariableSpeedSignSymbol::updateGeometry(), GNETAZRelData::updateGeometry(), GNEStop::updateGeometry(), GNEStopPlan::updateGeometry(), GNEVehicle::updateGeometry(), GNEConnection::updateGeometry(), GNECrossing::updateGeometry(), GNELane::updateGeometry(), GNEPoly::updateGeometry(), and GNEDemandElementPlan::updatePlanGeometry().

Here is the caller graph for this function:

◆ updateGeometry() [2/4]

void GUIGeometry::updateGeometry ( const PositionVector shape,
const double  posOverShape,
const double  lateralOffset 
)

update geometry (using a shape, a position over shape and a lateral offset)

Definition at line 70 of file GUIGeometry.cpp.

References clearGeometry(), PositionVector::length(), myShape, myShapeRotations, PositionVector::positionAtOffset(), and PositionVector::rotationDegreeAtOffset().

◆ updateGeometry() [3/4]

void GUIGeometry::updateGeometry ( const PositionVector shape,
double  beginTrimPosition,
const Position extraFirstPosition,
double  endTrimPosition,
const Position extraLastPosition 
)

◆ updateGeometry() [4/4]

void GUIGeometry::updateGeometry ( const PositionVector shape,
double  starPosOverShape,
double  endPosOverShape,
const double  lateralOffset 
)

update geometry (using a shape, a starPos over shape, a endPos and a lateral offset)

Definition at line 91 of file GUIGeometry.cpp.

References calculateShapeRotationsAndLengths(), clearGeometry(), PositionVector::getSubpart2D(), PositionVector::length2D(), PositionVector::move2side(), and myShape.

◆ updateSinglePosGeometry()

void GUIGeometry::updateSinglePosGeometry ( const Position position,
const double  rotation 
)

update position and rotation

Definition at line 175 of file GUIGeometry.cpp.

References clearGeometry(), myShape, and myShapeRotations.

Referenced by GNEMultiEntryExitDetector::updateGeometry(), GNERerouter::updateGeometry(), GNETractionSubstation::updateGeometry(), GNEVariableSpeedSign::updateGeometry(), and GNEVehicle::updateGeometry().

Here is the caller graph for this function:

Field Documentation

◆ myCircleCoords

PositionVector GUIGeometry::myCircleCoords
staticprivate

Storage for precomputed sin/cos-values describing a circle.

Definition at line 144 of file GUIGeometry.h.

Referenced by angleLookup(), and getVertexCircleAroundPosition().

◆ myShape

◆ myShapeLengths

std::vector<double> GUIGeometry::myShapeLengths
protected

The lengths of the shape (note: Always size = myShape.size()-1)

Definition at line 140 of file GUIGeometry.h.

Referenced by calculateShapeRotationsAndLengths(), clearGeometry(), getShapeLengths(), and scaleGeometry().

◆ myShapeRotations

std::vector<double> GUIGeometry::myShapeRotations
protected

The rotations of the shape (note: Always size = myShape.size()-1)

Definition at line 137 of file GUIGeometry.h.

Referenced by calculateShapeRotationsAndLengths(), clearGeometry(), getShapeRotations(), updateGeometry(), and updateSinglePosGeometry().


The documentation for this class was generated from the following files: