71 myAllowChangeLanes->setCheck(FALSE);
74 myMergeGeometryPoints->setCheck(TRUE);
83 return (myAllowChangeLanes->getCheck() == TRUE);
89 return (myMergeGeometryPoints->getCheck() == TRUE);
98 myMoveFrameParent(moveFrameParent) {
129 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
131 return (myMoveWholePolygons->getCheck() == TRUE);
140 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
142 return (myForceDrawGeometryPoints->getCheck() == TRUE);
151 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
153 return (myMoveOnlyJunctionCenter->getCheck() == TRUE);
163 myMoveFrameParent->getViewNet()->update();
173 myMoveFrameParent(moveFrameParent) {
198 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
200 return (myLeaveStopPersonsConnected->getCheck() == TRUE);
212 myMoveFrameParent(moveFrameParent) {
231 myShiftValueTextField->enable();
232 myApplyZValue->enable();
239 myShiftValueTextField->disable();
240 myApplyZValue->disable();
247 return onCmdShiftEdgeGeometry(
nullptr, 0,
nullptr);
254 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
256 const double shiftValue = GNEAttributeCarrier::parse<double>(myShiftValueTextField->getText().text());
258 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
260 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::EDGE,
"shift edge geometries");
262 for (
const auto& edge : selectedEdges) {
268 const Position shapeStart = edgeShape.front();
269 const Position shapeEnd = edgeShape.back();
272 edgeShape.pop_back();
274 if (edgeShape.size() > 0) {
282 myMoveFrameParent->getViewNet()->getUndoList()->end();
292 myMoveFrameParent(moveFrameParent) {
320 myZValueTextField->enable();
321 myAbsoluteValue->enable();
322 myRelativeValue->enable();
323 myApplyButton->enable();
332 myZValueTextField->disable();
333 myAbsoluteValue->disable();
334 myRelativeValue->disable();
335 myApplyButton->disable();
347 if (obj == myAbsoluteValue) {
348 myAbsoluteValue->setCheck(
true);
349 myRelativeValue->setCheck(
false);
351 myAbsoluteValue->setCheck(
false);
352 myRelativeValue->setCheck(
true);
361 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
363 const double zValue = GNEAttributeCarrier::parse<double>(myZValueTextField->getText().text());
365 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
367 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
369 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODEMOVE,
"change Z values in selection");
371 for (
const auto& junction : selectedJunctions) {
372 if (junction->getNBNode()->hasCustomShape()) {
376 for (
auto& shapePos : junctionShape) {
377 if (myAbsoluteValue->getCheck() == TRUE) {
378 shapePos.setz(zValue);
387 Position junctionPos = junction->getNBNode()->getPosition();
389 if (myAbsoluteValue->getCheck() == TRUE) {
390 junctionPos.
setz(zValue);
398 for (
const auto& edge : selectedEdges) {
402 Position shapeStart = edge->getNBEdge()->getGeometry().front();
403 Position shapeEnd = edge->getNBEdge()->getGeometry().back();
405 for (
auto& shapePos : edgeShape) {
406 if (myAbsoluteValue->getCheck() == TRUE) {
407 shapePos.
setz(zValue);
409 shapePos.add(
Position(0, 0, zValue));
413 if (myAbsoluteValue->getCheck() == TRUE) {
414 shapeStart.
setz(zValue);
415 shapeEnd.
setz(zValue);
421 if (edgeShape.size() > 0) {
426 (shapeStart.
distanceSquaredTo2D(edge->getFromJunction()->getNBNode()->getPosition()) < 2)) {
435 myMoveFrameParent->getViewNet()->getUndoList()->end();
445 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
447 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
449 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
451 double selectionMinimum = 0;
452 double selectionMaximum = 0;
454 if (selectedJunctions.size() > 0) {
455 selectionMinimum = selectedJunctions.front()->getNBNode()->getPosition().z();
456 selectionMaximum = selectedJunctions.front()->getNBNode()->getPosition().z();
458 selectionMinimum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
459 selectionMaximum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
462 double selectionAverage = 0;
466 for (
const auto& junction : selectedJunctions) {
468 const double z = junction->getNBNode()->getPosition().z();
470 if (z < selectionMinimum) {
471 selectionMinimum = z;
474 if (z > selectionMaximum) {
475 selectionMaximum = z;
478 selectionAverage += z;
483 for (
const auto& edge : selectedEdges) {
485 const PositionVector innerGeometry = edge->getNBEdge()->getInnerGeometry();
487 for (
const auto& geometryPoint : innerGeometry) {
489 if (geometryPoint.z() < selectionMinimum) {
490 selectionMinimum = geometryPoint.z();
493 if (geometryPoint.z() > selectionMaximum) {
494 selectionMaximum = geometryPoint.z();
497 selectionAverage += geometryPoint.z();
504 const double z = edge->getNBEdge()->getGeometry().front().z();
506 if (z < selectionMinimum) {
507 selectionMinimum = z;
510 if (z > selectionMaximum) {
511 selectionMaximum = z;
514 selectionAverage += z;
521 const double z = edge->getNBEdge()->getGeometry().back().z();
523 if (z < selectionMinimum) {
524 selectionMinimum = z;
527 if (z > selectionMaximum) {
528 selectionMaximum = z;
531 selectionAverage += z;
537 selectionAverage = (100 * selectionAverage) / (
double)numPoints;
539 selectionAverage = floor(selectionAverage);
540 selectionAverage *= 0.01;
542 const std::string labelStr =
543 TL(
"- Num geometry points: ") +
toString(numPoints) +
"\n" +
544 TL(
"- Selection minimum Z: ") +
toString(selectionMinimum) +
"\n" +
545 TL(
"- Selection maximum Z: ") +
toString(selectionMaximum) +
"\n" +
546 TL(
"- Selection average Z: ") +
toString(selectionAverage);
548 myInfoLabel->setText(labelStr.c_str());
558 myMoveFrameParent(moveFrameParent) {
573 TL(
"Shift shape geometry"),
"",
TL(
"Shift shape geometry orthogonally to driving direction for all selected shapes"),
598 return onCmdShiftShapeGeometry(
nullptr, 0,
nullptr);
605 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
607 const double shiftValueX = GNEAttributeCarrier::parse<double>(myShiftValueXTextField->getText().text());
608 const double shiftValueY = GNEAttributeCarrier::parse<double>(myShiftValueYTextField->getText().text());
609 const Position shiftValue(shiftValueX, shiftValueY);
611 const auto selectedShapes = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedShapes();
612 std::vector<GNEAdditional*> polygons, POIs;
613 for (
const auto& shape : selectedShapes) {
615 polygons.push_back(shape);
617 POIs.push_back(shape);
621 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::POLY,
"shift shape geometries");
623 for (
const auto& polygon : polygons) {
627 shape.
add(shiftValue);
632 for (
const auto&
POI : POIs) {
638 position.
add(shiftValue);
644 myMoveFrameParent->getViewNet()->getUndoList()->end();
655 std::string info = std::string(
"- ") +
TL(
"Click over edge to create or edit geometry point.") + std::string(
"\n") +
656 std::string(
"- ") +
TL(
"Shift+click over edge to edit start or end geometry point.");
716 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
722 if (selectedEdges.size() > 0) {
FXDEFMAP(GNEMoveFrame::NetworkMoveOptions) NetworkMoveOptionsMap[]
@ NETWORK_MOVE
mode for moving network elements
@ DEMAND_MOVE
mode for moving demand elements
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CHOOSEN_OPERATION
set type of selection
@ MID_GNE_APPLY
apply element
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
#define GUIDesignRadioButton
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ GNE_ATTR_SHAPE_END
last coordinate of edge shape
@ GNE_ATTR_SHAPE_START
first coordinate of edge shape
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
GNEViewNet * myViewNet
FOX need this.
virtual void show()
show Frame
virtual void hide()
hide Frame
void updateInfoLabel()
FOX need this.
void disableChangeZInSelection()
disable change Z in selection
ChangeZInSelection(GNEMoveFrame *moveFrameParent)
FOX-declaration.
FXRadioButton * myRelativeValue
radio button for relative value
FXRadioButton * myAbsoluteValue
radio button for absolute value
long onCmdChangeZValue(FXObject *, FXSelector, void *)
FXButton * myApplyButton
apply button
~ChangeZInSelection()
destructor
void enableChangeZInSelection()
enabale change Z in selection
FXLabel * myInfoLabel
info label
long onCmdChangeZMode(FXObject *, FXSelector, void *)
Called when user changes Z mode.
FXTextField * myZValueTextField
textField for Z value
long onCmdApplyZ(FXObject *, FXSelector, void *)
Called when user press the apply Z value button.
bool getMergeGeometryPoints() const
check if merge geometry points
bool getAllowChangeLane() const
allow change lane
~CommonMoveOptions()
destructor
void hideDemandMoveOptions()
hide DemandMoveOptions
bool getLeaveStopPersonsConnected() const
check if leave stopPersonConnected is enabled
FXCheckButton * myLeaveStopPersonsConnected
checkbox for enable/disable leave stopPersons connected
~DemandMoveOptions()
destructor
DemandMoveOptions(GNEMoveFrame *moveFrameParent)
constructor
void showDemandMoveOptions()
show DemandMoveOptions
~NetworkMoveOptions()
destructor
bool getMoveWholePolygons() const
check if option "move whole polygons" is enabled
FXCheckButton * myMoveWholePolygons
checkbox for enable/disable move whole polygons
bool getForceDrawGeometryPoints() const
check if option "force draw geometry points" is enabled
long onCmdChangeOption(FXObject *, FXSelector, void *)
bool getMoveOnlyJunctionCenter() const
check if option "move only junction center" is enabled
void showNetworkMoveOptions()
show NetworkMoveOptions
FXCheckButton * myMoveOnlyJunctionCenter
checkbox for move only juntion center
FXCheckButton * myForceDrawGeometryPoints
checkbox for force draw geometry points
void hideNetworkMoveOptions()
hide NetworkMoveOptions
NetworkMoveOptions(GNEMoveFrame *moveFrameParent)
FOX-declaration.
long onCmdChangeShiftValue(FXObject *, FXSelector, void *)
FXButton * myApplyZValue
button for apply Z value
void enableShiftEdgeGeometry()
enable shift edge geometry
void disableShiftEdgeGeometry()
disable change Z in selection
FXTextField * myShiftValueTextField
textField for shift value
~ShiftEdgeSelectedGeometry()
destructor
ShiftEdgeSelectedGeometry(GNEMoveFrame *moveFrameParent)
FOX-declaration.
long onCmdShiftEdgeGeometry(FXObject *, FXSelector, void *)
Called when user press the apply Z value button.
void hideShiftShapeGeometry()
hide change Z in selection
FXTextField * myShiftValueYTextField
textField for shiftY value
long onCmdChangeShiftValue(FXObject *, FXSelector, void *)
FXTextField * myShiftValueXTextField
textField for shiftX value
ShiftShapeGeometry(GNEMoveFrame *moveFrameParent)
FOX-declaration.
~ShiftShapeGeometry()
destructor
long onCmdShiftShapeGeometry(FXObject *, FXSelector, void *)
Called when user press the apply Z value button.
void showShiftShapeGeometry()
show shift shape geometry
void show()
show prohibition frame
ChangeZInSelection * myChangeZInSelection
modul for change Z in selection
NetworkMoveOptions * myNetworkMoveOptions
modul for NetworkMove Options
DemandMoveOptions * getDemandMoveOptions() const
get demand mode options
DemandMoveOptions * myDemandMoveOptions
modul for DemandMove Options
CommonMoveOptions * getCommonMoveOptions() const
get common mode options
void hide()
hide prohibition frame
~GNEMoveFrame()
Destructor.
ShiftEdgeSelectedGeometry * myShiftEdgeSelectedGeometry
modul for shift edge selected geometry
GNEMoveFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
NetworkMoveOptions * getNetworkMoveOptions() const
get network mode options
CommonMoveOptions * myCommonMoveOptions
modul for CommonMove Options
Information * myInformation
modul for show information
ShiftShapeGeometry * myShiftShapeGeometry
modul for shift shape geometry
void processClick(const Position &clickedPosition, const GNEViewNetHelper::ViewObjectsSelector &viewObjects, const GNEViewNetHelper::ViewObjectsSelector &objectsUnderGrippedCursor)
handle processClick and set the relative coloring
std::vector< GNEAdditional * > getSelectedShapes() const
get selected shapes
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
std::vector< GNEEdge * > getSelectedEdges() const
return all edges
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
class used to group all variables related with objects under cursor after a click over view
GNENet * getNet() const
get the net object
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
A single child window which contains a view of the simulation area.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXRadioButton * buildFXRadioButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXObject *tgt, FXSelector sel, FXuint opts=RADIOBUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build radio button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
A list item which allows for custom coloring.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
C++ TraCI client API implementation.
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
void add(const Position &pos)
Adds the given position to this one.
void setz(double z)
set position z
void add(double xoff, double yoff, double zoff)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
void pop_front()
pop first Position
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network