﻿function PTServiceProvider(nID, bLocal, bGlobalBus, bGlobalTrain, strName, strAddress, strPhone, strWebSite, strAreaDescription, strLinkPrefix)
{
	this.nID = (nID != undefined ? nID : 0);
	this.bLocal = (bLocal != undefined ? bLocal : false);
	this.bGlobalBus = (bGlobalBus != undefined ? bGlobalBus : false);
	this.bGlobalTrain = (bGlobalTrain != undefined ? bGlobalTrain : false);
	this.strName = (strName != undefined ? strName : "");
	this.strAddress = (strAddress != undefined ? strAddress : "");
	this.strPhone = (strPhone != undefined ? strPhone : "");
	this.strWebSite = (strWebSite != undefined ? strWebSite : "");
	this.strAreaDescription = (strAreaDescription != undefined ? strAreaDescription : "");
	this.strLinkPrefix = (strLinkPrefix != undefined ? strLinkPrefix : "");
}

function VehicleType(nID, strName)
{
	this.nID = (nID != undefined ? nID : 0);
	this.strName = (strName != undefined ? strName : "");
}

function PTRunView(iServiceProviderID, strVehicleTypeEnum, strName, iRunSubID)
{
	this.iServiceProviderID = ( iServiceProviderID != undefined ? iServiceProviderID : 0);
	this.strVehicleTypeEnum = ( strVehicleTypeEnum != undefined ? strVehicleTypeEnum : "");
	this.strName = ( strName != undefined ? strName : "");
	this.iRunSubID = ( iRunSubID != undefined ? iRunSubID : 0);
}


function PTRun(strVehicleType, iVehicleTypeID, iServiceProviderID, iRunSubID, strName, strDescription, strLink, bSingleDir, strClass, bShowName, bShowDescription, arrStops)
{
	this.strVehicleType = ( strVehicleType != undefined ? strVehicleType : "");
	this.iVehicleTypeID = ( iVehicleTypeID != undefined ? iVehicleTypeID : 0);
	this.iServiceProviderID = ( iServiceProviderID != undefined ? iServiceProviderID : 0);
	this.iRunSubID = ( iRunSubID != undefined ? iRunSubID : 0);
	this.strName = ( strName != undefined ? strName : "");
	this.strDescription = ( strDescription != undefined ? strDescription : "");
	this.strLink = ( strLink != undefined ? strLink : "");
	this.bSingleDir = ( bSingleDir != undefined ? bSingleDir : 0);
	this.strClass = ( strClass != undefined ? strClass : "");
	this.bShowName = ( bShowName != undefined ? bShowName : true);
	this.bShowDescription = ( bShowDescription != undefined ? bShowDescription : false);
	this.arrStops = (arrStops != undefined ? arrStops : new Array());
}

function ClickablePTStop(nID, iPxlX, iPxlY, dWgsX, dWgsY, strName, strLink, arrRuns, strCity)
{
	this.nID = (nID != undefined ? nID: 0);
	this.iPxlX = (iPxlX != undefined ? iPxlX : 0);
	this.iPxlY = (iPxlY != undefined ? iPxlY : 0);
	this.dWgsX = (dWgsX != undefined ? dWgsX : 0);
	this.dWgsY = (dWgsY != undefined ? dWgsY : 0);
	this.strName = (strName != undefined ? strName : "");
	this.strLink = (strLink != undefined ? strLink : "");
	this.arrRuns = (arrRuns != undefined ? arrRuns : []);
	this.strCity = (strCity != undefined ? strCity : "");
}

function RoutePTRun(strVehicleType, iVehicleTypeID, iServiceProviderID, iRunSubID, strName, strDescription, strLink, iStops,
                    strClass, bShowName, bShowDescription, bLowDeck)
{
	this.strVehicleType = ( strVehicleType != undefined ? strVehicleType : "");
	this.iVehicleTypeID = ( iVehicleTypeID != undefined ? iVehicleTypeID : 0);
	this.iServiceProviderID = ( iServiceProviderID != undefined ? iServiceProviderID : 0);
	this.iRunSubID = ( iRunSubID != undefined ? iRunSubID : 0);
	this.strName = ( strName != undefined ? strName : "");
	this.strDescription = ( strDescription != undefined ? strDescription : "");
	this.strLink = ( strLink != undefined ? strLink : "");
	this.iStops = ( iStops != undefined ? iStops : 0);
	this.strClass = ( strClass != undefined ? strClass : "");
	this.bShowName = ( bShowName != undefined ? bShowName : true);
	this.bShowDescription = ( bShowDescription != undefined ? bShowDescription : false);
	this.bLowDeck = (bLowDeck != undefined ? bLowDeck : false);
}

