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-2019 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 /****************************************************************************/
14 // The Widget for add polygons
15 /****************************************************************************/
16 
17 // ===========================================================================
18 // included modules
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>
32 
33 #include "GNEPolygonFrame.h"
34 
35 
36 // ===========================================================================
37 // FOX callback mapping
38 // ===========================================================================
39 
40 FXDEFMAP(GNEPolygonFrame::GEOPOICreator) GEOPOICreatorMap[] = {
44 };
45 
46 // Object implementation
47 FXIMPLEMENT(GNEPolygonFrame::GEOPOICreator, FXGroupBox, GEOPOICreatorMap, ARRAYNUMBER(GEOPOICreatorMap))
48 
49 
50 // ===========================================================================
51 // method definitions
52 // ===========================================================================
53 
54 // ---------------------------------------------------------------------------
55 // GNEPolygonFrame::GEOPOICreator - methods
56 // ---------------------------------------------------------------------------
57 
59  FXGroupBox(polygonFrameParent->myContentFrame, "GEO POI Creator", GUIDesignGroupBoxFrame),
60  myPolygonFrameParent(polygonFrameParent) {
61  // create RadioButtons for formats
62  myLonLatRadioButton = new FXRadioButton(this, "Format: Lon-Lat", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
63  myLatLonRadioButton = new FXRadioButton(this, "Format: Lat-Lon", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
64  // set lat-lon as default
65  myLatLonRadioButton->setCheck(TRUE);
66  // create text field for coordinates
67  myCoordinatesTextField = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
68  // create checkBox
69  myCenterViewAfterCreationCheckButton = new FXCheckButton(this, "Center View after creation", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
70  // create button for create GEO POIs
71  myCreateGEOPOIButton = new FXButton(this, "Create GEO POI (clipboard)", nullptr, this, MID_GNE_CREATE, GUIDesignButton);
72  // create information label
73  myLabelCartesianPosition = new FXLabel(this, "Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude", 0, GUIDesignLabelFrameInformation);
74 }
75 
76 
78 
79 
80 void
82  // check if there is an GEO Proj string is defined
83  if (GeoConvHelper::getFinal().getProjString() != "!") {
84  myCoordinatesTextField->enable();
85  myCoordinatesTextField->setText("");
86  myCoordinatesTextField->enable();
87  myCreateGEOPOIButton->enable();
88  } else {
89  myCoordinatesTextField->setText("No geo-conversion defined");
90  myCoordinatesTextField->disable();
91  myCreateGEOPOIButton->disable();
92  }
93  show();
94 }
95 
96 
97 void
99  hide();
100 }
101 
102 
103 long
105  // check if input contains spaces
106  std::string input = myCoordinatesTextField->getText().text();
107  std::string inputWithoutSpaces;
108  for (const auto& i : input) {
109  if (i != ' ') {
110  inputWithoutSpaces.push_back(i);
111  }
112  }
113  // if input contains spaces, call this function again, and in other case set red text color
114  if (input.size() != inputWithoutSpaces.size()) {
115  myCoordinatesTextField->setText(inputWithoutSpaces.c_str());
116  }
117  if (inputWithoutSpaces.size() > 0) {
118  myCreateGEOPOIButton->setText("Create GEO POI");
119  } else {
120  myCreateGEOPOIButton->setText("Create GEO POI (clipboard)");
121  }
122  // simply check if given value can be parsed to Position
123  if (GNEAttributeCarrier::canParse<Position>(myCoordinatesTextField->getText().text())) {
124  myCoordinatesTextField->setTextColor(FXRGB(0, 0, 0));
125  myCoordinatesTextField->killFocus();
126  // convert coordinates into lon-lat
127  Position geoPos = GNEAttributeCarrier::parse<Position>(myCoordinatesTextField->getText().text());
128  if (myLatLonRadioButton->getCheck() == TRUE) {
129  geoPos.swapXY();
130  }
132  // check if GEO Position has to be swapped
133  // update myLabelCartesianPosition
134  myLabelCartesianPosition->setText(("Cartesian equivalence:\n- X = " + toString(geoPos.x()) + "\n- Y = " + toString(geoPos.y())).c_str());
135  } else {
136  myCoordinatesTextField->setTextColor(FXRGB(255, 0, 0));
137  myLabelCartesianPosition->setText("Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude");
138  };
139  return 1;
140 }
141 
142 
143 long
144 GNEPolygonFrame::GEOPOICreator::onCmdSetFormat(FXObject* obj, FXSelector, void*) {
145  //disable other radio button depending of selected option
146  if (obj == myLonLatRadioButton) {
147  myLonLatRadioButton->setCheck(TRUE);
148  myLatLonRadioButton->setCheck(FALSE);
149  } else if (obj == myLatLonRadioButton) {
150  myLonLatRadioButton->setCheck(FALSE);
151  myLatLonRadioButton->setCheck(TRUE);
152  }
153  // in both cases call onCmdSetCoordinates(0,0,0) to set new cartesian equivalence
154  onCmdSetCoordinates(0, 0, 0);
155  return 1;
156 }
157 
158 
159 long
161  // first check if current GEO Position is valid
162  if (myPolygonFrameParent->myShapeAttributes->areValuesValid()) {
163  std::string geoPosStr = myCoordinatesTextField->getText().text();
164  if (geoPosStr.empty()) {
165  // use clipboard
166  WRITE_WARNING("Using clipboard");
167  geoPosStr = GUIUserIO::copyFromClipboard(*getApp());
168  myCoordinatesTextField->setText(geoPosStr.c_str());
169  // remove spaces, update cartesian value
170  onCmdSetCoordinates(0, 0, 0);
171  geoPosStr = myCoordinatesTextField->getText().text();
172  myCoordinatesTextField->setText("");
173  myCreateGEOPOIButton->setText("Create GEO POI (clipboard)");
174  }
175  if (GNEAttributeCarrier::canParse<Position>(geoPosStr)) {
176  // obtain shape attributes and values
177  auto valuesMap = myPolygonFrameParent->myShapeAttributes->getAttributesAndValues(true);
178  // obtain netedit attributes and values
179  myPolygonFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, nullptr);
180  // Check if ID has to be generated
181  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
182  valuesMap[SUMO_ATTR_ID] = myPolygonFrameParent->myViewNet->getNet()->generateShapeID(myPolygonFrameParent->myShapeTagSelector->getCurrentTagProperties().getTag());
183  }
184  // force GEO attribute to true and obain position
185  valuesMap[SUMO_ATTR_GEO] = "true";
186  Position geoPos = GNEAttributeCarrier::parse<Position>(geoPosStr);
187  // convert coordinates into lon-lat
188  if (myLatLonRadioButton->getCheck() == TRUE) {
189  geoPos.swapXY();
190  }
192  valuesMap[SUMO_ATTR_POSITION] = toString(geoPos);
193  // return ADDSHAPE_SUCCESS if POI was sucesfully created
194  if (myPolygonFrameParent->addPOI(valuesMap)) {
195  // check if view has to be centered over created GEO POI
196  if (myCenterViewAfterCreationCheckButton->getCheck() == TRUE) {
197  // create a boundary over given GEO Position and center view over it
198  Boundary centerPosition;
199  centerPosition.add(geoPos);
200  centerPosition = centerPosition.grow(10);
201  myPolygonFrameParent->myViewNet->getViewParent()->getView()->centerTo(centerPosition);
202  }
203  } else {
204  WRITE_WARNING("Could not create GEO POI");
205  }
206  }
207  // refresh shape attributes
208  myPolygonFrameParent->myShapeAttributes->refreshRows();
209  }
210  return 1;
211 }
212 
213 
214 // ---------------------------------------------------------------------------
215 // GNEPolygonFrame - methods
216 // ---------------------------------------------------------------------------
217 
218 GNEPolygonFrame::GNEPolygonFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
219  GNEFrame(horizontalFrameParent, viewNet, "Shapes") {
220 
221  // create item Selector modul for shapes
222  myShapeTagSelector = new GNEFrameModuls::TagSelector(this, GNEAttributeCarrier::TagType::TAGTYPE_SHAPE);
223 
224  // Create shape parameters
226 
227  // Create Netedit parameter
229 
230  // Create drawing controls
232 
234  myGEOPOICreator = new GEOPOICreator(this);
235 
236  // set polygon as default shape
238 }
239 
240 
242 }
243 
244 
245 void
247  // refresh item selector
249  // show frame
250  GNEFrame::show();
251 }
252 
253 
255 GNEPolygonFrame::processClick(const Position& clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor) {
256  // Declare map to keep values
257  std::map<SumoXMLAttr, std::string> valuesMap;
258  // check if current selected shape is valid
260  // show warning dialogbox and stop if input parameters are invalid
261  if (myShapeAttributes->areValuesValid() == false) {
263  return ADDSHAPE_INVALID;
264  }
265  // obtain shape attributes and values
266  valuesMap = myShapeAttributes->getAttributesAndValues(true);
267  // obtain netedit attributes and values
268  myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, objectsUnderCursor.getLaneFront());
269  // Check if ID has to be generated
270  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
272  }
273  // obtain position
274  valuesMap[SUMO_ATTR_POSITION] = toString(clickedPosition);
275  // set GEO Position as false (because we have created POI clicking over View
276  valuesMap[SUMO_ATTR_GEO] = "false";
277  // return ADDSHAPE_SUCCESS if POI was sucesfully created
278  if (addPOI(valuesMap)) {
279  // refresh shape attributes
281  return ADDSHAPE_SUCCESS;
282  } else {
283  return ADDSHAPE_INVALID;
284  }
286  // abort if lane is nullptr
287  if (objectsUnderCursor.getLaneFront() == nullptr) {
288  WRITE_WARNING(toString(SUMO_TAG_POILANE) + " can be only placed over lanes");
289  return ADDSHAPE_INVALID;
290  }
291  // show warning dialogbox and stop if input parameters are invalid
292  if (myShapeAttributes->areValuesValid() == false) {
294  return ADDSHAPE_INVALID;
295  }
296  // obtain shape attributes and values
297  valuesMap = myShapeAttributes->getAttributesAndValues(true);
298  // obtain netedit attributes and values
299  myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, objectsUnderCursor.getLaneFront());
300  // Check if ID has to be generated
301  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
303  }
304  // obtain Lane
305  valuesMap[SUMO_ATTR_LANE] = objectsUnderCursor.getLaneFront()->getID();
306  // obtain position over lane
307  valuesMap[SUMO_ATTR_POSITION] = toString(objectsUnderCursor.getLaneFront()->getLaneShape().nearest_offset_to_point2D(clickedPosition));
308  // return ADDSHAPE_SUCCESS if POI was sucesfully created
309  if (addPOILane(valuesMap)) {
310  // refresh shape attributes
312  return ADDSHAPE_SUCCESS;
313  } else {
314  return ADDSHAPE_INVALID;
315  }
317  if (myDrawingShape->isDrawing()) {
318  // add or delete a new point depending of flag "delete last created point"
321  } else {
322  myDrawingShape->addNewPoint(clickedPosition);
323  }
325  } else {
326  // return ADDSHAPE_NOTHING if is drawing isn't enabled
327  return ADDSHAPE_NOTHING;
328  }
329  } else {
330  myViewNet->setStatusBarText("Current selected shape isn't valid.");
331  return ADDSHAPE_INVALID;
332  }
333 }
334 
335 
336 std::string
337 GNEPolygonFrame::getIdsSelected(const FXList* list) {
338  // Obtain Id's of list
339  std::string vectorOfIds;
340  for (int i = 0; i < list->getNumItems(); i++) {
341  if (list->isItemSelected(i)) {
342  if (vectorOfIds.size() > 0) {
343  vectorOfIds += " ";
344  }
345  vectorOfIds += (list->getItem(i)->getText()).text();
346  }
347  }
348  return vectorOfIds;
349 }
350 
351 
354  return myDrawingShape;
355 }
356 
357 
358 bool
360  // show warning dialogbox and stop check if input parameters are valid
363  return false;
364  } else if (myDrawingShape->getTemporalShape().size() == 0) {
365  WRITE_WARNING("Polygon shape cannot be empty");
366  return false;
367  } else {
368  // Declare map to keep values
369  std::map<SumoXMLAttr, std::string> valuesMap = myShapeAttributes->getAttributesAndValues(true);
370  // obtain netedit attributes and values
372  // Check if ID has to be generated
373  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
375  }
376  // obtain shape and check if has to be closed
378  if (valuesMap[GNE_ATTR_CLOSE_SHAPE] == "true") {
379  temporalShape.closePolygon();
380  }
381  valuesMap[SUMO_ATTR_SHAPE] = toString(temporalShape);
382  // obtain geo (by default false)
383  valuesMap[SUMO_ATTR_GEO] = "false";
384  // return true if polygon was successfully created
385  if (addPolygon(valuesMap)) {
386  // refresh shape attributes
388  return true;
389  }
390  }
391  return false;
392 }
393 
394 
395 void
398  // if there are parmeters, show and Recalc groupBox
400  // show netedit attributes
402  // Check if drawing mode has to be shown
405  } else {
407  }
408  // Check if GEO POI Creator has to be shown
411  } else {
413  }
414  } else {
415  // hide all widgets
420  }
421 }
422 
423 
424 bool
425 GNEPolygonFrame::addPolygon(const std::map<SumoXMLAttr, std::string>& polyValues) {
426  // parse attributes from polyValues
427  std::string id = polyValues.at(SUMO_ATTR_ID);
428  std::string type = polyValues.at(SUMO_ATTR_TYPE);
429  RGBColor color = RGBColor::parseColor(polyValues.at(SUMO_ATTR_COLOR));
430  std::string layerStr = polyValues.at(SUMO_ATTR_LAYER);
431  double angle = GNEAttributeCarrier::parse<double>(polyValues.at(SUMO_ATTR_ANGLE));
432  std::string imgFile = polyValues.at(SUMO_ATTR_IMGFILE);
433  bool relativePath = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_RELATIVEPATH));
434  PositionVector shape = GNEAttributeCarrier::parse<PositionVector>(polyValues.at(SUMO_ATTR_SHAPE));
435  bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(SUMO_ATTR_FILL));
436  double lineWidth = GNEAttributeCarrier::parse<double>(polyValues.at(SUMO_ATTR_LINEWIDTH));
437  // parse layer
438  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER;
439  // create new Polygon only if number of shape points is greather than 2
441  if ((shape.size() > 0) && myViewNet->getNet()->addPolygon(id, type, color, layer, angle, imgFile, relativePath, shape, false, fill, lineWidth)) {
442  // set manually attributes use GEO, block movement and block shape
443  GNEPoly* polygon = myViewNet->getNet()->retrievePolygon(id);
447  return true;
448  } else {
449  // abort creation
451  return false;
452  }
453 }
454 
455 
456 bool
457 GNEPolygonFrame::addPOI(const std::map<SumoXMLAttr, std::string>& POIValues) {
458  // parse attributes from POIValues
459  std::string id = POIValues.at(SUMO_ATTR_ID);
460  std::string type = POIValues.at(SUMO_ATTR_TYPE);
461  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
462  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
463  Position pos = GNEAttributeCarrier::parse<Position>(POIValues.at(SUMO_ATTR_POSITION));
464  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
465  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
466  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
467  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
468  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
469  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
470  bool geo = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_GEO));
471  // create new POI
473  if (myViewNet->getNet()->addPOI(id, type, color, pos, geo, "", 0, 0, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
474  // Set manually the attribute block movement
475  GNEPOI* poi = myViewNet->getNet()->retrievePOI(id);
478  return true;
479  } else {
480  // abort creation
482  return false;
483  }
484 }
485 
486 
487 bool
488 GNEPolygonFrame::addPOILane(const std::map<SumoXMLAttr, std::string>& POIValues) {
489  // parse attributes from POIValues
490  std::string id = POIValues.at(SUMO_ATTR_ID);
491  std::string type = POIValues.at(SUMO_ATTR_TYPE);
492  RGBColor color = RGBColor::parseColor(POIValues.at(SUMO_ATTR_COLOR));
493  std::string layerStr = POIValues.at(SUMO_ATTR_LAYER);
494  double angle = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_ANGLE));
495  std::string imgFile = POIValues.at(SUMO_ATTR_IMGFILE);
496  bool relativePath = GNEAttributeCarrier::parse<bool>(POIValues.at(SUMO_ATTR_RELATIVEPATH));
497  GNELane* lane = myViewNet->getNet()->retrieveLane(POIValues.at(SUMO_ATTR_LANE));
498  double posLane = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION));
499  double posLat = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_POSITION_LAT));
500  double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_WIDTH));
501  double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(SUMO_ATTR_HEIGHT));
502  // parse layer
503  double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) : Shape::DEFAULT_LAYER_POI;
504  // create new POILane
506  if (myViewNet->getNet()->addPOI(id, type, color, Position(), false, lane->getID(), posLane, posLat, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
507  // Set manually the attribute block movement
509  POI->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, POIValues.at(GNE_ATTR_BLOCK_MOVEMENT), myViewNet->getUndoList());
511  return true;
512  } else {
513  // abort creation
515  return false;
516  }
517 }
518 
519 /****************************************************************************/
MID_GNE_CREATE
create element
Definition: GUIAppEnum.h:648
SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
SUMO_ATTR_ANGLE
Definition: SUMOXMLDefinitions.h:794
GNEPolygonFrame::GEOPOICreator::hideGEOPOICreatorModul
void hideGEOPOICreatorModul()
hide GEOPOICreator Modul
Definition: GNEPolygonFrame.cpp:98
GNEPolygonFrame::addPOI
bool addPOI(const std::map< SumoXMLAttr, std::string > &POIValues)
add POI
Definition: GNEPolygonFrame.cpp:457
GUIDesignTextFieldNCol
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:42
GNEFrameModuls::DrawingShape::showDrawingShape
void showDrawingShape()
show Drawing mode
Definition: GNEFrameModuls.cpp:1597
SUMO_ATTR_IMGFILE
Definition: SUMOXMLDefinitions.h:792
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
GNENet::retrievePOI
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:1115
SUMO_TAG_POLY
begin/end of the description of a polygon
Definition: SUMOXMLDefinitions.h:57
GNEPolygonFrame::myDrawingShape
GNEFrameModuls::DrawingShape * myDrawingShape
Drawing shape.
Definition: GNEPolygonFrame.h:159
GeoConvHelper::x2cartesian_const
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
Definition: GeoConvHelper.cpp:417
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:79
GNEPOI
Definition: GNEPOI.h:44
GNEFrameAttributesModuls::NeteditAttributes
Definition: GNEFrameAttributesModuls.h:714
GNEFrameModuls::DrawingShape::addNewPoint
void addNewPoint(const Position &P)
add new point to temporal shape
Definition: GNEFrameModuls.cpp:1656
GNEPolygonFrame::addPolygon
bool addPolygon(const std::map< SumoXMLAttr, std::string > &POIValues)
add Polygon
Definition: GNEPolygonFrame.cpp:425
GNEPolygonFrame::GNEPolygonFrame
GNEPolygonFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
Definition: GNEPolygonFrame.cpp:218
GNEFrameAttributesModuls::AttributesCreator
Definition: GNEFrameAttributesModuls.h:148
GNEPoly
Definition: GNEPoly.h:45
Shape::DEFAULT_LAYER
static const double DEFAULT_LAYER
Definition: Shape.h:43
GNEPolygonFrame::getIdsSelected
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
Definition: GNEPolygonFrame.cpp:337
GNEFrameAttributesModuls::AttributesCreator::areValuesValid
bool areValuesValid() const
check if parameters of attributes are valid
Definition: GNEFrameAttributesModuls.cpp:731
GNEViewNet::setStatusBarText
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:523
GNEFrame
Definition: GNEFrame.h:34
SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:704
SUMO_TAG_POI
begin/end of the description of a Point of interest
Definition: SUMOXMLDefinitions.h:53
GNEViewNet
Definition: GNEViewNet.h:42
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
GNEFrameModuls::DrawingShape::hideDrawingShape
void hideDrawingShape()
hide Drawing mode
Definition: GNEFrameModuls.cpp:1605
SUMO_TAG_NOTHING
invalid tag
Definition: SUMOXMLDefinitions.h:43
GUIDesigns.h
SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
GNEPolygonFrame.h
GUIDesignTextField
#define GUIDesignTextField
Definition: GUIDesigns.h:33
MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:646
GNEPolygonFrame::shapeDrawed
bool shapeDrawed()
build a shaped element using the drawed shape return true if was successfully created
Definition: GNEPolygonFrame.cpp:359
PositionVector
A list of positions.
Definition: PositionVector.h:45
GNEFrameModuls::DrawingShape::removeLastPoint
void removeLastPoint()
remove last added point
Definition: GNEFrameModuls.cpp:1666
GNEFrameModuls::DrawingShape::getDeleteLastCreatedPoint
bool getDeleteLastCreatedPoint()
get flag delete last created point
Definition: GNEFrameModuls.cpp:1690
GNEPolygonFrame::myShapeAttributes
GNEFrameAttributesModuls::AttributesCreator * myShapeAttributes
shape internal attributes
Definition: GNEPolygonFrame.h:153
GUIDesignButton
#define GUIDesignButton
Definition: GUIDesigns.h:50
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:523
GUIAppEnum.h
GNEFrameAttributesModuls::AttributesCreator::hideAttributesCreatorModul
void hideAttributesCreatorModul()
hide group box
Definition: GNEFrameAttributesModuls.cpp:659
GUIDesignLabelFrameInformation
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:194
GNEPolygonFrame::show
void show()
show Frame
Definition: GNEPolygonFrame.cpp:246
GNENet::generateShapeID
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
Definition: GNENet.cpp:2597
FXDEFMAP
FXDEFMAP(GNEPolygonFrame::GEOPOICreator) GEOPOICreatorMap[]
GNENet::retrievePolygon
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
Definition: GNENet.cpp:1102
GNEFrameAttributesModuls::AttributesCreator::getAttributesAndValues
std::map< SumoXMLAttr, std::string > getAttributesAndValues(bool includeAll) const
get attributes and their values
Definition: GNEFrameAttributesModuls.cpp:671
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
PositionVector::nearest_offset_to_point2D
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Definition: PositionVector.cpp:817
GNEPOI::setAttribute
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:308
RGBColor
Definition: RGBColor.h:39
SUMO_ATTR_LINEWIDTH
Definition: SUMOXMLDefinitions.h:715
GNEPolygonFrame::myGEOPOICreator
GEOPOICreator * myGEOPOICreator
GEOPOICreator.
Definition: GNEPolygonFrame.h:162
GeoConvHelper::getFinal
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
Definition: GeoConvHelper.h:105
GNEPolygonFrame::myShapeTagSelector
GNEFrameModuls::TagSelector * myShapeTagSelector
shape tag selector
Definition: GNEPolygonFrame.h:150
GNELane::getLaneShape
const PositionVector & getLaneShape() const
Definition: GNELane.cpp:86
SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
Definition: SUMOXMLDefinitions.h:55
GNEPolygonFrame::GEOPOICreator::onCmdSetCoordinates
long onCmdSetCoordinates(FXObject *, FXSelector, void *)
Definition: GNEPolygonFrame.cpp:104
GNEViewNetHelper::ObjectsUnderCursor
class used to group all variables related with objects under cursor after a click over view
Definition: GNEViewNetHelper.h:148
GNEFrameModuls::TagSelector
Definition: GNEFrameModuls.h:44
GNEPolygonFrame::AddShapeResult
AddShapeResult
enum with all possible values after try to create an shape using frame
Definition: GNEPolygonFrame.h:38
PositionVector::closePolygon
void closePolygon()
ensures that the last position equals the first
Definition: PositionVector.cpp:1231
GNEViewNet.h
RGBColor::parseColor
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:176
SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:386
GNEPolygonFrame::ADDSHAPE_INVALID
Definition: GNEPolygonFrame.h:41
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
SUMO_ATTR_LAYER
A layer number.
Definition: SUMOXMLDefinitions.h:712
GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
Definition: SUMOXMLDefinitions.h:985
GNEFrameModuls::DrawingShape
Definition: GNEFrameModuls.h:393
GUIDesignCheckButton
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:115
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
GNE_ATTR_BLOCK_SHAPE
block shape of a graphic element (Used mainly in GNEShapes)
Definition: SUMOXMLDefinitions.h:983
GNEFrame::myViewNet
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:121
GNEViewNet::getUndoList
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:1020
GNEPoly::setAttribute
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:667
GNEPolygonFrame::~GNEPolygonFrame
~GNEPolygonFrame()
Destructor.
Definition: GNEPolygonFrame.cpp:241
GUIDesignGroupBoxFrame
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:239
GNEFrameAttributesModuls::NeteditAttributes::showNeteditAttributesModul
void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties &tagValue)
show Netedit attributes modul
Definition: GNEFrameAttributesModuls.cpp:2537
GNEPolygonFrame::myNeteditAttributes
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
Definition: GNEPolygonFrame.h:156
GNEFrameModuls::TagSelector::getCurrentTagProperties
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
Definition: GNEFrameModuls.cpp:203
GNEPolygonFrame::GEOPOICreator
Definition: GNEPolygonFrame.h:49
SUMO_ATTR_RELATIVEPATH
Definition: SUMOXMLDefinitions.h:793
GNELane.h
GNENet::addPolygon
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.
Definition: GNENet.cpp:217
GNEFrameAttributesModuls::NeteditAttributes::getNeteditAttributesAndValues
bool getNeteditAttributesAndValues(std::map< SumoXMLAttr, std::string > &valuesMap, const GNELane *lane) const
fill valuesMap with netedit attributes
Definition: GNEFrameAttributesModuls.cpp:2594
SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
SUMO_ATTR_FILL
Fill the polygon.
Definition: SUMOXMLDefinitions.h:714
GNEPolygonFrame::ADDSHAPE_NOTHING
Definition: GNEPolygonFrame.h:42
GNEUndoList::p_abort
void p_abort()
reverts and discards ALL active command groups
Definition: GNEUndoList.cpp:93
GNEFrameAttributesModuls::AttributesCreator::refreshRows
void refreshRows()
refresh rows (called after creating an element)
Definition: GNEFrameAttributesModuls.cpp:744
GNEPolygonFrame::addPOILane
bool addPOILane(const std::map< SumoXMLAttr, std::string > &POIValues)
add POILane
Definition: GNEPolygonFrame.cpp:488
GNEViewParent.h
SUMO_ATTR_HEIGHT
Definition: SUMOXMLDefinitions.h:789
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEPoly.h
GNEFrameModuls::TagSelector::setCurrentTag
void setCurrentTag(SumoXMLTag newTag)
set current type manually
Definition: GNEFrameModuls.cpp:234
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
GUIUserIO.h
GNEPolygonFrame::GEOPOICreator::~GEOPOICreator
~GEOPOICreator()
destructor
Definition: GNEPolygonFrame.cpp:77
GNEPolygonFrame::processClick
AddShapeResult processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
Definition: GNEPolygonFrame.cpp:255
GNEPolygonFrame
Definition: GNEPolygonFrame.h:33
GNEFrameModuls::TagSelector::refreshTagProperties
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show
Definition: GNEFrameModuls.cpp:251
GUIDesignRadioButton
#define GUIDesignRadioButton
Definition: GUIDesigns.h:139
GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
Definition: SUMOXMLDefinitions.h:981
GNEPolygonFrame::ADDSHAPE_SUCCESS
Definition: GNEPolygonFrame.h:39
GNEPolygonFrame::getDrawingShapeModul
GNEFrameModuls::DrawingShape * getDrawingShapeModul() const
get drawing mode editor
Definition: GNEPolygonFrame.cpp:353
SUMO_ATTR_POSITION_LAT
Definition: SUMOXMLDefinitions.h:661
GNENet::addPOI
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:240
GNENet::retrieveLane
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1228
GNEFrameModuls::DrawingShape::isDrawing
bool isDrawing() const
return true if currently a shape is drawed
Definition: GNEFrameModuls.cpp:1678
GNEViewNetHelper::ObjectsUnderCursor::getLaneFront
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
Definition: GNEViewNetHelper.cpp:278
config.h
GNEPolygonFrame::ADDSHAPE_UPDATEDTEMPORALSHAPE
Definition: GNEPolygonFrame.h:40
Position::swapXY
void swapXY()
swap position X and Y
Definition: Position.h:274
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
GNEPOI.h
POI
C++ TraCI client API implementation.
GUIUserIO::copyFromClipboard
static std::string copyFromClipboard(const FXApp &app)
Copies text from the clipboard.
Definition: GUIUserIO.cpp:45
GNEFrameAttributesModuls::NeteditAttributes::hideNeteditAttributesModul
void hideNeteditAttributesModul()
hide Netedit attributes modul
Definition: GNEFrameAttributesModuls.cpp:2588
GNEUndoList::p_begin
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:72
GNEPolygonFrame::tagSelected
void tagSelected()
Tag selected in TagSelector.
Definition: GNEPolygonFrame.cpp:396
GNEFrame::show
virtual void show()
show Frame
Definition: GNEFrame.cpp:107
SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:690
GNEPolygonFrame::GEOPOICreator::onCmdSetFormat
long onCmdSetFormat(FXObject *, FXSelector, void *)
called when user select a format radio button
Definition: GNEPolygonFrame.cpp:144
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
Shape::DEFAULT_LAYER_POI
static const double DEFAULT_LAYER_POI
Definition: Shape.h:45
SUMO_ATTR_GEO
Definition: SUMOXMLDefinitions.h:816
GNEFrameAttributesModuls::AttributesCreator::showAttributesCreatorModul
void showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &tagProperties, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
Definition: GNEFrameAttributesModuls.cpp:603
GNEFrameAttributesModuls::AttributesCreator::showWarningMessage
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
Definition: GNEFrameAttributesModuls.cpp:704
GNEFrame::hide
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:116
GNEPolygonFrame::GEOPOICreator::showGEOPOICreatorModul
void showGEOPOICreatorModul()
Show list of GEOPOICreator Modul.
Definition: GNEPolygonFrame.cpp:81
GNENet.h
GNEFrameModuls::DrawingShape::getTemporalShape
const PositionVector & getTemporalShape() const
get Temporal shape
Definition: GNEFrameModuls.cpp:1672
GNEUndoList.h
MID_CHOOSEN_OPERATION
set type of selection
Definition: GUIAppEnum.h:510
GNEPolygonFrame::GEOPOICreator::onCmdCreateGEOPOI
long onCmdCreateGEOPOI(FXObject *, FXSelector, void *)
called when user type in search box
Definition: GNEPolygonFrame.cpp:160