68 myAllowChangeLanes->setCheck(FALSE);
71 myMergeGeometryPoints->setCheck(TRUE);
80 return (myAllowChangeLanes->getCheck() == TRUE);
86 return (myMergeGeometryPoints->getCheck() == TRUE);
95 myMoveFrameParent(moveFrameParent) {
120 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
122 return (myMoveWholePolygons->getCheck() == TRUE);
134 myMoveFrameParent(moveFrameParent) {
159 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
161 return (myLeaveStopPersonsConnected->getCheck() == TRUE);
173 myMoveFrameParent(moveFrameParent) {
181 myApplyZValue =
new FXButton(
getCollapsableFrame(), (
TL(
"Apply shift value") + std::string(
"\t\t") +
TL(
"Shift edge geometry orthogonally to driving direction for all selected edges")).c_str(),
192 myShiftValueTextField->enable();
193 myApplyZValue->enable();
200 myShiftValueTextField->disable();
201 myApplyZValue->disable();
208 return onCmdShiftEdgeGeometry(
nullptr, 0,
nullptr);
215 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
217 const double shiftValue = GNEAttributeCarrier::parse<double>(myShiftValueTextField->getText().text());
219 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
221 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::EDGE,
"shift edge geometries");
223 for (
const auto& edge : selectedEdges) {
229 const Position shapeStart = edgeShape.front();
230 const Position shapeEnd = edgeShape.back();
233 edgeShape.pop_back();
235 if (edgeShape.size() > 0) {
243 myMoveFrameParent->getViewNet()->getUndoList()->end();
253 myMoveFrameParent(moveFrameParent) {
281 myZValueTextField->enable();
282 myAbsoluteValue->enable();
283 myRelativeValue->enable();
284 myApplyButton->enable();
293 myZValueTextField->disable();
294 myAbsoluteValue->disable();
295 myRelativeValue->disable();
296 myApplyButton->disable();
308 if (obj == myAbsoluteValue) {
309 myAbsoluteValue->setCheck(
true);
310 myRelativeValue->setCheck(
false);
312 myAbsoluteValue->setCheck(
false);
313 myRelativeValue->setCheck(
true);
322 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
324 const double zValue = GNEAttributeCarrier::parse<double>(myZValueTextField->getText().text());
326 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
328 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
330 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODEMOVE,
"change Z values in selection");
332 for (
const auto& junction : selectedJunctions) {
333 if (junction->getNBNode()->hasCustomShape()) {
337 for (
auto& shapePos : junctionShape) {
338 if (myAbsoluteValue->getCheck() == TRUE) {
339 shapePos.setz(zValue);
348 Position junctionPos = junction->getNBNode()->getPosition();
350 if (myAbsoluteValue->getCheck() == TRUE) {
351 junctionPos.
setz(zValue);
359 for (
const auto& edge : selectedEdges) {
363 Position shapeStart = edge->getNBEdge()->getGeometry().front();
364 Position shapeEnd = edge->getNBEdge()->getGeometry().back();
366 for (
auto& shapePos : edgeShape) {
367 if (myAbsoluteValue->getCheck() == TRUE) {
368 shapePos.
setz(zValue);
370 shapePos.add(
Position(0, 0, zValue));
374 if (myAbsoluteValue->getCheck() == TRUE) {
375 shapeStart.
setz(zValue);
376 shapeEnd.
setz(zValue);
382 if (edgeShape.size() > 0) {
387 (shapeStart.
distanceSquaredTo2D(edge->getFromJunction()->getNBNode()->getPosition()) < 2)) {
396 myMoveFrameParent->getViewNet()->getUndoList()->end();
406 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
408 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
410 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
412 double selectionMinimum = 0;
413 double selectionMaximun = 0;
415 if (selectedJunctions.size() > 0) {
416 selectionMinimum = selectedJunctions.front()->getNBNode()->getPosition().z();
417 selectionMaximun = selectedJunctions.front()->getNBNode()->getPosition().z();
419 selectionMinimum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
420 selectionMaximun = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
423 double selectionAverage = 0;
427 for (
const auto& junction : selectedJunctions) {
429 const double z = junction->getNBNode()->getPosition().z();
431 if (z < selectionMinimum) {
432 selectionMinimum = z;
435 if (z > selectionMaximun) {
436 selectionMaximun = z;
439 selectionAverage += z;
444 for (
const auto& edge : selectedEdges) {
446 const PositionVector innenGeometry = edge->getNBEdge()->getInnerGeometry();
448 for (
const auto& geometryPoint : innenGeometry) {
450 if (geometryPoint.z() < selectionMinimum) {
451 selectionMinimum = geometryPoint.z();
454 if (geometryPoint.z() > selectionMaximun) {
455 selectionMaximun = geometryPoint.z();
458 selectionAverage += geometryPoint.z();
465 const double z = edge->getNBEdge()->getGeometry().front().z();
467 if (z < selectionMinimum) {
468 selectionMinimum = z;
471 if (z > selectionMaximun) {
472 selectionMaximun = z;
475 selectionAverage += z;
482 const double z = edge->getNBEdge()->getGeometry().back().z();
484 if (z < selectionMinimum) {
485 selectionMinimum = z;
488 if (z > selectionMaximun) {
489 selectionMaximun = z;
492 selectionAverage += z;
498 selectionAverage = (100 * selectionAverage) / (
double)numPoints;
500 selectionAverage = floor(selectionAverage);
501 selectionAverage *= 0.01;
503 const std::string labelStr =
504 "- Num geometry points: " +
toString(numPoints) +
"\n" +
505 "- Selection minimum Z: " +
toString(selectionMinimum) +
"\n" +
506 "- Selection maximum Z: " +
toString(selectionMaximun) +
"\n" +
507 "- Selection average Z: " +
toString(selectionAverage);
509 myInfoLabel->setText(labelStr.c_str());
519 myMoveFrameParent(moveFrameParent) {
534 (
TL(
"Shift shape geometry") + std::string(
"\t\t") +
TL(
"Shift shape geometry orthogonally to driving direction for all selected shapes")).c_str(),
559 return onCmdShiftShapeGeometry(
nullptr, 0,
nullptr);
566 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
568 const double shiftValueX = GNEAttributeCarrier::parse<double>(myShiftValueXTextField->getText().text());
569 const double shiftValueY = GNEAttributeCarrier::parse<double>(myShiftValueYTextField->getText().text());
570 const Position shiftValue(shiftValueX, shiftValueY);
572 const auto selectedShapes = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedShapes();
573 std::vector<GNEAdditional*> polygons, POIs;
574 for (
const auto& shape : selectedShapes) {
576 polygons.push_back(shape);
578 POIs.push_back(shape);
582 myMoveFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::POLY,
"shift shape geometries");
584 for (
const auto& polygon : polygons) {
588 shape.
add(shiftValue);
593 for (
const auto&
POI : POIs) {
599 position.
add(shiftValue);
605 myMoveFrameParent->getViewNet()->getUndoList()->end();
633 GNEFrame(viewParent, viewNet,
"Move") {
681 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
687 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
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 * 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
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
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
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 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 ammount
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