Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIGeometry Class Reference

#include <GUIGeometry.h>

Collaboration diagram for GUIGeometry:
[legend]

Public Member Functions

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

Static Public Member Functions

calculation functions
static double calculateRotation (const Position &first, const Position &second)
 return angle between two points (used in geometric calculations)
 
static double calculateLength (const Position &first, const Position &second)
 return length between two points (used in geometric calculations)
 
static void adjustStartPosGeometricPath (double &startPos, const PositionVector &startLaneShape, double &endPos, const PositionVector &endLaneShape)
 adjust start and end positions in geometric path
 
draw functions
static void drawGeometry (const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
 draw geometry
 
static void drawGeometry (const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const std::vector< RGBColor > &colors, const double width, double offset=0)
 draw colored geometry
 
static void drawContourGeometry (const GUIGeometry &geometry, const double width, const bool drawExtremes=false)
 draw contour geometry
 
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
 
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)
 
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)
 
static PositionVector getVertexCircleAroundPosition (const Position &pos, const double width, const int steps=8)
 get a circle around the given position
 
static void rotateOverLane (const double rot)
 rotate over lane (used by Lock icons, detector logos, etc.)
 

Protected Member Functions

void calculateShapeRotationsAndLengths ()
 calculate shape rotations and lengths
 

Protected Attributes

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

Static Private Member Functions

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

Static Private Attributes

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

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 243 of file GUIGeometry.cpp.

References PositionVector::length().

◆ angleLookup()

int GUIGeometry::angleLookup ( const double  angleDeg)
staticprivate

normalize angle for lookup in myCircleCoords

Definition at line 551 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 236 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 229 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(), updateGeometry(), updateGeometry(), and updateGeometry().

Here is the caller graph for this function:

◆ clearGeometry()

void GUIGeometry::clearGeometry ( )

clear geometry

Definition at line 184 of file GUIGeometry.cpp.

References myShape, myShapeLengths, and myShapeRotations.

Referenced by GNEConnection::updateGeometry(), updateGeometry(), updateGeometry(), updateGeometry(), updateGeometry(), GNEDemandElementPlan::updatePlanGeometry(), 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 322 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 277 of file GUIGeometry.cpp.

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

Referenced by GNECrossing::drawCrossing(), GNELaneAreaDetector::drawE2(), GNELaneAreaDetector::drawE2PartialJunction(), GNELaneAreaDetector::drawE2PartialLane(), GNEBusStop::drawGL(), GNEChargingStation::drawGL(), GNEContainerStop::drawGL(), GNEParkingArea::drawGL(), GNERouteProbe::drawGL(), GNETAZ::drawGL(), GNEVaporizer::drawGL(), GNETAZRelData::drawGL(), GNEStopPlan::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(), 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 211 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(), 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(), GNEStopPlan::drawGL(), GNEVehicle::drawGL(), GNEConnection::drawGL(), GNECrossing::drawGL(), GNEInternalLane::drawGL(), GNELane::drawGL(), GNELaneAreaDetector::drawJunctionPartialGL(), GNEOverheadWire::drawJunctionPartialGL(), GNERoute::drawJunctionPartialGL(), GNEVehicle::drawJunctionPartialGL(), 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(), GNEStop::drawStopOverLane(), GNEStop::drawStopOverStoppingPlace(), GNEConsecutiveSelector::drawTemporalConsecutiveLanePath(), GNEPathCreator::drawTemporalRoute(), GNEPlanCreator::drawTemporalRoute(), GNELane::drawTLSLinkNo(), GNEVariableSpeedSignSymbol::drawVSSSymbol(), GNEAdditional::getCenteringBoundary(), 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(), GNELane::updateGeometry(), and GNEDemandElementPlan::updatePlanCenteringBoundary().

◆ getShapeLengths()

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

The lengths of the single shape parts.

Definition at line 223 of file GUIGeometry.cpp.

References myShapeLengths.

Referenced by GNECrossing::checkDrawCrossing(), GNEConnection::drawConnection(), GNECrossing::drawCrossingDetailed(), GNELane::drawDirectionIndicators(), drawGeometry(), 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 521 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 193 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

rotate over lane (used by Lock icons, detector logos, etc.)

Definition at line 544 of file GUIGeometry.cpp.

Referenced by GNEEntryExitDetector::drawBody(), GNECalibrator::drawCalibratorSymbol(), GNEDetector::drawE1Shape(), GNEEntryExitDetector::drawE3Logo(), GNEEntryExitDetector::drawEntryLogo(), GNERouteProbe::drawGL(), GNEVaporizer::drawGL(), GNEStopPlan::drawGL(), GNEStoppingPlace::drawLines(), GNERerouterSymbol::drawRerouterSymbol(), GNEStoppingPlace::drawSign(), and GNEVariableSpeedSignSymbol::drawVSSSymbol().

Here is the caller graph for this function:

◆ scaleGeometry()

void GUIGeometry::scaleGeometry ( const double  scale)

scale geometry

Definition at line 200 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: