73 myAllowChangeLanes->setCheck(FALSE);
76 myMergeGeometryPoints->setCheck(TRUE);
85 return (myAllowChangeLanes->getCheck() == TRUE);
91 return (myMergeGeometryPoints->getCheck() == TRUE);
100 myMoveFrameParent(moveFrameParent) {
128 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
130 return (myMoveWholePolygons->getCheck() == TRUE);
139 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
141 return (myForceDrawGeometryPoints->getCheck() == TRUE);
151 myMoveFrameParent->getViewNet()->update();
161 myMoveFrameParent(moveFrameParent) {
186 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
188 return (myLeaveStopPersonsConnected->getCheck() == TRUE);
200 myMoveFrameParent(moveFrameParent) {
219 myShiftValueTextField->enable();
220 myApplyZValue->enable();
227 myShiftValueTextField->disable();
228 myApplyZValue->disable();
235 return onCmdShiftEdgeGeometry(
nullptr, 0,
nullptr);
242 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
244 const double shiftValue = GNEAttributeCarrier::parse<double>(myShiftValueTextField->getText().text());
246 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
248 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::EDGE,
"shift edge geometries");
250 for (
const auto& edge : selectedEdges) {
256 const Position shapeStart = edgeShape.front();
257 const Position shapeEnd = edgeShape.back();
260 edgeShape.pop_back();
262 if (edgeShape.size() > 0) {
270 myMoveFrameParent->getViewNet()->getUndoList()->end();
280 myMoveFrameParent(moveFrameParent) {
308 myZValueTextField->enable();
309 myAbsoluteValue->enable();
310 myRelativeValue->enable();
311 myApplyButton->enable();
320 myZValueTextField->disable();
321 myAbsoluteValue->disable();
322 myRelativeValue->disable();
323 myApplyButton->disable();
335 if (obj == myAbsoluteValue) {
336 myAbsoluteValue->setCheck(
true);
337 myRelativeValue->setCheck(
false);
339 myAbsoluteValue->setCheck(
false);
340 myRelativeValue->setCheck(
true);
349 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
351 const double zValue = GNEAttributeCarrier::parse<double>(myZValueTextField->getText().text());
353 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
355 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
357 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODEMOVE,
"change Z values in selection");
359 for (
const auto& junction : selectedJunctions) {
360 if (junction->getNBNode()->hasCustomShape()) {
364 for (
auto& shapePos : junctionShape) {
365 if (myAbsoluteValue->getCheck() == TRUE) {
366 shapePos.setz(zValue);
375 Position junctionPos = junction->getNBNode()->getPosition();
377 if (myAbsoluteValue->getCheck() == TRUE) {
378 junctionPos.
setz(zValue);
386 for (
const auto& edge : selectedEdges) {
390 Position shapeStart = edge->getNBEdge()->getGeometry().front();
391 Position shapeEnd = edge->getNBEdge()->getGeometry().back();
393 for (
auto& shapePos : edgeShape) {
394 if (myAbsoluteValue->getCheck() == TRUE) {
395 shapePos.
setz(zValue);
397 shapePos.add(
Position(0, 0, zValue));
401 if (myAbsoluteValue->getCheck() == TRUE) {
402 shapeStart.
setz(zValue);
403 shapeEnd.
setz(zValue);
409 if (edgeShape.size() > 0) {
414 (shapeStart.
distanceSquaredTo2D(edge->getFromJunction()->getNBNode()->getPosition()) < 2)) {
423 myMoveFrameParent->getViewNet()->getUndoList()->end();
433 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
435 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
437 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
439 double selectionMinimum = 0;
440 double selectionMaximum = 0;
442 if (selectedJunctions.size() > 0) {
443 selectionMinimum = selectedJunctions.front()->getNBNode()->getPosition().z();
444 selectionMaximum = selectedJunctions.front()->getNBNode()->getPosition().z();
446 selectionMinimum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
447 selectionMaximum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
450 double selectionAverage = 0;
454 for (
const auto& junction : selectedJunctions) {
456 const double z = junction->getNBNode()->getPosition().z();
458 if (z < selectionMinimum) {
459 selectionMinimum = z;
462 if (z > selectionMaximum) {
463 selectionMaximum = z;
466 selectionAverage += z;
471 for (
const auto& edge : selectedEdges) {
473 const PositionVector innerGeometry = edge->getNBEdge()->getInnerGeometry();
475 for (
const auto& geometryPoint : innerGeometry) {
477 if (geometryPoint.z() < selectionMinimum) {
478 selectionMinimum = geometryPoint.z();
481 if (geometryPoint.z() > selectionMaximum) {
482 selectionMaximum = geometryPoint.z();
485 selectionAverage += geometryPoint.z();
492 const double z = edge->getNBEdge()->getGeometry().front().z();
494 if (z < selectionMinimum) {
495 selectionMinimum = z;
498 if (z > selectionMaximum) {
499 selectionMaximum = z;
502 selectionAverage += z;
509 const double z = edge->getNBEdge()->getGeometry().back().z();
511 if (z < selectionMinimum) {
512 selectionMinimum = z;
515 if (z > selectionMaximum) {
516 selectionMaximum = z;
519 selectionAverage += z;
525 selectionAverage = (100 * selectionAverage) / (
double)numPoints;
527 selectionAverage = floor(selectionAverage);
528 selectionAverage *= 0.01;
530 const std::string labelStr =
531 TL(
"- Num geometry points: ") +
toString(numPoints) +
"\n" +
532 TL(
"- Selection minimum Z: ") +
toString(selectionMinimum) +
"\n" +
533 TL(
"- Selection maximum Z: ") +
toString(selectionMaximum) +
"\n" +
534 TL(
"- Selection average Z: ") +
toString(selectionAverage);
536 myInfoLabel->setText(labelStr.c_str());
546 myMoveFrameParent(moveFrameParent) {
561 TL(
"Shift shape geometry"),
"",
TL(
"Shift shape geometry orthogonally to driving direction for all selected shapes"),
586 return onCmdShiftShapeGeometry(
nullptr, 0,
nullptr);
593 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
595 const double shiftValueX = GNEAttributeCarrier::parse<double>(myShiftValueXTextField->getText().text());
596 const double shiftValueY = GNEAttributeCarrier::parse<double>(myShiftValueYTextField->getText().text());
597 const Position shiftValue(shiftValueX, shiftValueY);
599 const auto selectedShapes = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedShapes();
600 std::vector<GNEAdditional*> polygons, POIs;
601 for (
const auto& shape : selectedShapes) {
603 polygons.push_back(shape);
605 POIs.push_back(shape);
609 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::POLY,
"shift shape geometries");
611 for (
const auto& polygon : polygons) {
615 shape.
add(shiftValue);
620 for (
const auto&
POI : POIs) {
626 position.
add(shiftValue);
632 myMoveFrameParent->getViewNet()->getUndoList()->end();
708 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
714 if (selectedEdges.size() > 0) {
FXDEFMAP(GNEMoveFrame::NetworkModeOptions) NetworkModeOptionsMap[]
@ 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 GUIDesignLabel(justify)
#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
~CommonModeOptions()
destructor
bool getAllowChangeLane() const
allow change lane
~DemandModeOptions()
destructor
FXCheckButton * myLeaveStopPersonsConnected
checkbox for enable/disable leave stopPersons connected
bool getLeaveStopPersonsConnected() const
check if leave stopPersonConnected is enabled
DemandModeOptions(GNEMoveFrame *moveFrameParent)
constructor
void hideDemandModeOptions()
hide DemandModeOptions
void showDemandModeOptions()
show DemandModeOptions
void hideNetworkModeOptions()
hide NetworkModeOptions
FXCheckButton * myForceDrawGeometryPoints
checkbox for force darwi geometry points
FXCheckButton * myMoveWholePolygons
checkbox for enable/disable move whole polygons
long onCmdChangeOption(FXObject *, FXSelector, void *)
void showNetworkModeOptions()
show NetworkModeOptions
NetworkModeOptions(GNEMoveFrame *moveFrameParent)
FOX-declaration.
bool getMoveWholePolygons() const
move whole polygons
bool getForceDrawGeometryPoints() const
force draw geometry points
~NetworkModeOptions()
destructor
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
DemandModeOptions * myDemandModeOptions
modul for DemandMode Options
NetworkModeOptions * getNetworkModeOptions() const
get network mode options
void hide()
hide prohibition frame
~GNEMoveFrame()
Destructor.
ShiftEdgeSelectedGeometry * myShiftEdgeSelectedGeometry
modul for shift edge selected geometry
GNEMoveFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
DemandModeOptions * getDemandModeOptions() const
get demand mode options
NetworkModeOptions * myNetworkModeOptions
modul for NetworkMode Options
Information * myInformation
modul for show information
CommonModeOptions * myCommonModeOptions
modul for CommonMode Options
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
CommonModeOptions * getCommonModeOptions() const
get common mode options
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)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
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
static const RGBColor ORANGE
static const RGBColor CYAN
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network