Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2001-2024 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 : /****************************************************************************/ 14 : /// @file NIVissimExtendedEdgePoint.cpp 15 : /// @author Daniel Krajzewicz 16 : /// @author Michael Behrisch 17 : /// @date Sept 2002 18 : /// 19 : // ------------------- 20 : /****************************************************************************/ 21 : #include <config.h> 22 : 23 : #include <utils/common/VectorHelper.h> 24 : #include <netbuild/NBEdge.h> 25 : #include "NIVissimExtendedEdgePoint.h" 26 : #include "NIVissimEdge.h" 27 : 28 : 29 : // =========================================================================== 30 : // method definitions 31 : // =========================================================================== 32 2559 : NIVissimExtendedEdgePoint::NIVissimExtendedEdgePoint( 33 : int edgeid, const std::vector<int>& lanes, double position, 34 2559 : const std::vector<int>& assignedVehicles) 35 2559 : : myEdgeID(edgeid), myLanes(lanes), myPosition(position), 36 2559 : myAssignedVehicles(assignedVehicles) {} 37 : 38 : 39 5243 : NIVissimExtendedEdgePoint::~NIVissimExtendedEdgePoint() {} 40 : 41 : 42 : int 43 260293 : NIVissimExtendedEdgePoint::getEdgeID() const { 44 260293 : return myEdgeID; 45 : } 46 : 47 : 48 : double 49 16707 : NIVissimExtendedEdgePoint::getPosition() const { 50 16707 : return myPosition; 51 : } 52 : 53 : 54 : Position 55 9042 : NIVissimExtendedEdgePoint::getGeomPosition() const { 56 : return 57 9042 : NIVissimAbstractEdge::dictionary(myEdgeID)->getGeomPosition(myPosition); 58 : } 59 : 60 : 61 : const std::vector<int>& 62 1812 : NIVissimExtendedEdgePoint::getLanes() const { 63 1812 : return myLanes; 64 : } 65 : 66 : 67 : void 68 1806 : NIVissimExtendedEdgePoint::recheckLanes(const NBEdge* const edge) { 69 : // check whether an "all" indicator is there 70 : bool hadAll = false; 71 4078 : for (std::vector<int>::const_iterator i = myLanes.begin(); !hadAll && i != myLanes.end(); ++i) { 72 2272 : if ((*i) == -1) { 73 : hadAll = true; 74 : } 75 : } 76 : // no -> return 77 1806 : if (!hadAll) { 78 : return; 79 : } 80 : // patch lane indices 81 0 : myLanes.clear(); 82 0 : for (int i = 0; i < (int) edge->getNumLanes(); ++i) { 83 0 : myLanes.push_back(i); 84 : } 85 : } 86 : 87 : 88 : /****************************************************************************/