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, double endTrimPosition, const Position &extraFirstPosition, 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 drawLaneGeometry (const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const std::vector< double > &rotations, const std::vector< double > &lengths, const std::vector< RGBColor > &colors, double width, const bool onlyContour=false, const double offset=0)
 draw lane geometry (use their own function due colors) More...
 
static void drawGeometry (const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
 draw geometry More...
 
static void drawContourGeometry (const GUIGeometry &geometry, const double width, const bool drawExtremes=false)
 draw contour geometry More...
 
static void drawGeometryPoints (const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
 draw geometry points More...
 
static void drawMovingHint (const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
 draw moving hint 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 30 of file GUIGeometry.h.

Constructor & Destructor Documentation

◆ GUIGeometry() [1/3]

GUIGeometry::GUIGeometry ( )

default constructor

Definition at line 38 of file GUIGeometry.cpp.

◆ GUIGeometry() [2/3]

GUIGeometry::GUIGeometry ( const PositionVector shape)

parameter constructor

Definition at line 42 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 49 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 234 of file GUIGeometry.cpp.

References PositionVector::length().

◆ angleLookup()

int GUIGeometry::angleLookup ( const double  angleDeg)
staticprivate

normalize angle for lookup in myCircleCoords

Definition at line 611 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 227 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 220 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 631 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 622 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 295 of file GUIGeometry.cpp.

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

Referenced by GNELaneAreaDetector::drawPartialGL(), and GNEEdgeRelData::drawPartialGL().

Here is the caller graph for this function:

◆ drawGeometry()

void GUIGeometry::drawGeometry ( const GUIVisualizationSettings s,
const Position mousePos,
const GUIGeometry geometry,
const double  width,
double  offset = 0 
)
static

◆ drawGeometryPoints()

void GUIGeometry::drawGeometryPoints ( const GUIVisualizationSettings s,
const Position mousePos,
const PositionVector shape,
const RGBColor geometryPointColor,
const RGBColor textColor,
const double  radius,
const double  exaggeration,
const bool  editingElevation,
const bool  drawExtremeSymbols 
)
static

◆ drawLaneGeometry()

void GUIGeometry::drawLaneGeometry ( const GUIVisualizationSettings s,
const Position mousePos,
const PositionVector shape,
const std::vector< double > &  rotations,
const std::vector< double > &  lengths,
const std::vector< RGBColor > &  colors,
double  width,
const bool  onlyContour = false,
const double  offset = 0 
)
static

◆ drawMovingHint()

void GUIGeometry::drawMovingHint ( const GUIVisualizationSettings s,
const Position mousePos,
const PositionVector shape,
const RGBColor hintColor,
const double  radius,
const double  exaggeration 
)
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 202 of file GUIGeometry.cpp.

References myShape.

Referenced by GNEAdditional::drawAdditionalID(), GNEAdditional::drawAdditionalName(), GNELane::drawArrows(), GNEConnection::drawConnectionArrows(), drawContourGeometry(), GNEDetector::drawDetectorLogo(), GNELane::drawDirectionIndicators(), GNEEdge::drawDottedContourEdge(), GNETAZ::drawDottedContours(), GNEDetector::drawE1Shape(), drawGeometry(), GNEStop::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(), GNEVehicle::drawGL(), GNEConnection::drawGL(), GNECrossing::drawGL(), GNEInternalLane::drawGL(), GNELane::drawGL(), GNEPoly::drawGL(), GNELane::drawLane2LaneConnections(), GNELane::drawLaneAsRailway(), GNEStoppingPlace::drawLines(), GNELane::drawLinkNo(), GNELane::drawMarkings(), GNELane::drawOverlappedRoutes(), GNEEdgeRelData::drawPartialGL(), GNELaneAreaDetector::drawPartialGL(), GNEOverheadWire::drawPartialGL(), GNERoute::drawPartialGL(), GNEVehicle::drawPartialGL(), GNEDemandElement::drawPersonPlanPartial(), GNEStoppingPlace::drawSign(), GNEStop::drawStopPersonOverBusStop(), GNEStop::drawStopPersonOverEdge(), GNEConsecutiveSelector::drawTemporalConsecutiveLanePath(), GNEPathCreator::drawTemporalRoute(), GNELane::drawTLSLinkNo(), GNEStop::drawVehicleStop(), GNETAZRelData::getCenteringBoundary(), GNEStop::getCenteringBoundary(), GNEVehicle::getCenteringBoundary(), GNELane::getColorValue(), GNEConnection::getConnectionShape(), GNELane::getLaneShapeLength(), GNEStoppingPlace::getMoveOperation(), GNEStop::getMoveOperation(), GNEConnection::getMoveOperation(), GNEAdditional::getMoveOperationMultiLane(), GNEAdditional::getMoveOperationSingleLane(), GNEDemandElement::getPathElementArrivalPos(), GNEDemandElement::getPathElementDepartPos(), 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(), GNEStoppingPlace::updateCenteringBoundary(), GNETractionSubstation::updateCenteringBoundary(), GNEVariableSpeedSign::updateCenteringBoundary(), GNEConnection::updateCenteringBoundary(), GNEInternalLane::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 214 of file GUIGeometry.cpp.

References myShapeLengths.

Referenced by GNELane::drawDirectionIndicators(), drawGeometry(), GNEConnection::drawGL(), GNECrossing::drawGL(), GNELane::drawGL(), GNELane::drawLaneAsRailway(), GNELane::drawMarkings(), GNEStop::drawVehicleStop(), 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 581 of file GUIGeometry.cpp.

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

Referenced by GUIDottedGeometry::drawDottedContourCircle().

Here is the caller graph for this function:

◆ moveGeometryToSide()

void GUIGeometry::moveGeometryToSide ( const double  amount)

move current shape to side

Definition at line 184 of file GUIGeometry.cpp.

References PositionVector::move2side(), and myShape.

Referenced by GNEOverheadWire::drawPartialGL().

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

Referenced by GNECalibrator::drawCalibratorSymbol(), GNEDetector::drawDetectorLogo(), GNEDetector::drawE1Shape(), GNEEntryExitDetector::drawGL(), GNERerouterSymbol::drawGL(), GNERouteProbe::drawGL(), GNEVaporizer::drawGL(), GNEVariableSpeedSignSymbol::drawGL(), GNEStoppingPlace::drawLines(), GNELaneAreaDetector::drawPartialGL(), GNEStoppingPlace::drawSign(), GNEStop::drawStopPersonOverBusStop(), and GNEStop::drawStopPersonOverEdge().

Here is the caller graph for this function:

◆ scaleGeometry()

void GUIGeometry::scaleGeometry ( const double  scale)

scale geometry

Definition at line 191 of file GUIGeometry.cpp.

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

◆ updateGeometry() [1/4]

◆ 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 69 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,
double  endTrimPosition,
const Position extraFirstPosition,
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 90 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 174 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: