﻿/// private:
function MapLabel (id, x, y)
{
	this.ID = id;
	this.iPixX = x;
	this.iPixY = y;
}

/// public:
/// Terkepi koordinata
function CCoordinate(dX, dY)
{
	this.dX = dX;
	this.dY = dY;
}

/// public:
/// Poi-k nyilvantartasa: poi ID koordinataval
function CSimplePoi(strID, dX, dY)
{
	this.strID = strID;
	this.dX = dX;
	this.dY = dY;
}

/// public:
/// Szoveges cim koordinataval
function CSimpleAddress(strAddress, dX, dY)
{
	this.strAddress = strAddress;
	this.dX = dX;
	this.dY = dY;
}

function CPoiAddress(strName, strAddress, dX, dY)
{
	this.strName = strName;
	this.strAddress = strAddress;
	this.dX = dX;
	this.dY = dY;
}

/// public:
/// Kicsit bonyultabb cim
function CAddress(strAddress, dX, dY, dMinX, dMinY, dMaxX, dMaxY)
{
	this.strAddress = (strAddress != null ? strAddress : "");
	this.dX = (dX != null ? dX : 0);
	this.dY = (dY != null ? dY : 0);
	this.dMinX = (dMinX != null ? dMinX : 0);
	this.dMinY = (dMinY != null ? dMinY : 0);
	this.dMaxX = (dMaxX != null ? dMaxX : 0);
	this.dMaxY = (dMaxY != null ? dMaxY : 0);
}

/// public:
/// Meg bonyolultabb cim
function CComplexAddress(strAddress, dX, dY, dMinX, dMinY, dMaxX, dMaxY, strCountry, strRegion, strSettlement, strDistrict, strSubSettlement, strStreetName, strStreetType, strHouseNumber, strCornerStreetName, strCornerStreetType, strZip)
{
	this.strAddress = (strAddress != null ? strAddress : "");
	this.dX = (dX != null ? dX : 0);
	this.dY = (dY != null ? dY : 0);
	this.dMinX = (dMinX != null ? dMinX : 0);
	this.dMinY = (dMinY != null ? dMinY : 0);
	this.dMaxX = (dMaxX != null ? dMaxX : 0);
	this.dMaxY = (dMaxY != null ? dMaxY : 0);

	this.strCountry = (strCountry != null ? strCountry : ""); // orszag
	this.strRegion = (strRegion != null ? strRegion : ""); // megye
	this.strSettlement = (strSettlement != null ? strSettlement : ""); // telepules
	this.strDistrict = (strDistrict != null ? strDistrict : ""); // kerulet
	this.strSubSettlement = (strSubSettlement != null ? strSubSettlement : ""); // telepulesresz
	this.strStreetName = (strStreetName != null ? strStreetName : ""); // utcanev
	this.strStreetType = (strStreetType != null ? strStreetType : ""); // kozterulet tipus
	this.strHouseNumber = (strHouseNumber != null ? strHouseNumber : ""); // hazszam
	this.strCornerStreetName = (strCornerStreetName != null ? strCornerStreetName : ""); // sarokcim utcanev
	this.strCornerStreetType = (strCornerStreetType != null ? strCornerStreetType : ""); // sarokcim kozterulet tipus
	this.strZip = (strZip != null ? strZip : ""); // iranyitoszam

}

/// private:
/// NORC structure
function CNorc (lat, lon, id, angle)
{
	this.m_lat = lat;
	this.m_lon = lon;
	this.m_id = id;
	this.m_angle = angle;
}

/// public:
/// Az aktualisan kirajzolt kephez tartozo informaciok
function CMapData()
{
	/// Terkep neve (melyik telepulest latjuk rajta)
	this.strCaption;
	/// A terkep szelessege pixelben
	this.iMapWidth;
	/// A terkep magassaga pixelben
	this.iMapHeight;
	/// A terkep kozeppontjanak WGS koordinatai
	this.dCenterX;
	this.dCenterY;
	/// A terkepbe irhato kor sugara meterben
	this.dRadius;
	/// A terkep sarkainak koordinatai
	this.dMinX;
	this.dMinY;
	this.dMaxX;
	this.dMaxY;
	/// Meter per pixel arany
	this.dMeterPerPixelX;
	this.dMeterPerPixelY;
	/// Viewport eltolasa a gridhez kepest
	this.iViewportOffsetX;
	this.iViewportOffsetY;
	/// A keret (rejtett resszel egyutt) sarkainak koordinatai
	this.dGridMinX;
	this.dGridMinY;
	this.dGridMaxX;
	this.dGridMaxY;
}

/// private:
/// RasterMap Info
function RasterLevel(iLevel, dPixelDensityXMeter, dPixelDensityYMeter, dPixelDensityXAC,dPixelDensityYAC, iActiveWidth, iActiveHeight, iRows, iCols)
{
	// Raster map level. Level 0 is has the smallest density (largest view).
	this.iLevel = (iLevel!=undefined ? iLevel : 0);
	// Map coordinanes/pixel at current level.
	this.dPixelDensityXMeter = (dPixelDensityXMeter != undefined ? dPixelDensityXMeter : 1.0);
	this.dPixelDensityYMeter = (dPixelDensityYMeter != undefined ? dPixelDensityYMeter : 1.0);
	this.dPixelDensityXAC = (dPixelDensityXAC != undefined ? dPixelDensityXAC : 1.0);
	this.dPixelDensityYAC = (dPixelDensityYAC != undefined ? dPixelDensityYAC : 1.0);

	// Active viewport pixel width.
	this.iActiveWidth = (iActiveWidth != undefined ? iActiveWidth : 0);
	// Active viewport pixel height.
	this.iActiveHeight = (iActiveHeight != undefined ? iActiveHeight : 0);
	// # of rows at current level.
	this.iRows = (iRows != undefined ? iRows : 0);
	// # of columns at current level.
	this.iCols = (iCols != undefined ? iCols : 0);
};

/// private:
function RasterMapInfo(iVersion, iLevels, iSectionWidth, iSectionHeight, wgsMapMinX, wgsMapMinY, wgsMapMaxX, wgsMapMaxY, arrLevels)
{
	// Raster map version Id.
	this.iVersion = (iVersion != undefined ? iVersion : 1);
	// # of raster levels.
	this.iLevels = (iLevels != undefined ? iLevels : 0);
	// Pixel width of one raster section.
	this.iSectionWidth = (iSectionWidth != undefined ? iSectionWidth : 0);
	// Pixel height of one raster section.	
	this.iSectionHeight = (iSectionHeight != undefined ? iSectionHeight : 0);
	this.wgsMapMinX = (wgsMapMinX != undefined ? wgsMapMinX : 0);
	this.wgsMapMinY = (wgsMapMinY != undefined ? wgsMapMinY : 0);
	this.wgsMapMaxX = (wgsMapMaxX != undefined ? wgsMapMaxX : 0);	
	this.wgsMapMaxY = (wgsMapMaxY != undefined ? wgsMapMaxY : 0);
	// Level Data
	this.arrLevels = (arrLevels != undefined && arrLevels != null ? arrLevels : new Array());
};

/// private:
function RasterMapResult(dGridLowerLeftX,dGridLowerLeftY,dGridUpperRightX,dGridUpperRightY, dViewportLowerLeftX,dViewportLowerLeftY,dViewportUpperRightX,dViewportUpperRightY, dCenterX,dCenterY,dMinRadius, iLevel,iGridUpperRow,iGridLeftColumn,iGridLowerRow,iGridRightColumn, iViewportOffsetX,iViewportOffsetY,iViewportDeltaX,iViewportDeltaY, arrUrls, strCaption)
{
	this.dGridLowerLeftX = (dGridLowerLeftX != undefined ? dGridLowerLeftX : 0.0);
	this.dGridLowerLeftY = (dGridLowerLeftY != undefined ? dGridLowerLeftY : 0.0);
	this.dGridUpperRightX = (dGridUpperRightX != undefined ? dGridUpperRightX : 0.0);
	this.dGridUpperRightY = (dGridUpperRightY != undefined ? dGridUpperRightY : 0.0);

	this.dViewportLowerLeftX = (dViewportLowerLeftX != undefined ? dViewportLowerLeftX : 0.0);
	this.dViewportLowerLeftY = (dViewportLowerLeftY != undefined ? dViewportLowerLeftY : 0.0);
	this.dViewportUpperRightX = (dViewportUpperRightX != undefined ? dViewportUpperRightX : 0.0);
	this.dViewportUpperRightY = (dViewportUpperRightY != undefined ? dViewportUpperRightY : 0.0);


	this.dCenterX = (dCenterX != undefined ? dCenterX : 0.0);
	this.dCenterY = (dCenterY != undefined ? dCenterY : 0.0);
	this.dMinRadius = (dMinRadius != undefined ? dMinRadius : 0.0);

	this.iLevel = (iLevel != undefined ? iLevel : 0);
	this.iGridUpperRow = (iGridUpperRow != undefined ? iGridUpperRow : 0);
	this.iGridLeftColumn = (iGridLeftColumn != undefined ? iGridLeftColumn : 0);
	this.iGridLowerRow = (iGridLowerRow != undefined ? iGridLowerRow : 0);
	this.iGridRightColumn = (iGridRightColumn != undefined ? iGridRightColumn : 0);

	this.iViewportOffsetX = (iViewportOffsetX != undefined ? iViewportOffsetX : 0);
	this.iViewportOffsetY = (iViewportOffsetY != undefined ?  iViewportOffsetY : 0);
	this.iViewportDeltaX = (iViewportDeltaX != undefined ? iViewportDeltaX : 0);
	this.iViewportDeltaY = (iViewportDeltaY != undefined ?  iViewportDeltaY : 0);

	this.arrUrls = (arrUrls != undefined && arrUrls != null ? arrUrls : new Array());
	
	this.strCaption = (strCaption != undefined && strCaption != null ? strCaption : "");
}

