Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEMoveFrame.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// The Widget for move elements
19/****************************************************************************/
20#include <config.h>
21
23#include <netedit/GNEViewNet.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNENet.h>
29
30// ===========================================================================
31// FOX callback mapping
32// ===========================================================================
33
37
43
48
53
54
55// Object implementation
56FXIMPLEMENT(GNEMoveFrame::NetworkModeOptions, MFXGroupBoxModule, NetworkModeOptionsMap, ARRAYNUMBER(NetworkModeOptionsMap))
57FXIMPLEMENT(GNEMoveFrame::ChangeZInSelection, MFXGroupBoxModule, ChangeZInSelectionMap, ARRAYNUMBER(ChangeZInSelectionMap))
58FXIMPLEMENT(GNEMoveFrame::ShiftEdgeSelectedGeometry, MFXGroupBoxModule, ShiftEdgeGeometryMap, ARRAYNUMBER(ShiftEdgeGeometryMap))
59FXIMPLEMENT(GNEMoveFrame::ShiftShapeGeometry, MFXGroupBoxModule, ShiftShapeGeometryMap, ARRAYNUMBER(ShiftShapeGeometryMap))
60
61// ===========================================================================
62// method definitions
63// ===========================================================================
64
65// ---------------------------------------------------------------------------
66// GNEMoveFrame::CommonModeOptions - methods
67// ---------------------------------------------------------------------------
68
70 MFXGroupBoxModule(moveFrameParent, TL("Common move options")) {
71 // Create checkbox for enable/disable allow change lanes
72 myAllowChangeLanes = new FXCheckButton(getCollapsableFrame(), TL("Allow change lanes"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
73 myAllowChangeLanes->setCheck(FALSE);
74 // Create checkbox for enable/disable merge geometry points
75 myMergeGeometryPoints = new FXCheckButton(getCollapsableFrame(), TL("Merge geometry points"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
76 myMergeGeometryPoints->setCheck(TRUE);
77}
78
79
81
82
83bool
85 return (myAllowChangeLanes->getCheck() == TRUE);
86}
87
88
89bool
91 return (myMergeGeometryPoints->getCheck() == TRUE);
92}
93
94// ---------------------------------------------------------------------------
95// GNEMoveFrame::NetworkModeOptions - methods
96// ---------------------------------------------------------------------------
97
99 MFXGroupBoxModule(moveFrameParent, TL("Network move options")),
100 myMoveFrameParent(moveFrameParent) {
101 // Create checkbox for enable/disable move whole polygons
102 myMoveWholePolygons = new FXCheckButton(getCollapsableFrame(), TL("Move whole polygons"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
103 myMoveWholePolygons->setCheck(FALSE);
104 // Create checkbox for force draw end geometry points
105 myForceDrawGeometryPoints = new FXCheckButton(getCollapsableFrame(), TL("Force draw geom. points"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
106 myForceDrawGeometryPoints->setCheck(FALSE);
107}
108
109
111
112
113void
118
119
120void
124
125
126bool
128 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
129 (myMoveFrameParent->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE)) {
130 return (myMoveWholePolygons->getCheck() == TRUE);
131 } else {
132 return false;
133 }
134}
135
136
137bool
139 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
140 (myMoveFrameParent->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE)) {
141 return (myForceDrawGeometryPoints->getCheck() == TRUE);
142 } else {
143 return false;
144 }
145}
146
147
148long
150 // just update viewNet
151 myMoveFrameParent->getViewNet()->update();
152 return 1;
153}
154
155// ---------------------------------------------------------------------------
156// GNEMoveFrame::DemandModeOptions - methods
157// ---------------------------------------------------------------------------
158
160 MFXGroupBoxModule(moveFrameParent, TL("Demand move options")),
161 myMoveFrameParent(moveFrameParent) {
162 // Create checkbox for enable/disable move whole polygons
163 myLeaveStopPersonsConnected = new FXCheckButton(getCollapsableFrame(), TL("Leave stopPersons connected"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
164 myLeaveStopPersonsConnected->setCheck(FALSE);
165}
166
167
169
170
171void
176
177
178void
182
183
184bool
186 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
187 (myMoveFrameParent->getViewNet()->getEditModes().demandEditMode == DemandEditMode::DEMAND_MOVE)) {
188 return (myLeaveStopPersonsConnected->getCheck() == TRUE);
189 } else {
190 return false;
191 }
192}
193
194// ---------------------------------------------------------------------------
195// GNEMoveFrame::ShiftEdgeSelectedGeometry - methods
196// ---------------------------------------------------------------------------
197
199 MFXGroupBoxModule(moveFrameParent, TL("Shift selected edges geometry")),
200 myMoveFrameParent(moveFrameParent) {
201 // create horizontal frame
202 FXHorizontalFrame* myZValueFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
203 // create elements for Z value
204 new FXLabel(myZValueFrame, "Shift value", 0, GUIDesignLabelThickedFixed(100));
205 myShiftValueTextField = new FXTextField(myZValueFrame, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
206 myShiftValueTextField->setText("0");
207 // create apply button
208 myApplyZValue = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Apply shift value"), "", TL("Shift edge geometry orthogonally to driving direction for all selected edges"),
210}
211
212
214
215
216void
218 // enable elements
219 myShiftValueTextField->enable();
220 myApplyZValue->enable();
221}
222
223
224void
226 // enable elements
227 myShiftValueTextField->disable();
228 myApplyZValue->disable();
229}
230
231
232long
234 // just call onCmdShiftEdgeGeometry
235 return onCmdShiftEdgeGeometry(nullptr, 0, nullptr);
236}
237
238
239long
241 // get undo-list
242 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
243 // get value
244 const double shiftValue = GNEAttributeCarrier::parse<double>(myShiftValueTextField->getText().text());
245 // get selected edges
246 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
247 // begin undo-redo
248 myMoveFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::EDGE, "shift edge geometries");
249 // iterate over edges
250 for (const auto& edge : selectedEdges) {
251 // get edge geometry
252 PositionVector edgeShape = edge->getNBEdge()->getGeometry();
253 // shift edge geometry
254 edgeShape.move2side(shiftValue);
255 // get first and last position
256 const Position shapeStart = edgeShape.front();
257 const Position shapeEnd = edgeShape.back();
258 // set inner geometry
259 edgeShape.pop_front();
260 edgeShape.pop_back();
261 // set new shape again
262 if (edgeShape.size() > 0) {
263 edge->setAttribute(SUMO_ATTR_SHAPE, toString(edgeShape), undoList);
264 }
265 // set new start and end positions
266 edge->setAttribute(GNE_ATTR_SHAPE_START, toString(shapeStart), undoList);
267 edge->setAttribute(GNE_ATTR_SHAPE_END, toString(shapeEnd), undoList);
268 }
269 // end undo-redo
270 myMoveFrameParent->getViewNet()->getUndoList()->end();
271 return 1;
272}
273
274// ---------------------------------------------------------------------------
275// GNEMoveFrame::ChangeZInSelection - methods
276// ---------------------------------------------------------------------------
277
279 MFXGroupBoxModule(moveFrameParent, TL("Change Z in selection")),
280 myMoveFrameParent(moveFrameParent) {
281 // create horizontal frame
282 FXHorizontalFrame* myZValueFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
283 // create elements for Z value
284 new FXLabel(myZValueFrame, "Z value", 0, GUIDesignLabelThickedFixed(100));
285 myZValueTextField = new FXTextField(myZValueFrame, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
286 myZValueTextField->setText("0");
287 // Create all options buttons
288 myAbsoluteValue = GUIDesigns::buildFXRadioButton(getCollapsableFrame(), TL("Absolute value"), "", TL("Set Z value as absolute"),
290 myRelativeValue = GUIDesigns::buildFXRadioButton(getCollapsableFrame(), TL("Relative value"), "", TL("Set Z value as relative"),
292 // create apply button
293 myApplyButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Apply Z value"), "", TL("Apply Z value to all selected junctions"),
295 // set absolute value as default
296 myAbsoluteValue->setCheck(true);
297 // set info label
299}
300
301
303
304
305void
307 // enable elements
308 myZValueTextField->enable();
309 myAbsoluteValue->enable();
310 myRelativeValue->enable();
311 myApplyButton->enable();
312 // update info label
313 updateInfoLabel();
314}
315
316
317void
319 // disable elements
320 myZValueTextField->disable();
321 myAbsoluteValue->disable();
322 myRelativeValue->disable();
323 myApplyButton->disable();
324}
325
326
327long
328GNEMoveFrame::ChangeZInSelection::onCmdChangeZValue(FXObject* /*obj*/, FXSelector /*sel*/, void*) {
329 return 1;
330}
331
332
333long
334GNEMoveFrame::ChangeZInSelection::onCmdChangeZMode(FXObject* obj, FXSelector, void*) {
335 if (obj == myAbsoluteValue) {
336 myAbsoluteValue->setCheck(true);
337 myRelativeValue->setCheck(false);
338 } else {
339 myAbsoluteValue->setCheck(false);
340 myRelativeValue->setCheck(true);
341 }
342 return 1;
343}
344
345
346long
348 // get undo-list
349 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
350 // get value
351 const double zValue = GNEAttributeCarrier::parse<double>(myZValueTextField->getText().text());
352 // get junctions
353 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
354 // get selected edges
355 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
356 // begin undo-redo
357 myMoveFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::MODEMOVE, "change Z values in selection");
358 // iterate over junctions
359 for (const auto& junction : selectedJunctions) {
360 if (junction->getNBNode()->hasCustomShape()) {
361 // get junction position
362 PositionVector junctionShape = junction->getNBNode()->getShape();
363 // modify z Value depending of absolute/relative
364 for (auto& shapePos : junctionShape) {
365 if (myAbsoluteValue->getCheck() == TRUE) {
366 shapePos.setz(zValue);
367 } else {
368 shapePos.add(Position(0, 0, zValue));
369 }
370 }
371 // set new position again
372 junction->setAttribute(SUMO_ATTR_SHAPE, toString(junctionShape), undoList);
373 }
374 // get junction position
375 Position junctionPos = junction->getNBNode()->getPosition();
376 // modify z Value depending of absolute/relative
377 if (myAbsoluteValue->getCheck() == TRUE) {
378 junctionPos.setz(zValue);
379 } else {
380 junctionPos.add(Position(0, 0, zValue));
381 }
382 // set new position again
383 junction->setAttribute(SUMO_ATTR_POSITION, toString(junctionPos), undoList);
384 }
385 // iterate over edges
386 for (const auto& edge : selectedEdges) {
387 // get edge geometry
388 PositionVector edgeShape = edge->getNBEdge()->getInnerGeometry();
389 // get first and last position
390 Position shapeStart = edge->getNBEdge()->getGeometry().front();
391 Position shapeEnd = edge->getNBEdge()->getGeometry().back();
392 // modify z Value depending of absolute/relative
393 for (auto& shapePos : edgeShape) {
394 if (myAbsoluteValue->getCheck() == TRUE) {
395 shapePos.setz(zValue);
396 } else {
397 shapePos.add(Position(0, 0, zValue));
398 }
399 }
400 // modify begin an end positions
401 if (myAbsoluteValue->getCheck() == TRUE) {
402 shapeStart.setz(zValue);
403 shapeEnd.setz(zValue);
404 } else {
405 shapeStart.add(Position(0, 0, zValue));
406 shapeEnd.add(Position(0, 0, zValue));
407 }
408 // set new shape again
409 if (edgeShape.size() > 0) {
410 edge->setAttribute(SUMO_ATTR_SHAPE, toString(edgeShape), undoList);
411 }
412 // set new start and end positions
413 if ((edge->getAttribute(GNE_ATTR_SHAPE_START).size() > 0) &&
414 (shapeStart.distanceSquaredTo2D(edge->getFromJunction()->getNBNode()->getPosition()) < 2)) {
415 edge->setAttribute(GNE_ATTR_SHAPE_START, toString(shapeStart), undoList);
416 }
417 if ((edge->getAttribute(GNE_ATTR_SHAPE_END).size() > 0) &&
418 (shapeEnd.distanceSquaredTo2D(edge->getToJunction()->getNBNode()->getPosition()) < 2)) {
419 edge->setAttribute(GNE_ATTR_SHAPE_END, toString(shapeEnd), undoList);
420 }
421 }
422 // end undo-redo
423 myMoveFrameParent->getViewNet()->getUndoList()->end();
424 // update info label
425 updateInfoLabel();
426 return 1;
427}
428
429
430void
432 // get junctions
433 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
434 // get selected edges
435 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
436 // check if there is edges or junctions
437 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
438 // declare minimum and maximum
439 double selectionMinimum = 0;
440 double selectionMaximum = 0;
441 // set first values
442 if (selectedJunctions.size() > 0) {
443 selectionMinimum = selectedJunctions.front()->getNBNode()->getPosition().z();
444 selectionMaximum = selectedJunctions.front()->getNBNode()->getPosition().z();
445 } else {
446 selectionMinimum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
447 selectionMaximum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
448 }
449 // declare average
450 double selectionAverage = 0;
451 // declare numPoints
452 int numPoints = 0;
453 // iterate over junctions
454 for (const auto& junction : selectedJunctions) {
455 // get z
456 const double z = junction->getNBNode()->getPosition().z();
457 // check min
458 if (z < selectionMinimum) {
459 selectionMinimum = z;
460 }
461 // check max
462 if (z > selectionMaximum) {
463 selectionMaximum = z;
464 }
465 // update average
466 selectionAverage += z;
467 // update numPoints
468 numPoints++;
469 }
470 // iterate over edges
471 for (const auto& edge : selectedEdges) {
472 // get inner geometry
473 const PositionVector innerGeometry = edge->getNBEdge()->getInnerGeometry();
474 // iterate over innerGeometry
475 for (const auto& geometryPoint : innerGeometry) {
476 // check min
477 if (geometryPoint.z() < selectionMinimum) {
478 selectionMinimum = geometryPoint.z();
479 }
480 // check max
481 if (geometryPoint.z() > selectionMaximum) {
482 selectionMaximum = geometryPoint.z();
483 }
484 // update average
485 selectionAverage += geometryPoint.z();
486 // update numPoints
487 numPoints++;
488 }
489 // check shape start
490 if (edge->getAttribute(GNE_ATTR_SHAPE_START).size() > 0) {
491 // get z
492 const double z = edge->getNBEdge()->getGeometry().front().z();
493 // check min
494 if (z < selectionMinimum) {
495 selectionMinimum = z;
496 }
497 // check max
498 if (z > selectionMaximum) {
499 selectionMaximum = z;
500 }
501 // update average
502 selectionAverage += z;
503 // update numPoints
504 numPoints++;
505 }
506 // check shape end
507 if (edge->getAttribute(GNE_ATTR_SHAPE_END).size() > 0) {
508 // get z
509 const double z = edge->getNBEdge()->getGeometry().back().z();
510 // check min
511 if (z < selectionMinimum) {
512 selectionMinimum = z;
513 }
514 // check max
515 if (z > selectionMaximum) {
516 selectionMaximum = z;
517 }
518 // update average
519 selectionAverage += z;
520 // update numPoints
521 numPoints++;
522 }
523 }
524 // update average
525 selectionAverage = (100 * selectionAverage) / (double)numPoints;
526 // floor average
527 selectionAverage = floor(selectionAverage);
528 selectionAverage *= 0.01;
529 // set label string
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);
535 // update info label
536 myInfoLabel->setText(labelStr.c_str());
537 }
538}
539
540// ---------------------------------------------------------------------------
541// GNEMoveFrame::ShiftShapeGeometry - methods
542// ---------------------------------------------------------------------------
543
545 MFXGroupBoxModule(moveFrameParent, TL("Shift shape geometry")),
546 myMoveFrameParent(moveFrameParent) {
547 // create horizontal frame
548 FXHorizontalFrame* horizontalFrameX = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
549 // create elements for Z value
550 new FXLabel(horizontalFrameX, "X value", 0, GUIDesignLabelThickedFixed(100));
551 myShiftValueXTextField = new FXTextField(horizontalFrameX, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
552 myShiftValueXTextField->setText("0");
553 // create horizontal frame
554 FXHorizontalFrame* horizontalFrameY = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
555 // create elements for Z value
556 new FXLabel(horizontalFrameY, "Y value", 0, GUIDesignLabelThickedFixed(100));
557 myShiftValueYTextField = new FXTextField(horizontalFrameY, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
558 myShiftValueYTextField->setText("0");
559 // create apply button
561 TL("Shift shape geometry"), "", TL("Shift shape geometry orthogonally to driving direction for all selected shapes"),
563}
564
565
567
568
569void
574
575
576void
581
582
583long
585 // just call onCmdShiftShapeGeometry
586 return onCmdShiftShapeGeometry(nullptr, 0, nullptr);
587}
588
589
590long
592 // get undo-list
593 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
594 // get values
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);
598 // get selected polygons and POIs
599 const auto selectedShapes = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedShapes();
600 std::vector<GNEAdditional*> polygons, POIs;
601 for (const auto& shape : selectedShapes) {
602 if (shape->getTagProperty().getTag() == SUMO_TAG_POLY) {
603 polygons.push_back(shape);
604 } else {
605 POIs.push_back(shape);
606 }
607 }
608 // begin undo-redo
609 myMoveFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::POLY, "shift shape geometries");
610 // iterate over shapes
611 for (const auto& polygon : polygons) {
612 // get shape geometry
613 PositionVector shape = GNEAttributeCarrier::parse<PositionVector>(polygon->getAttribute(SUMO_ATTR_SHAPE));
614 // shift shape geometry
615 shape.add(shiftValue);
616 // set new shape again
617 polygon->setAttribute(SUMO_ATTR_SHAPE, toString(shape), undoList);
618 }
619 // iterate over POIs
620 for (const auto& POI : POIs) {
621 // currently only for POIs (not for POILanes or POIGEOs
622 if (POI->getTagProperty().hasAttribute(SUMO_ATTR_POSITION)) {
623 // get shape geometry
624 Position position = GNEAttributeCarrier::parse<Position>(POI->getAttribute(SUMO_ATTR_POSITION));
625 // shift shape geometry
626 position.add(shiftValue);
627 // set new shape again
628 POI->setAttribute(SUMO_ATTR_POSITION, toString(position), undoList);
629 }
630 }
631 // end undo-redo
632 myMoveFrameParent->getViewNet()->getUndoList()->end();
633 return 1;
634}
635
636// ---------------------------------------------------------------------------
637// GNEMoveFrame::Information - methods
638// ---------------------------------------------------------------------------
639
641 MFXGroupBoxModule(moveFrameParent, TL("Information")) {
642 // create info label
643 new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Click over edge to create or edit geometry point.") + std::string("\n- ") + TL("Shift+click over edge to edit start or end geometry point.")).c_str(), 0, GUIDesignLabelFrameInformation);
644 // create source label
645 FXLabel* sourceLabel = new FXLabel(getCollapsableFrame(), TL("-Move geometry point"), 0, GUIDesignLabel(JUSTIFY_LEFT));
646 sourceLabel->setBackColor(MFXUtils::getFXColor(RGBColor::ORANGE));
647 // create target label
648 FXLabel* targetLabel = new FXLabel(getCollapsableFrame(), TL("-Merge geometry point"), 0, GUIDesignLabel(JUSTIFY_LEFT));
649 targetLabel->setBackColor(MFXUtils::getFXColor(RGBColor::CYAN));
650}
651
652
654
655// ---------------------------------------------------------------------------
656// GNEMoveFrame - methods
657// ---------------------------------------------------------------------------
658
660 GNEFrame(viewParent, viewNet, TL("Move")) {
661 // create common mode options
663 // create network mode options
665 // create demand mode options
667 // create shift edge geometry module
669 // create change z selection
671 // create information label
672 myInformation = new Information(this);
673 // create shift shape geometry module
675}
676
677
679
680
681void
682GNEMoveFrame::processClick(const Position& /*clickedPosition*/,
683 const GNEViewNetHelper::ViewObjectsSelector& /*viewObjects*/,
684 const GNEViewNetHelper::ViewObjectsSelector& /*objectsUnderGrippedCursor*/) {
685 // currently unused
686}
687
688
689void
691 // show network options frames
694 } else {
696 }
697 // show demand options frames
700 } else {
702 }
703 // get selected junctions
704 const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
705 // get selected edges
706 const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
707 // check if there are junctions and edge selected
708 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
710 } else {
712 }
713 // check if there are edges selected
714 if (selectedEdges.size() > 0) {
716 } else {
718 }
719 // check if there are shapes selected
720 if (myViewNet->getNet()->getAttributeCarriers()->getSelectedShapes().size() > 0) {
722 } else {
724 }
725 // show
727 // recalc and update
728 recalc();
729 update();
730}
731
732
733void
735 // hide frame
737}
738
739
744
745
750
751
756
757/****************************************************************************/
FXDEFMAP(GNEMoveFrame::NetworkModeOptions) NetworkModeOptionsMap[]
@ NETWORK_MOVE
mode for moving network elements
@ DEMAND_MOVE
mode for moving demand elements
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:939
@ MID_CHOOSEN_OPERATION
set type of selection
Definition GUIAppEnum.h:597
@ MID_GNE_APPLY
apply element
Definition GUIAppEnum.h:949
#define GUIDesignButton
Definition GUIDesigns.h:88
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:405
#define GUIDesignLabel(justify)
Definition GUIDesigns.h:249
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:80
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:198
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
Definition GUIDesigns.h:68
#define GUIDesignRadioButton
Definition GUIDesigns.h:235
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:258
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition GUIDesigns.h:285
#define TL(string)
Definition MsgHandler.h:315
@ 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
@ SUMO_ATTR_POSITION
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
GNEViewNet * myViewNet
FOX need this.
Definition GNEFrame.h:117
virtual void show()
show Frame
Definition GNEFrame.cpp:115
virtual void hide()
hide Frame
Definition GNEFrame.cpp:124
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
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
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
Information(GNEMoveFrame *moveFrameParent)
constructor
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
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(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.
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
Definition GNENet.cpp:125
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
Definition MFXUtils.cpp:112
C++ TraCI client API implementation.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition Position.h:281
void add(const Position &pos)
Adds the given position to this one.
Definition Position.h:132
void setz(double z)
set position z
Definition Position.h:80
A list of positions.
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
Definition RGBColor.h:191
static const RGBColor CYAN
Definition RGBColor.h:189
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network