Eclipse SUMO - Simulation of Urban MObility
GNEAdditional.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-2022 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 // A abstract class for representation of additional elements
19 /****************************************************************************/
20 #include <config.h>
21 
23 #include <netedit/GNENet.h>
24 #include <netedit/GNEViewNet.h>
25 #include <utils/gui/div/GLHelper.h>
31 
32 #include "GNEAdditional.h"
33 
34 // ===========================================================================
35 // member method definitions
36 // ===========================================================================
37 
38 GNEAdditional::GNEAdditional(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName,
39  const std::vector<GNEJunction*>& junctionParents,
40  const std::vector<GNEEdge*>& edgeParents,
41  const std::vector<GNELane*>& laneParents,
42  const std::vector<GNEAdditional*>& additionalParents,
43  const std::vector<GNEShape*>& shapeParents,
44  const std::vector<GNETAZElement*>& TAZElementParents,
45  const std::vector<GNEDemandElement*>& demandElementParents,
46  const std::vector<GNEGenericData*>& genericDataParents,
47  const std::map<std::string, std::string>& parameters) :
48  GUIGlObject(type, id),
49  GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
50  GNEPathManager::PathElement(GNEPathManager::PathElement::Options::ADDITIONAL_ELEMENT),
51  Parameterised(parameters),
52  myAdditionalName(additionalName) {
53  myIsTemplate = (id == "");
54 }
55 
56 
57 GNEAdditional::GNEAdditional(GNENet* net, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName,
58  const std::vector<GNEJunction*>& junctionParents,
59  const std::vector<GNEEdge*>& edgeParents,
60  const std::vector<GNELane*>& laneParents,
61  const std::vector<GNEAdditional*>& additionalParents,
62  const std::vector<GNEShape*>& shapeParents,
63  const std::vector<GNETAZElement*>& TAZElementParents,
64  const std::vector<GNEDemandElement*>& demandElementParents,
65  const std::vector<GNEGenericData*>& genericDataParents,
66  const std::map<std::string, std::string>& parameters) :
67  GUIGlObject(type, additionalParents.front()->getID()),
68  GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
69  GNEPathManager::PathElement(GNEPathManager::PathElement::Options::ADDITIONAL_ELEMENT),
70  Parameterised(parameters),
71  myAdditionalName(additionalName) {
72 }
73 
74 
76 
77 
78 void
79 GNEAdditional::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
80  // currently there isn't additionals with removable geometry points
81 }
82 
83 
84 const std::string&
86  return getMicrosimID();
87 }
88 
89 
92  return this;
93 }
94 
95 
96 const GUIGeometry&
98  return myAdditionalGeometry;
99 }
100 
101 
102 void
104  mySpecialColor = color;
105 }
106 
107 /*
108 void
109 GNEAdditional::writeAdditional(OutputDevice& device) const {
110  // first check if minimum number of children is correct
111  if ((myTagProperty.hasMinimumNumberOfChildren() || myTagProperty.hasMinimumNumberOfChildren()) && !checkChildAdditionalRestriction()) {
112  WRITE_WARNING(getTagStr() + " with ID='" + getID() + "' cannot be written");
113  } else {
114  // Open XML Tag or synonym Tag
115  device.openTag(myTagProperty.getXMLTag());
116  // iterate over attribute properties
117  for (const auto& attrProperty : myTagProperty) {
118  // obtain attribute value
119  const std::string attributeValue = getAttribute(attrProperty.getAttr());
120  // first check if attribute is optional but not vehicle classes
121  if (attrProperty.isOptional() && !attrProperty.isVClasses()) {
122  // Only write attributes with default value if is different from original
123  if (attrProperty.getDefaultValue() != attributeValue) {
124  // check if attribute must be written using a synonim
125  if (attrProperty.hasAttrSynonym()) {
126  device.writeAttr(attrProperty.getAttrSynonym(), attributeValue);
127  } else {
128  // SVC permissions uses their own writting function
129  if (attrProperty.isSVCPermission()) {
130  // disallow attribute musn't be written
131  if (attrProperty.getAttr() != SUMO_ATTR_DISALLOW) {
132  writePermissions(device, parseVehicleClasses(attributeValue));
133  }
134  } else if (myTagProperty.canMaskXYZPositions() && (attrProperty.getAttr() == SUMO_ATTR_POSITION)) {
135  // get position attribute and write it separate
136  Position pos = parse<Position>(getAttribute(SUMO_ATTR_POSITION));
137  device.writeAttr(SUMO_ATTR_X, toString(pos.x()));
138  device.writeAttr(SUMO_ATTR_Y, toString(pos.y()));
139  // write 0 only if is different from 0 (the default value)
140  if (pos.z() != 0) {
141  device.writeAttr(SUMO_ATTR_Z, toString(pos.z()));
142  }
143  } else {
144  device.writeAttr(attrProperty.getAttr(), attributeValue);
145  }
146  }
147  }
148  } else {
149  // Attributes without default values are always writted
150  if (attrProperty.hasAttrSynonym()) {
151  device.writeAttr(attrProperty.getAttrSynonym(), attributeValue);
152  } else {
153  // SVC permissions uses their own writting function
154  if (attrProperty.isSVCPermission()) {
155  // disallow attribute musn't be written
156  if (attrProperty.getAttr() != SUMO_ATTR_DISALLOW) {
157  writePermissions(device, parseVehicleClasses(attributeValue));
158  }
159  } else if (myTagProperty.canMaskXYZPositions() && (attrProperty.getAttr() == SUMO_ATTR_POSITION)) {
160  // get position attribute and write it separate
161  Position pos = parse<Position>(getAttribute(SUMO_ATTR_POSITION));
162  device.writeAttr(SUMO_ATTR_X, toString(pos.x()));
163  device.writeAttr(SUMO_ATTR_Y, toString(pos.y()));
164  // write 0 only if is different from 0 (the default value)
165  if (pos.z() != 0) {
166  device.writeAttr(SUMO_ATTR_Z, toString(pos.z()));
167  }
168  } else {
169  device.writeAttr(attrProperty.getAttr(), attributeValue);
170  }
171  }
172  }
173  }
174  // iterate over children and write it in XML (or in a different file)
175  if (myTagProperty.canWriteChildrenSeparate() && myTagProperty.hasAttribute(SUMO_ATTR_FILE) && !getAttribute(SUMO_ATTR_FILE).empty()) {
176  // we assume that rerouter values files is placed in the same folder as the additional file
177  OutputDevice& deviceChildren = OutputDevice::getDevice(FileHelpers::getFilePath(OptionsCont::getOptions().getString("additional-files")) + getAttribute(SUMO_ATTR_FILE));
178  deviceChildren.writeXMLHeader("rerouterValue", "additional_file.xsd");
179  // save children in a different filename
180  for (const auto& additionalChild : getChildAdditionals()) {
181  // avoid to write two times additionals that haben two parents (Only write as child of first parent)
182  if (additionalChild->getParentAdditionals().size() < 1) {
183  additionalChild->writeAdditional(deviceChildren);
184  } else if (myTagProperty.getTag() == additionalChild->getTagProperty().getParentTags().front()) {
185  additionalChild->writeAdditional(deviceChildren);
186  }
187  }
188  deviceChildren.close();
189  } else {
190  for (const auto& additionalChild : getChildAdditionals()) {
191  // avoid write symbols
192  if (!additionalChild->getTagProperty().isSymbol()) {
193  // avoid to write two times additionals that haben two parents (Only write as child of first parent)
194  if (additionalChild->getParentAdditionals().size() < 2) {
195  additionalChild->writeAdditional(device);
196  } else if (myTagProperty.getTag() == additionalChild->getTagProperty().getParentTags().front()) {
197  additionalChild->writeAdditional(device);
198  }
199  }
200  }
201  }
202  // write parameters (Always after children to avoid problems with additionals.xsd)
203  writeParams(device);
204  // Close tag
205  device.closeTag();
206  }
207 }
208 */
209 
210 bool
212  return true;
213 }
214 
215 
216 std::string
218  return "";
219 }
220 
221 
222 void
224  throw InvalidArgument(getTagStr() + " cannot fix any problem");
225 }
226 
227 
228 void
230  throw InvalidArgument(getTagStr() + " doesn't have an additional dialog");
231 }
232 
233 
234 double
236  return s.addSize.getExaggeration(s, this);
237 }
238 
239 
240 Boundary
242  return myAdditionalBoundary;
243 }
244 
245 
248  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
249  // build header
250  buildPopupHeader(ret, app);
251  // build menu command for center button and copy cursor position to clipboard
253  buildPositionCopyEntry(ret, false);
254  // buld menu commands for names
255  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
256  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
257  new FXMenuSeparator(ret);
258  // build selection and show parameters menu
261  // show option to open additional dialog
262  if (myTagProperty.hasDialog()) {
263  GUIDesigns::buildFXMenuCommand(ret, "Open " + getTagStr() + " Dialog", getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
264  new FXMenuSeparator(ret);
265  }
266  // Show position parameters
269  // Show menu command inner position
271  GUIDesigns::buildFXMenuCommand(ret, "Cursor position over additional shape: " + toString(innerPos), nullptr, nullptr, 0);
272  // If shape isn't empty, show menu command lane position
273  if (myAdditionalGeometry.getShape().size() > 0) {
274  const double lanePos = lane->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
275  GUIDesigns::buildFXMenuCommand(ret, "Cursor position over " + toString(SUMO_TAG_LANE) + ": " + toString(innerPos + lanePos), nullptr, nullptr, 0);
276  }
279  // Show menu command inner position
281  GUIDesigns::buildFXMenuCommand(ret, "Cursor position over additional shape: " + toString(innerPos), nullptr, nullptr, 0);
282  // If shape isn't empty, show menu command edge position
283  if (myAdditionalGeometry.getShape().size() > 0) {
284  const double edgePos = edge->getLanes().at(0)->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
285  GUIDesigns::buildFXMenuCommand(ret, "Mouse position over " + toString(SUMO_TAG_EDGE) + ": " + toString(innerPos + edgePos), nullptr, nullptr, 0);
286  }
287  } else {
288  GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
289  }
290  return ret;
291 }
292 
293 
296  // Create table
297  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
298  // Iterate over attributes
299  for (const auto& i : myTagProperty) {
300  // Add attribute and set it dynamic if aren't unique
301  if (i.isUnique()) {
302  ret->mkItem(i.getAttrStr().c_str(), false, getAttribute(i.getAttr()));
303  } else {
304  ret->mkItem(i.getAttrStr().c_str(), true, getAttribute(i.getAttr()));
305  }
306  }
307  // close building
308  ret->closeBuilding();
309  return ret;
310 }
311 
312 
313 const std::string&
315  return myAdditionalName;
316 }
317 
318 
319 void
321  // currently onle for E2 multilane detectors
323  // calculate path
325  }
326 }
327 
328 
329 void
330 GNEAdditional::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
331  // calculate E2Detector width
332  const double E2DetectorWidth = s.addSize.getExaggeration(s, lane);
333  // check if E2 can be drawn
334  if (s.drawAdditionals(E2DetectorWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
335  // calculate startPos
336  const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_POSITION);
337  // get endPos
338  const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
339  // declare path geometry
340  GUIGeometry E2Geometry;
341  // update pathGeometry depending of first and last segment
342  if (segment->isFirstSegment() && segment->isLastSegment()) {
343  E2Geometry.updateGeometry(lane->getLaneGeometry().getShape(),
344  geometryDepartPos, geometryEndPos, // extrem positions
345  Position::INVALID, Position::INVALID); // extra positions
346  } else if (segment->isFirstSegment()) {
347  E2Geometry.updateGeometry(lane->getLaneGeometry().getShape(),
348  geometryDepartPos, -1, // extrem positions
349  Position::INVALID, Position::INVALID); // extra positions
350  } else if (segment->isLastSegment()) {
351  E2Geometry.updateGeometry(lane->getLaneGeometry().getShape(),
352  -1, geometryEndPos, // extrem positions
353  Position::INVALID, Position::INVALID); // extra positions
354  } else {
355  E2Geometry = lane->getLaneGeometry();
356  }
357  // obtain color
359  // Start drawing adding an gl identificator
361  // push layer matrix
363  // Start with the drawing of the area traslating matrix to origin
364  glTranslated(0, 0, getType() + offsetFront);
365  // Set color
366  GLHelper::setColor(E2Color);
367  // draw geometry
368  GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), E2Geometry, E2DetectorWidth);
369  // draw geometry points
370  if (segment->isFirstSegment() && segment->isLastSegment()) {
371  drawLeftGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().front(), E2Geometry.getShapeRotations().front(), E2Color);
372  drawRightGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().back(), E2Geometry.getShapeRotations().back(), E2Color);
373  } else if (segment->isFirstSegment()) {
374  drawLeftGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().front(), E2Geometry.getShapeRotations().front(), E2Color);
375  } else if (segment->isLastSegment()) {
376  drawRightGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().back(), E2Geometry.getShapeRotations().back(), E2Color);
377  }
378  // Pop layer matrix
380  // Pop name
382  // draw additional ID
383  if (!s.drawForRectangleSelection) {
384  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
385  // check if this is the label segment
386  if (segment->isLabelSegment()) {
387  // calculate middle point
388  const double middlePoint = (E2Geometry.getShape().length2D() * 0.5);
389  // calculate position
390  const Position pos = E2Geometry.getShape().positionAtOffset2D(middlePoint);
391  // calculate rotation
392  const double rot = E2Geometry.getShape().rotationDegreeAtOffset(middlePoint);
393  // Start pushing matrix
395  // Traslate to position
396  glTranslated(pos.x(), pos.y(), getType() + offsetFront + 0.1);
397  // rotate over lane
399  // move
400  glTranslated(-1, 0, 0);
401  // scale text
402  glScaled(E2DetectorWidth, E2DetectorWidth, 1);
403  // draw E1 logo
404  GLHelper::drawText("E2 Multilane", Position(), .1, 1.5, RGBColor::BLACK);
405  // pop matrix
407  }
408  }
409  // check if shape dotted contour has to be drawn
411  // declare trim geometry to draw
412  const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? E2Geometry.getShape() : lane->getLaneShape();
413  // draw inspected dotted contour
416  }
417  // draw front dotted contour
418  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
420  }
421  }
422  }
423 }
424 
425 
426 void
427 GNEAdditional::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* /*segment*/, const double offsetFront) const {
428  // calculate E2Detector width
429  const double E2DetectorWidth = s.addSize.getExaggeration(s, fromLane);
430  // check if E2 can be drawn
431  if (s.drawAdditionals(E2DetectorWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
432  // get flag for show only contour
434  // Start drawing adding an gl identificator
436  // Add a draw matrix
438  // Start with the drawing of the area traslating matrix to origin
439  glTranslated(0, 0, getType() + offsetFront);
440  // Set color of the base
441  if (drawUsingSelectColor()) {
443  } else {
445  }
446  // draw lane2lane
447  if (fromLane->getLane2laneConnections().exist(toLane)) {
448  // check if draw only contour
449  if (onlyContour) {
451  } else {
453  }
454  } else {
455  // Set invalid person plan color
457  // calculate invalid geometry
458  const GUIGeometry invalidGeometry({fromLane->getLaneShape().back(), toLane->getLaneShape().front()});
459  // check if draw only contour
460  if (onlyContour) {
461  GUIGeometry::drawContourGeometry(invalidGeometry, (0.5 * E2DetectorWidth));
462  } else {
463  // draw invalid geometry
464  GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), invalidGeometry, (0.5 * E2DetectorWidth));
465  }
466  }
467  // Pop last matrix
469  // Pop name
471  // check if shape dotted contour has to be drawn
473  // draw lane2lane dotted geometry
474  if (fromLane->getLane2laneConnections().exist(toLane)) {
476  E2DetectorWidth, 1, false, false);
477  }
478  }
479  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
480  // draw lane2lane dotted geometry
481  if (fromLane->getLane2laneConnections().exist(toLane)) {
483  E2DetectorWidth, 1, false, false);
484  }
485  }
486  }
487 }
488 
489 // ---------------------------------------------------------------------------
490 // GNEAdditional - protected methods
491 // ---------------------------------------------------------------------------
492 
493 bool
494 GNEAdditional::isValidAdditionalID(const std::string& newID) const {
496  return true;
497  } else {
498  return false;
499  }
500 }
501 
502 
503 bool
504 GNEAdditional::isValidDetectorID(const std::string& newID) const {
506  return true;
507  } else {
508  return false;
509  }
510 }
511 
512 
513 void
516  // calculate middle point
517  const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
518  // calculate position
520  // calculate rotation
521  const double rot = (myAdditionalGeometry.getShape().size() == 1) ? myAdditionalGeometry.getShapeRotations().front() : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint);
522  // draw additional ID
525  } else {
527  }
528  }
529 }
530 
531 
532 void
535  // calculate middle point
536  const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
537  // calculate position
539  // calculate rotation
540  const double rot = (myAdditionalGeometry.getShape().size() == 1) ? myAdditionalGeometry.getShapeRotations().front() : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint);
541  // draw additional name
544  } else {
546  }
547  }
548 }
549 
550 
551 void
553  replaceParentElements(this, parse<std::vector<GNEEdge*> >(getNet(), value));
554 }
555 
556 
557 void
559  replaceParentElements(this, parse<std::vector<GNELane*> >(getNet(), value));
560 }
561 
562 
563 void
565  replaceChildElements(this, parse<std::vector<GNEEdge*> >(getNet(), value));
566 }
567 
568 
569 void
571  replaceChildElements(this, parse<std::vector<GNELane*> >(getNet(), value));
572 }
573 
574 
575 void
576 GNEAdditional::replaceAdditionalParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
577  std::vector<GNEAdditional*> parentAdditionals;
578  // special case for calibrators and routeprobes
579  if (value.size() > 0) {
580  parentAdditionals = getParentAdditionals();
581  if ((parentAdditionals.size() == 0) && (parentIndex == 0)) {
582  parentAdditionals.push_back(myNet->getAttributeCarriers()->retrieveAdditional(tag, value));
583  } else {
584  parentAdditionals[parentIndex] = myNet->getAttributeCarriers()->retrieveAdditional(tag, value);
585  }
586  }
587  // replace parent additionals
588  replaceParentElements(this, parentAdditionals);
589 }
590 
591 
592 void
593 GNEAdditional::replaceDemandElementParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
594  std::vector<GNEDemandElement*> parentDemandElements = getParentDemandElements();
595  parentDemandElements[parentIndex] = myNet->getAttributeCarriers()->retrieveDemandElement(tag, value);
596  // replace parent demand elements
597  replaceParentElements(this, parentDemandElements);
598 }
599 
600 
601 void
603  // get new lane parent vector
604  std::vector<GNELane*> newLane = {getParentLanes().front()->getParentEdge()->getLanes().at(getParentLanes().front()->getIndex() + 1)};
605  // replace parent elements
606  replaceParentElements(this, newLane);
607 }
608 
609 
610 void
611 GNEAdditional::calculatePerpendicularLine(const double endLaneposition) {
612  if (getParentEdges().empty()) {
613  throw ProcessError("Invalid number of edges");
614  } else {
615  // get lanes
616  const GNELane* firstLane = getParentEdges().front()->getLanes().front();
617  const GNELane* lastLane = getParentEdges().front()->getLanes().back();
618  // get first and back lane shapes
619  PositionVector firstLaneShape = firstLane->getLaneShape();
620  PositionVector lastLaneShape = lastLane->getLaneShape();
621  // move shapes
622  firstLaneShape.move2side((firstLane->getParentEdge()->getNBEdge()->getLaneWidth(firstLane->getIndex()) * 0.5) + 1);
623  lastLaneShape.move2side(lastLane->getParentEdge()->getNBEdge()->getLaneWidth(lastLane->getIndex()) * -0.5);
624  // calculate lane postion
625  const double lanePosition = firstLaneShape.length2D() >= endLaneposition ? endLaneposition : firstLaneShape.length2D();
626  // update geometry
627  myAdditionalGeometry.updateGeometry({firstLaneShape.positionAtOffset2D(lanePosition), lastLaneShape.positionAtOffset2D(lanePosition)});
628  }
629 }
630 
631 
632 void
633 GNEAdditional::drawSquaredAdditional(const GUIVisualizationSettings& s, const Position& pos, const double size, GUITexture texture, GUITexture selectedTexture) const {
634  // Obtain drawing exaggeration
635  const double exaggeration = getExaggeration(s);
636  // first check if additional has to be drawn
637  if (s.drawAdditionals(exaggeration) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
638  // check if boundary has to be drawn
639  if (s.drawBoundaries) {
641  }
642  // Start drawing adding an gl identificator
644  // Add layer matrix
646  // translate to front
648  // translate to position
649  glTranslated(pos.x(), pos.y(), 0);
650  // scale
651  glScaled(exaggeration, exaggeration, 1);
652  // set White color
653  glColor3d(1, 1, 1);
654  // rotate
655  glRotated(180, 0, 0, 1);
656  // draw texture
657  if (drawUsingSelectColor()) {
659  } else {
661  }
662  // Pop layer matrix
664  // Pop name
666  // draw lock icon
667  GNEViewNetHelper::LockIcon::drawLockIcon(this, getType(), pos, exaggeration, 0.4, 0.5, 0.5);
668  // check if dotted contour has to be drawn
671  }
672  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
674  }
675  // Draw additional ID
676  drawAdditionalID(s);
677  // draw additional name
679  }
680 }
681 
682 
683 void
684 GNEAdditional::drawListedAddtional(const GUIVisualizationSettings& s, const Position& parentPosition, const int offsetX, const int extraOffsetY,
685  const RGBColor baseCol, const RGBColor textCol, GUITexture texture, const std::string text) const {
686  // first check if additional has to be drawn
688  // declare offsets
689  const double lineOffset = 0.1875;
690  const double baseOffsetX = 6.25;
691  const double baseOffsetY = 0.6;
692  // get draw position index
693  const int drawPositionIndex = getDrawPositionIndex();
694  // calculate lineA position (from parent to middle)
695  Position positionLineA = parentPosition;
696  const double positionLineA_Y = (0 - extraOffsetY + baseOffsetY);
697  // set position depending of indexes
698  positionLineA.add(1 + lineOffset + (baseOffsetX * offsetX), positionLineA_Y, 0);
699  // calculate lineC position (From middle until current listenAdditional
700  Position positionLineB = parentPosition;
701  const double positionLineB_Y = ((drawPositionIndex * -1) - extraOffsetY + baseOffsetY);
702  // set position depending of indexes
703  positionLineB.add(1 + lineOffset + (baseOffsetX * offsetX) + (2 * lineOffset), positionLineB_Y, 0);
704  // calculate signPosition position
705  Position signPosition = parentPosition;
706  // set position depending of indexes
707  signPosition.add(4.5 + (baseOffsetX * offsetX), (drawPositionIndex * -1) - extraOffsetY + 1, 0);
708  // check if boundary has to be drawn
709  if (s.drawBoundaries) {
711  }
712  // Start drawing adding an gl identificator
714  // calculate colors
716  const RGBColor secondColor = baseColor.changedBrightness(-30);
718  // Add layer matrix
720  // translate to front
722  // set line color
724  // draw both lines
725  GLHelper::drawBoxLine(positionLineA, 0, 0.1, lineOffset);
726  GLHelper::drawBoxLine(positionLineB, 0, 0.1, lineOffset);
727  // check if draw middle lane
728  if (drawPositionIndex != 0) {
729  // calculate length
730  const double lenght = std::abs(positionLineA_Y - positionLineB_Y);
731  // push middle lane matrix
733  //move and rotate
734  glTranslated(positionLineA.x() + lineOffset, positionLineA.y(), 0);
735  glRotated(90, 0, 0, 1);
736  glTranslated((lenght * -0.5), 0, 0);
737  // draw line
738  GLHelper::drawBoxLine(Position(0, 0), 0, 0.1, lenght * 0.5);
739  // pop middle lane matrix
741  }
742  // draw extern rectangle
743  GLHelper::setColor(secondColor);
744  GLHelper::drawBoxLine(signPosition, 0, 0.96, 2.75);
745  // move to front
746  glTranslated(0, -0.06, 0.1);
747  // draw intern rectangle
748  GLHelper::setColor(baseColor);
749  GLHelper::drawBoxLine(signPosition, 0, 0.84, 2.69);
750  // move position down
751  signPosition.add(-2, -0.43, 0);
752  // draw interval
753  GLHelper::drawText(adjustListedAdditionalText(text), signPosition, .1, 0.5, textColor, 0, (FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE));
754  // move to icon position
755  signPosition.add(-0.3, 0);
756  // check if draw lock icon or rerouter interval icon
758  // pop layer matrix
760  // Pop name
762  // draw lock icon
763  GNEViewNetHelper::LockIcon::drawLockIcon(this, getType(), signPosition, 1, 0.4, 0.0, -0.05);
764  } else {
765  // translate to front
766  glTranslated(signPosition.x(), signPosition.y(), 0.1);
767  // set White color
768  glColor3d(1, 1, 1);
769  // rotate
770  glRotated(180, 0, 0, 1);
771  // draw texture
773  // pop layer matrix
775  // Pop name
777  }
778  // check if dotted contour has to be drawn
781  }
782  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
784  }
785  }
786 }
787 
788 
789 void
791  //
792 }
793 
794 
795 void
797  //
798 }
799 
800 
801 bool
803  return false;
804 }
805 
806 
807 GNELane*
809  return getParentLanes().front();
810 }
811 
812 
813 GNELane*
815  return getParentLanes().back();
816 }
817 
818 
819 double
821  return 0; // CHECK
822 }
823 
824 
825 Position
827  return Position(); // CHECK
828 }
829 
830 
831 double
833  return 0; // CHECK
834 }
835 
836 
837 Position
839  return Position();
840 }
841 
842 
843 const std::map<std::string, std::string>&
845  return getParametersMap();
846 }
847 
848 
849 void
850 GNEAdditional::drawParentChildLines(const GUIVisualizationSettings& s, const RGBColor& color, const bool onlySymbols) const {
851  // check if current additional is inspected, front or selected
852  const bool currentDrawEntire = myNet->getViewNet()->isAttributeCarrierInspected(this) ||
854  // push layer matrix
856  // translate to parentChildLine layer
857  glTranslated(0, 0, GLO_PARENTCHILDLINE);
858  // iterate over parent additionals
859  for (const auto& parent : getParentAdditionals()) {
860  // get inspected flag
861  const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(parent);
862  // draw parent lines
863  GUIGeometry::drawParentLine(s, getPositionInView(), parent->getPositionInView(),
864  (isAttributeCarrierSelected() || parent->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
865  currentDrawEntire || inspected || parent->isAttributeCarrierSelected());
866  }
867  // special case for Parking area reroutes
868  if (getTagProperty().getTag() == SUMO_TAG_REROUTER) {
869  // iterate over rerouter elements
870  for (const auto& rerouterInterval : getChildAdditionals()) {
871  for (const auto& rerouterElement : rerouterInterval->getChildAdditionals()) {
872  if (rerouterElement->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
873  // get parking area
874  const auto parkingArea = rerouterElement->getParentAdditionals().at(1);
875  // get inspected flag
876  const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(parkingArea);
877  // draw parent lines
878  GUIGeometry::drawParentLine(s, getPositionInView(), parkingArea->getPositionInView(),
879  (isAttributeCarrierSelected() || parkingArea->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
880  currentDrawEntire || inspected || parkingArea->isAttributeCarrierSelected());
881  }
882  }
883  }
884  }
885  // iterate over child additionals
886  for (const auto& child : getChildAdditionals()) {
887  // get inspected flag
888  const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(child);
889  // special case for parking zone reroute
890  if (child->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
891  // draw child line between parking area and rerouter
892  GUIGeometry::drawChildLine(s, getPositionInView(), child->getParentAdditionals().front()->getParentAdditionals().front()->getPositionInView(),
893  (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
894  currentDrawEntire || inspected || child->isAttributeCarrierSelected());
895  } else if (!onlySymbols || child->getTagProperty().isSymbol()) {
896  // draw child line
897  GUIGeometry::drawChildLine(s, getPositionInView(), child->getPositionInView(),
898  (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
899  currentDrawEntire || inspected || child->isAttributeCarrierSelected());
900  }
901  }
902  // pop layer matrix
904 }
905 
906 
907 void
908 GNEAdditional::drawUpGeometryPoint(const GNEViewNet* viewNet, const Position& pos, const double rot, const RGBColor& baseColor) {
909  drawSemiCircleGeometryPoint(viewNet, pos, rot, baseColor, -90, 90);
910 }
911 
912 
913 void
914 GNEAdditional::drawDownGeometryPoint(const GNEViewNet* viewNet, const Position& pos, const double rot, const RGBColor& baseColor) {
915  drawSemiCircleGeometryPoint(viewNet, pos, rot, baseColor, 90, 270);
916 }
917 
918 
919 void
920 GNEAdditional::drawLeftGeometryPoint(const GNEViewNet* viewNet, const Position& pos, const double rot, const RGBColor& baseColor) {
921  drawSemiCircleGeometryPoint(viewNet, pos, rot, baseColor, -90, 90);
922 }
923 
924 
925 void
926 GNEAdditional::drawRightGeometryPoint(const GNEViewNet* viewNet, const Position& pos, const double rot, const RGBColor& baseColor) {
927  drawSemiCircleGeometryPoint(viewNet, pos, rot, baseColor, 270, 90);
928 }
929 
930 
931 int
933  // filter symbols
934  std::vector<GNEAdditional*> children;
935  for (const auto& child : getParentAdditionals().front()->getChildAdditionals()) {
936  if (!child->getTagProperty().isSymbol()) {
937  children.push_back(child);
938  }
939  }
940  // now get index
941  for (int i = 0; i < (int)children.size(); i++) {
942  if (children.at(i) == this) {
943  return i;
944  }
945  }
946  return 0;
947 }
948 
949 
950 bool
952  // throw exception because this function mus be implemented in child (see GNEE3Detector)
953  throw ProcessError("Calling non-implemented function checkChildAdditionalRestriction during saving of " + getTagStr() + ". It muss be reimplemented in child class");
954 }
955 
956 
957 void
958 GNEAdditional::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
959  // nothing to toogle in Additionals
960 }
961 
962 
963 void
964 GNEAdditional::drawSemiCircleGeometryPoint(const GNEViewNet* viewNet, const Position& pos, const double rot, const RGBColor& baseColor,
965  const double fromAngle, const double toAngle) {
966  // first check that we're in move mode and shift key is pressed
969  // calculate new color
970  const RGBColor color = baseColor.changedBrightness(-50);
971  // push matrix
973  // translated to front
974  glTranslated(0, 0, 0.1);
975  // set color
976  GLHelper::setColor(color);
977  // push geometry point matrix
979  // translate and rotate
980  glTranslated(pos.x(), pos.y(), 0.1);
981  glRotated(rot, 0, 0, 1);
982  // draw geometry point
984  viewNet->getVisualisationSettings().getCircleResolution(), fromAngle, toAngle);
985  // pop geometry point matrix
987  // pop draw matrix
989  }
990 }
991 
992 
993 std::string
994 GNEAdditional::adjustListedAdditionalText(const std::string& text) const {
995  // 10 + 3 + 10
996  if (text.size() <= 23) {
997  return text;
998  } else {
999  // get text size
1000  const int textPosition = (int)text.size() - 10;
1001  // declare strings
1002  std::string partA, partB;
1003  // resize
1004  partA.reserve(10);
1005  partB.reserve(10);
1006  // fill both
1007  for (int i = 0; i < 10; i++) {
1008  partA.push_back(text.at(i));
1009  partB.push_back(text.at(textPosition + i));
1010  }
1011  // return composition
1012  return (partA + "..." + partB);
1013  }
1014 }
1015 
1016 /****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:413
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:423
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:411
GUIGlObjectType
@ GLO_MAX
empty max
@ GLO_E3DETECTOR
a E3 detector
@ GLO_PARENTCHILDLINE
line between parent and childrens
GUITexture
An enumeration of gifs used by the gui applications.
Definition: GUITextures.h:31
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ GNE_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LANE
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_POSITION
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:801
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:431
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:231
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition: GLHelper.cpp:609
static void drawRightGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw right geometry point
const std::string & getID() const
get ID
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNELane * getLastPathLane() const
get last path lane
virtual bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
static void drawDownGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw down geometry point
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
double getPathElementArrivalValue() const
get path element arrival lane pos
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
std::string adjustListedAdditionalText(const std::string &text) const
adjust listed addtitional text
virtual void openAdditionalDialog()
open Additional Dialog
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void replaceAdditionalChildLanes(const std::string &value)
replace additional child lanes
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
GNELane * getFirstPathLane() const
get first path lane
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
double getPathElementDepartValue() const
get path element depart lane pos
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void calculatePerpendicularLine(const double endLaneposition)
calculate perpendicular line between lane parents
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
std::string myAdditionalName
name of additional
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
virtual void fixAdditionalProblem()
fix additional problem (by default throw an exception, has to be reimplemented in children)
void setSpecialColor(const RGBColor *color)
set special color
static void drawSemiCircleGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const double fromAngle, const double toAngle)
draw geometry point
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
GNEAdditional(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName, const std::vector< GNEJunction * > &junctionParents, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNEShape * > &shapeParents, const std::vector< GNETAZElement * > &TAZElementParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents, const std::map< std::string, std::string > &parameters)
Constructor.
void drawSquaredAdditional(const GUIVisualizationSettings &s, const Position &pos, const double size, GUITexture texture, GUITexture selectedTexture) const
draw squared additional
virtual bool checkChildAdditionalRestriction() const
check restriction with the number of children
void replaceAdditionalChildEdges(const std::string &value)
replace additional child edges
void drawListedAddtional(const GUIVisualizationSettings &s, const Position &parentPosition, const int offsetX, const int extraOffsetY, const RGBColor baseCol, const RGBColor textCol, GUITexture texture, const std::string text) const
draw listed additional
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void computePathElement()
compute pathElement
Position getPathElementDepartPos() const
get path element depart position
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
int getDrawPositionIndex() const
get draw position index (used in rerouters and VSS)
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
Boundary myAdditionalBoundary
Additional Boundary.
virtual void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
~GNEAdditional()
Destructor.
const std::string & getOptionalAdditionalName() const
Returns the additional name.
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object (lane)
bool isAttributeComputed(SumoXMLAttr key) const
Position getPathElementArrivalPos() const
get path element arrival position
virtual Position getPositionInView() const =0
Returns position of additional in view.
static void drawUpGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw up geometry point
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position (Currently unused in shapes)
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
virtual std::string getAdditionalProblem() const
return a string with the current additional problem (by default empty, can be reimplemented in childr...
static void drawLeftGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw left geometry point
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool myIsTemplate
whether the current object is a template object (not drawn in the view)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
FXIcon * getIcon() const
get FXIcon associated to this AC
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:435
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:782
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
void replaceParentElements(T *elementChild, const U &newParents)
replace parent elements
void replaceChildElements(T *elementChild, const U &newChildren)
replace child elements
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:838
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:797
const GUIGeometry & getLaneGeometry() const
Definition: GNELane.cpp:125
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:113
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
bool isLabelSegment() const
check if segment is label segment
bool isLastSegment() const
check if segment is the last path's segment
bool isFirstSegment() const
check if segment is the first path's segment
void calculateConsecutivePathLanes(PathElement *pathElement, const std::vector< GNELane * > lanes)
calculate consecutive path lanes
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:537
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:513
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed modul
Definition: GNEViewNet.cpp:543
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
The popup menu of a globject.
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
static void drawChildLine(const GUIVisualizationSettings &s, const Position &child, const Position &parent, const RGBColor &color, const bool drawEntire)
draw line between child and parent (used in NETEDIT)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
static void drawContourGeometry(const GUIGeometry &geometry, const double width, const bool drawExtremes=false)
draw contour geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
static void drawParentLine(const GUIVisualizationSettings &s, const Position &parent, const Position &child, const RGBColor &color, const bool drawEntire)
draw line between parent and children (used in NETEDIT)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
bool drawBoundaries
enable or disable draw boundaries
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationSizeSettings addSize
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationTextSettings addFullName
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
GUIVisualizationDetectorSettings detectorSettings
Detector settings.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:630
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:293
double x() const
Returns the x-position.
Definition: Position.h:55
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:125
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor BLACK
Definition: RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:197
static const RGBColor RED
named colors
Definition: RGBColor.h:185
static bool isValidAdditionalID(const std::string &value)
whether the given string is a valid id for an additional object
static bool isValidDetectorID(const std::string &value)
whether the given string is a valid id for an detector
@ FONS_ALIGN_MIDDLE
Definition: fontstash.h:47
@ FONS_ALIGN_LEFT
Definition: fontstash.h:42
bool showAdditionals() const
check if additionals has to be drawn
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
static bool checkDrawing(const GNEAttributeCarrier *AC, GUIGlObjectType type, const double exaggeration)
check if icon can be drawn
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool showConnections() const
check if select show connections checkbox is enabled
static const RGBColor connectionColor
connection color
static const RGBColor connectionColorSelected
connection color selected
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const RGBColor E2Color
color for E2 detectors
static const double additionalGeometryPointRadius
moving additional geometry point radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size