Skip to content

Commit

Permalink
refactoring refs #12
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk@15380 afbd958f-9f77-42d5-a016-97a22340ccf4
  • Loading branch information
namdre committed Jan 13, 2014
1 parent 308599f commit f4fd90e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions sumo/src/microsim/MSPerson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ MSPerson::MSPersonStage_Walking::~MSPersonStage_Walking() {}


const MSEdge*
MSPerson::MSPersonStage_Walking::getEdge(SUMOTime /* now */) const {
MSPerson::MSPersonStage_Walking::getEdge() const {
return *myRouteStep;
}

Expand All @@ -161,15 +161,15 @@ MSPerson::MSPersonStage_Walking::getEdgePos(SUMOTime now) const {

Position
MSPerson::MSPersonStage_Walking::getPosition(SUMOTime now) const {
const MSEdge* e = getEdge(now);
const MSEdge* e = getEdge();
SUMOReal off = STEPS2TIME(now - myLastEntryTime);
return getEdgePosition(e, myCurrentBeginPos + myCurrentLength / myCurrentDuration * off, SIDEWALK_OFFSET);
}


SUMOReal
MSPerson::MSPersonStage_Walking::getAngle(SUMOTime now) const {
const MSEdge* e = getEdge(now);
const MSEdge* e = getEdge();
SUMOReal off = STEPS2TIME(now - myLastEntryTime);
return getEdgeAngle(e, myCurrentBeginPos + myCurrentLength / myCurrentDuration * off) + 90;
}
Expand Down Expand Up @@ -286,7 +286,7 @@ MSPerson::MSPersonStage_Driving::~MSPersonStage_Driving() {}


const MSEdge*
MSPerson::MSPersonStage_Driving::getEdge(SUMOTime /* now */) const {
MSPerson::MSPersonStage_Driving::getEdge() const {
if (myVehicle != 0) {
return myVehicle->getEdge();
}
Expand All @@ -304,7 +304,7 @@ SUMOReal
MSPerson::MSPersonStage_Driving::getEdgePos(SUMOTime now) const {
if (myVehicle != 0) {
// vehicle may already have passed the lane (check whether this is correct)
return MIN2(myVehicle->getPositionOnLane(), getEdge(now)->getLength());
return MIN2(myVehicle->getPositionOnLane(), getEdge()->getLength());
}
return myWaitingPos;
}
Expand Down Expand Up @@ -394,13 +394,13 @@ MSPerson::MSPersonStage_Driving::routeOutput(OutputDevice& os) const {

void
MSPerson::MSPersonStage_Driving::beginEventOutput(const MSPerson& p, SUMOTime t, OutputDevice& os) const {
os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge(t)->getID()).closeTag();
os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
}


void
MSPerson::MSPersonStage_Driving::endEventOutput(const MSPerson& p, SUMOTime t, OutputDevice& os) const {
os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge(t)->getID()).closeTag();
os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
}


Expand All @@ -424,7 +424,7 @@ MSPerson::MSPersonStage_Waiting::~MSPersonStage_Waiting() {}


const MSEdge*
MSPerson::MSPersonStage_Waiting::getEdge(SUMOTime /* now */) const {
MSPerson::MSPersonStage_Waiting::getEdge() const {
return &myDestination;
}

Expand Down Expand Up @@ -490,14 +490,14 @@ MSPerson::MSPersonStage_Waiting::routeOutput(OutputDevice& os) const {
void
MSPerson::MSPersonStage_Waiting::beginEventOutput(const MSPerson& p, SUMOTime t, OutputDevice& os) const {
os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actstart " + myActType)
.writeAttr("agent", p.getID()).writeAttr("link", getEdge(t)->getID()).closeTag();
.writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
}


void
MSPerson::MSPersonStage_Waiting::endEventOutput(const MSPerson& p, SUMOTime t, OutputDevice& os) const {
os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actend " + myActType).writeAttr("agent", p.getID())
.writeAttr("link", getEdge(t)->getID()).closeTag();
.writeAttr("link", getEdge()->getID()).closeTag();
}


Expand Down Expand Up @@ -528,7 +528,7 @@ MSPerson::getID() const {

bool
MSPerson::proceed(MSNet* net, SUMOTime time) {
MSEdge* arrivedAt = (MSEdge*)(*myStep)->getEdge(time);
MSEdge* arrivedAt = (MSEdge*)(*myStep)->getEdge();
SUMOReal atPos = (*myStep)->getEdgePos(time);
//MSPersonPlan::iterator prior = myStep;
(*myStep)->setArrived(time);
Expand Down
12 changes: 6 additions & 6 deletions sumo/src/microsim/MSPerson.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class MSPerson {
const MSEdge& getDestination() const;

/// Returns the current edge
virtual const MSEdge* getEdge(SUMOTime now) const = 0;
virtual const MSEdge* getEdge() const = 0;
virtual const MSEdge* getFromEdge() const = 0;
virtual SUMOReal getEdgePos(SUMOTime now) const = 0;

Expand Down Expand Up @@ -195,7 +195,7 @@ class MSPerson {
virtual void proceed(MSNet* net, MSPerson* person, SUMOTime now, MSEdge* previousEdge, const SUMOReal at);

/// Returns the current edge
const MSEdge* getEdge(SUMOTime now) const;
const MSEdge* getEdge() const;
const MSEdge* getFromEdge() const;
SUMOReal getEdgePos(SUMOTime now) const;

Expand Down Expand Up @@ -320,7 +320,7 @@ class MSPerson {
virtual void proceed(MSNet* net, MSPerson* person, SUMOTime now, MSEdge* previousEdge, const SUMOReal at);

/// Returns the current edge
const MSEdge* getEdge(SUMOTime now) const;
const MSEdge* getEdge() const;
const MSEdge* getFromEdge() const;
SUMOReal getEdgePos(SUMOTime now) const;

Expand Down Expand Up @@ -405,7 +405,7 @@ class MSPerson {
~MSPersonStage_Waiting();

/// Returns the current edge
const MSEdge* getEdge(SUMOTime now) const;
const MSEdge* getEdge() const;
const MSEdge* getFromEdge() const;
SUMOReal getEdgePos(SUMOTime now) const;
SUMOTime getUntil() const;
Expand Down Expand Up @@ -516,8 +516,8 @@ class MSPerson {
}

/// @brief Returns the current edge
const MSEdge* getEdge(SUMOTime now) const {
return (*myStep)->getEdge(now);
const MSEdge* getEdge() const {
return (*myStep)->getEdge();
}

/// @brief Returns the departure edge
Expand Down

0 comments on commit f4fd90e

Please sign in to comment.