34 moveElement(_moveElement),
35 originalShape({_originalPosition}),
36 shapeToMove({_originalPosition}),
43 moveElement(_moveElement),
44 originalShape(_originalShape),
45 shapeToMove(_originalShape),
52 const std::vector<int> _originalgeometryPoints,
54 const std::vector<int> _geometryPointsToMove) :
55 moveElement(_moveElement),
56 originalShape(_originalShape),
57 originalGeometryPoints(_originalgeometryPoints),
58 shapeToMove(_shapeToMove),
59 geometryPointsToMove(_geometryPointsToMove),
66 const std::vector<double> _originalPosOverLanes) :
67 moveElement(_moveElement),
69 originalPosOverLanes(_originalPosOverLanes) {
75 const std::vector<double> _originalPosOverLanes,
76 const std::vector<int> _geometryPointsToMove) :
77 moveElement(_moveElement),
78 geometryPointsToMove(_geometryPointsToMove),
80 originalPosOverLanes(_originalPosOverLanes) {
110 if (moveOperation->
lane) {
120 geometryPointIndex.
add(offset);
124 throw ProcessError(
"trying to move an invalid position");
138 throw ProcessError(
"trying to move an invalid position");
152 if (moveOperation->
lane) {
158 originalPosOverLanes.push_back(
Position(posOverlane, 0));
183 geometryPointIndex.
add(offset);
187 throw ProcessError(
"trying to move an invalid position");
199 throw ProcessError(
"trying to move an invalid position");
224 double posOverLaneOffset = 0;
228 lanePositionAtCentralPosition.
add(offset);
230 lanePositionAtCentralPosition = viewNet->
snapToActiveGrid(lanePositionAtCentralPosition);
234 if (newPosOverLanePerpendicular == -1) {
238 if (newPosOverLane == 0) {
245 if ((newPosOverLanePerpendicular - middleLenght) < 0) {
247 }
else if ((newPosOverLanePerpendicular + middleLenght) > laneLengt) {
250 posOverLaneOffset = centralPosition - newPosOverLanePerpendicular;
255 newShape.push_back(
Position(posOverlane - posOverLaneOffset, 0));
NBEdge * getNBEdge() const
returns the internal NBEdge
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
double getLengthGeometryFactor() const
get length geometry factor
GNEEdge * getParentEdge() const
get arent edge
virtual void setMoveShape(const GNEMoveResult &moveResult)=0
set move shape
static const PositionVector calculateMovementOverLane(const GNEViewNet *viewNet, const GNEMoveOperation *moveOperation, const Position &offset)
calculate movement over lane
GNEMoveElement()
constructor
static void commitMove(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const Position &offset, GNEUndoList *undoList)
commit move element for the given offset
virtual void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)=0
commit move shape
static void moveElement(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const Position &offset)
move element the for given offset (note: offset can be X-Y-0, 0-0-Z or X-Y-Z)
const PositionVector originalShape
original shape
const std::vector< int > originalGeometryPoints
original shape points to move (of original shape)
const PositionVector shapeToMove
shape to move
const std::vector< double > originalPosOverLanes
original position over lanes
GNEMoveOperation(GNEMoveElement *moveElement, const Position originalPosition)
constructor for values with a single position (junctions, E3, ParkingSpaces...)
~GNEMoveOperation()
destructor
const GNELane * lane
original lane
const std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
GNEMoveElement * moveElement
move element
~GNEMoveResult()
destructor
GNEMoveResult()
constructor
std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
PositionVector shapeToUpdate
shape to update (edited in moveElement)
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
double getFinalLength() const
get length that will be assigned to the lanes in the final network
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
void add(const Position &pos)
Adds the given position to this one.
void add(double xoff, double yoff, double zoff)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.