67 myAllowChangeLanes->setCheck(FALSE);
76 return (myAllowChangeLanes->getCheck() == TRUE);
85 myMoveFrameParent(moveFrameParent) {
110 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
112 return (myMoveWholePolygons->getCheck() == TRUE);
124 myMoveFrameParent(moveFrameParent) {
149 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
151 return (myLeaveStopPersonsConnected->getCheck() == TRUE);
163 myMoveFrameParent(moveFrameParent) {
182 myShiftValueTextField->enable();
183 myApplyZValue->enable();
190 myShiftValueTextField->disable();
191 myApplyZValue->disable();
198 return onCmdShiftEdgeGeometry(
nullptr, 0,
nullptr);
205 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
207 const double shiftValue = GNEAttributeCarrier::parse<double>(myShiftValueTextField->getText().text());
209 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
211 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::EDGE,
"shift edge geometries");
213 for (
const auto& edge : selectedEdges) {
219 const Position shapeStart = edgeShape.front();
220 const Position shapeEnd = edgeShape.back();
223 edgeShape.pop_back();
225 if (edgeShape.size() > 0) {
233 myMoveFrameParent->getViewNet()->getUndoList()->end();
243 myMoveFrameParent(moveFrameParent) {
271 myZValueTextField->enable();
272 myAbsoluteValue->enable();
273 myRelativeValue->enable();
274 myApplyButton->enable();
283 myZValueTextField->disable();
284 myAbsoluteValue->disable();
285 myRelativeValue->disable();
286 myApplyButton->disable();
293 return onCmdApplyZ(
nullptr, 0,
nullptr);
299 if (obj == myAbsoluteValue) {
300 myAbsoluteValue->setCheck(
true);
301 myRelativeValue->setCheck(
false);
303 myAbsoluteValue->setCheck(
false);
304 myRelativeValue->setCheck(
true);
313 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
315 const double zValue = GNEAttributeCarrier::parse<double>(myZValueTextField->getText().text());
317 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
319 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
321 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODEMOVE,
"change Z values in selection");
323 for (
const auto& junction : selectedJunctions) {
324 if (junction->getNBNode()->hasCustomShape()) {
328 for (
auto& shapePos : junctionShape) {
329 if (myAbsoluteValue->getCheck() == TRUE) {
330 shapePos.setz(zValue);
339 Position junctionPos = junction->getNBNode()->getPosition();
341 if (myAbsoluteValue->getCheck() == TRUE) {
342 junctionPos.
setz(zValue);
350 for (
const auto& edge : selectedEdges) {
354 Position shapeStart = edge->getNBEdge()->getGeometry().front();
355 Position shapeEnd = edge->getNBEdge()->getGeometry().back();
357 for (
auto& shapePos : edgeShape) {
358 if (myAbsoluteValue->getCheck() == TRUE) {
359 shapePos.
setz(zValue);
361 shapePos.add(
Position(0, 0, zValue));
365 if (myAbsoluteValue->getCheck() == TRUE) {
366 shapeStart.
setz(zValue);
367 shapeEnd.
setz(zValue);
373 if (edgeShape.size() > 0) {
378 (shapeStart.
distanceSquaredTo2D(edge->getFromJunction()->getNBNode()->getPosition()) < 2)) {
387 myMoveFrameParent->getViewNet()->getUndoList()->end();
397 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
399 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
401 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
403 double selectionMinimum = 0;
404 double selectionMaximun = 0;
406 if (selectedJunctions.size() > 0) {
407 selectionMinimum = selectedJunctions.front()->getNBNode()->getPosition().z();
408 selectionMaximun = selectedJunctions.front()->getNBNode()->getPosition().z();
410 selectionMinimum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
411 selectionMaximun = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
414 double selectionAverage = 0;
418 for (
const auto& junction : selectedJunctions) {
420 const double z = junction->getNBNode()->getPosition().z();
422 if (z < selectionMinimum) {
423 selectionMinimum = z;
426 if (z > selectionMaximun) {
427 selectionMaximun = z;
430 selectionAverage += z;
435 for (
const auto& edge : selectedEdges) {
437 const PositionVector innenGeometry = edge->getNBEdge()->getInnerGeometry();
439 for (
const auto& geometryPoint : innenGeometry) {
441 if (geometryPoint.z() < selectionMinimum) {
442 selectionMinimum = geometryPoint.z();
445 if (geometryPoint.z() > selectionMaximun) {
446 selectionMaximun = geometryPoint.z();
449 selectionAverage += geometryPoint.z();
456 const double z = edge->getNBEdge()->getGeometry().front().z();
458 if (z < selectionMinimum) {
459 selectionMinimum = z;
462 if (z > selectionMaximun) {
463 selectionMaximun = z;
466 selectionAverage += z;
473 const double z = edge->getNBEdge()->getGeometry().back().z();
475 if (z < selectionMinimum) {
476 selectionMinimum = z;
479 if (z > selectionMaximun) {
480 selectionMaximun = z;
483 selectionAverage += z;
489 selectionAverage = (100 * selectionAverage) / (
double)numPoints;
491 selectionAverage = floor(selectionAverage);
492 selectionAverage *= 0.01;
494 const std::string labelStr =
495 "- Num geometry points: " +
toString(numPoints) +
"\n" +
496 "- Selection minimum Z: " +
toString(selectionMinimum) +
"\n" +
497 "- Selection maximum Z: " +
toString(selectionMaximun) +
"\n" +
498 "- Selection average Z: " +
toString(selectionAverage);
500 myInfoLabel->setText(labelStr.c_str());
510 myMoveFrameParent(moveFrameParent) {
525 "Shift shape geometry\t\tShift shape geometry orthogonally to driving direction for all selected shapes",
550 return onCmdShiftShapeGeometry(
nullptr, 0,
nullptr);
557 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
559 const double shiftValueX = GNEAttributeCarrier::parse<double>(myShiftValueXTextField->getText().text());
560 const double shiftValueY = GNEAttributeCarrier::parse<double>(myShiftValueYTextField->getText().text());
561 const Position shiftValue(shiftValueX, shiftValueY);
563 const auto selectedShapes = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedShapes();
564 std::vector<GNEShape*> polygons, POIs;
565 for (
const auto& shape : selectedShapes) {
567 polygons.push_back(shape);
569 POIs.push_back(shape);
574 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::POLY,
"shift shape geometries");
576 for (
const auto& polygon : polygons) {
580 shape.
add(shiftValue);
585 for (
const auto&
POI : POIs) {
591 position.
add(shiftValue);
597 myMoveFrameParent->getViewNet()->getUndoList()->end();
606 GNEFrame(horizontalFrameParent, viewNet,
"Move") {
652 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
658 if (selectedEdges.size() > 0) {
FXDEFMAP(GNEMoveFrame::ChangeZInSelection) ChangeZInSelectionMap[]
@ 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
aply element
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignRadioButton
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame (real)
#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)
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
GNEViewNet * myViewNet
View Net.
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
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.
~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 * myMoveWholePolygons
checkbox for enable/disable move whole polygons
void showNetworkModeOptions()
show NetworkModeOptions
NetworkModeOptions(GNEMoveFrame *moveFrameParent)
constructor
bool getMoveWholePolygons() const
move whole polygons
~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
GNEMoveFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
void show()
show prohibition frame
ChangeZInSelection * myChangeZInSelection
modul for change Z in selection
void processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderGrippedCursor)
handle processClick and set the relative colouring
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
DemandModeOptions * getDemandModeOptions() const
get demand mode options
NetworkModeOptions * myNetworkModeOptions
modul for NetworkMode Options
CommonModeOptions * myCommonModeOptions
modul for CommonMode Options
ShiftShapeGeometry * myShiftShapeGeometry
modul for shift shape geometry
CommonModeOptions * getCommonModeOptions() const
get common mode options
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
std::vector< GNEShape * > getSelectedShapes()
get selected shapes
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
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
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 ammount
void pop_front()
pop first Position
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network