/// private:
function ClickablePoi(strID, iX, iY, strName, iImageID, iPriority)
{
	this.strID = (strID != undefined && strID != null ? strID : "");
	this.iX    = (iX != undefined ? iX : 0);
	this.iY    = (iY != undefined ? iY : 0); 
	this.strName = (strName != undefined && strName != null ? strName : "");
	this.iImageID = (iImageID != undefined ? iImageID : 0);
	this.iPriority = (iPriority != undefined ? iPriority : 0);
}

// private:
function ClickableTMC(iID, iX, iY, iTMCTextIndex, iEventDescriptionIndex, iLocationDescriptionIndex)
{
	this.iID    = (iID != undefined ? iID : 0);
	this.iX    = (iX != undefined ? iX : 0);
	this.iY    = (iY != undefined ? iY : 0); 
	
	this.iTMCTextIndex             = (iTMCTextIndex != undefined ? iTMCTextIndex : -1); 
	this.iEventDescriptionIndex    = (iEventDescriptionIndex != undefined ? iEventDescriptionIndex : -1); 
	this.iLocationDescriptionIndex = (iLocationDescriptionIndex != undefined ? iLocationDescriptionIndex : -1); 
}

/// private:
function DrawMapPersonalResult (dLowerLeftX,dLowerLeftY, dUpperRightX, dUpperRightY, strCaption, strUrl, arrPois, arrMapLabels, arrTMCEvents, arrTMCTextTable, arrPTStops, dLastDistPointX, dLastDistPointY, arrDistPolylinePixelX, arrDistPolylinePixelY, dDistanceMeter)
{
	this.dLowerLeftX = (dLowerLeftX != undefined ? dLowerLeftX : 0.0);
	this.dLowerLeftY = (dLowerLeftY != undefined ? dLowerLeftY : 0.0);
	this.dUpperRightX = (dUpperRightX != undefined ? dUpperRightX : 0.0);
	this.dUpperRightY = (dUpperRightY != undefined ? dUpperRightY : 0.0);
	this.strCaption = (strCaption != undefined && strCaption != null ? strCaption : "");
	this.strUrl = (strUrl != undefined && strUrl != null ? strUrl : "");
	this.arrPois = (arrPois != undefined && arrPois != null ? arrPois : new Array());
	this.arrMapLabels = (arrMapLabels != undefined && arrMapLabels != null ? arrMapLabels : new Array());
	this.arrTMCEvents = (arrTMCEvents != undefined && arrTMCEvents != null ? arrTMCEvents : new Array());
	this.arrTMCTextTable  = (arrTMCTextTable != undefined && arrTMCTextTable != null ? arrTMCTextTable : new Array());
	this.arrPTStops = (arrPTStops != undefined ? arrPTStops : []);

	// a kirajzolt polyline utolso koordinataja wgs-ben:
	this.dLastDistPointX = (dLastDistPointX != undefined ? dLastDistPointX : 0.0);
	this.dLastDistPointY = (dLastDistPointY != undefined ? dLastDistPointY : 0.0);

	// a kirajzolt polyline koordinatai pixelben:
	this.arrDistPolylinePixelX = (arrDistPolylinePixelX != undefined ? arrDistPolylinePixelX : null);
	this.arrDistPolylinePixelY = (arrDistPolylinePixelY != undefined ? arrDistPolylinePixelY : null);
	//a kirajzolt polyline hossza meterben:
	this.dDistanceMeter = (dDistanceMeter != undefined ? dDistanceMeter : 0.0);
}

