//----------------------------------------------------------						
void ofxVectorGraphics::endShape(bool bClose){
	if(bDraw){
		ofEndShape(bClose);
	}
	if(bRecord){
											
		//catmull roms - we need at least 4 points to draw
		if( whichShapeMode == 1 && curvePts.size() > 3){												
			
			//we go through and we calculate the bezier of each 
			//catmull rom curve - smart right? :)
			for (unsigned int i = 1; i< curvePts.size()-2; i++) {
				
				ofPoint3 prevPt(	curvePts[i-1][0],	curvePts[i-1][1]);
				ofPoint3 startPt(curvePts[i][0],		curvePts[i][1]);							
				ofPoint3 endPt(	curvePts[i+1][0],	curvePts[i+1][1]);
				ofPoint3 nextPt(	curvePts[i+2][0],	curvePts[i+2][1]);
				
				//SUPER WEIRD MAGIC CONSTANT = 1/6
				//Someone please explain this!!! 
				//It works and is 100% accurate but wtf!
				ofPoint3 cp1 = startPt + ( endPt - prevPt ) * (1.0/6);
				ofPoint3 cp2 = endPt + ( startPt - nextPt ) * (1.0/6);						
				
				//if this is the first line we are drawing 
				//we have to start the path at a location
				if( i == 1 ){
					creeps.startPath(startPt.x, startPt.y);
					bShouldClose = true;
				}
				
				creeps.addCurve( cp1.x, cp1.y, cp2.x, cp2.y, endPt.x, endPt.y);
			}						
		}
		
		if(bShouldClose){														
			//we close the path if requested
			if(bClose)creeps.closeSubpath();
		
			//render the stroke as either a fill or a stroke.
			if(bFill){
				creeps.endPath(CreEPS::FILL);
			}else{
				creeps.endPath(CreEPS::STROKE);
			}
			bShouldClose = false;
		}
		
		//we want to clear all the vertices
		//otherwise we keep adding points from
		//the previous file - cool but not what we want!
		clearAllVertices();
		
	}
}			
void ArrivalPaxLandsideBehavior::ProcessGetOffVehicle( const ElapsedTime& eEventTime )
{
	//get vehicle

	//get
	//the position where the vehicle stops
	//
	WriteLogEntry(eEventTime);

	setState(GetOffVehicle);
	setDestination(m_pVehicle->getLastState().pos);
	//setLocation(m_pVechile->getState().pos);
	WriteLogEntry(eEventTime);

	CPoint2008 nextPt(0,0,0);

	LandsideBusStationInSim*  pBusStation = NULL;
	if( LandsideResourceInSim* pRes = getResource())
	{
		pBusStation =  pRes->toBusSation();
		if ( pBusStation)
		{
			nextPt = pBusStation->GetPaxWaitPos();
		}
	}
	//move outside vehicle
	CPoint2008 nextpos = m_pVehicle->getOffVehiclePos(nextPt);
	setDestination(nextpos);
	ElapsedTime eMovetime = moveTime();
	ElapsedTime eCurTime = eMovetime + eEventTime;

	//setLocation(nextpos);
	WriteLogEntry(eCurTime);

	m_pVehicle->RemoveOnPax(this, eCurTime);

	//start to pick the Bag
	
	m_pPerson->setState(PickCarryOnFromVehicle);
	GenerateEvent(eCurTime);


}