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-2025 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
21#include <netedit/GNENet.h>
23#include <netedit/GNEUndoList.h>
28
29// ===========================================================================
30// FOX callback mapping
31// ===========================================================================
32
36
42
47
52
53// Object implementation
54FXIMPLEMENT(GNEMoveFrame::NetworkMoveOptions, MFXGroupBoxModule, NetworkMoveOptionsMap, ARRAYNUMBER(NetworkMoveOptionsMap))
55FXIMPLEMENT(GNEMoveFrame::ChangeZInSelection, MFXGroupBoxModule, ChangeZInSelectionMap, ARRAYNUMBER(ChangeZInSelectionMap))
56FXIMPLEMENT(GNEMoveFrame::ShiftEdgeSelectedGeometry, MFXGroupBoxModule, ShiftEdgeGeometryMap, ARRAYNUMBER(ShiftEdgeGeometryMap))
57FXIMPLEMENT(GNEMoveFrame::ShiftShapeGeometry, MFXGroupBoxModule, ShiftShapeGeometryMap, ARRAYNUMBER(ShiftShapeGeometryMap))
58
59// ===========================================================================
60// method definitions
61// ===========================================================================
62
63// ---------------------------------------------------------------------------
64// GNEMoveFrame::CommonMoveOptions - methods
65// ---------------------------------------------------------------------------
66
68 MFXGroupBoxModule(moveFrameParent, TL("Common move options")) {
69 // Create checkbox for enable/disable allow change lanes
70 myAllowChangeLanes = new FXCheckButton(getCollapsableFrame(), TL("Allow change lanes"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
71 myAllowChangeLanes->setCheck(FALSE);
72 // Create checkbox for enable/disable merge geometry points
73 myMergeGeometryPoints = new FXCheckButton(getCollapsableFrame(), TL("Merge geometry points"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
74 myMergeGeometryPoints->setCheck(TRUE);
75}
76
77
79
80
81bool
83 return (myAllowChangeLanes->getCheck() == TRUE);
84}
85
86
87bool
89 return (myMergeGeometryPoints->getCheck() == TRUE);
90}
91
92// ---------------------------------------------------------------------------
93// GNEMoveFrame::NetworkMoveOptions - methods
94// ---------------------------------------------------------------------------
95
97 MFXGroupBoxModule(moveFrameParent, TL("Network move options")),
98 myMoveFrameParent(moveFrameParent) {
99 // Create checkbox for enable/disable move whole polygons
100 myMoveWholePolygons = new FXCheckButton(getCollapsableFrame(), TL("Move whole polygons"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
101 myMoveWholePolygons->setCheck(FALSE);
102 // Create checkbox for force draw end geometry points
103 myForceDrawGeometryPoints = new FXCheckButton(getCollapsableFrame(), TL("Force draw geom. points"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
104 myForceDrawGeometryPoints->setCheck(FALSE);
105 // Create checkbox for force draw end geometry points
106 myMoveOnlyJunctionCenter = new FXCheckButton(getCollapsableFrame(), TL("Move only junction center"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
107 myMoveOnlyJunctionCenter->setCheck(FALSE);
108}
109
110
112
113
114void
119
120
121void
125
126
127bool
129 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
130 (myMoveFrameParent->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE)) {
131 return (myMoveWholePolygons->getCheck() == TRUE);
132 } else {
133 return false;
134 }
135}
136
137
138bool
140 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
141 (myMoveFrameParent->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE)) {
142 return (myForceDrawGeometryPoints->getCheck() == TRUE);
143 } else {
144 return false;
145 }
146}
147
148
149bool
151 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
152 (myMoveFrameParent->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE)) {
153 return (myMoveOnlyJunctionCenter->getCheck() == TRUE);
154 } else {
155 return false;
156 }
157}
158
159
160long
162 // just update viewNet
163 myMoveFrameParent->getViewNet()->update();
164 return 1;
165}
166
167// ---------------------------------------------------------------------------
168// GNEMoveFrame::DemandMoveOptions - methods
169// ---------------------------------------------------------------------------
170
172 MFXGroupBoxModule(moveFrameParent, TL("Demand move options")),
173 myMoveFrameParent(moveFrameParent) {
174 // Create checkbox for enable/disable move whole polygons
175 myLeaveStopPersonsConnected = new FXCheckButton(getCollapsableFrame(), TL("Leave stopPersons connected"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
176 myLeaveStopPersonsConnected->setCheck(FALSE);
177}
178
179
181
182
183void
188
189
190void
194
195
196bool
198 if (myMoveFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
199 (myMoveFrameParent->getViewNet()->getEditModes().demandEditMode == DemandEditMode::DEMAND_MOVE)) {
200 return (myLeaveStopPersonsConnected->getCheck() == TRUE);
201 } else {
202 return false;
203 }
204}
205
206// ---------------------------------------------------------------------------
207// GNEMoveFrame::ShiftEdgeSelectedGeometry - methods
208// ---------------------------------------------------------------------------
209
211 MFXGroupBoxModule(moveFrameParent, TL("Shift selected edges geometry")),
212 myMoveFrameParent(moveFrameParent) {
213 // create horizontal frame
214 FXHorizontalFrame* myZValueFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
215 // create elements for Z value
216 new FXLabel(myZValueFrame, TL("Shift value"), 0, GUIDesignLabelThickedFixed(100));
217 myShiftValueTextField = new FXTextField(myZValueFrame, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
218 myShiftValueTextField->setText("0");
219 // create apply button
220 myApplyZValue = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Apply shift value"), "", TL("Shift edge geometry orthogonally to driving direction for all selected edges"),
222}
223
224
226
227
228void
230 // enable elements
231 myShiftValueTextField->enable();
232 myApplyZValue->enable();
233}
234
235
236void
238 // enable elements
239 myShiftValueTextField->disable();
240 myApplyZValue->disable();
241}
242
243
244long
246 // just call onCmdShiftEdgeGeometry
247 return onCmdShiftEdgeGeometry(nullptr, 0, nullptr);
248}
249
250
251long
253 // get undo-list
254 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
255 // get value
256 const double shiftValue = GNEAttributeCarrier::parse<double>(myShiftValueTextField->getText().text());
257 // get selected edges
258 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
259 // begin undo-redo
260 myMoveFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::EDGE, "shift edge geometries");
261 // iterate over edges
262 for (const auto& edge : selectedEdges) {
263 // get edge geometry
264 PositionVector edgeShape = edge->getNBEdge()->getGeometry();
265 // shift edge geometry
266 edgeShape.move2side(shiftValue);
267 // get first and last position
268 const Position shapeStart = edgeShape.front();
269 const Position shapeEnd = edgeShape.back();
270 // set inner geometry
271 edgeShape.pop_front();
272 edgeShape.pop_back();
273 // set new shape again
274 if (edgeShape.size() > 0) {
275 edge->setAttribute(SUMO_ATTR_SHAPE, toString(edgeShape), undoList);
276 }
277 // set new start and end positions
278 edge->setAttribute(GNE_ATTR_SHAPE_START, toString(shapeStart), undoList);
279 edge->setAttribute(GNE_ATTR_SHAPE_END, toString(shapeEnd), undoList);
280 }
281 // end undo-redo
282 myMoveFrameParent->getViewNet()->getUndoList()->end();
283 return 1;
284}
285
286// ---------------------------------------------------------------------------
287// GNEMoveFrame::ChangeZInSelection - methods
288// ---------------------------------------------------------------------------
289
291 MFXGroupBoxModule(moveFrameParent, TL("Change Z in selection")),
292 myMoveFrameParent(moveFrameParent) {
293 // create horizontal frame
294 FXHorizontalFrame* myZValueFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
295 // create elements for Z value
296 new FXLabel(myZValueFrame, TL("Z value"), 0, GUIDesignLabelThickedFixed(100));
297 myZValueTextField = new FXTextField(myZValueFrame, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
298 myZValueTextField->setText("0");
299 // Create all options buttons
300 myAbsoluteValue = GUIDesigns::buildFXRadioButton(getCollapsableFrame(), TL("Absolute value"), "", TL("Set Z value as absolute"),
302 myRelativeValue = GUIDesigns::buildFXRadioButton(getCollapsableFrame(), TL("Relative value"), "", TL("Set Z value as relative"),
304 // create apply button
305 myApplyButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Apply Z value"), "", TL("Apply Z value to all selected junctions"),
307 // set absolute value as default
308 myAbsoluteValue->setCheck(true);
309 // set info label
311}
312
313
315
316
317void
319 // enable elements
320 myZValueTextField->enable();
321 myAbsoluteValue->enable();
322 myRelativeValue->enable();
323 myApplyButton->enable();
324 // update info label
325 updateInfoLabel();
326}
327
328
329void
331 // disable elements
332 myZValueTextField->disable();
333 myAbsoluteValue->disable();
334 myRelativeValue->disable();
335 myApplyButton->disable();
336}
337
338
339long
340GNEMoveFrame::ChangeZInSelection::onCmdChangeZValue(FXObject* /*obj*/, FXSelector /*sel*/, void*) {
341 return 1;
342}
343
344
345long
346GNEMoveFrame::ChangeZInSelection::onCmdChangeZMode(FXObject* obj, FXSelector, void*) {
347 if (obj == myAbsoluteValue) {
348 myAbsoluteValue->setCheck(true);
349 myRelativeValue->setCheck(false);
350 } else {
351 myAbsoluteValue->setCheck(false);
352 myRelativeValue->setCheck(true);
353 }
354 return 1;
355}
356
357
358long
360 // get undo-list
361 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
362 // get value
363 const double zValue = GNEAttributeCarrier::parse<double>(myZValueTextField->getText().text());
364 // get junctions
365 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
366 // get selected edges
367 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
368 // begin undo-redo
369 myMoveFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::MODEMOVE, "change Z values in selection");
370 // iterate over junctions
371 for (const auto& junction : selectedJunctions) {
372 if (junction->getNBNode()->hasCustomShape()) {
373 // get junction position
374 PositionVector junctionShape = junction->getNBNode()->getShape();
375 // modify z Value depending of absolute/relative
376 for (auto& shapePos : junctionShape) {
377 if (myAbsoluteValue->getCheck() == TRUE) {
378 shapePos.setz(zValue);
379 } else {
380 shapePos.add(Position(0, 0, zValue));
381 }
382 }
383 // set new position again
384 junction->setAttribute(SUMO_ATTR_SHAPE, toString(junctionShape), undoList);
385 }
386 // get junction position
387 Position junctionPos = junction->getNBNode()->getPosition();
388 // modify z Value depending of absolute/relative
389 if (myAbsoluteValue->getCheck() == TRUE) {
390 junctionPos.setz(zValue);
391 } else {
392 junctionPos.add(Position(0, 0, zValue));
393 }
394 // set new position again
395 junction->setAttribute(SUMO_ATTR_POSITION, toString(junctionPos), undoList);
396 }
397 // iterate over edges
398 for (const auto& edge : selectedEdges) {
399 // get edge geometry
400 PositionVector edgeShape = edge->getNBEdge()->getInnerGeometry();
401 // get first and last position
402 Position shapeStart = edge->getNBEdge()->getGeometry().front();
403 Position shapeEnd = edge->getNBEdge()->getGeometry().back();
404 // modify z Value depending of absolute/relative
405 for (auto& shapePos : edgeShape) {
406 if (myAbsoluteValue->getCheck() == TRUE) {
407 shapePos.setz(zValue);
408 } else {
409 shapePos.add(Position(0, 0, zValue));
410 }
411 }
412 // modify begin an end positions
413 if (myAbsoluteValue->getCheck() == TRUE) {
414 shapeStart.setz(zValue);
415 shapeEnd.setz(zValue);
416 } else {
417 shapeStart.add(Position(0, 0, zValue));
418 shapeEnd.add(Position(0, 0, zValue));
419 }
420 // set new shape again
421 if (edgeShape.size() > 0) {
422 edge->setAttribute(SUMO_ATTR_SHAPE, toString(edgeShape), undoList);
423 }
424 // set new start and end positions
425 if ((edge->getAttribute(GNE_ATTR_SHAPE_START).size() > 0) &&
426 (shapeStart.distanceSquaredTo2D(edge->getFromJunction()->getNBNode()->getPosition()) < 2)) {
427 edge->setAttribute(GNE_ATTR_SHAPE_START, toString(shapeStart), undoList);
428 }
429 if ((edge->getAttribute(GNE_ATTR_SHAPE_END).size() > 0) &&
430 (shapeEnd.distanceSquaredTo2D(edge->getToJunction()->getNBNode()->getPosition()) < 2)) {
431 edge->setAttribute(GNE_ATTR_SHAPE_END, toString(shapeEnd), undoList);
432 }
433 }
434 // end undo-redo
435 myMoveFrameParent->getViewNet()->getUndoList()->end();
436 // update info label
437 updateInfoLabel();
438 return 1;
439}
440
441
442void
444 // get junctions
445 const auto selectedJunctions = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
446 // get selected edges
447 const auto selectedEdges = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
448 // check if there is edges or junctions
449 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
450 // declare minimum and maximum
451 double selectionMinimum = 0;
452 double selectionMaximum = 0;
453 // set first values
454 if (selectedJunctions.size() > 0) {
455 selectionMinimum = selectedJunctions.front()->getNBNode()->getPosition().z();
456 selectionMaximum = selectedJunctions.front()->getNBNode()->getPosition().z();
457 } else {
458 selectionMinimum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
459 selectionMaximum = selectedEdges.front()->getNBEdge()->getGeometry().front().z();
460 }
461 // declare average
462 double selectionAverage = 0;
463 // declare numPoints
464 int numPoints = 0;
465 // iterate over junctions
466 for (const auto& junction : selectedJunctions) {
467 // get z
468 const double z = junction->getNBNode()->getPosition().z();
469 // check min
470 if (z < selectionMinimum) {
471 selectionMinimum = z;
472 }
473 // check max
474 if (z > selectionMaximum) {
475 selectionMaximum = z;
476 }
477 // update average
478 selectionAverage += z;
479 // update numPoints
480 numPoints++;
481 }
482 // iterate over edges
483 for (const auto& edge : selectedEdges) {
484 // get inner geometry
485 const PositionVector innerGeometry = edge->getNBEdge()->getInnerGeometry();
486 // iterate over innerGeometry
487 for (const auto& geometryPoint : innerGeometry) {
488 // check min
489 if (geometryPoint.z() < selectionMinimum) {
490 selectionMinimum = geometryPoint.z();
491 }
492 // check max
493 if (geometryPoint.z() > selectionMaximum) {
494 selectionMaximum = geometryPoint.z();
495 }
496 // update average
497 selectionAverage += geometryPoint.z();
498 // update numPoints
499 numPoints++;
500 }
501 // check shape start
502 if (edge->getAttribute(GNE_ATTR_SHAPE_START).size() > 0) {
503 // get z
504 const double z = edge->getNBEdge()->getGeometry().front().z();
505 // check min
506 if (z < selectionMinimum) {
507 selectionMinimum = z;
508 }
509 // check max
510 if (z > selectionMaximum) {
511 selectionMaximum = z;
512 }
513 // update average
514 selectionAverage += z;
515 // update numPoints
516 numPoints++;
517 }
518 // check shape end
519 if (edge->getAttribute(GNE_ATTR_SHAPE_END).size() > 0) {
520 // get z
521 const double z = edge->getNBEdge()->getGeometry().back().z();
522 // check min
523 if (z < selectionMinimum) {
524 selectionMinimum = z;
525 }
526 // check max
527 if (z > selectionMaximum) {
528 selectionMaximum = z;
529 }
530 // update average
531 selectionAverage += z;
532 // update numPoints
533 numPoints++;
534 }
535 }
536 // update average
537 selectionAverage = (100 * selectionAverage) / (double)numPoints;
538 // floor average
539 selectionAverage = floor(selectionAverage);
540 selectionAverage *= 0.01;
541 // set label string
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);
547 // update info label
548 myInfoLabel->setText(labelStr.c_str());
549 }
550}
551
552// ---------------------------------------------------------------------------
553// GNEMoveFrame::ShiftShapeGeometry - methods
554// ---------------------------------------------------------------------------
555
557 MFXGroupBoxModule(moveFrameParent, TL("Shift shape geometry")),
558 myMoveFrameParent(moveFrameParent) {
559 // create horizontal frame
560 FXHorizontalFrame* horizontalFrameX = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
561 // create elements for Z value
562 new FXLabel(horizontalFrameX, "X value", 0, GUIDesignLabelThickedFixed(100));
563 myShiftValueXTextField = new FXTextField(horizontalFrameX, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
564 myShiftValueXTextField->setText("0");
565 // create horizontal frame
566 FXHorizontalFrame* horizontalFrameY = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
567 // create elements for Z value
568 new FXLabel(horizontalFrameY, "Y value", 0, GUIDesignLabelThickedFixed(100));
569 myShiftValueYTextField = new FXTextField(horizontalFrameY, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
570 myShiftValueYTextField->setText("0");
571 // create apply button
573 TL("Shift shape geometry"), "", TL("Shift shape geometry orthogonally to driving direction for all selected shapes"),
575}
576
577
579
580
581void
586
587
588void
593
594
595long
597 // just call onCmdShiftShapeGeometry
598 return onCmdShiftShapeGeometry(nullptr, 0, nullptr);
599}
600
601
602long
604 // get undo-list
605 auto undoList = myMoveFrameParent->getViewNet()->getUndoList();
606 // get values
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);
610 // get selected polygons and POIs
611 const auto selectedShapes = myMoveFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedShapes();
612 std::vector<GNEAdditional*> polygons, POIs;
613 for (const auto& shape : selectedShapes) {
614 if (shape->getTagProperty()->getTag() == SUMO_TAG_POLY) {
615 polygons.push_back(shape);
616 } else {
617 POIs.push_back(shape);
618 }
619 }
620 // begin undo-redo
621 myMoveFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::POLY, "shift shape geometries");
622 // iterate over shapes
623 for (const auto& polygon : polygons) {
624 // get shape geometry
625 PositionVector shape = GNEAttributeCarrier::parse<PositionVector>(polygon->getAttribute(SUMO_ATTR_SHAPE));
626 // shift shape geometry
627 shape.add(shiftValue);
628 // set new shape again
629 polygon->setAttribute(SUMO_ATTR_SHAPE, toString(shape), undoList);
630 }
631 // iterate over POIs
632 for (const auto& POI : POIs) {
633 // currently only for POIs (not for POILanes or POIGEOs
634 if (POI->getTagProperty()->hasAttribute(SUMO_ATTR_POSITION)) {
635 // get shape geometry
636 Position position = GNEAttributeCarrier::parse<Position>(POI->getAttribute(SUMO_ATTR_POSITION));
637 // shift shape geometry
638 position.add(shiftValue);
639 // set new shape again
640 POI->setAttribute(SUMO_ATTR_POSITION, toString(position), undoList);
641 }
642 }
643 // end undo-redo
644 myMoveFrameParent->getViewNet()->getUndoList()->end();
645 return 1;
646}
647
648// ---------------------------------------------------------------------------
649// GNEMoveFrame::Information - methods
650// ---------------------------------------------------------------------------
651
653 MFXGroupBoxModule(moveFrameParent, TL("Information")) {
654 // create info label
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.");
658}
659
660
662
663// ---------------------------------------------------------------------------
664// GNEMoveFrame - methods
665// ---------------------------------------------------------------------------
666
668 GNEFrame(viewParent, viewNet, TL("Move")) {
669 // create common mode options
671 // create network mode options
673 // create demand mode options
675 // create shift edge geometry module
677 // create change z selection
679 // create information label
680 myInformation = new Information(this);
681 // create shift shape geometry module
683}
684
685
687
688
689void
690GNEMoveFrame::processClick(const Position& /*clickedPosition*/,
691 const GNEViewNetHelper::ViewObjectsSelector& /*viewObjects*/,
692 const GNEViewNetHelper::ViewObjectsSelector& /*objectsUnderGrippedCursor*/) {
693 // currently unused
694}
695
696
697void
699 // show network options frames
702 } else {
704 }
705 // show demand options frames
708 } else {
710 }
711 // get selected junctions
712 const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
713 // get selected edges
714 const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
715 // check if there are junctions and edge selected
716 if ((selectedJunctions.size() > 0) || (selectedEdges.size() > 0)) {
718 } else {
720 }
721 // check if there are edges selected
722 if (selectedEdges.size() > 0) {
724 } else {
726 }
727 // check if there are shapes selected
728 if (myViewNet->getNet()->getAttributeCarriers()->getSelectedShapes().size() > 0) {
730 } else {
732 }
733 // show
735 // recalc and update
736 recalc();
737 update();
738}
739
740
741void
743 // hide frame
745}
746
747
752
753
758
759
764
765/****************************************************************************/
FXDEFMAP(GNEMoveFrame::NetworkMoveOptions) NetworkMoveOptionsMap[]
@ NETWORK_MOVE
mode for moving network elements
@ DEMAND_MOVE
mode for moving demand elements
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:993
@ MID_CHOOSEN_OPERATION
set type of selection
Definition GUIAppEnum.h:599
@ MID_GNE_APPLY
apply element
#define GUIDesignButton
Definition GUIDesigns.h:100
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:430
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:92
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:194
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
Definition GUIDesigns.h:77
#define GUIDesignRadioButton
Definition GUIDesigns.h:231
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:254
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition GUIDesigns.h:281
#define TL(string)
Definition MsgHandler.h:304
@ 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:121
virtual void show()
show Frame
Definition GNEFrame.cpp:117
virtual void hide()
hide Frame
Definition GNEFrame.cpp:126
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
void hideDemandMoveOptions()
hide DemandMoveOptions
bool getLeaveStopPersonsConnected() const
check if leave stopPersonConnected is enabled
FXCheckButton * myLeaveStopPersonsConnected
checkbox for enable/disable leave stopPersons connected
DemandMoveOptions(GNEMoveFrame *moveFrameParent)
constructor
void showDemandMoveOptions()
show DemandMoveOptions
Information(GNEMoveFrame *moveFrameParent)
constructor
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(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
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
Definition GNENet.cpp:144
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.
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:278
void add(const Position &pos)
Adds the given position to this one.
Definition Position.h:129
void setz(double z)
set position z
Definition Position.h:77
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
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network