SUMO - Simulation of Urban MObility
GNEPolygonFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The Widget for add polygons
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
23 #include <iostream>
32 #include <utils/gui/div/GLHelper.h>
34 #include <netedit/GNEViewNet.h>
35 #include <netedit/GNEViewParent.h>
36 #include <netedit/GNENet.h>
37 #include <netedit/GNEUndoList.h>
42 
43 #include "GNEPolygonFrame.h"
44 
45 // ===========================================================================
46 // FOX callback mapping
47 // ===========================================================================
48 
49 FXDEFMAP(GNEPolygonFrame::ShapeSelector) ShapeSelectorMap[] = {
51 };
52 
53 FXDEFMAP(GNEPolygonFrame::ShapeAttributeSingle) ShapeAttributeSingleMap[] = {
57 };
58 
59 FXDEFMAP(GNEPolygonFrame::ShapeAttributes) ShapeAttributesMap[] = {
61 };
62 
63 FXDEFMAP(GNEPolygonFrame::NeteditAttributes) NeteditAttributesMap[] = {
66 };
67 
68 FXDEFMAP(GNEPolygonFrame::DrawingMode) DrawingModeMap[] = {
72 };
73 
74 // Object implementation
75 FXIMPLEMENT(GNEPolygonFrame::ShapeSelector, FXGroupBox, ShapeSelectorMap, ARRAYNUMBER(ShapeSelectorMap))
76 FXIMPLEMENT(GNEPolygonFrame::ShapeAttributeSingle, FXHorizontalFrame, ShapeAttributeSingleMap, ARRAYNUMBER(ShapeAttributeSingleMap))
77 FXIMPLEMENT(GNEPolygonFrame::ShapeAttributes, FXGroupBox, ShapeAttributesMap, ARRAYNUMBER(ShapeAttributesMap))
78 FXIMPLEMENT(GNEPolygonFrame::NeteditAttributes, FXGroupBox, NeteditAttributesMap, ARRAYNUMBER(NeteditAttributesMap))
79 FXIMPLEMENT(GNEPolygonFrame::DrawingMode, FXGroupBox, DrawingModeMap, ARRAYNUMBER(DrawingModeMap))
80 
81 
82 // ---------------------------------------------------------------------------
83 // GNEPolygonFrame::ShapeSelector - methods
84 // ---------------------------------------------------------------------------
85 
87  FXGroupBox(shapeFrameParent->myContentFrame, "Shape element", GUIDesignGroupBoxFrame),
88  myShapeFrameParent(shapeFrameParent),
89  myCurrentShapeType(SUMO_TAG_NOTHING) {
90 
91  // Create FXListBox in myGroupBoxForMyShapeMatchBox
92  myShapeMatchBox = new FXComboBox(this, GUIDesignComboBoxNCol, this, MID_GNE_SET_TYPE, GUIDesignComboBox);
93 
94  // Add options to myShapeMatchBox
95  auto listOfTags = GNEAttributeCarrier::allowedShapeTags(false);
96  for (auto i : listOfTags) {
97  myShapeMatchBox->appendItem(toString(i).c_str());
98  }
99 
100  // Set visible items
101  myShapeMatchBox->setNumVisible((int)myShapeMatchBox->getNumItems());
102 
103  // set busstop as default additional
104  myShapeMatchBox->setCurrentItem(2);
105 
106  // ShapeSelector is always shown
107  show();
108 }
109 
110 
112 
113 
116  return myCurrentShapeType;
117 }
118 
119 
120 void
122  // Set new actualShapeType
123  myCurrentShapeType = actualShapeType;
124  // Check that current shape type is valid
126  // Clear internal attributes
128  // Iterate over attributes of myActualShapeType
130  if (!i.second.isUnique()) {
132  }
133  }
134  // if there are parmeters, show and Recalc groupBox
137  }
138  // show netedit attributes
141  } else {
143  }
144  // show drawing mode
147  } else {
149  }
150  } else {
151  // hide all widgets
155  }
156 }
157 
158 
159 long
161  // Check if value of myShapeMatchBox correspond of an allowed shape tags
162  auto listOfTags = GNEAttributeCarrier::allowedShapeTags(false);
163  for (auto i : listOfTags) {
164  if (toString(i) == myShapeMatchBox->getText().text()) {
165  myShapeMatchBox->setTextColor(FXRGB(0, 0, 0));
166  setCurrentShape(i);
167  // Write Warning in console if we're in testing mode
168  WRITE_DEBUG(("Selected shape '" + myShapeMatchBox->getText() + "' in ShapeSelector").text());
169  return 1;
170  }
171  }
172  // if shape name isn't correct, hidde all
174  myShapeMatchBox->setTextColor(FXRGB(255, 0, 0));
175  // Write Warning in console if we're in testing mode
176  WRITE_DEBUG("Selected invalid shape in ShapeSelector");
177  return 1;
178 }
179 
180 // ---------------------------------------------------------------------------
181 // GNEPolygonFrame::ShapeAttributeSingle - methods
182 // ---------------------------------------------------------------------------
183 
185  FXHorizontalFrame(shapeAttributesParent, GUIDesignAuxiliarHorizontalFrame),
186  myShapeAttributesParent(shapeAttributesParent),
187  myShapeAttr(SUMO_ATTR_NOTHING) {
188  // Create visual elements
189  myLabel = new FXLabel(this, "name", 0, GUIDesignLabelAttribute);
190  myColorEditor = new FXButton(this, "ColorButton", 0, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonAttribute);
194  myBoolCheckButton = new FXCheckButton(this, "Disabled", this, MID_GNE_SET_ATTRIBUTE_BOOL, GUIDesignCheckButtonAttribute);
195  // Hide elements
196  hideParameter();
197 }
198 
199 
201 
202 
203 void
205  myShapeAttr = shapeAttr;
206  myInvalidValue = "";
207  // Retrieve attribute properties
208  const auto& attributeProperties = GNEAttributeCarrier::getTagProperties(myShapeAttributesParent->getPolygonFrameParent()->myShapeSelector->getCurrentShapeType()).getAttribute(shapeAttr);
209  // show label or button for edit colors
210  if (attributeProperties.isColor()) {
211  myColorEditor->setTextColor(FXRGB(0, 0, 0));
212  myColorEditor->setText(toString(shapeAttr).c_str());
213  myColorEditor->show();
214  } else {
215  myLabel->setText(toString(myShapeAttr).c_str());
216  myLabel->show();
217  }
218  if (attributeProperties.isInt()) {
219  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
220  myTextFieldInt->setText(value.c_str());
221  myTextFieldInt->show();
222  } else if (attributeProperties.isFloat()) {
223  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
224  myTextFieldReal->setText(value.c_str());
225  myTextFieldReal->show();
226  } else if (attributeProperties.isBool()) {
227  if (GNEAttributeCarrier::parse<bool>(value)) {
228  myBoolCheckButton->setCheck(true);
229  myBoolCheckButton->setText("true");
230  } else {
231  myBoolCheckButton->setCheck(false);
232  myBoolCheckButton->setText("false");
233  }
234  myBoolCheckButton->show();
235  } else {
236  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
237  myTextFieldStrings->setText(value.c_str());
238  myTextFieldStrings->show();
239  }
240  show();
241 }
242 
243 
244 void
247  myLabel->hide();
248  myTextFieldInt->hide();
249  myTextFieldReal->hide();
250  myTextFieldStrings->hide();
251  myBoolCheckButton->hide();
252  myColorEditor->hide();
253  hide();
254 }
255 
256 
259  return myShapeAttr;
260 }
261 
262 
263 std::string
265  // obtain attribute property (only for improve code legibility)
267  if (attrValue.isBool()) {
268  return (myBoolCheckButton->getCheck() == 1) ? "true" : "false";
269  } else if (attrValue.isInt()) {
270  return myTextFieldInt->getText().text();
271  } else if (attrValue.isFloat() || attrValue.isTime()) {
272  return myTextFieldReal->getText().text();
273  } else {
274  return myTextFieldStrings->getText().text();
275  }
276 }
277 
278 
279 const std::string&
281  return myInvalidValue;
282 }
283 
284 
288 }
289 
290 
291 long
293  // We assume that current value is valid
294  myInvalidValue = "";
295  // get attribute Values (only for improve efficiency)
297  // Check if format of current value of myTextField is correct
298  if (attrValues.isInt()) {
299  if (GNEAttributeCarrier::canParse<int>(myTextFieldInt->getText().text())) {
300  // convert string to int
301  int intValue = GNEAttributeCarrier::parse<int>(myTextFieldInt->getText().text());
302  // Check if int value must be positive
303  if (attrValues.isPositive() && (intValue < 0)) {
304  myInvalidValue = "'" + toString(myShapeAttr) + "' cannot be negative";
305  }
306  } else {
307  myInvalidValue = "'" + toString(myShapeAttr) + "' doesn't have a valid 'int' format";
308  }
309  } else if (attrValues.isTime()) {
310  // time attributes work as positive doubles
311  if (GNEAttributeCarrier::canParse<double>(myTextFieldReal->getText().text())) {
312  // convert string to double
313  double doubleValue = GNEAttributeCarrier::parse<double>(myTextFieldReal->getText().text());
314  // Check if parsed value is negative
315  if (doubleValue < 0) {
316  myInvalidValue = "'" + toString(myShapeAttr) + "' cannot be negative";
317  }
318  } else {
319  myInvalidValue = "'" + toString(myShapeAttr) + "' doesn't have a valid 'time' format";
320  }
321  } else if (attrValues.isFloat()) {
322  if (GNEAttributeCarrier::canParse<double>(myTextFieldReal->getText().text())) {
323  // convert string to double
324  double doubleValue = GNEAttributeCarrier::parse<double>(myTextFieldReal->getText().text());
325  // Check if double value must be positive
326  if (attrValues.isPositive() && (doubleValue < 0)) {
327  myInvalidValue = "'" + toString(myShapeAttr) + "' cannot be negative";
328  // check if double value is a probability
329  } else if (attrValues.isProbability() && ((doubleValue < 0) || doubleValue > 1)) {
330  myInvalidValue = "'" + toString(myShapeAttr) + "' takes only values between 0 and 1";
331  }
332  } else {
333  myInvalidValue = "'" + toString(myShapeAttr) + "' doesn't have a valid 'float' format";
334  }
335  } else if (attrValues.isColor()) {
336  // check if filename format is valid
337  if (GNEAttributeCarrier::canParse<RGBColor>(myTextFieldStrings->getText().text()) == false) {
338  myInvalidValue = "'" + toString(myShapeAttr) + "' doesn't have a valid 'RBGColor' format";
339  }
340  } else if (attrValues.isFilename()) {
341  std::string file = myTextFieldStrings->getText().text();
342  // check if filename format is valid
343  if (SUMOXMLDefinitions::isValidFilename(file) == false) {
344  myInvalidValue = "input contains invalid characters for a filename";
345  } else if (myShapeAttr == SUMO_ATTR_IMGFILE) {
346  if (!file.empty()) {
347  // only load value if file isn't empty
348  if (GUITexturesHelper::getTextureID(file) == -1) {
349  myInvalidValue = "doesn't exist image '" + file + "'";
350  }
351  }
352  }
353  }
354  // change color of text field depending of myCurrentValueValid
355  if (myInvalidValue.size() == 0) {
356  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
357  myTextFieldInt->killFocus();
358  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
359  myTextFieldReal->killFocus();
360  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
361  myTextFieldStrings->killFocus();
362  } else {
363  // IF value of TextField isn't valid, change their color to Red
364  myTextFieldInt->setTextColor(FXRGB(255, 0, 0));
365  myTextFieldReal->setTextColor(FXRGB(255, 0, 0));
366  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
367  }
368  // Update aditional frame
369  update();
370  return 1;
371 }
372 
373 
374 long
376  if (myBoolCheckButton->getCheck()) {
377  myBoolCheckButton->setText("true");
378  } else {
379  myBoolCheckButton->setText("false");
380  }
381  return 0;
382 }
383 
384 
386  // create FXColorDialog
387  FXColorDialog colordialog(this, tr("Color Dialog"));
388  colordialog.setTarget(this);
389  // If previous attribute wasn't correct, set black as default color
390  if (GNEAttributeCarrier::canParse<RGBColor>(myTextFieldStrings->getText().text())) {
391  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::parseColor(myTextFieldStrings->getText().text())));
392  } else {
394  }
395  // execute dialog to get a new color
396  if (colordialog.execute()) {
397  myTextFieldStrings->setText(toString(MFXUtils::getRGBColor(colordialog.getRGBA())).c_str());
398  onCmdSetAttribute(0, 0, 0);
399  }
400  return 0;
401 }
402 
403 // ---------------------------------------------------------------------------
404 // GNEPolygonFrame::NeteditAttributes- methods
405 // ---------------------------------------------------------------------------
406 
408  FXGroupBox(polygonFrameParent->myContentFrame, "Internal attributes", GUIDesignGroupBoxFrame),
409  myPolygonFrameParent(polygonFrameParent) {
410 
411  // Create single parameters
412  for (int i = 0; i < GNEAttributeCarrier::getHigherNumberOfAttributes(); i++) {
414  }
415 
416  // Create help button
417  new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
418 }
419 
420 
422 }
423 
424 
425 void
427  // Hide all fields
428  for (int i = 0; i < (int)myVectorOfsingleShapeParameter.size(); i++) {
429  myVectorOfsingleShapeParameter.at(i)->hideParameter();
430  }
431 }
432 
433 
434 void
436  // get current tag Properties
437  const auto& attrProperties = GNEAttributeCarrier::getTagProperties(myPolygonFrameParent->getShapeSelector()->getCurrentShapeType()).getAttribute(ShapeAttributeSingle);
438  myVectorOfsingleShapeParameter.at(attrProperties.getPositionListed())->showParameter(ShapeAttributeSingle, attrProperties.getDefaultValue());
439 }
440 
441 
442 void
444  recalc();
445  show();
446 }
447 
448 
449 void
451  hide();
452 }
453 
454 
455 std::map<SumoXMLAttr, std::string>
457  std::map<SumoXMLAttr, std::string> values;
458  // get standard parameters
459  for (int i = 0; i < (int)myVectorOfsingleShapeParameter.size(); i++) {
460  if (myVectorOfsingleShapeParameter.at(i)->getAttr() != SUMO_ATTR_NOTHING) {
461  values[myVectorOfsingleShapeParameter.at(i)->getAttr()] = myVectorOfsingleShapeParameter.at(i)->getValue();
462  }
463  }
464  return values;
465 }
466 
467 
468 void
470  std::string errorMessage;
471  // iterate over standar parameters
473  if (errorMessage.empty()) {
474  // Return string with the error if at least one of the parameter isn't valid
475  std::string attributeValue = myVectorOfsingleShapeParameter.at(i.second.getPositionListed())->isAttributeValid();
476  if (attributeValue.size() != 0) {
477  errorMessage = attributeValue;
478  }
479  }
480  }
481  // show warning box if input parameters aren't invalid
482  if (extra.size() == 0) {
483  errorMessage = "Invalid input parameter of " + toString(myPolygonFrameParent->getShapeSelector()->getCurrentShapeType()) + ": " + errorMessage;
484  } else {
485  errorMessage = "Invalid input parameter of " + toString(myPolygonFrameParent->getShapeSelector()->getCurrentShapeType()) + ": " + extra;
486  }
487 
488  // set message in status bar
490  // Write Warning in console if we're in testing mode
491  WRITE_DEBUG(errorMessage);
492 }
493 
494 
495 bool
497  // iterate over standar parameters
499  // Return false if error message of attriuve isn't empty
500  if (myVectorOfsingleShapeParameter.at(i.second.getPositionListed())->isAttributeValid().size() != 0) {
501  return false;
502  }
503  }
504  return true;
505 }
506 
507 
508 int
510  return (1);
511 }
512 
513 
516  return myPolygonFrameParent;
517 }
518 
519 
520 long
521 GNEPolygonFrame::ShapeAttributes::onCmdHelp(FXObject*, FXSelector, void*) {
522  // open Help attributes dialog
524  return 1;
525 }
526 
527 // ---------------------------------------------------------------------------
528 // GNEPolygonFrame::NeteditAttributes - methods
529 // ---------------------------------------------------------------------------
530 
532  FXGroupBox(polygonFrameParent->myContentFrame, "Netedit attributes", GUIDesignGroupBoxFrame) {
533  // Create Frame for block movement label and checkBox (By default disabled)
534  FXHorizontalFrame* blockMovement = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
535  myBlockMovementLabel = new FXLabel(blockMovement, "block move", 0, GUIDesignLabelAttribute);
536  myBlockMovementCheckButton = new FXCheckButton(blockMovement, "false", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute);
537  myBlockMovementCheckButton->setCheck(false);
538  // Create Frame for block shape label and checkBox (By default disabled)
539  myBlockShapeFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
540  myBlockShapeLabel = new FXLabel(myBlockShapeFrame, "block shape", 0, GUIDesignLabelAttribute);
542  // Create Frame for block close polygon and checkBox (By default disabled)
543  myClosePolygonFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
544  myClosePolygonLabel = new FXLabel(myClosePolygonFrame, "Close shape", 0, GUIDesignLabelAttribute);
546  myBlockShapeCheckButton->setCheck(false);
547  // Create help button
548  new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
549 }
550 
551 
553 
554 
555 void
557  // show block and closing sahpe depending of shapeEditing
558  if (shapeEditing) {
559  myBlockShapeFrame->show();
560  myClosePolygonFrame->show();
561  } else {
562  myBlockShapeFrame->hide();
563  myClosePolygonFrame->hide();
564  }
565  FXGroupBox::show();
566 }
567 
568 
569 void
571  FXGroupBox::hide();
572 }
573 
574 
575 bool
577  return myBlockMovementCheckButton->getCheck() == 1 ? true : false;
578 }
579 
580 
581 bool
583  return myBlockShapeCheckButton->getCheck() == 1 ? true : false;
584 }
585 
586 
587 bool
589  return myClosePolygonCheckButton->getCheck() == 1 ? true : false;
590 }
591 
592 
593 long
595  if (obj == myBlockMovementCheckButton) {
596  if (myBlockMovementCheckButton->getCheck()) {
597  myBlockMovementCheckButton->setText("true");
598  } else {
599  myBlockMovementCheckButton->setText("false");
600  }
601  } else if (obj == myBlockShapeCheckButton) {
602  if (myBlockShapeCheckButton->getCheck()) {
603  myBlockShapeCheckButton->setText("true");
604  } else {
605  myBlockShapeCheckButton->setText("false");
606  }
607  } else if (obj == myClosePolygonCheckButton) {
608  if (myClosePolygonCheckButton->getCheck()) {
609  myClosePolygonCheckButton->setText("true");
610  } else {
611  myClosePolygonCheckButton->setText("false");
612  }
613  }
614  return 1;
615 }
616 
617 
618 long
619 GNEPolygonFrame::NeteditAttributes::onCmdHelp(FXObject*, FXSelector, void*) {
620  // Create dialog box
621  FXDialogBox* polygonNeteditAttributesHelpDialog = new FXDialogBox(this, "Netedit Parameters Help", GUIDesignDialogBox);
622  polygonNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(ICON_MODEPOLYGON));
623  // Set help text
624  std::ostringstream help;
625  help
626  << "- Block movement: If enabled, the created polygon element will be blocked. i.e. cannot be moved with\n"
627  << " the mouse. This option can be modified inspecting element.\n"
628  << "\n"
629  << "- Block shape: If enabled, the shape of created polygon element will be blocked. i.e. their geometry points\n"
630  << " cannot be edited be moved with the mouse. This option can be modified inspecting element.\n"
631  << "\n"
632  << "- Close shape: If enabled, the created polygon element will be closed. i.e. the last created geometry point\n"
633  << " will be connected with the first geometry point automatically. This option can be modified inspecting element.";
634  // Create label with the help text
635  new FXLabel(polygonNeteditAttributesHelpDialog, help.str().c_str(), 0, GUIDesignLabelFrameInformation);
636  // Create horizontal separator
637  new FXHorizontalSeparator(polygonNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
638  // Create frame for OK Button
639  FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(polygonNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
640  // Create Button Close (And two more horizontal frames to center it)
641  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
642  new FXButton(myHorizontalFrameOKButton, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), polygonNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
643  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
644  // Write Warning in console if we're in testing mode
645  WRITE_DEBUG("Opening NeteditAttributes dialog for tag '");
646  // create Dialog
647  polygonNeteditAttributesHelpDialog->create();
648  // show in the given position
649  polygonNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
650  // refresh APP
651  getApp()->refresh();
652  // open as modal dialog (will block all windows until stop() or stopModal() is called)
653  getApp()->runModalFor(polygonNeteditAttributesHelpDialog);
654  // Write Warning in console if we're in testing mode
655  WRITE_DEBUG("Closing NeteditAttributes dialog for tag '");
656  return 1;
657 }
658 
659 // ---------------------------------------------------------------------------
660 // GNEPolygonFrame::DrawingMode - methods
661 // ---------------------------------------------------------------------------
662 
664  FXGroupBox(polygonFrameParent->myContentFrame, "Drawing", GUIDesignGroupBoxFrame),
665  myPolygonFrameParent(polygonFrameParent) {
666  // create start and stop buttons
667  myStartDrawingButton = new FXButton(this, "Start drawing", 0, this, MID_GNE_POLYGONFRAME_STARTDRAWING, GUIDesignButton);
668  myStopDrawingButton = new FXButton(this, "Stop drawing", 0, this, MID_GNE_POLYGONFRAME_STOPDRAWING, GUIDesignButton);
669  myAbortDrawingButton = new FXButton(this, "Abort drawing", 0, this, MID_GNE_POLYGONFRAME_ABORTDRAWING, GUIDesignButton);
670 
671  // create information label
672  std::ostringstream information;
673  information
674  << "- 'Start drawing' or ENTER\n"
675  << " draws polygon boundary.\n"
676  << "- 'Stop drawing' or ENTER\n"
677  << " creates polygon.\n"
678  << "- 'Abort drawing' or ESC\n"
679  << " removes drawed polygon.";
680  myInformationLabel = new FXLabel(this, information.str().c_str(), 0, GUIDesignLabelFrameInformation);
681  // disable stop and abort functions as init
682  myStopDrawingButton->disable();
683  myAbortDrawingButton->disable();
684 }
685 
686 
688 
689 
691  // abort current drawing before show
692  abortDrawing();
693  // show FXGroupBox
694  FXGroupBox::show();
695 }
696 
697 
699  // abort current drawing before hide
700  abortDrawing();
701  // show FXGroupBox
702  FXGroupBox::hide();
703 }
704 
705 
706 void
708  // Only start drawing if DrawingMode modul is shown
709  if (shown()) {
710  // change buttons
711  myStartDrawingButton->disable();
712  myStopDrawingButton->enable();
713  myAbortDrawingButton->enable();
714  }
715 }
716 
717 
718 void
720  // check if shape has to be closed
723  }
724  // try to build polygon
726  // clear created points
727  myTemporalShapeShape.clear();
728  myPolygonFrameParent->getViewNet()->update();
729  // change buttons
730  myStartDrawingButton->enable();
731  myStopDrawingButton->disable();
732  myAbortDrawingButton->disable();
733  } else {
734  // abort drawing if polygon cannot be created
735  abortDrawing();
736  }
737 }
738 
739 
740 void
742  // clear created points
743  myTemporalShapeShape.clear();
744  myPolygonFrameParent->getViewNet()->update();
745  // change buttons
746  myStartDrawingButton->enable();
747  myStopDrawingButton->disable();
748  myAbortDrawingButton->disable();
749 }
750 
751 
752 void
754  if (myStopDrawingButton->isEnabled()) {
755  myTemporalShapeShape.push_back(P);
756  } else {
757  throw ProcessError("A new point cannot be added if drawing wasn't started");
758  }
759 }
760 
761 
762 void
764  if (myStopDrawingButton->isEnabled()) {
765  if (myTemporalShapeShape.size() > 0) {
766  myTemporalShapeShape.pop_back();
767  }
768  } else {
769  throw ProcessError("Last point cannot be removed if drawing wasn't started");
770  }
771 }
772 
773 
774 const PositionVector&
776  return myTemporalShapeShape;
777 }
778 
779 
780 bool
782  return myStopDrawingButton->isEnabled();
783 }
784 
785 
786 long
787 GNEPolygonFrame::DrawingMode::onCmdStartDrawing(FXObject*, FXSelector, void*) {
788  startDrawing();
789  return 0;
790 }
791 
792 
793 long
794 GNEPolygonFrame::DrawingMode::onCmdStopDrawing(FXObject*, FXSelector, void*) {
795  stopDrawing();
796  return 0;
797 }
798 
799 
800 long
801 GNEPolygonFrame::DrawingMode::onCmdAbortDrawing(FXObject*, FXSelector, void*) {
802  abortDrawing();
803  return 0;
804 }
805 
806 // ===========================================================================
807 // method definitions
808 // ===========================================================================
809 
810 GNEPolygonFrame::GNEPolygonFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
811  GNEFrame(horizontalFrameParent, viewNet, "Shapes") {
812 
813  // Create shape selector
814  myShapeSelector = new ShapeSelector(this);
815 
816  // Create shape parameters
818 
819  // Create Netedit parameter
821 
822  // Create drawing controls
824 
825  // set polygon as default additional
827 }
828 
829 
831 }
832 
833 
835 GNEPolygonFrame::processClick(const Position& clickedPosition, GNELane* lane) {
836  // Declare map to keep values
837  std::map<SumoXMLAttr, std::string> valuesOfElement;
838  // check if current selected shape is valid
840  // obtain POI values
841  valuesOfElement = myShapeAttributes->getAttributesAndValues();
842  // show warning dialogbox and stop if input parameters are invalid
843  if (myShapeAttributes->areValuesValid() == false) {
845  return ADDSHAPE_INVALID;
846  }
847  // generate new ID
849  // obtain position
850  valuesOfElement[SUMO_ATTR_POSITION] = toString(clickedPosition);
851  // obtain block movement value
853  // return ADDSHAPE_SUCCESS if POI was sucesfully created
854  if (addPOI(valuesOfElement)) {
855  return ADDSHAPE_SUCCESS;
856  } else {
857  return ADDSHAPE_INVALID;
858  }
860  // obtain POILane values
861  valuesOfElement = myShapeAttributes->getAttributesAndValues();
862  // show warning dialogbox and stop if input parameters are invalid
863  if (myShapeAttributes->areValuesValid() == false) {
865  return ADDSHAPE_INVALID;
866  }
867  // abort if lane is nullptr
868  if (lane == nullptr) {
869  WRITE_WARNING(toString(SUMO_TAG_POILANE) + " can be only placed over lanes");
870  return ADDSHAPE_INVALID;
871  }
872  // generate new ID
874  // obtain Lane
875  valuesOfElement[SUMO_ATTR_LANE] = lane->getID();
876  // obtain position over lane
877  valuesOfElement[SUMO_ATTR_POSITION] = toString(lane->getShape().nearest_offset_to_point2D(clickedPosition));
878  // obtain block movement value
880  // return ADDSHAPE_SUCCESS if POI was sucesfully created
881  if (addPOILane(valuesOfElement)) {
882  return ADDSHAPE_SUCCESS;
883  } else {
884  return ADDSHAPE_INVALID;
885  }
887  // obtain Shape values
888  valuesOfElement = myShapeAttributes->getAttributesAndValues();
889  if (myDrawingMode->isDrawing()) {
890  myDrawingMode->addNewPoint(clickedPosition);
891  return ADDSHAPE_NEWPOINT;
892  } else {
893  // return ADDSHAPE_NOTHING if is drawing isn't enabled
894  return ADDSHAPE_NOTHING;
895  }
896  } else {
897  myViewNet->setStatusBarText("Current selected shape isn't valid.");
898  return ADDSHAPE_INVALID;
899  }
900 }
901 
902 
903 bool
905  // show warning dialogbox and stop check if input parameters are valid
906  if (myShapeAttributes->areValuesValid() == false) {
908  return false;
909  } else {
910  // Declare map to keep values
911  std::map<SumoXMLAttr, std::string> valuesOfElement = myShapeAttributes->getAttributesAndValues();
912 
913  // generate new ID
915 
916  // obtain shape
917  valuesOfElement[SUMO_ATTR_SHAPE] = toString(drawedShape);
918 
919  // obtain geo (by default false)
920  valuesOfElement[SUMO_ATTR_GEO] = "false";
921 
922  // obtain block movement value
924 
925  // obtain block shape value
927 
928  // return ADDSHAPE_SUCCESS if POI was sucesfully created
929  return addPolygon(valuesOfElement);
930  }
931 }
932 
933 
934 void
936  // Show frame
937  GNEFrame::show();
938 }
939 
940 
941 std::string
942 GNEPolygonFrame::getIdsSelected(const FXList* list) {
943  // Obtain Id's of list
944  std::string vectorOfIds;
945  for (int i = 0; i < list->getNumItems(); i++) {
946  if (list->isItemSelected(i)) {
947  if (vectorOfIds.size() > 0) {
948  vectorOfIds += " ";
949  }
950  vectorOfIds += (list->getItem(i)->getText()).text();
951  }
952  }
953  return vectorOfIds;
954 }
955 
956 
959  return myShapeSelector;
960 }
961 
962 
965  return myShapeAttributes;
966 }
967 
968 
971  return myNeteditAttributes;
972 }
973 
974 
977  return myDrawingMode;
978 }
979 
980 bool
981 GNEPolygonFrame::addPolygon(const std::map<SumoXMLAttr, std::string>& polyValues) {
982  bool ok = true;
983  // parse attributes from polyValues
984  std::string id = polyValues.at(SUMO_ATTR_ID);
985  std::string type = polyValues.at(SUMO_ATTR_TYPE);
986  RGBColor color = RGBColor::parseColor(polyValues.at(SUMO_ATTR_COLOR));
987  std::string layerStr = polyValues.at(SUMO_ATTR_LAYER);
988  double angle = GNEAttributeCarrier::parse<double>(polyValues.at(SUMO_ATTR_ANGLE));
989  std::string imgFile = polyValues.at(SUMO_ATTR_IMGFILE);
990  bool relativePath = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_RELATIVEPATH));
991  PositionVector shape = GeomConvHelper::parseShapeReporting(polyValues.at(SUMO_ATTR_SHAPE), "user-supplied position", 0, ok, true);
992  bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_FILL));
993  // parse layer
994  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER;
995  // create new Polygon only if number of shape points is greather than 2
997  if ((shape.size() > 0) && myViewNet->getNet()->addPolygon(id, type, color, layer, angle, imgFile, relativePath, shape, false, fill)) {
998  // set manually attributes use GEO, block movement and block shape
999  GNEPoly* polygon = myViewNet->getNet()->retrievePolygon(id);
1002  myViewNet->getUndoList()->p_end();
1003  return true;
1004  } else {
1005  // abort creation
1007  return false;
1008  }
1009 }
1010 
1011 
1012 bool
1013 GNEPolygonFrame::addPOI(const std::map<SumoXMLAttr, std::string>& POIValues) {
1014  bool ok = true;
1015  // parse attributes from POIValues
1016  std::string id = POIValues.at(SUMO_ATTR_ID);
1017  std::string type = POIValues.at(SUMO_ATTR_TYPE);
1018  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
1019  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
1020  Position pos = GeomConvHelper::parseShapeReporting(POIValues.at(SUMO_ATTR_POSITION), "netedit-given", 0, ok, false)[0];
1021  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
1022  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
1023  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
1024  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
1025  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
1026  // parse layer
1027  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
1028  // create new POI
1030  if (myViewNet->getNet()->addPOI(id, type, color, pos, false, "", 0, 0, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
1031  // Set manually the attribute block movement
1032  GNEPOI* poi = myViewNet->getNet()->retrievePOI(id);
1034  myViewNet->getUndoList()->p_end();
1035  return true;
1036  } else {
1037  // abort creation
1039  return false;
1040  }
1041 }
1042 
1043 
1044 bool
1045 GNEPolygonFrame::addPOILane(const std::map<SumoXMLAttr, std::string>& POIValues) {
1046  // parse attributes from POIValues
1047  std::string id = POIValues.at(SUMO_ATTR_ID);
1048  std::string type = POIValues.at(SUMO_ATTR_TYPE);
1049  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
1050  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
1051  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
1052  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
1053  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
1054  GNELane* lane = myViewNet->getNet()->retrieveLane(POIValues.at(SUMO_ATTR_LANE));
1055  double posLane = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION));
1056  double posLat = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION_LAT));
1057  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
1058  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
1059  // parse layer
1060  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
1061  // create new POILane
1063  if (myViewNet->getNet()->addPOI(id, type, color, Position(), false, lane->getID(), posLane, posLat, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
1064  // Set manually the attribute block movement
1065  GNEPOI* POI = myViewNet->getNet()->retrievePOI(id);
1067  myViewNet->getUndoList()->p_end();
1068  return true;
1069  } else {
1070  // abort creation
1072  return false;
1073  }
1074 }
1075 
1076 /****************************************************************************/
AddShapeResult processClick(const Position &clickedPosition, GNELane *lane)
process click over Viewnet
long onCmdStopDrawing(FXObject *, FXSelector, void *)
Called when the user press stop drawing button.
bool isBlockShapeEnabled() const
check if block shape is enabled
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::string getValue() const
return value
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:205
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:173
text attribute edited
Definition: GUIAppEnum.h:539
bool buildPoly(const PositionVector &drawedShape)
build Polygon using values of Fields and drawed shape return true if was sucesfully created ...
int getNumberOfAddedAttributes() const
get number of added attributes
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:115
void addAttribute(SumoXMLAttr ShapeAttributeSingle)
add attribute
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
Definition: GUIDesigns.h:57
FXHorizontalFrame * myBlockShapeFrame
frame for Block shape
ShapeAttributes * myShapeAttributesParent
pointer to ShapeAttributes
~GNEPolygonFrame()
Destructor.
FXTextField * myTextFieldInt
textField to modify the default value of int/float/string parameters
void stopDrawing()
stop drawing and create polygon or
SumoXMLTag getCurrentShapeType() const
get current shape type
void showNeteditAttributes(bool shapeEditing)
show NeteditAttributes
block shape of a graphic element (Used mainly in GNEShapes)
bool isBlockMovementEnabled() const
check if block movement is enabled
void setCurrentShape(SumoXMLTag actualShapeType)
set parameters depending of the given shapeType
AddShapeResult
enum with all possible values after try to create an shape using frame
long onCmdselectAttributeCarrier(FXObject *, FXSelector, void *)
static const double DEFAULT_LAYER_POI
Definition: Shape.h:45
A layer number.
GNEPolygonFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
Definition: GNEPOI.h:44
FXLabel * myClosePolygonLabel
Label for open/close polygon.
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:108
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
Definition: GNEPOI.cpp:326
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:953
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
long onCmdHelp(FXObject *, FXSelector, void *)
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
Definition: GNENet.cpp:940
void addNewPoint(const Position &P)
add new point to temporal shape
void hideShapeParameters()
hide group box
long onCmdStartDrawing(FXObject *, FXSelector, void *)
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get attributes and their values
long onCmdSetBooleanAttribute(FXObject *, FXSelector, void *)
called when user change the value of myBoolCheckButton
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:78
FXLabel * myInformationLabel
Label with information.
bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath, const PositionVector &shape, bool fill, bool geo, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
Definition: GNENet.cpp:220
FXTextField * myTextFieldReal
textField to modify the default value of real/times parameters
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a Point of interest
FXCheckButton * myBlockMovementCheckButton
checkBox for block movement
abort drawing polygon
Definition: GUIAppEnum.h:671
FXLabel * myBlockMovementLabel
Label for block movement.
FXButton * myStopDrawingButton
button for stop drawing
void showDrawingMode()
show Drawing mode
void openHelpAttributesDialog(SumoXMLTag tag) const
Open help attributes dialog.
Definition: GNEFrame.cpp:784
FXButton * myColorEditor
Button for open color editor.
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:766
bool addPolygon(const std::map< SumoXMLAttr, std::string > &POIValues)
add Polygon
bool addPOI(const std::map< SumoXMLAttr, std::string > &POIValues)
add POI
long onCmdSetNeteditAttribute(FXObject *, FXSelector, void *)
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:242
FXHorizontalFrame * myClosePolygonFrame
Frame for open/close polygon.
bool isDrawing() const
return true if currently a shape is drawed
#define GUIDesignComboBox
Definition: GUIDesigns.h:195
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
Definition: GNENet.cpp:2014
GNEViewNet * myViewNet
View Net for changes.
Definition: GNEFrame.h:232
GNEUndoList * getUndoList() const
get the undoList object
void removeLastPoint()
remove last added point
FXTextField * myTextFieldStrings
textField to modify the default value of string parameters
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:295
#define GUIDesignTextField
Definition: GUIDesigns.h:34
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
bool areValuesValid() const
check if parameters of attributes are valid
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:235
help button
Definition: GUIAppEnum.h:400
PositionVector myTemporalShapeShape
current drawed shape
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:85
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
void hideDrawingMode()
hide Drawing mode
FXCheckButton * myClosePolygonCheckButton
checkbox to enable/disable closing polygon
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
Definition: GUIDesigns.h:258
A list of positions.
void hideParameter()
hide all parameters
static std::vector< SumoXMLTag > allowedShapeTags(bool onlyDrawables)
get all editable for tag shape elements
void clearAttributes()
clear attributes
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
Definition: GNENet.cpp:243
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
block movement of a graphic element
bool addPOILane(const std::map< SumoXMLAttr, std::string > &POIValues)
add POILane
invalid attribute
FXButton * myAbortDrawingButton
button for abort drawing
A 2D- or 3D-Shape.
Definition: Shape.h:39
attribute edited trought dialog
Definition: GUIAppEnum.h:543
SumoXMLTag myCurrentShapeType
actual shape type selected in the match Box
ShapeAttributes * myShapeAttributes
shape internal attributes
edge: the shape in xml-definition
ShapeAttributes * getShapeAttributes() const
get shape attributes
const std::string getID() const
function to support debugging
ShapeSelector * getShapeSelector() const
get shape selector
FXCheckButton * myBlockShapeCheckButton
checkBox for block shape
void startDrawing()
start drawing
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
Definition: GNEPoly.cpp:615
NeteditAttributes * myNeteditAttributes
Netedit parameter.
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:249
stop drawing polygon
Definition: GUIAppEnum.h:669
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:184
void p_abort()
reverts and discards ALL active command groups
Definition: GNEUndoList.cpp:99
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
Definition: GUIDesigns.h:60
long onCmdAbortDrawing(FXObject *, FXSelector, void *)
Called when the user press abort drawing button.
start drawing polygon
Definition: GUIAppEnum.h:667
NeteditAttributes * getNeteditAttributes() const
get netedit attributes editor
bool isCloseShapeEnabled() const
check if clse shape is enabled
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:46
ShapeSelector * myShapeSelector
additional selector
DrawingMode * getDrawingMode() const
get drawing mode editor
#define GUIDesignButton
Definition: GUIDesigns.h:54
void showParameter(SumoXMLAttr shapeAttr, std::string value)
show name and value of attribute of type string
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:613
virtual void show()
show Frame
Definition: GNEFrame.cpp:741
#define GUIDesignDialogBox
Definition: GUIDesigns.h:407
FXDEFMAP(GNEPolygonFrame::ShapeSelector) ShapeSelectorMap[]
DrawingMode * myDrawingMode
drawing mode
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:227
void show()
show shape frame and update use selected edges/lanes
const std::string & isAttributeValid() const
returns a empty string if current value is valid, a string with information about invalid value in ot...
GNEPolygonFrame * myPolygonFrameParent
pointer to Polygon Frame Parent
GNEPolygonFrame * myShapeFrameParent
pointer to Shape Frame Parent
SumoXMLAttr getAttr() const
return Attr
FXButton * myStartDrawingButton
button for start drawing
std::vector< ShapeAttributeSingle * > myVectorOfsingleShapeParameter
vector with the shape parameters
void abortDrawing()
abort drawing
FXLabel * myBlockShapeLabel
Label for block shape.
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
Definition: GUIDesigns.h:37
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:750
void hideNeteditAttributes()
hide NeteditAttributes
FXComboBox * myShapeMatchBox
combo box with the list of shape elements
static std::string getIdsSelected(const FXList *list)
get list of selecte id&#39;s in string format
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:40
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:114
attribute edited
Definition: GUIAppEnum.h:535
#define GUIDesignButtonOK
Definition: GUIDesigns.h:96
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:311
void showShapeParameters()
show group box
SumoXMLAttr myShapeAttr
current XML attribute
used to select a type of element in a combo box
Definition: GUIAppEnum.h:537
static const TagValues & getTagProperties(SumoXMLTag tag)
get Tag Properties
ShapeAttributes * getShapeAttributesParent() const
get shape attributes parent
bool attribute edited
Definition: GUIAppEnum.h:541
GNEPolygonFrame * getPolygonFrameParent() const
get PolygonFrame parent
begin/end of the description of a Point of interest over Lane (used by Netedit)
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
Definition: GUIDesigns.h:166
FXCheckButton * myBoolCheckButton
check button to enable/disable the value of boolean parameters
const PositionVector & getTemporalShape() const
get Temporal shape
GNEPolygonFrame * myPolygonFrameParent
frame frame parent
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void closePolygon()
ensures that the last position equals the first
long onCmdSetAttribute(FXObject *, FXSelector, void *)
C++ TraCI client API implementation.
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name) ...
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1066
A color information.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occurred errors.
Fill the polygon.
begin/end of the description of a polygon
static const double DEFAULT_LAYER
Definition: Shape.h:44
long onCmdSetColorAttribute(FXObject *, FXSelector, void *)
called when user press the "Color" button
std::string myInvalidValue
string which indicates the reason due current value is invalid
FXLabel * myLabel
lael with the name of the parameter