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.

Referenced by drawContourGeometry(), drawGeometry(), and drawGeometry().

Here is the caller graph for this function:

◆ GUIGeometry() [2/3]

GUIGeometry::GUIGeometry ( const PositionVector & shape)

parameter constructor

Definition at line 43 of file GUIGeometry.cpp.

References calculateShapeRotationsAndLengths(), and myShape.

◆ 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.

References myShape, myShapeLengths, and myShapeRotations.

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 updateGeometry(), updateGeometry(), updateGeometry(), 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 322 of file GUIGeometry.cpp.

References PositionVector::append(), PositionVector::closePolygon(), GLHelper::drawBoxLines(), getShape(), GUIGeometry(), 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(), getShapeRotations(), and GUIGeometry().

Referenced by GNEConnection::drawConnection(), GNECrossing::drawCrossing(), GNELaneAreaDetector::drawE2(), GNELaneAreaDetector::drawE2PartialJunction(), GNELaneAreaDetector::drawE2PartialLane(), GNEBusStop::drawGL(), GNEChargingStation::drawGL(), GNEContainerStop::drawGL(), GNEInternalLane::drawGL(), GNEParkingArea::drawGL(), GNERouteProbe::drawGL(), GNEStopPlan::drawGL(), GNETAZ::drawGL(), GNETAZRelData::drawGL(), GNEVaporizer::drawGL(), GNEJunction::drawJunctionAsShape(), GNEOverheadWire::drawJunctionPartialGL(), GNEVehicle::drawJunctionPartialGL(), GNELane::drawLane(), GNELane::drawLaneAsRailway(), GNEEdgeData::drawLanePartialGL(), GNEOverheadWire::drawLanePartialGL(), GNEVehicle::drawLanePartialGL(), GNEAdditionalListed::drawListedAdditional(), 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()

◆ 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 GNEConnection::drawConnection(), drawGeometry(), and drawGeometry().

Here is the caller graph for this function:

◆ getShapeRotations()

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

The rotations of the single shape parts.

Definition at line 217 of file GUIGeometry.cpp.

References myShapeRotations.

Referenced by GNEConnection::drawConnection(), GNELaneAreaDetector::drawE2PartialLane(), drawGeometry(), drawGeometry(), and GNEOverheadWire::drawLanePartialGL().

Here is the caller graph for this function:

◆ 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 myShape.

Referenced by 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(), GNEStopPlan::drawGL(), GNEVaporizer::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, and myShapeLengths.

◆ updateGeometry() [1/4]

void GUIGeometry::updateGeometry ( const PositionVector & shape)

◆ 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::length2D(), myShape, myShapeRotations, PositionVector::positionAtOffset2D(), and PositionVector::rotationDegreeAtOffset().

◆ updateGeometry() [3/4]

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

update geometry (using a shape to be trimmed)

Definition at line 129 of file GUIGeometry.cpp.

References calculateShapeRotationsAndLengths(), clearGeometry(), Position::INVALID, and myShape.

◆ 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(), 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.

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(), GUIGeometry(), 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(), GUIGeometry(), updateGeometry(), and updateSinglePosGeometry().


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