function RouteBkvData(iStops, strName, strVType, bIsAppendType, strClass, strLink, strLinkType, strLinkRunName, strLinkParam)
{
	this.iStops = (iStops != undefined ? iStops: 0);
	this.strName = (strName != undefined ? strName : "");
	this.strVType = (strVType != undefined ? strVType : "");
	this.bIsAppendType = (bIsAppendType != undefined ? bIsAppendType : true);
	this.strClass = (strClass != undefined ? strClass : "");
	this.strLink = (strLink != undefined ? strLink : "");
	this.strLinkType = (strLinkType != undefined ? strLinkType : "");
	this.strLinkRunName = (strLinkRunName != undefined ? strLinkRunName : "");
	this.strLinkParam = (strLinkParam != undefined ?  strLinkParam : "");
}

function RouteSub(dLwrX, dLwrY, dUprX, dUprY, iLength, iTravelSeconds, dtStart, dtStop, eType, eTurnInfo, strCity, strDistrict, strStreet, strRoad, strInternational, strStopFrom, strStopTo, iWaitingMinutes, strVehicleType, arrPTRuns, ePedEnum, arrPolylines)
{
	this.dLwrX = (dLwrX != undefined ? dLwrX : 0.0);
	this.dLwrY = (dLwrY != undefined ? dLwrY : 0.0);
	this.dUprX = (dUprX != undefined ? dUprX : 0.0);
	this.dUprY = (dUprY != undefined ? dUprY : 0.0);
	this.iLength = (iLength != undefined ? iLength : 0);
	this.iTravelSeconds = (iTravelSeconds != undefined ? iTravelSeconds : 0);
	this.dtStart = (dtStart != undefined ?  dtStart : "");
	this.dtStop = (dtStop != undefined ?  dtStop : "");

	this.eType = (eType != undefined ? eType : 0);
	this.eTurnInfo = (eTurnInfo != undefined ? eTurnInfo : 0);
	this.strCity = (strCity != undefined ? strCity : "");
	this.strDistrict = (strDistrict != undefined ? strDistrict : "");
	this.strStreet = (strStreet != undefined ? strStreet : "");
	this.strRoad = (strRoad != undefined ? strRoad : "");
	this.strInternational = (strInternational != undefined ? strInternational : "");
	this.strStopFrom = (strStopFrom != undefined ? strStopFrom : "");
	this.strStopTo = (strStopTo != undefined ? strStopTo : "");
	this.iWaitingMinutes = (iWaitingMinutes != undefined ? iWaitingMinutes : 0);
	this.strVehicleType = (strVehicleType != undefined ? strVehicleType : false);
	this.arrPTRuns = (arrPTRuns != undefined ? arrPTRuns : new Array());
	this.ePedEnum = (ePedEnum != undefined ? ePedEnum : 0);
	this.arrPolylines = (arrPolylines != undefined ? arrPolylines : []);
}

function RouteMain(dLwrX, dLwrY, dUprX, dUprY, iLength, iTravelSeconds, dtStart, dtStop, strNameFrom, strAddressFrom, dFromX, dFromY, strNameTo, strAddressTo, dToX, dToY, arrSubs)
{
	this.dLwrX = (dLwrX != undefined ? dLwrX : 0.0);
	this.dLwrY = (dLwrY != undefined ? dLwrY : 0.0);
	this.dUprX = (dUprX != undefined ? dUprX : 0.0);
	this.dUprY = (dUprY != undefined ? dUprY : 0.0);
	this.iLength = (iLength != undefined ? iLength : 0);
	this.iTravelSeconds = (iTravelSeconds != undefined ? iTravelSeconds : 0);
	this.dtStart = (dtStart != undefined ?  dtStart : "");
	this.dtStop = (dtStop != undefined ?  dtStop : "");

	this.strNameFrom = (strNameFrom != undefined ? strNameFrom : "");
	this.strAddressFrom = (strAddressFrom != undefined ? strAddressFrom : "");
	this.dFromX = (dFromX != undefined ? dFromX : 0.0);
	this.dFromY = (dFromY != undefined ? dFromY : 0.0);

	this.strNameTo = (strNameTo != undefined ? strNameTo : "");
	this.strAddressTo = (strAddressTo != undefined ? strAddressTo : "");
	this.dToX = (dToX != undefined ? dToX : 0.0);
	this.dToY = (dToY != undefined ? dToY : 0.0);
	this.arrSubs = (arrSubs != undefined ? arrSubs : new Array());
}

function Route(dLwrX, dLwrY, dUprX, dUprY, iLength, iTravelSeconds, dtStart, dtStop, strTrafficType, iAlternative, arrMains)
{
	this.dLwrX = (dLwrX != undefined ? dLwrX : 0.0);
	this.dLwrY = (dLwrY != undefined ? dLwrY : 0.0);
	this.dUprX = (dUprX != undefined ? dUprX : 0.0);
	this.dUprY = (dUprY != undefined ? dUprY : 0.0);
	this.iLength = (iLength != undefined ? iLength : 0);
	this.iTravelSeconds = (iTravelSeconds != undefined ? iTravelSeconds : 0);
	this.dtStart = (dtStart != undefined ?  dtStart : "");
	this.dtStop = (dtStop != undefined ?  dtStop : "");

	this.strTrafficType = (strTrafficType != undefined ? strTrafficType : "");
	this.iAlternative = (iAlternative != undefined ? iAlternative : 0);
	this.iRunChanges = null;
	this.iDiffHour = 0;
	this.arrMains = (arrMains != undefined ? arrMains : new Array());
}

