Eclipse 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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // The Widget for add polygons
19 /****************************************************************************/
20 #include <config.h>
21 
25 #include <netedit/GNEViewParent.h>
26 #include <netedit/GNENet.h>
27 #include <netedit/GNEViewNet.h>
28 #include <netedit/GNEUndoList.h>
29 
30 #include "GNEPolygonFrame.h"
31 
32 
33 // ===========================================================================
34 // FOX callback mapping
35 // ===========================================================================
36 
41 };
42 
43 // Object implementation
44 FXIMPLEMENT(GNEPolygonFrame::GEOPOICreator, FXGroupBox, GEOPOICreatorMap, ARRAYNUMBER(GEOPOICreatorMap))
45 
46 
47 // ===========================================================================
48 // method definitions
49 // ===========================================================================
50 
51 // ---------------------------------------------------------------------------
52 // GNEPolygonFrame::GEOPOICreator - methods
53 // ---------------------------------------------------------------------------
54 
56  FXGroupBox(polygonFrameParent->myContentFrame, "GEO POI Creator", GUIDesignGroupBoxFrame),
57  myPolygonFrameParent(polygonFrameParent) {
58  // create RadioButtons for formats
59  myLonLatRadioButton = new FXRadioButton(this, "Format: Lon-Lat", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
60  myLatLonRadioButton = new FXRadioButton(this, "Format: Lat-Lon", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
61  // set lat-lon as default
62  myLatLonRadioButton->setCheck(TRUE);
63  // create text field for coordinates
64  myCoordinatesTextField = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
65  // create checkBox
66  myCenterViewAfterCreationCheckButton = new FXCheckButton(this, "Center View after creation", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
67  // create button for create GEO POIs
68  myCreateGEOPOIButton = new FXButton(this, "Create GEO POI (clipboard)", nullptr, this, MID_GNE_CREATE, GUIDesignButton);
69  // create information label
70  myLabelCartesianPosition = new FXLabel(this, "Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude", 0, GUIDesignLabelFrameInformation);
71 }
72 
73 
75 
76 
77 void
79  // check if there is an GEO Proj string is defined
80  if (GeoConvHelper::getFinal().getProjString() != "!") {
81  myCoordinatesTextField->enable();
82  myCoordinatesTextField->setText("");
83  myCoordinatesTextField->enable();
84  myCreateGEOPOIButton->enable();
85  } else {
86  myCoordinatesTextField->setText("No geo-conversion defined");
87  myCoordinatesTextField->disable();
88  myCreateGEOPOIButton->disable();
89  }
90  show();
91 }
92 
93 
94 void
96  hide();
97 }
98 
99 
100 long
102  // check if input contains spaces
103  std::string input = myCoordinatesTextField->getText().text();
104  std::string inputWithoutSpaces;
105  for (const auto& i : input) {
106  if (i != ' ') {
107  inputWithoutSpaces.push_back(i);
108  }
109  }
110  // if input contains spaces, call this function again, and in other case set red text color
111  if (input.size() != inputWithoutSpaces.size()) {
112  myCoordinatesTextField->setText(inputWithoutSpaces.c_str());
113  }
114  if (inputWithoutSpaces.size() > 0) {
115  myCreateGEOPOIButton->setText("Create GEO POI");
116  } else {
117  myCreateGEOPOIButton->setText("Create GEO POI (clipboard)");
118  }
119  // simply check if given value can be parsed to Position
120  if (GNEAttributeCarrier::canParse<Position>(myCoordinatesTextField->getText().text())) {
121  myCoordinatesTextField->setTextColor(FXRGB(0, 0, 0));
122  myCoordinatesTextField->killFocus();
123  // convert coordinates into lon-lat
124  Position geoPos = GNEAttributeCarrier::parse<Position>(myCoordinatesTextField->getText().text());
125  if (myLatLonRadioButton->getCheck() == TRUE) {
126  geoPos.swapXY();
127  }
129  // check if GEO Position has to be swapped
130  // update myLabelCartesianPosition
131  myLabelCartesianPosition->setText(("Cartesian equivalence:\n- X = " + toString(geoPos.x()) + "\n- Y = " + toString(geoPos.y())).c_str());
132  } else {
133  myCoordinatesTextField->setTextColor(FXRGB(255, 0, 0));
134  myLabelCartesianPosition->setText("Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude");
135  };
136  return 1;
137 }
138 
139 
140 long
141 GNEPolygonFrame::GEOPOICreator::onCmdSetFormat(FXObject* obj, FXSelector, void*) {
142  //disable other radio button depending of selected option
143  if (obj == myLonLatRadioButton) {
144  myLonLatRadioButton->setCheck(TRUE);
145  myLatLonRadioButton->setCheck(FALSE);
146  } else if (obj == myLatLonRadioButton) {
147  myLonLatRadioButton->setCheck(FALSE);
148  myLatLonRadioButton->setCheck(TRUE);
149  }
150  // in both cases call onCmdSetCoordinates(0,0,0) to set new cartesian equivalence
151  onCmdSetCoordinates(0, 0, 0);
152  return 1;
153 }
154 
155 
156 long
158  // first check if current GEO Position is valid
159  if (myPolygonFrameParent->myShapeAttributes->areValuesValid()) {
160  std::string geoPosStr = myCoordinatesTextField->getText().text();
161  if (geoPosStr.empty()) {
162  // use clipboard
163  WRITE_WARNING("Using clipboard");
164  geoPosStr = GUIUserIO::copyFromClipboard(*getApp());
165  myCoordinatesTextField->setText(geoPosStr.c_str());
166  // remove spaces, update cartesian value
167  onCmdSetCoordinates(0, 0, 0);
168  geoPosStr = myCoordinatesTextField->getText().text();
169  myCoordinatesTextField->setText("");
170  myCreateGEOPOIButton->setText("Create GEO POI (clipboard)");
171  }
172  if (GNEAttributeCarrier::canParse<Position>(geoPosStr)) {
173  // obtain shape attributes and values
174  auto valuesMap = myPolygonFrameParent->myShapeAttributes->getAttributesAndValues(true);
175  // obtain netedit attributes and values
176  myPolygonFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, nullptr);
177  // Check if ID has to be generated
178  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
179  valuesMap[SUMO_ATTR_ID] = myPolygonFrameParent->myViewNet->getNet()->generateShapeID(myPolygonFrameParent->myShapeTagSelector->getCurrentTagProperties().getTag());
180  }
181  // force GEO attribute to true and obain position
182  valuesMap[SUMO_ATTR_GEO] = "true";
183  Position geoPos = GNEAttributeCarrier::parse<Position>(geoPosStr);
184  // convert coordinates into lon-lat
185  if (myLatLonRadioButton->getCheck() == TRUE) {
186  geoPos.swapXY();
187  }
189  valuesMap[SUMO_ATTR_POSITION] = toString(geoPos);
190  // return AddShape::SUCCESS if POI was sucesfully created
191  if (myPolygonFrameParent->addPOI(valuesMap)) {
192  // check if view has to be centered over created GEO POI
193  if (myCenterViewAfterCreationCheckButton->getCheck() == TRUE) {
194  // create a boundary over given GEO Position and center view over it
195  Boundary centerPosition;
196  centerPosition.add(geoPos);
197  centerPosition = centerPosition.grow(10);
198  myPolygonFrameParent->myViewNet->getViewParent()->getView()->centerTo(centerPosition);
199  }
200  } else {
201  WRITE_WARNING("Could not create GEO POI");
202  }
203  }
204  // refresh shape attributes
205  myPolygonFrameParent->myShapeAttributes->refreshRows();
206  }
207  return 1;
208 }
209 
210 
211 // ---------------------------------------------------------------------------
212 // GNEPolygonFrame - methods
213 // ---------------------------------------------------------------------------
214 
215 GNEPolygonFrame::GNEPolygonFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
216  GNEFrame(horizontalFrameParent, viewNet, "Shapes") {
217 
218  // create item Selector modul for shapes
219  myShapeTagSelector = new GNEFrameModuls::TagSelector(this, GNETagProperties::TagType::SHAPE);
220 
221  // Create shape parameters
223 
224  // Create Netedit parameter
226 
227  // Create drawing controls
229 
231  myGEOPOICreator = new GEOPOICreator(this);
232 
233  // set polygon as default shape
235 }
236 
237 
239 }
240 
241 
242 void
244  // refresh item selector
246  // show frame
247  GNEFrame::show();
248 }
249 
250 
252 GNEPolygonFrame::processClick(const Position& clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor) {
253  // Declare map to keep values
254  std::map<SumoXMLAttr, std::string> valuesMap;
255  // check if current selected shape is valid
257  // show warning dialogbox and stop if input parameters are invalid
258  if (myShapeAttributes->areValuesValid() == false) {
260  return AddShape::INVALID;
261  }
262  // obtain shape attributes and values
263  valuesMap = myShapeAttributes->getAttributesAndValues(true);
264  // obtain netedit attributes and values
265  myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, objectsUnderCursor.getLaneFront());
266  // Check if ID has to be generated
267  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
269  }
270  // obtain position
271  valuesMap[SUMO_ATTR_POSITION] = toString(clickedPosition);
272  // set GEO Position as false (because we have created POI clicking over View
273  valuesMap[SUMO_ATTR_GEO] = "false";
274  // return AddShape::SUCCESS if POI was sucesfully created
275  if (addPOI(valuesMap)) {
276  // refresh shape attributes
278  return AddShape::SUCCESS;
279  } else {
280  return AddShape::INVALID;
281  }
283  // abort if lane is nullptr
284  if (objectsUnderCursor.getLaneFront() == nullptr) {
285  WRITE_WARNING(toString(SUMO_TAG_POILANE) + " can be only placed over lanes");
286  return AddShape::INVALID;
287  }
288  // show warning dialogbox and stop if input parameters are invalid
289  if (myShapeAttributes->areValuesValid() == false) {
291  return AddShape::INVALID;
292  }
293  // obtain shape attributes and values
294  valuesMap = myShapeAttributes->getAttributesAndValues(true);
295  // obtain netedit attributes and values
296  myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, objectsUnderCursor.getLaneFront());
297  // Check if ID has to be generated
298  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
300  }
301  // obtain Lane
302  valuesMap[SUMO_ATTR_LANE] = objectsUnderCursor.getLaneFront()->getID();
303  // obtain position over lane
304  valuesMap[SUMO_ATTR_POSITION] = toString(objectsUnderCursor.getLaneFront()->getLaneShape().nearest_offset_to_point2D(clickedPosition));
305  // return AddShape::SUCCESS if POI was sucesfully created
306  if (addPOILane(valuesMap)) {
307  // refresh shape attributes
309  return AddShape::SUCCESS;
310  } else {
311  return AddShape::INVALID;
312  }
314  if (myDrawingShape->isDrawing()) {
315  // add or delete a new point depending of flag "delete last created point"
318  } else {
319  myDrawingShape->addNewPoint(clickedPosition);
320  }
322  } else {
323  // return AddShape::NOTHING if is drawing isn't enabled
324  return AddShape::NOTHING;
325  }
326  } else {
327  myViewNet->setStatusBarText("Current selected shape isn't valid.");
328  return AddShape::INVALID;
329  }
330 }
331 
332 
333 std::string
334 GNEPolygonFrame::getIdsSelected(const FXList* list) {
335  // Obtain Id's of list
336  std::string vectorOfIds;
337  for (int i = 0; i < list->getNumItems(); i++) {
338  if (list->isItemSelected(i)) {
339  if (vectorOfIds.size() > 0) {
340  vectorOfIds += " ";
341  }
342  vectorOfIds += (list->getItem(i)->getText()).text();
343  }
344  }
345  return vectorOfIds;
346 }
347 
348 
351  return myDrawingShape;
352 }
353 
354 
355 bool
357  // show warning dialogbox and stop check if input parameters are valid
360  return false;
361  } else if (myDrawingShape->getTemporalShape().size() == 0) {
362  WRITE_WARNING("Polygon shape cannot be empty");
363  return false;
364  } else {
365  // Declare map to keep values
366  std::map<SumoXMLAttr, std::string> valuesMap = myShapeAttributes->getAttributesAndValues(true);
367  // obtain netedit attributes and values
369  // Check if ID has to be generated
370  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
372  }
373  // obtain shape and check if has to be closed
375  if (GNEAttributeCarrier::parse<bool>(valuesMap[GNE_ATTR_CLOSE_SHAPE])) {
376  temporalShape.closePolygon();
377  }
378  valuesMap[SUMO_ATTR_SHAPE] = toString(temporalShape);
379  // obtain geo (by default false)
380  valuesMap[SUMO_ATTR_GEO] = "false";
381  // return true if polygon was successfully created
382  if (addPolygon(valuesMap)) {
383  // refresh shape attributes
385  return true;
386  }
387  }
388  return false;
389 }
390 
391 
392 void
395  // if there are parmeters, show and Recalc groupBox
397  // show netedit attributes
399  // Check if drawing mode has to be shown
402  } else {
404  }
405  // Check if GEO POI Creator has to be shown
408  } else {
410  }
411  } else {
412  // hide all widgets
417  }
418 }
419 
420 
421 bool
422 GNEPolygonFrame::addPolygon(const std::map<SumoXMLAttr, std::string>& polyValues) {
423  // parse attributes from polyValues
424  std::string id = polyValues.at(SUMO_ATTR_ID);
425  std::string type = polyValues.at(SUMO_ATTR_TYPE);
426  RGBColor color = RGBColor::parseColor(polyValues.at(SUMO_ATTR_COLOR));
427  std::string layerStr = polyValues.at(SUMO_ATTR_LAYER);
428  double angle = GNEAttributeCarrier::parse<double>(polyValues.at(SUMO_ATTR_ANGLE));
429  std::string imgFile = polyValues.at(SUMO_ATTR_IMGFILE);
430  bool relativePath = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_RELATIVEPATH));
431  PositionVector shape = GNEAttributeCarrier::parse<PositionVector>(polyValues.at(SUMO_ATTR_SHAPE));
432  bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_FILL));
433  double lineWidth = GNEAttributeCarrier::parse<double>(polyValues.at(SUMO_ATTR_LINEWIDTH));
434  // parse layer
435  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER;
436  // create new Polygon only if number of shape points is greather than 2
438  if ((shape.size() > 0) && myViewNet->getNet()->getAttributeCarriers()->addPolygon(id, type, color, layer, angle, imgFile, relativePath, shape, false, fill, lineWidth)) {
439  // set manually attributes use GEO, block movement and block shape
444  return true;
445  } else {
446  // abort creation
448  return false;
449  }
450 }
451 
452 
453 bool
454 GNEPolygonFrame::addPOI(const std::map<SumoXMLAttr, std::string>& POIValues) {
455  // parse attributes from POIValues
456  std::string id = POIValues.at(SUMO_ATTR_ID);
457  std::string type = POIValues.at(SUMO_ATTR_TYPE);
458  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
459  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
460  Position pos = GNEAttributeCarrier::parse<Position>(POIValues.at(SUMO_ATTR_POSITION));
461  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
462  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
463  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
464  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
465  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
466  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
467  bool geo = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_GEO));
468  // create new POI
470  if (myViewNet->getNet()->getAttributeCarriers()->addPOI(id, type, color, pos, geo, "", 0, 0, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
471  // Set manually the attribute block movement
473  POI->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, POIValues.at(GNE_ATTR_BLOCK_MOVEMENT), myViewNet->getUndoList());
475  return true;
476  } else {
477  // abort creation
479  return false;
480  }
481 }
482 
483 
484 bool
485 GNEPolygonFrame::addPOILane(const std::map<SumoXMLAttr, std::string>& POIValues) {
486  // parse attributes from POIValues
487  std::string id = POIValues.at(SUMO_ATTR_ID);
488  std::string type = POIValues.at(SUMO_ATTR_TYPE);
489  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
490  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
491  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
492  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
493  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
494  GNELane* lane = myViewNet->getNet()->retrieveLane(POIValues.at(SUMO_ATTR_LANE));
495  double posLane = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION));
496  double posLat = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION_LAT));
497  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
498  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
499  // parse layer
500  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
501  // create new POILane
503  if (myViewNet->getNet()->getAttributeCarriers()->addPOI(id, type, color, Position(), false, lane->getID(), posLane, posLat, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
504  // Set manually the attribute block movement
505  GNEShape* POILane = myViewNet->getNet()->retrieveShape(SUMO_TAG_POI, id);
508  return true;
509  } else {
510  // abort creation
512  return false;
513  }
514 }
515 
516 
517 /****************************************************************************/
FXDEFMAP(GNEPolygonFrame::GEOPOICreator) GEOPOICreatorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:717
@ MID_CHOOSEN_OPERATION
set type of selection
Definition: GUIAppEnum.h:535
@ MID_GNE_CREATE
create element
Definition: GUIAppEnum.h:719
#define GUIDesignButton
Definition: GUIDesigns.h:62
#define GUIDesignTextField
Definition: GUIDesigns.h:36
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:54
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:278
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:133
#define GUIDesignRadioButton
Definition: GUIDesigns.h:164
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:223
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:276
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
@ SUMO_ATTR_LANE
@ GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
@ SUMO_ATTR_LINEWIDTH
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_GEO
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_FILL
Fill the polygon.
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ GNE_ATTR_BLOCK_SHAPE
block shape of a graphic element (Used mainly in GNEShapes)
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_RELATIVEPATH
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
void refreshRows()
refresh rows (called after creating an element)
void showAttributesCreatorModul(const GNETagProperties &tagProperties, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
std::map< SumoXMLAttr, std::string > getAttributesAndValues(bool includeAll) const
get attributes and their values
bool areValuesValid() const
check if parameters of attributes are valid
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
void showNeteditAttributesModul(const GNETagProperties &tagValue)
show Netedit attributes modul
bool getNeteditAttributesAndValues(std::map< SumoXMLAttr, std::string > &valuesMap, const GNELane *lane) const
fill valuesMap with netedit attributes
void hideNeteditAttributesModul()
hide Netedit attributes modul
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:113
virtual void show()
show Frame
Definition: GNEFrame.cpp:108
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:117
void showDrawingShape()
show Drawing mode
bool getDeleteLastCreatedPoint()
get flag delete last created point
void hideDrawingShape()
hide Drawing mode
const PositionVector & getTemporalShape() const
get Temporal shape
void addNewPoint(const Position &P)
add new point to temporal shape
void removeLastPoint()
remove last added point
bool isDrawing() const
return true if currently a shape is drawed
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show
const GNETagProperties & getCurrentTagProperties() const
get current type tag
void setCurrentTag(SumoXMLTag newTag)
set current type manually
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
const PositionVector & getLaneShape() const
Definition: GNELane.cpp:117
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.
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 geo, bool fill, double lineWidth, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1337
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
Definition: GNENet.cpp:2971
GNEShape * retrieveShape(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named shape.
Definition: GNENet.cpp:2944
const std::string & getID() const
get ID
void showGEOPOICreatorModul()
Show list of GEOPOICreator Modul.
long onCmdCreateGEOPOI(FXObject *, FXSelector, void *)
called when user type in search box
void hideGEOPOICreatorModul()
hide GEOPOICreator Modul
long onCmdSetFormat(FXObject *, FXSelector, void *)
called when user select a format radio button
long onCmdSetCoordinates(FXObject *, FXSelector, void *)
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
bool addPOI(const std::map< SumoXMLAttr, std::string > &POIValues)
add POI
void show()
show Frame
GNEFrameModuls::TagSelector * myShapeTagSelector
shape tag selector
GNEFrameModuls::DrawingShape * getDrawingShapeModul() const
get drawing mode editor
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
void tagSelected()
Tag selected in TagSelector.
~GNEPolygonFrame()
Destructor.
AddShape
enum with all possible values after try to create an shape using frame
GNEPolygonFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
GEOPOICreator * myGEOPOICreator
GEOPOICreator.
GNEFrameAttributesModuls::AttributesCreator * myShapeAttributes
shape internal attributes
bool shapeDrawed()
build a shaped element using the drawed shape return true if was successfully created
GNEFrameModuls::DrawingShape * myDrawingShape
Drawing shape.
bool addPOILane(const std::map< SumoXMLAttr, std::string > &POIValues)
add POILane
GNEPolygonFrame::AddShape processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
bool addPolygon(const std::map< SumoXMLAttr, std::string > &POIValues)
add Polygon
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
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:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
void p_abort()
reverts and discards ALL active command groups
class used to group all variables related with objects under cursor after a click over view
GNELane * getLaneFront() const
get front lane or a pointer to nullptr
GNENet * getNet() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:575
static std::string copyFromClipboard(const FXApp &app)
Copies text from the clipboard.
Definition: GUIUserIO.cpp:44
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
C++ TraCI client API implementation.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
double x() const
Returns the x-position.
Definition: Position.h:54
void swapXY()
swap position X and Y
Definition: Position.h:272
double y() const
Returns the y-position.
Definition: Position.h:59
A list of positions.
void closePolygon()
ensures that the last position equals the first
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:168
static const double DEFAULT_LAYER
Definition: Shape.h:41
static const double DEFAULT_LAYER_POI
Definition: Shape.h:43