/// public:
/// Poi tipust leiro struktura
/// A Poi tipusok egy tobbszintu faban vannak
function CPoiType(iID, strName, iLevel, bOnMap, bShowInTree, iCount)
{
	// Poi tipus ID-je (alt. pozitiv szam)
	this.iID = (iID != undefined && iID != null ? iID : 0);
	// Poi tipus neve
	this.strName = (strName != undefined && strName != null ? strName : "");
	// A poi tipus a fa melyik szintjen van
	this.iLevel = (iLevel != undefined && iLevel != null ? iLevel : 0);
	// A szulo tipus azonositoja
	//this.iParentID = (iParentID != undefined && iParentID != null ? iParentID : 0);
	this.bOnMap = bOnMap;
	// Latszodjon-e a faban
	this.bShowInTree = (bShowInTree != undefined ? bShowInTree : true);
	// Peldanyszam
	this.iCount = (iCount != undefined ? iCount : 0);
}

// public:
// Egy poi rekordot leiro struktura
function CPoiRecord(nID, nTypeID, iImageID, iListPriority, arrNames, arrValues, dX, dY)
{
	// A rekord azonositoja
	this.nID = nID;
	// A tipus azonositoja (legszukebb ertelmu)
	this.nTypeID = nTypeID;
	// A rekordhoz tartozo kep azonositoja (jelenleg nem hasznalt)
	this.iImageID = iImageID;
	// Rekord prioritasa (kiemelt rekord-e)
	this.iListPriority = (iListPriority != null ? iListPriority : 0);
	// Egy tombben a rekordhoz tartozo, ervenyes adatot tartalmazo mezonevek
	this.arrNames = (arrNames != null ? arrNames : new Array() );
	// Mezoertekek a fenti mezokhoz
	this.arrValues = (arrValues != null ? arrValues : new Array() );
	// A rekord wgs koordinataja
	this.dX = dX;
	this.dY = dY;
}

// public:
// Poi kereses parametereit tartalmazo osztaly
function CPoiQuery(nID, strFilter, strType, iFirst, iLast, bHasRect, dMinX, dMinY, dMaxX, dMaxY)
{
	// Keresett poi azonositoja (0, ha nem kell ID-re keresni)
	this.nID = (nID != undefined && nID != null ? nID: 0);
	// Reszsztring a keresett poi nevebol, vagy mas keresheto attributumabol (pl. webcim)
	this.strFilter = (strFilter != undefined && strFilter != null ? strFilter : "");
	// Reszsztring a keresett poi tipusabol
	this.strType = (strType != undefined && strType != null ? strType : "");
	// Hanyadik talalatol kezdve adja vissza
	this.iFirst = (iFirst != undefined && iFirst != null ? iFirst : 0);
	// Hanyadik talalatig adja vissza
	this.iLast = (iLast != undefined && iLast != null ? iLast : iFirst + 20);
	// Egy teglalapon belul keres (true), vagy a teljes adatbazisban
	this.bHasRect = (bHasRect ? true : false);
	// A teglalapos kereseshez a koordinatak
	this.dMinX = (dMinX != undefined && dMinX != null ? dMinX : 0.0);
	this.dMinY = (dMinY != undefined && dMinY != null ? dMinY : 0.0);
	this.dMaxX = (dMaxX != undefined && dMaxX != null ? dMaxX : 0.0);
	this.dMaxY = (dMaxY != undefined && dMaxY != null ? dMaxY : 0.0);
}

//public:
// Poi kereses eredmenye
function CPoiSearchResult(iFirst, bHasNextPage, arrRecords)
{
	this.iFirst = (iFirst != undefined && iFirst != null ? iFirst : 0);
	this.bHasNextPage = (bHasNextPage != undefined && bHasNextPage != null ? bHasNextPage : false);
	this.arrRecords = (arrRecords != null ? arrRecords : new Array() );
}

// private:
function CFavouritePlace(id, x, y, name)
{
	this.id = id;
	this.x = x;
	this.y = y;
	this.name = unescape(name);
}

// private:
function CFavouriteRoute(id, name, data)
{
	this.id = id;
	this.name = unescape(name);
	this.data = unescape(data);
}

