63 int numberOfSegments = (int)
shape.size() - 1;
65 if (numberOfSegments >= 0) {
70 for (
int i = 0; i < numberOfSegments; ++i) {
165 if (numberOfSegments >= 0) {
167 for (
int i = 0; i < numberOfSegments; ++i) {
177 myShapeSegments[i].rotation = ((double)atan2((s.
x() - f.
x()), (f.
y() - s.
y())) * (double) 180.0 / (
double)
M_PI);
184 std::vector<GNEDemandElement::DemandElementSegmentGeometry::Segment>::const_iterator
190 std::vector<GNEDemandElement::DemandElementSegmentGeometry::Segment>::const_iterator
224 std::vector<GNEEdge*>
227 std::vector<GNEEdge*> solution;
229 if (partialEdges.size() == 1) {
231 solution.push_back(partialEdges.front());
234 NBVehicle tmpVehicle(
"temporalNBVehicle", vClass);
236 GNENet* net = partialEdges.front()->getNet();
238 for (
int i = 1; i < (int)partialEdges.size(); i++) {
240 std::vector<const NBRouterEdge*> partialRoute;
241 myDijkstraRouter->
compute(partialEdges.at(i - 1)->getNBEdge(), partialEdges.at(i)->getNBEdge(), &tmpVehicle, 10, partialRoute);
243 for (
const auto& j : partialRoute) {
249 auto solutionIt = solution.begin();
251 while (solutionIt != solution.end()) {
252 if ((solutionIt + 1) != solution.end()) {
254 if (*solutionIt == *(solutionIt + 1)) {
255 solutionIt = solution.erase(solutionIt);
267 std::vector<GNEEdge*>
270 std::vector<GNEEdge*> partialEdges;
271 partialEdges.reserve(partialEdgesStr.size());
273 for (
const auto& i : partialEdgesStr) {
309 const std::vector<GNEEdge*>& edgeParents,
310 const std::vector<GNELane*>& laneParents,
311 const std::vector<GNEShape*>& shapeParents,
312 const std::vector<GNEAdditional*>& additionalParents,
313 const std::vector<GNEDemandElement*>& demandElementParents,
314 const std::vector<GNEEdge*>& edgeChildren,
315 const std::vector<GNELane*>& laneChildren,
316 const std::vector<GNEShape*>& shapeChildren,
317 const std::vector<GNEAdditional*>& additionalChildren,
318 const std::vector<GNEDemandElement*>& demandElementChildren) :
328 const std::vector<GNEEdge*>& edgeParents,
329 const std::vector<GNELane*>& laneParents,
330 const std::vector<GNEShape*>& shapeParents,
331 const std::vector<GNEAdditional*>& additionalParents,
332 const std::vector<GNEDemandElement*>& demandElementParents,
333 const std::vector<GNEEdge*>& edgeChildren,
334 const std::vector<GNELane*>& laneChildren,
335 const std::vector<GNEShape*>& shapeChildren,
336 const std::vector<GNEAdditional*>& additionalChildren,
337 const std::vector<GNEDemandElement*>& demandElementChildren) :
453 new FXMenuCommand(ret, (
"Copy " +
getTagStr() +
" name to clipboard").c_str(),
nullptr, ret,
MID_COPY_NAME);
455 new FXMenuSeparator(ret);
462 new FXMenuSeparator(ret);
490 if (edges.size() == 0) {
493 }
else if (edges.size() == 1) {
498 auto it = edges.begin();
499 while (it != edges.end() - 1) {
503 if (currentEdge->
getID() == nextEdge->
getID()) {
512 "' ins't consecutive to " + nextEdge->
getTagStr() +
" '" + nextEdge->
getID() +
"'");
573 throw ProcessError(
"Calling non-implemented function checkDemandElementChildRestriction during saving of " +
getTagStr() +
". It muss be reimplemented in child class");
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
struct for pack all variables related with geometry of elemements divided in segments ...
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
static bool isRouteValid(const std::vector< GNEEdge *> &edges, bool report)
check if a route is valid
Copy object name - popup entry.
DemandElementGeometry myDemandElementGeometry
demand element geometry
An special type of Attribute carrier that owns hierarchical elements.
void clearGeometry()
reset geometry
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge *> &partialEdges) const
calculate Dijkstra route between a list of partial edges
SumoXMLTag
Numbers representing SUMO-XML - element names.
A structure which describes a connection between edges or lanes.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
GNEDemandElement(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, const std::vector< GNEEdge *> &edgeParents, const std::vector< GNELane *> &laneParents, const std::vector< GNEShape *> &shapeParents, const std::vector< GNEAdditional *> &additionalParents, const std::vector< GNEDemandElement *> &demandElementParents, const std::vector< GNEEdge *> &edgeChildren, const std::vector< GNELane *> &laneChildren, const std::vector< GNEShape *> &shapeChildren, const std::vector< GNEAdditional *> &additionalChildren, const std::vector< GNEDemandElement *> &demandElementChildren)
Constructor.
Segment(const GNEDemandElement *_element, const GNEEdge *_edge, const Position _pos, const bool _visible, const bool _valid)
parameter constructor for edges
virtual void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children) ...
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNetBuilder * getNetBuilder() const
get net builder
virtual std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
DemandElementGeometry()
constructor
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
const GNEDemandElement * element
element
virtual Position getPositionInView() const =0
Returns position of demand element in view.
double y() const
Returns the y-position.
The representation of a single edge during network building.
bool geometryDeprecated
mark geometry as deprecated (used to avoid multiple updates)
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
double x() const
Returns the x-position.
void insertEdgeLengthRotSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, double length, double rotation, const bool visible, const bool valid)
insert edge segment with length and rotation (used to avoid unnecessary calculation in calculateParti...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
class used to calculate routes in nets
FXIcon * getIcon() const
get FXIcon associated to this AC
A NBNetBuilder extended by visualisation and editing capabilities.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
void changeDemandElementID(const std::string &newID)
change ID of demand element
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
const GNEJunction * junction
junction
PositionVector shape
The shape of the additional element.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
#define WRITE_WARNING(msg)
~RouteCalculator()
destructor
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const DemandElementGeometry & getDemandElementGeometry() const
get demand element geometry
NBEdge * getNBEdge() const
returns the internal NBEdge
RouterEdgeVector getAllRouterEdges() const
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
An special type of Attribute carrier that owns hierarchical elements.
static void createRouteCalculatorInstance(GNENet *net)
create instance of RouteCalculator
static double getTravelTimeStatic(const NBRouterEdge *const edge, const NBVehicle *const, double)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Computes the shortest path through a network using the Dijkstra algorithm.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
~GNEDemandElement()
Destructor.
int getNumberOfAttributes() const
get number of attributes
A point in 2D or 3D with translation and scaling methods.
DemandElementSegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
std::vector< double > shapeLengths
The lengths of the single shape parts.
NBEdgeCont & getEdgeCont()
Supermode currentSupermode
the current supermode
GNENet * myNet
pointer to net
void markSegmentGeometryDeprecated()
mark demand element segment geometry as deprecated
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
void calculatePartialShapeRotationsAndLengths()
calculate partial shape, rotations and lengths
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E *> &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
const std::string & getDemandElementID() const
returns DemandElement ID
void updateDemandElementID(const std::string &oldID, GNEDemandElement *demandElement)
update demand element ID in container
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
A vehicle as used by router.
void insertEdgeSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, const bool visible, const bool valid)
insert edge segment
const std::string getID() const
function to support debugging
void clearDemandElementSegmentGeometry()
clear demand element geometry
static RouteCalculator * myRouteCalculatorInstance
RouteCalculator instance.
virtual bool checkDemandElementChildRestriction() const
check restriction with the number of children
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
struct used for represent segments of demand element geometry
virtual void openDemandElementDialog()
open DemandElement Dialog
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const DemandElementSegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry
A road/street connecting two junctions (netedit-version)
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
std::vector< Segment >::const_iterator end() const
end iterator
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void updateDijkstraRouter()
update DijkstraRoute (called when SuperMode Demand is selected)
const std::string & getTagStr() const
get tag assigned to this object in string format
Demanding mode (Routes, Vehicles etc..)
RouteCalculator(GNENet *net)
constructor
open additional dialog (used in netedit)
GNENet * getNet() const
get the net object
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
std::vector< Segment >::const_iterator begin() const
begin iterator
virtual std::string getBegin() const
get begin time of demand element
DemandElementSegmentGeometry()
constructor
struct for pack all variables related with geometry of stop
static void deleteRouteCalculatorInstance()
delete instance of RouteCalculator
std::vector< double > shapeRotations
The rotations of the single shape parts.
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
const Position pos
position
const bool visible
visible
SUMOAbstractRouter< NBRouterEdge, NBVehicle > * myDijkstraRouter
SUMO Abstract DijkstraRouter.
Copy typed object name - popup entry.
A window containing a gl-object's parameter.
virtual std::string getAttribute(SumoXMLAttr key) const =0
void insertJunctionSegment(const GNEDemandElement *element, const GNEJunction *junction, const Position pos, const bool visible, const bool valid)
insert junction segment
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
An Element which don't belongs to GNENet but has influency in the simulation.
virtual bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
std::vector< Segment > myShapeSegments
vector of segments that constitutes the shape