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  myDeleteLastCreatedPoint(false) {
667  // create start and stop buttons
668  myStartDrawingButton = new FXButton(this, "Start drawing", 0, this, MID_GNE_POLYGONFRAME_STARTDRAWING, GUIDesignButton);
669  myStopDrawingButton = new FXButton(this, "Stop drawing", 0, this, MID_GNE_POLYGONFRAME_STOPDRAWING, GUIDesignButton);
670  myAbortDrawingButton = new FXButton(this, "Abort drawing", 0, this, MID_GNE_POLYGONFRAME_ABORTDRAWING, GUIDesignButton);
671 
672  // create information label
673  std::ostringstream information;
674  information
675  << "- 'Start drawing' or ENTER\n"
676  << " draws polygon boundary.\n"
677  << "- 'Stop drawing' or ENTER\n"
678  << " creates polygon.\n"
679  << "- 'Shift + Click'\n"
680  << " removes last created point.\n"
681  << "- 'Abort drawing' or ESC\n"
682  << " removes drawed polygon.";
683  myInformationLabel = new FXLabel(this, information.str().c_str(), 0, GUIDesignLabelFrameInformation);
684  // disable stop and abort functions as init
685  myStopDrawingButton->disable();
686  myAbortDrawingButton->disable();
687 }
688 
689 
691 
692 
694  // abort current drawing before show
695  abortDrawing();
696  // show FXGroupBox
697  FXGroupBox::show();
698 }
699 
700 
702  // abort current drawing before hide
703  abortDrawing();
704  // show FXGroupBox
705  FXGroupBox::hide();
706 }
707 
708 
709 void
711  // Only start drawing if DrawingMode modul is shown
712  if (shown()) {
713  // change buttons
714  myStartDrawingButton->disable();
715  myStopDrawingButton->enable();
716  myAbortDrawingButton->enable();
717  }
718 }
719 
720 
721 void
723  // check if shape has to be closed
726  }
727  // try to build polygon
729  // clear created points
730  myTemporalShapeShape.clear();
731  myPolygonFrameParent->getViewNet()->update();
732  // change buttons
733  myStartDrawingButton->enable();
734  myStopDrawingButton->disable();
735  myAbortDrawingButton->disable();
736  } else {
737  // abort drawing if polygon cannot be created
738  abortDrawing();
739  }
740 }
741 
742 
743 void
745  // clear created points
746  myTemporalShapeShape.clear();
747  myPolygonFrameParent->getViewNet()->update();
748  // change buttons
749  myStartDrawingButton->enable();
750  myStopDrawingButton->disable();
751  myAbortDrawingButton->disable();
752 }
753 
754 
755 void
757  if (myStopDrawingButton->isEnabled()) {
758  myTemporalShapeShape.push_back(P);
759  } else {
760  throw ProcessError("A new point cannot be added if drawing wasn't started");
761  }
762 }
763 
764 
765 void
767 
768 }
769 
770 
771 const PositionVector&
773  return myTemporalShapeShape;
774 }
775 
776 
777 bool
779  return myStopDrawingButton->isEnabled();
780 }
781 
782 
783 void
785  myDeleteLastCreatedPoint = value;
786 }
787 
788 
789 bool
792 }
793 
794 
795 long
796 GNEPolygonFrame::DrawingMode::onCmdStartDrawing(FXObject*, FXSelector, void*) {
797  startDrawing();
798  return 0;
799 }
800 
801 
802 long
803 GNEPolygonFrame::DrawingMode::onCmdStopDrawing(FXObject*, FXSelector, void*) {
804  stopDrawing();
805  return 0;
806 }
807 
808 
809 long
810 GNEPolygonFrame::DrawingMode::onCmdAbortDrawing(FXObject*, FXSelector, void*) {
811  abortDrawing();
812  return 0;
813 }
814 
815 // ===========================================================================
816 // method definitions
817 // ===========================================================================
818 
819 GNEPolygonFrame::GNEPolygonFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
820  GNEFrame(horizontalFrameParent, viewNet, "Shapes") {
821 
822  // Create shape selector
823  myShapeSelector = new ShapeSelector(this);
824 
825  // Create shape parameters
827 
828  // Create Netedit parameter
830 
831  // Create drawing controls
833 
834  // set polygon as default additional
836 }
837 
838 
840 }
841 
842 
844 GNEPolygonFrame::processClick(const Position& clickedPosition, GNELane* lane) {
845  // Declare map to keep values
846  std::map<SumoXMLAttr, std::string> valuesOfElement;
847  // check if current selected shape is valid
849  // obtain POI values
850  valuesOfElement = myShapeAttributes->getAttributesAndValues();
851  // show warning dialogbox and stop if input parameters are invalid
852  if (myShapeAttributes->areValuesValid() == false) {
854  return ADDSHAPE_INVALID;
855  }
856  // generate new ID
858  // obtain position
859  valuesOfElement[SUMO_ATTR_POSITION] = toString(clickedPosition);
860  // obtain block movement value
862  // return ADDSHAPE_SUCCESS if POI was sucesfully created
863  if (addPOI(valuesOfElement)) {
864  return ADDSHAPE_SUCCESS;
865  } else {
866  return ADDSHAPE_INVALID;
867  }
869  // obtain POILane values
870  valuesOfElement = myShapeAttributes->getAttributesAndValues();
871  // show warning dialogbox and stop if input parameters are invalid
872  if (myShapeAttributes->areValuesValid() == false) {
874  return ADDSHAPE_INVALID;
875  }
876  // abort if lane is nullptr
877  if (lane == nullptr) {
878  WRITE_WARNING(toString(SUMO_TAG_POILANE) + " can be only placed over lanes");
879  return ADDSHAPE_INVALID;
880  }
881  // generate new ID
883  // obtain Lane
884  valuesOfElement[SUMO_ATTR_LANE] = lane->getID();
885  // obtain position over lane
886  valuesOfElement[SUMO_ATTR_POSITION] = toString(lane->getShape().nearest_offset_to_point2D(clickedPosition));
887  // obtain block movement value
889  // return ADDSHAPE_SUCCESS if POI was sucesfully created
890  if (addPOILane(valuesOfElement)) {
891  return ADDSHAPE_SUCCESS;
892  } else {
893  return ADDSHAPE_INVALID;
894  }
896  // obtain Shape values
897  valuesOfElement = myShapeAttributes->getAttributesAndValues();
898  if (myDrawingMode->isDrawing()) {
899  // add or delete a new point depending of flag "delete last created point"
902  } else {
903  myDrawingMode->addNewPoint(clickedPosition);
904  }
906  } else {
907  // return ADDSHAPE_NOTHING if is drawing isn't enabled
908  return ADDSHAPE_NOTHING;
909  }
910  } else {
911  myViewNet->setStatusBarText("Current selected shape isn't valid.");
912  return ADDSHAPE_INVALID;
913  }
914 }
915 
916 
917 bool
919  // show warning dialogbox and stop check if input parameters are valid
920  if (myShapeAttributes->areValuesValid() == false) {
922  return false;
923  } else {
924  // Declare map to keep values
925  std::map<SumoXMLAttr, std::string> valuesOfElement = myShapeAttributes->getAttributesAndValues();
926 
927  // generate new ID
929 
930  // obtain shape
931  valuesOfElement[SUMO_ATTR_SHAPE] = toString(drawedShape);
932 
933  // obtain geo (by default false)
934  valuesOfElement[SUMO_ATTR_GEO] = "false";
935 
936  // obtain block movement value
938 
939  // obtain block shape value
941 
942  // return ADDSHAPE_SUCCESS if POI was sucesfully created
943  return addPolygon(valuesOfElement);
944  }
945 }
946 
947 
948 void
950  // Show frame
951  GNEFrame::show();
952 }
953 
954 
955 std::string
956 GNEPolygonFrame::getIdsSelected(const FXList* list) {
957  // Obtain Id's of list
958  std::string vectorOfIds;
959  for (int i = 0; i < list->getNumItems(); i++) {
960  if (list->isItemSelected(i)) {
961  if (vectorOfIds.size() > 0) {
962  vectorOfIds += " ";
963  }
964  vectorOfIds += (list->getItem(i)->getText()).text();
965  }
966  }
967  return vectorOfIds;
968 }
969 
970 
973  return myShapeSelector;
974 }
975 
976 
979  return myShapeAttributes;
980 }
981 
982 
985  return myNeteditAttributes;
986 }
987 
988 
991  return myDrawingMode;
992 }
993 
994 
995 bool
996 GNEPolygonFrame::addPolygon(const std::map<SumoXMLAttr, std::string>& polyValues) {
997  bool ok = true;
998  // parse attributes from polyValues
999  std::string id = polyValues.at(SUMO_ATTR_ID);
1000  std::string type = polyValues.at(SUMO_ATTR_TYPE);
1001  RGBColor color = RGBColor::parseColor(polyValues.at(SUMO_ATTR_COLOR));
1002  std::string layerStr = polyValues.at(SUMO_ATTR_LAYER);
1003  double angle = GNEAttributeCarrier::parse<double>(polyValues.at(SUMO_ATTR_ANGLE));
1004  std::string imgFile = polyValues.at(SUMO_ATTR_IMGFILE);
1005  bool relativePath = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_RELATIVEPATH));
1006  PositionVector shape = GeomConvHelper::parseShapeReporting(polyValues.at(SUMO_ATTR_SHAPE), "user-supplied position", 0, ok, true);
1007  bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_FILL));
1008  // parse layer
1009  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER;
1010  // create new Polygon only if number of shape points is greather than 2
1012  if ((shape.size() > 0) && myViewNet->getNet()->addPolygon(id, type, color, layer, angle, imgFile, relativePath, shape, false, fill)) {
1013  // set manually attributes use GEO, block movement and block shape
1014  GNEPoly* polygon = myViewNet->getNet()->retrievePolygon(id);
1017  myViewNet->getUndoList()->p_end();
1018  return true;
1019  } else {
1020  // abort creation
1022  return false;
1023  }
1024 }
1025 
1026 
1027 bool
1028 GNEPolygonFrame::addPOI(const std::map<SumoXMLAttr, std::string>& POIValues) {
1029  bool ok = true;
1030  // parse attributes from POIValues
1031  std::string id = POIValues.at(SUMO_ATTR_ID);
1032  std::string type = POIValues.at(SUMO_ATTR_TYPE);
1033  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
1034  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
1035  Position pos = GeomConvHelper::parseShapeReporting(POIValues.at(SUMO_ATTR_POSITION), "netedit-given", 0, ok, false)[0];
1036  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
1037  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
1038  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
1039  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
1040  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
1041  // parse layer
1042  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
1043  // create new POI
1045  if (myViewNet->getNet()->addPOI(id, type, color, pos, false, "", 0, 0, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
1046  // Set manually the attribute block movement
1047  GNEPOI* poi = myViewNet->getNet()->retrievePOI(id);
1049  myViewNet->getUndoList()->p_end();
1050  return true;
1051  } else {
1052  // abort creation
1054  return false;
1055  }
1056 }
1057 
1058 
1059 bool
1060 GNEPolygonFrame::addPOILane(const std::map<SumoXMLAttr, std::string>& POIValues) {
1061  // parse attributes from POIValues
1062  std::string id = POIValues.at(SUMO_ATTR_ID);
1063  std::string type = POIValues.at(SUMO_ATTR_TYPE);
1064  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
1065  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
1066  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
1067  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
1068  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
1069  GNELane* lane = myViewNet->getNet()->retrieveLane(POIValues.at(SUMO_ATTR_LANE));
1070  double posLane = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION));
1071  double posLat = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION_LAT));
1072  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
1073  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
1074  // parse layer
1075  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
1076  // create new POILane
1078  if (myViewNet->getNet()->addPOI(id, type, color, Position(), false, lane->getID(), posLane, posLat, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
1079  // Set manually the attribute block movement
1080  GNEPOI* POI = myViewNet->getNet()->retrievePOI(id);
1082  myViewNet->getUndoList()->p_end();
1083  return true;
1084  } else {
1085  // abort creation
1087  return false;
1088  }
1089 }
1090 
1091 /****************************************************************************/
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:332
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:961
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:948
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:2022
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:679
virtual void show()
show Frame
Definition: GNEFrame.cpp:741
#define GUIDesignDialogBox
Definition: GUIDesigns.h:407
FXDEFMAP(GNEPolygonFrame::ShapeSelector) ShapeSelectorMap[]
DrawingMode * myDrawingMode
drawing mode
bool getDeleteLastCreatedPoint()
get flag delete last created point
bool myDeleteLastCreatedPoint
flag to enable/disable delete point 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:331
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
void setDeleteLastCreatedPoint(bool value)
enable or disable delete last created point
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:1074
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