// private:
function CRegisteredData(arrPlaces, arrRoutes, name)
{
	this.favouritePlaces = (arrPlaces != null ? arrPlaces : new Array());
	this.favouriteRoutes = (arrRoutes != null ? arrRoutes : new Array());
	this.userName = name;
}

/// private:
function CWeather (id, x, y, place, weather, temperature, wind, humidity, pressure, uv, iconId)
{
    this.id = (id != null ? id : "");
	this.x = (x != null ? x : "");
	this.y = (y != null ? y : "");
	this.place = (place != null ? place : "");
	this.weather = (weather != null ? weather : "");
	this.temperature = (temperature != null ? temperature : "");
	this.wind = (wind != null ? wind : "");
	this.humidity = (humidity != null ? humidity : "");
	this.pressure = (pressure != null ? pressure : "");
	this.uv = (uv != null ? uv : "");
	this.iconId = (iconId != null ? iconId : "");
}

/// private:
function CUTV (id, x, y, address, name, camUrl, angle, pixelradius)
{
	this.id = (id != null ? id : 0);
	this.x = (x != null ? x : 0);
	this.y = (y != null ? y : 0);
	this.address = (address != null ? unescape(address) : "");
	this.name = (name != null ? unescape(name) : "");
	this.camUrl = (camUrl != null ? unescape(camUrl) : "");
	this.angle = (angle != null ? angle : 0);
	this.pixelradius = (pixelradius != null ? pixelradius : 0);
	
	var me = this;
	this.GetSafeCamUrl = function()
	{
		return me.camUrl + "?"+Math.round(Math.random()*1000);
	}
}

// private:
function CDailyNews (id, shortdescription, longdescription, eovx, eovy, signid)
{
    this.id = (id != null ? id : "");
	this.shortdescription =(shortdescription != null ? shortdescription : "");
	this.longdescription = (longdescription != null ? longdescription : "");
	this.eovx = (eovx != null ? eovx : "");
	this.eovy = (eovy != null ? eovy : "");
	this.signid = (signid != null ? signid : "");
}

function SimpleAction(bSuccess, strError)
{
	this.bSuccess = bSuccess;
	this.strError = (strError != null ? strError : "");
	
}

// private:
function CInitSettings(bShowTrafficChoice, bShowMenuTraffic, bShowMenuExtraInfo, bShowMenuSearch, strCountryName, iMultiModalVersion, bTMC, bMapMenu)
{
	this.bShowTrafficChoice = bShowTrafficChoice;
	this.bShowMenuTraffic = bShowMenuTraffic;
	this.bShowMenuExtraInfo = bShowMenuExtraInfo;
	this.bShowMenuSearch = bShowMenuSearch;
	this.strCountryName = strCountryName;
	this.iMultiModalVersion = iMultiModalVersion;
	this.bTMC = bTMC;
	this.bMapMenu = bMapMenu; // menu in the map rect
}

function PBFullPoi(nID, strCaption, strIconUrl, iIconWidth, iIconHeight, strLinkUrl)
{
	this.nID = nID;
	this.strCaption = strCaption;
	this.strIconUrl = strIconUrl;
	this.iIconWidth = iIconWidth;
	this.iIconHeight = iIconHeight;
	this.strLinkUrl = strLinkUrl;
}

function PoiBannerCampaign(strItinerHeaderHtml, arrPois, pDefaultPoiData, arrContentTemplates)
{
	this.strItinerHeaderHtml = strItinerHeaderHtml;
	this.pDefaultPoiData = pDefaultPoiData;
	this.arrPois = arrPois;
	this.arrContentTemplates = (arrContentTemplates != null ? arrContentTemplates : []);
	
	if(this.pDefaultPoiData != null && this.arrPois != null)
	{
		for(var i=0; i<this.arrPois.length; i++)
		{
		    if (arrPois[i].strCaption == null || arrPois[i].strCaption == "")
		        arrPois[i].strCaption = pDefaultPoiData.strCaption;
			if(arrPois[i].strIconUrl == null || arrPois[i].strIconUrl == "")
				arrPois[i].strIconUrl = pDefaultPoiData.strIconUrl;

			if(arrPois[i].iIconWidth == null || arrPois[i].iIconWidth == 0)
				arrPois[i].iIconWidth = pDefaultPoiData.iIconWidht;
			if(arrPois[i].iIconHeight == null || arrPois[i].iIconHeight == 0)
				arrPois[i].iIconHeight = pDefaultPoiData.iIconWidht;
		}
	}
}