function PTStop(strName, iDistance, iTravelTime, dX, dY)
{
	this.strName = (strName != undefined ? strName : "");
	this.iDistance = (iDistance != undefined ? iDistance : 0);
	this.iTravelTime = (iTravelTime != undefined ? iTravelTime : 0);
	this.dX = (dX != undefined ? dX : 0);
	this.dY = (dY != undefined ? dY : 0);
}

PedEnum = new function()
{
	this.P_ISSIDEWALK = 0x00000001;
	this.P_HIGHCATEGORY = 0x00000002;	// PRC - road category - if not set that means Normal
	this.P_MOVINGSTAIRS = 0x00000004;	// PRF - road feature
	this.P_ELEVATOR = 0x00000008;	// PRF - road feature
	this.P_WALKWAY = 0x00000010;	// PDT - road type - stairs and crossroad is set elsewhere
	this.P_PROMENADE = 0x00000020;	// PDT - road type - stairs and crossroad is set elsewhere
	this.P_PATH = 0x00000040;	// PDT - road type - stairs and crossroad is set elsewhere
	this.P_PASSAGE = 0x00000080;	// PDT - road type - stairs and crossroad is set elsewhere
	this.P_PAVEDGOOD = 0x00000100;	// PRS - road structure
	this.P_PAVEDPOOR = 0x00000200;	// PRS - road structure
	this.P_UNPAVEDSHINGLY = 0x00000400;	// PRS - road structure
	this.P_UNPAVEDCARTROAD = 0x00000800;	// PRS - road structure
	this.P_COBBLESTONE = 0x00001000;	// PRS - road structure
	this.P_GRADSTAIRSNEG = 0x00002000;	// GRAD - if no Grad set that means Flat
	this.P_GRADHIGHNEG = 0x00004000;	// GRAD - if no Grad set that means Flat
	this.P_GRADLOWNEG = 0x00008000;	// GRAD - if no Grad set that means Flat
	this.P_GRADLOWPOS = 0x00010000;	// GRAD - if no Grad set that means Flat
	this.P_GRADHIGHPOS = 0x00020000;	// GRAD - if no Grad set that means Flat
	this.P_GRADSTAIRSPOS = 0x00040000;	// GRAD - if no Grad set that means Flat
	this.P_TOLL = 0x00080000;	// Toll road
	this.P_TACTILE = 0x00100000;	// Tactile along the road

	this.P_OBSTACLE = 0x00200000;	// Obstacle along the road
	this.P_CROSSING = 0x00400000;	// Is it a Crossing?
	this.P_PEDCROSSING = 0x00800000;	// Pedestrian Crossing
	this.P_TRAFFICLIGHT = 0x01000000;	// Has traffic light
	this.P_NOTICESIGNAL = 0x02000000;	// Has notice signal
	this.P_TLBUTTON = 0x04000000;	// Has button
	this.P_TCURBSIDE = 0x08000000;	// Tactile curbside
	this.P_LCURBSIDE = 0x10000000;	// Low curbside
	this.P_COMPOUND = 0x20000000;	// Compound crossing
	this.P_SUBWAY =		    0x40000000;	  // Aluljaro

	this.P_NONE = 0;          // Not applicable: set all edges but special pedestrian
	// edges to P_NONE:
	// eep->PedAttrib.EdgeId.eiPairId = INV_EDGE_ID;
	// ep->PedAttrib.EdgeId.epPair = NULL;
	// ep->PedAttrib.ePedEnum = P_NONE;

	this.P_ALL = (this.P_ISSIDEWALK | this.P_HIGHCATEGORY | this.P_SHOPPING | this.P_TURIST | this.P_WALKWAY |
					 this.P_PROMENADE | this.P_PATH | this.P_PASSAGE | this.P_PAVEDGOOD | this.P_PAVEDPOOR |
					 this.P_UNPAVEDSHINGLY | this.P_UNPAVEDCARTROAD | this.P_COBBLESTONE | this.P_GRADSTAIRSNEG |
					 this.P_GRADHIGHNEG | this.P_GRADLOWNEG | this.P_GRADLOWPOS | this.P_GRADHIGHPOS |
					 this.P_GRADSTAIRSPOS | this.P_TOLL | this.P_TACTILE | this.P_OBSTACLE | this.P_CROSSING |
					 this.P_PEDCROSSING | this.P_TRAFFICLIGHT | this.P_NOTICESIGNAL | this.P_TLBUTTON |
					 this.P_TCURBSIDE | this.P_LCURBSIDE | this.P_COMPOUND);
					 
}
