/*L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',
maxZoom: 18,
id: 'mapbox.streets',
accessToken: 'your.mapbox.access.token'
}).addTo(mymap);*/
//////////////////////////
// AFFICHAGE INFO BULLE //
//////////////////////////
function DisplayInfosRoad(Point, type, context)
{
// Creation de la DIV qui va contenir les informations dans l'info bulle
var div = createElem("div", "", "infowindow", "");
// Ajout du titre
var title = "Adresse";
switch (context.toUpperCase()) {
case "DEP":
title = "Lieu de départ";
break;
case "ARR":
title = "Lieu d'arrivée";
break;
case "VIA":
title = "Étape";
break;
}
div.appendChild(createElem("p", "", "typePt type" + type, Point.Name + " (" + Point.Locality.Name + ")"));
// Ajout du libelle du point
// div.appendChild(createElem("p", "", "title", Point.Name + " (" + Point.Locality.Name + ")"));
// Ajout des liens
if (MOBILE_MODE == "0" && (context == "" || context == "CENTER"))
{
//if (RUB_CODE == RUB_CARTE_INTERACTIVE)
// div.appendChild(BuildLinkCarto(Point, type));
if(RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_RI || RUB_CODE == RUB_PRESENTATION || RUB_CODE == RUB_DEPOSITAIRE)
div.appendChild(BuildLinkRI(Point, type));
}
div.appendChild(createElem("div", "", "clear", ""));
return div;
}
function DisplayInfosPlace(Point)
{
var categ = "1";
if (Point.Category != null) categ = Point.Category;
else if (Point.CategoryList.length > 0) categ = Point.CategoryList[0].Id;
var categorie = ArrayPlacesCateg[categ];
// Creation de la DIV qui va contenir les informations dans l'info bulle
var div = createElem("div", "", "infowindow", "");
// Ajout du titre
var divtitle = createElem("div", "", "titleInfo", "");
if (categ != 3)
divtitle.appendChild(createImg("", "", categorie, CARTO_IMG + "place_" + categ + "_w.png"));
divtitle.appendChild(createElem("p", "", "typePt type" + TYPE_LP, Point.Name + " (" + Point.Locality.Name + ")"));
div.appendChild(divtitle);
// Ajout du libelle du point
var libelle = Point.Name + " (" + Point.Locality.Name + ")";
if (categ == 3)
libelle = Point.Name;
//div.appendChild(createElem("p", "", "title", libelle));
//Ajout bike
if (categ == 4)
{
if (Point.FreeBikes != null)
div.appendChild(createElem("div", "", "infosTR", Point.FreeBikes + " vélos disponibles"));
if (Point.FreePlaces != null)
div.appendChild(createElem("div", "", "infosTR", Point.FreePlaces + " places disponibles"));
}
if (categ == 9 && typeof(Point.FreePlaces) != 'undefined')
{
div.appendChild(createElem("div", "", "infosTR", Point.FreePlaces + " places de parking disponibles"));
}
// Ajout des liens
if (MOBILE_MODE == "0")
{
//if (RUB_CODE == RUB_CARTE_INTERACTIVE)
// div.appendChild(BuildLinkCarto(Point, TYPE_LP));
if(RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_PLAN || RUB_CODE == RUB_HORAIRE_LIGNE || RUB_CODE == RUB_HORAIRE_ARRET || RUB_CODE == RUB_PRESENTATION || RUB_CODE == RUB_DEPOSITAIRE)
div.appendChild(BuildLinkRI(Point, TYPE_LP));
else if(RUB_CODE == RUB_LIAISON)
div.appendChild(getLinkLiaisonDirecte(Point));
else if(RUB_CODE == RUB_HORAIRES_SCOLAIRES)
div.appendChild(getLinkHorairesScolaires(Point));
if (RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_PRESENTATION || RUB_CODE == RUB_DEPOSITAIRE)
{
var url = "";
if (RUB_CODE == RUB_CARTE_INTERACTIVE)
{
url = "/carte_interactive/?rub_code=145&pointDep="+Point.Id+"$"+Point.Name+"$"+Point.PointType+"$"+Point.LocalityId;
}
else if (RUB_CODE == RUB_DEPOSITAIRE)
{
url = "/depositaire/?rub_code=15&pointDep="+Point.Id+"$"+Point.Name+"$"+Point.PointType+"$"+Point.LocalityId;
}
else
{
url = "/presentation/?rub_code=1&thm_id="+THM_ID_VELOMAGG+"&pointDep="+Point.Id+"$"+Point.Name+"$"+Point.PointType+"$"+Point.LocalityId;
}
var divPlusInfos = createElem("div", "", "link", "");
var linkPoint = createLink("plusInfos" + Point.Id, "plusInfos", "Choisir ce lieu", url, "");
divPlusInfos.appendChild(linkPoint);
div.appendChild(divPlusInfos);
}
if (RUB_RI == RUB_CODE)
div.appendChild(BuildLinkRI(Point, TYPE_LP));
}
div.appendChild(createElem("div", "", "clear", ""));
return div;
}
function DisplayInfosStop(Point)
{
// Creation de la DIV qui va contenir les informations dans l'info bulle
var div = createElem("div", "", "infowindow", "");
// Ajout du titre
var divtitle = createElem("div", "", "titleInfo", "");
//divtitle.appendChild(createImg("", "", "Arret", CARTO_IMG + "stop_w.png"));
divtitle.appendChild(createElem("p", "", "typePt type" + TYPE_PTA, Point.Name + " (" + Point.Locality.Name + ")"));
div.appendChild(divtitle);
// Ajout du libelle du point
//div.appendChild(createElem("p", "", "title", Point.Name + " (" + Point.Locality.Name + ")"));
// Ajout des liens
if (MOBILE_MODE == "0")
{
if(RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_PLAN || RUB_CODE == RUB_HORAIRE_LIGNE || RUB_CODE == RUB_HORAIRE_ARRET )
{
if(Point.LineList != null)
div.appendChild(createLinesList(Point));
}
if ((RUB_CODE == RUB_PLAN || RUB_CODE == RUB_HORAIRE_LIGNE || RUB_CODE == RUB_HORAIRE_ARRET) )
{
var divLinkCarto = BuildLinkCarto(Point, TYPE_PTA);
addClassOnElement(divLinkCarto,"link");
div.appendChild(divLinkCarto);
}
if( (RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE== RUB_PLAN || RUB_CODE == RUB_HORAIRE_LIGNE))
div.appendChild(BuildHourStopLink(Point));
if(RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_PLAN || RUB_CODE == RUB_HORAIRE_LIGNE || RUB_CODE == RUB_HORAIRE_ARRET || RUB_CODE == RUB_PRESENTATION || RUB_CODE == RUB_DEPOSITAIRE || RUB_RI == RUB_CODE)
{
div.appendChild(BuildLinkRI(Point, TYPE_PTA));
}
if(RUB_CODE == RUB_LIAISON)
div.appendChild(getLinkLiaisonDirecte(Point));
}
div.appendChild(createElem("div", "", "clear", ""));
return div;
}
function DisplayInfosTripPoint(Point, context)
{
// Creation de la DIV qui va contenir les informations dans l'info bulle
var div = createElem("div", "", "infowindow", "");
// Ajout du titre
var divtitle = createElem("div", "", "titleInfo", "");
if (Point.PointType == TYPE_LP && Point.Category != 3)
divtitle.appendChild(createImg("", "", Point.Name, CARTO_IMG + "place_" + Point.Category + "_w.png"));
divtitle.appendChild(createElem("p", "", "typePt type" + Point.PointType, Point.Name + " (" + Point.Locality.Name + ")"));
// Ajout du titre
var title = "Arrêt";
switch (context.toUpperCase()) {
case "CENTER":
if (Point.PointType == TYPE_LP){
title = ArrayPlacesCateg[Point.Category];
}
else if (Point.PointType == TYPE_RUE) {
title = "Adresse";
}
break;
case "DEP":
title = "Lieu de départ";
break;
case "ARR":
title = "Lieu d'arrivée";
break;
case "VIA":
title = "Étape";
break;
}
div.appendChild(divtitle);
// Ajout du libelle du point
var libelle = Point.Name + " (" + Point.Locality.Name + ")";
if (Point.PointType == TYPE_LP && Point.Category == 3)
libelle = Point.Name;
//div.appendChild(createElem("p", "", "title", libelle));
//Ajout bike
if (Point.PointType == TYPE_LP && Point.Category == 4 && typeof(Point.FreeBikes) != 'undefined')
{
div.appendChild(createElem("div", "", "infosTR", Point.FreeBikes + " vélos disponibles"));
div.appendChild(createElem("div", "", "infosTR", Point.FreePlaces + " places disponibles"));
}
if (Point.PointType == TYPE_LP && Point.Category == 9 && typeof(Point.FreePlaces) != 'undefined')
{
div.appendChild(createElem("div", "", "infosTR", Point.FreePlaces + " places de parking disponibles"));
}
// Ajout des liens
if (MOBILE_MODE == "0" && context == "CENTER")
{
if(RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_PLAN || RUB_CODE == RUB_HORAIRE_LIGNE || RUB_CODE == RUB_HORAIRE_ARRET || RUB_RI == RUB_CODE || RUB_CODE == RUB_PRESENTATION || RUB_CODE == RUB_DEPOSITAIRE)
div.appendChild(BuildLinkRI(Point, Point.PointType));
else if(RUB_CODE == RUB_LIAISON)
div.appendChild(getLinkLiaisonDirecte(Point));
else if(RUB_CODE == RUB_HORAIRES_SCOLAIRES)
div.appendChild(getLinkHorairesScolaires(Point));
}
if (RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_PRESENTATION || RUB_CODE == RUB_DEPOSITAIRE)
{
if (document.getElementById("infosPoi") != null)
{
var divPlusInfos = createElem("div", "", "link", "");
var linkPoint = createLink("plusInfos" + Point.Id, "plusInfos", "Plus d'infos", "#", "ShowInfosPoi();");
divPlusInfos.appendChild(linkPoint);
div.appendChild(divPlusInfos);
}
}
if (RUB_RI == RUB_CODE)
div.appendChild(BuildLinkRI(Point, Point.PointType));
div.appendChild(createElem("div", "", "clear", ""));
return div;
}
//////////////////////////
// AFFICHAGE RESULT DIV //
//////////////////////////
function createPlacesList (obj, centerPoint)
{
var divListPlaces = createElem("div", "listPlaces", "", "");
// Creation de la DIV qui va contenir les informations
var divDescriptionPlace = createElem("div", "descriptionPlace_"+ obj.Id, "descriptionPlace", "");
// Ajout du titre
var divTitle = createElem("div", "", "title", "");
var aTitle = createLink("Placetitle_"+obj.Id, "plus left", First2UpperCase(obj.Name), "#gmap", "javascript:ClearWalkTrajects(ArrayWalkTrajects);ZoomOnPoint("+obj.Id +", TYPE_LP);");
divTitle.appendChild(aTitle);
var categ = "1";
if (obj.Category != null) categ = obj.Category;
else if (obj.CategoryList.length > 0) categ = obj.CategoryList[0].Id;
var categorie = ArrayPlacesCateg[categ];
divTitle.appendChild(createElem("span", "", "spanNetwork", categorie));
divTitle.appendChild(createElem("div", "", "clear", ""));
divDescriptionPlace.appendChild(divTitle);
// Ajout de la description
var divTextdescription = createElem("div", "textDescription_"+ obj.Id, "textDescription hideText", "");
var divLinkWalk = createElem("div", "", "linkWalk", "");
var aLinkWalk = createLink("Placetitle_"+obj.Id, "", "Rejoindre à pied", "#gmap", "javascript:ClearWalkTrajects(ArrayWalkTrajects);DisplayWalkItineray("+centerPoint.Latitude+","+centerPoint.Longitude+","+obj.Latitude+","+obj.Longitude+")");
divLinkWalk.appendChild(aLinkWalk);
divTextdescription.setAttribute("name","textDescription");
divTextdescription.appendChild(divLinkWalk);
divTextdescription.appendChild(createElem("div", "", "clear", ""));
divDescriptionPlace.appendChild(divTextdescription);
divListPlaces.appendChild(divDescriptionPlace);
return divListPlaces.innerHTML;
}
function createStopsList (obj, centerPoint)
{
var divListStops = createElem("div", "liststops", "", "")
var divDescriptionStop = createElem("div", "descriptionStop_"+ obj.Id, "descriptionStop", "")
// titre Arret
var divTitle = createElem("div", "", "title", "")
divTitle.appendChild(createLink("Stoptitle_"+obj.Id, "plus left", First2UpperCase(obj.Name), "#gmap", "javascript:ClearWalkTrajects(ArrayWalkTrajects);ZoomOnPoint("+obj.Id +","+ TYPE_PTA +");"));
divTitle.appendChild(createElem("span", "", "spanNetwork", obj.Operator.Name));
divTitle.appendChild(createElem("div", "", "clear", ""));
divDescriptionStop.appendChild(divTitle);
var divTextdescription = createElem("div", "textDescription_"+ obj.Id, "hideText", "");
divTextdescription.setAttribute("name","textDescription");
// Lien "rejoindre à pied"
var divLinkWalk = createElem("div", "", "linkWalk", "")
divLinkWalk.appendChild(createLink("", "", "Rejoindre à pied", "#gmap", "javascript:ClearWalkTrajects(ArrayWalkTrajects);DisplayWalkItineray("+centerPoint.Latitude+","+centerPoint.Longitude+","+obj.Latitude+","+obj.Longitude+",'#00DBB9'"+")"));
divTextdescription.appendChild(divLinkWalk);
divTextdescription.appendChild(createElem("div", "", "clear", ""));
if(obj.LineList.length != 0)
{
divTextdescription.appendChild(createElem("div", "", "title", "Horaires de(s) ligne(s) passant à cet arrêt:"));
}
else
{
divTextdescription.appendChild(createElem("div", "", "", "CARTO/NO_LINE indéfini"));
}
// Liste des lignes
for (var i = 0; i < obj.LineList.length; ++i)
{
for (var j = 0; j < obj.LineList[i].DirectionList.length; ++j)
{
var divLine = createElem("div", "", "line", "");
divLine.appendChild(createElem("div", "", "pictoLine pictoOp"+obj.OperatorId, obj.LineList[i].Number));
divLine.appendChild(createLink("", "", " vers " + obj.LineList[i].DirectionList[j].Name.toLowerCase(), "/horaires_arret/?rub_code=28&lign_id="+ obj.LineList[i].Id+"&sens="+obj.LineList[i].DirectionList[j].Direction+"&pa_id="+ obj.Id))
divLine.appendChild(createElem("div", "", "clear", ""));
divTextdescription.appendChild(divLine);
}
}
divTextdescription.appendChild(createElem("div", "", "clear", ""));
divDescriptionStop.appendChild(divTextdescription);
divListStops.appendChild(divDescriptionStop);
return divListStops.innerHTML;
}
function createLinesList(data)
{
var descriptionLine= createElem("div", "", "", "");
var listLines= createElem("div", "", "listLines", "");
if(data.LineList.length != 0)
{
//listLines.appendChild(createElem("div", "", "", "Ligne(s) associée(s)"));
//listLines.appendChild(createElem("div", "", "clear", ""));
}
else
{
listLines.appendChild(createElem("div", "", "", "CARTO/NO_LINE indéfini"));
listLines.appendChild(createElem("div", "", "clear", ""));
}
/*var tabLines = new Array();
for (var i = 0; i < data.LineList.length; ++i)
{
//On verifie que la ligne n'a pas deja été ajoutée
if(!contains(tabLines,data.LineList[i].Id))
{
tabLines.push(data.LineList[i].Id);
var divLine = createElem("div", "", "line", "");
if (RUB_CODE == "28")
{
divLine.appendChild(createElem("div", "", "pictoLine pictoOp"+data.LineList[i].OperatorId, ""));
divLine.appendChild(createImgLink("", "", "Horaires de la ligne", "/ftp/FR_ligne/L"+data.LineList[i].Number+".png", "/horaires_ligne/index.asp?rub_code=6&lign_id=" + data.LineList[i].Id + "&sens=" + data.LineList[i].DirectionList[0].Direction ));
}
else
{
divLine.appendChild(createElem("div", "", "pictoLine pictoOp"+data.LineList[i].OperatorId, data.LineList[i].Number+" "));
}
if (data.LineList[i].DirectionList[0].Disrupted) {
divLine.appendChild(createImgLink("", "", "Voir les perturbation(s) de la ligne", imgDisrupt, "/perturbation/?rub_code=17&lign_id=" + data.LineList[i].Id));
}
if (parseInt(DISPLAY_LINE_PLAN) == 1){
divLine.appendChild(createImgLink("", "", "Plan de ligne", imgLine, "/plan/?rub_code=5&lign_id=" + data.LineList[i].Id + "&sens=" + data.LineList[i].Direction));
}
//listLines.appendChild(divLine);
}
}*/
var divLines = document.createElement("div");
addClassOnElement(divLines,"lines");
addPictoLinesStop(data.LogicalStopId, divLines);
listLines.appendChild(divLines);
descriptionLine.appendChild(listLines);
return descriptionLine;
}
/////////////////////
// BUILD LINK //
/////////////////////
function BuildLinkCarto(Point, type)
{
var divMain = document.createElement("div");
addClassOnElement(divMain,"carte_interactive link");
var span = document.createElement("span");
var textSpan = document.createTextNode("Plus d'infos ");
span.appendChild(textSpan);
//divMain.appendChild(span);
var aDep=document.createElement("a");
if(type == TYPE_PTA)
{
aDep.setAttribute("class", "cartoPoint");
aDep.setAttribute("href","/carte_interactive/?rub_code=145&latDep="+Point.Latitude+"&lonDep="+Point.Longitude);
}
else
{
aDep.setAttribute("class", "cartoPoint");
aDep.setAttribute("href","/carte_interactive/?rub_code=145&pointDep=" + setTripPointKey(Point, type));
}
var textDep = document.createTextNode("A proximité");
aDep.appendChild(textDep);
divMain.appendChild(aDep);
return divMain;
}
// Création du lien "horaires à l'arrêt"
function BuildHourStopLink(Point)
{
var date;
if (document.getElementById("date") == null)
{
var dateObj = document.getElementById("laDate");
if (dateObj == null)
{
var laDate =new Date();
date = laDate.getDate()+"/"+(laDate.getMonth()+1)+"/"+laDate.getFullYear();
}
else
{
date= dateObj.value;
}
}
else
{
date = document.getElementById("date").value;
}
var lineId = Point.LineList[0].Id;
var sens = Point.LineList[0].DirectionList[0].Direction;
var divLink= document.createElement("div");
addClassOnElement(divLink,"link");
var aLink= document.createElement("a");
aLink.setAttribute("class", "hourStop");
aLink.setAttribute("href","/horaires_arret/?rub_code=28&lign_id="+lineId+"&laDate="+date+"&sens="+sens + "&pa_id=" + Point.Id);
var text = document.createTextNode("Horaires à l'arrêt");
aLink.appendChild(text);
divLink.appendChild(aLink);
return divLink;
}
// Création du lien départ, arrivée et via
function BuildLinkRI(Point, type)
{
var linkUrl="";
var linkUrlDep="";
var linkUrlArr="";
var linkUrlVia="";
if (RUB_CODE == RUB_RI)
{
var url = window.location.href;
if( url !='')
{
url=url.replace("#routeForm","");
url=url.replace("#gmap","");
url=url.replace("#Carto","");
url=url.replace("#Result","");
url=url.replace("#goatSelection","");
parametersList=url.split('?');
ArrayParams = parametersList[1].split('&');
var sep="&";
for (var i=0;i < ArrayParams.length ;i++ )
{
var value = ArrayParams[i].split('=');
if((value[0]!="") && (value[0]!="rub_code") && (value[0]!="laction") && (value[0]!="comDep") && (value[0]!="pointDep") && (value[0]!="pointPrefDep") && (value[0]!="comArr") && (value[0]!="pointArr") && (value[0]!="pointPrefArr") && (value[0]!="comVia") && (value[0]!="pointVia") && (value[0]!="pointPrefVia"))
{
linkUrl +=sep+ArrayParams[i];
}
else
{
if((value[0]=="comDep" && value[1]!="0") || (value[0]=="pointDep" && value[1]!="") || (value[0]=="numDep" && value[1]!="") || (value[0]=="pointPrefDep" && value[1]!=""))
{
linkUrlDep += sep + ArrayParams[i]
}
if((value[0]=="comArr" && value[1]!="0") || (value[0]=="pointArr" && value[1]!="") || (value[0]=="numArr" && value[1]!="") || (value[0]=="pointPrefArr" && value[1]!=""))
{
linkUrlArr += sep + ArrayParams[i]
}
if((value[0]=="comVia" && value[1]!="0") || (value[0]=="pointVia" && value[1]!="") || (value[0]=="numVia" && value[1]!="") || (value[0]=="pointPrefVia" && value[1]!=""))
{
linkUrlVia += sep + ArrayParams[i]
}
}
}
}
linkUrl=linkUrl.replace("'"," ");
var divLink = document.createElement("div");
addClassOnElement(divLink,"link");
if (type == TYPE_PTA) {
var divLines = document.createElement("div");
addClassOnElement(divLines,"lines");
addPictoLinesStop(Point.LogicalStopId, divLines);
divLink.appendChild(divLines);
var linkStopHour=document.createElement("a");
linkStopHour.setAttribute("class", "linkStopHour");
linkStopHour.setAttribute("href","/horaires_arret/?rub_code=28"+"&pointDep="+ setTripPointKey(Point, type));
var textHour = document.createTextNode("Horaires à l'arrêt");
linkStopHour.appendChild(textHour);
divLink.appendChild(linkStopHour);
}
var linkProx=document.createElement("a");
linkProx.setAttribute("href","/carte_interactive/?rub_code=145"+"&pointDep=" + setTripPointKey(Point, type));
linkProx.setAttribute("class", "linkProx");
var textProx = document.createTextNode("A proximité");
linkProx.appendChild(textProx);
divLink.appendChild(linkProx);
} else {
var divLink = document.createElement("div");
addClassOnElement(divLink,"link");
var aDep=document.createElement("a");
aDep.setAttribute("class", "riDep");
aDep.setAttribute("href","/ri/?rub_code=4"+ linkUrl + linkUrlArr + linkUrlVia +"&pointDep="+ setTripPointKey(Point, type));
var textDep = document.createTextNode("En partir");
aDep.appendChild(textDep);
var aArr=document.createElement("a");
aArr.setAttribute("href","/ri/?rub_code=4"+ linkUrl + linkUrlDep + linkUrlVia +"&pointArr=" + setTripPointKey(Point, type));
aArr.setAttribute("class", "riArr");
var textArr = document.createTextNode("Y aller");
aArr.appendChild(textArr);
divLink.appendChild(aDep);
divLink.appendChild(aArr);
/*if (DISPLAY_VIA_RI == "1") {
var divLink2 = document.createElement("div");
addClassOnElement(divLink2,"link");
var aVia = document.createElement("a");
aVia.setAttribute("href","/ri/?rub_code=4"+ linkUrl + linkUrlArr + linkUrlDep +"&pointVia=" + setTripPointKey(Point, type));
var textVia = document.createTextNode("Passer par ce lieu");
aVia.appendChild(textVia);
divLink2.appendChild(aVia);
divLink.appendChild(divLink2);
}*/
}
return divLink;
}
//permet d'initialiser les evenements sur les checkBox qui representent les types de poi
function InitPOI() {
initPOI = true;
if (RUB_CODE == RUB_PRESENTATION)
{
ArrayPlacesCateg[4] = "Vélomagg libre-service";
ArrayPlacesImg[4] = CARTO_IMG + "/place_4.png";
ArrayPlaces[4] = new Array();
$('#s1_4').bind("click", function () { CheckPOI(4); });
ArrayPlacesCateg[5] = "Vélomagg véloparcs";
ArrayPlacesImg[5] = CARTO_IMG + "/place_5.png";
ArrayPlaces[5] = new Array();
$('#s1_5').bind("click", function () { CheckPOI(5); });
ArrayPlacesCateg[200] = "Vélomagg loisirs";
ArrayPlacesImg[200] = CARTO_IMG + "/place_200.png";
ArrayPlaces[200] = new Array();
$('#s1_200').bind("click", function () { CheckPOI(200); });
ArrayPlacesCateg[236] = "Vélomagg plage";
ArrayPlacesImg[236] = CARTO_IMG + "/place_236.png";
ArrayPlaces[236] = new Array();
$('#s1_236').bind("click", function () { CheckPOI(236); });
}
else if (RUB_CODE == RUB_DEPOSITAIRE)
{
ArrayPlacesCateg[20] = "Espaces mobilité";
ArrayPlacesImg[20] = CARTO_IMG + "/place_20.png";
ArrayPlaces[20] = new Array();
$('#s1_20').bind("click", function () { CheckPOI(20); });
ArrayPlacesCateg[21] = "Commerçants relais";
ArrayPlacesImg[21] = CARTO_IMG + "/place_21.png";
ArrayPlaces[21] = new Array();
$('#s1_21').bind("click", function () { CheckPOI(21); });
}
else
{
var ssName = "velostation";
var JSStr = "";
ArrayPlacesCateg[4] = "Vélostations";
ArrayPlacesImg[4] = CARTO_IMG + "/place_4.png";
ArrayPlaces[4] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 4 + ");";
ArrayPlacesCateg[200] = "Vélostations";
ArrayPlacesImg[200] = CARTO_IMG + "/place_200.png";
ArrayPlaces[200] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 200 + ");";
ArrayPlacesCateg[235] = "Vélomagg à l'année";
ArrayPlacesImg[235] = CARTO_IMG + "/place_235.png";
ArrayPlaces[235] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 235 + ");";
ArrayPlacesCateg[236] = "Vélomagg plage";
ArrayPlacesImg[236] = CARTO_IMG + "/place_236.png";
ArrayPlaces[236] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 236 + ");";
ArrayPlacesCateg[237] = "Vélomagg' Electrik";
ArrayPlacesImg[237] = CARTO_IMG + "/place_237.png";
ArrayPlaces[237] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 237 + ");";
JS[ssName] = JSStr;
ArrayPlacesCateg[5] = "Véloparcs";
ArrayPlacesImg[5] = CARTO_IMG + "/place_5.png";
ArrayPlaces[5] = new Array();
$('#s1_5').bind("click", function () { CheckPOI(5); });
var ssName = "parking";
var JSStr = "";
ArrayPlacesCateg[6] = "Parkings P + Tram";
ArrayPlacesImg[6] = CARTO_IMG + "/place_6.png";
ArrayPlaces[6] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 6 + ");";
ArrayPlacesCateg[1] = "Lieu public";
ArrayPlacesImg[1] = CARTO_IMG + "/place_1.png";
ArrayPlaces[1] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 1 + ");";
JS[ssName] = JSStr;
ArrayPlacesCateg[8] = "Parkings de proximité";
ArrayPlacesImg[8] = CARTO_IMG + "/place_8.png";
ArrayPlaces[8] = new Array();
$('#s1_8').bind("click", function () { CheckPOI(8); });
ArrayPlacesCateg[9] = "Parkings de centre-ville";
ArrayPlacesImg[9] = CARTO_IMG + "/place_9.png";
ArrayPlaces[9] = new Array();
$('#s1_9').bind("click", function () { CheckPOI(9); });
var ssName = "pointvente";
var JSStr = "";
ArrayPlacesCateg[21] = "Commerçants relais";
ArrayPlacesImg[21] = CARTO_IMG + "/place_21.png";
ArrayPlaces[21] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 21 + ");";
ArrayPlacesCateg[22] = "Maisons de proximité";
ArrayPlacesImg[22] = CARTO_IMG + "/place_22.png";
ArrayPlaces[22] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 22 + ");";
JS[ssName] = JSStr;
ArrayPlacesCateg[20] = "Espaces mobilité";
ArrayPlacesImg[20] = CARTO_IMG + "/place_20.png";
ArrayPlaces[20] = new Array();
$('#s1_20').bind("click", function () { CheckPOI(20); });
ArrayPlacesCateg[201] = "Stations d'autopartage";
ArrayPlacesImg[201] = CARTO_IMG + "/place_201.png";
ArrayPlaces[201] = new Array();
$('#s1_201').bind("click", function () { CheckPOI(201); });
ArrayPlacesCateg[202] = "Aires de covoiturage";
ArrayPlacesImg[202] = CARTO_IMG + "/place_202.png";
ArrayPlaces[202] = new Array();
$('#s1_202').bind("click", function () { CheckPOI(202); });
var ssName = "enseignement";
var JSStr = "";
ArrayPlacesCateg[210] = "Écoles";
ArrayPlacesImg[210] = CARTO_IMG + "/place_210.png";
ArrayPlaces[210] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 210 + ");";
ArrayPlacesCateg[211] = "Collèges, lycées";
ArrayPlacesImg[211] = CARTO_IMG + "/place_211.png";
ArrayPlaces[211] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 211 + ");";
ArrayPlacesCateg[212] = "Enseignement supérieur";
ArrayPlacesImg[212] = CARTO_IMG + "/place_212.png";
ArrayPlaces[212] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 212 + ");";
JS[ssName] = JSStr;
var ssName = "administration";
var JSStr = "";
ArrayPlacesCateg[220] = "Administrations";
ArrayPlacesImg[220] = CARTO_IMG + "/place_220.png";
ArrayPlaces[220] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 220 + ");";
ArrayPlacesCateg[230] = "Hôtels de ville, d'agglomération, de département et de région";
ArrayPlacesImg[230] = CARTO_IMG + "/place_230.png";
ArrayPlaces[230] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 230 + ");";
ArrayPlacesCateg[231] = "Maisons de quartier et maisons pour tous";
ArrayPlacesImg[231] = CARTO_IMG + "/place_231.png";
ArrayPlaces[231] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 231 + ");";
ArrayPlacesCateg[233] = "Bureaux de poste";
ArrayPlacesImg[233] = CARTO_IMG + "/place_233.png";
ArrayPlaces[233] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 233 + ");";
JS[ssName] = JSStr;
var ssName = "loisirs";
var JSStr = "";
ArrayPlacesCateg[223] = "Bibliothèques, médiathèques";
ArrayPlacesImg[223] = CARTO_IMG + "/place_223.png";
ArrayPlaces[223] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 223 + ");";
ArrayPlacesCateg[229] = "Loisirs et culture";
ArrayPlacesImg[229] = CARTO_IMG + "/place_229.png";
ArrayPlaces[229] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 229 + ");";
ArrayPlacesCateg[232] = "Musées";
ArrayPlacesImg[232] = CARTO_IMG + "/place_232.png";
ArrayPlaces[232] = new Array();
JSStr = JSStr + "CheckPOI2( ssName , " + 232 + ");";
JS[ssName] = JSStr;
ArrayPlacesCateg[215] = "Sports";
ArrayPlacesImg[215] = CARTO_IMG + "/place_215.png";
ArrayPlaces[215] = new Array();
$('#s1_215').bind("click", function () { CheckPOI(215); });
ArrayPlacesCateg[216] = "Stades";
ArrayPlacesImg[216] = CARTO_IMG + "/place_216.png";
ArrayPlaces[216] = new Array();
$('#s1_216').bind("click", function () { CheckPOI(216); });
ArrayPlacesCateg[221] = "Arènes";
ArrayPlacesImg[221] = CARTO_IMG + "/place_221.png";
ArrayPlaces[221] = new Array();
$('#s1_221').bind("click", function () { CheckPOI(221); });
ArrayPlacesCateg[224] = "Centres commerciaux";
ArrayPlacesImg[224] = CARTO_IMG + "/place_224.png";
ArrayPlaces[224] = new Array();
$('#s1_224').bind("click", function () { CheckPOI(224); });
ArrayPlacesCateg[225] = "Châteaux et domaines";
ArrayPlacesImg[225] = CARTO_IMG + "/place_225.png";
ArrayPlaces[225] = new Array();
$('#s1_225').bind("click", function () { CheckPOI(225); });
ArrayPlacesCateg[226] = "Cimetières";
ArrayPlacesImg[226] = CARTO_IMG + "/place_226.png";
ArrayPlaces[226] = new Array();
$('#s1_226').bind("click", function () { CheckPOI(226); });
ArrayPlacesCateg[227] = "Lieux de culte";
ArrayPlacesImg[227] = CARTO_IMG + "/place_227.png";
ArrayPlaces[227] = new Array();
$('#s1_227').bind("click", function () { CheckPOI(227); });
ArrayPlacesCateg[228] = "Hôpitaux et cliniques";
ArrayPlacesImg[228] = CARTO_IMG + "/place_228.png";
ArrayPlaces[228] = new Array();
$('#s1_228').bind("click", function () { CheckPOI(228); });
ArrayPlacesCateg[234] = "Campings";
ArrayPlacesImg[234] = CARTO_IMG + "/place_234.png";
ArrayPlaces[234] = new Array();
$('#s1_234').bind("click", function () { CheckPOI(234); });
ArrayPlacesCateg[222] = "Autres équipements";
ArrayPlacesImg[222] = CARTO_IMG + "/place_222.png";
ArrayPlaces[222] = new Array();
$('#s1_222').bind("click", function () { CheckPOI(222); });
//regroupement des POI correspondants
$('#s1_stop').bind("click", function () { if ($('#s1_stop').is(':checked') && mymap.getZoom() >= ZOOM_SHOW_STOP) { AddStopsByBoundingBox(mymap.getBounds().getSouthWest().lat, mymap.getBounds().getSouthWest().lng, mymap.getBounds().getNorthEast().lat, mymap.getBounds().getNorthEast().lng,""); } else { HideMarkers(ArrayStops )} });
$('#s1_enseignement').bind("click", function () { ssName="enseignement"; eval(JS['enseignement']); });
$('#s1_administration').bind("click", function () { ssName="administration"; eval(JS['administration']); });
$('#s1_loisirs').bind("click", function () { ssName="loisirs"; eval(JS['loisirs']); });
$('#s1_velostation').bind("click", function () { ssName="velostation"; eval(JS['velostation']); });
$('#s1_pointvente').bind("click", function () { ssName="pointvente"; eval(JS['pointvente']); });
$('#s1_parking').bind("click", function () { ssName="parking"; eval(JS['parking']); });
}
}
function CheckPOI(categ)
{
if ($('#s1_' + categ).is(':checked') && mymap.getZoom() >= ZOOM_SHOW_POI)
{
AddPlacesByBoundingBox(mymap.getBounds().getSouthWest().lat, mymap.getBounds().getSouthWest().lng, mymap.getBounds().getNorthEast().lat, mymap.getBounds().getNorthEast().lng, categ); ;
}
else {
if (RUB_CODE == RUB_CARTE_INTERACTIVE || RUB_CODE == RUB_HORAIRE_ARRET || RUB_CODE == RUB_PRESENTATION || RUB_CODE == RUB_DEPOSITAIRE) {
HideMarkers(ArrayPlaces[categ]);
}
else {
HideMarkers(ArrayPlaces);
}
}
}
function CheckPOI2(categ, sscateg)
{
if ($('#s1_' + categ).is(':checked') && mymap.getZoom() >= ZOOM_SHOW_POI)
{
$('#s1_' + sscateg).attr('checked','checked');
AddPlacesByBoundingBox(mymap.getBounds().getSouthWest().lat, mymap.getBounds().getSouthWest().lng, mymap.getBounds().getNorthEast().lat, mymap.getBounds().getNorthEast().lng, sscateg); ;
}
else {
$('#s1_' + sscateg).removeAttr('checked');
HideMarkers(ArrayPlaces[sscateg]);
}
}
function FullScreenControl(map) {
var controlDiv = document.createElement('DIV');
// Set CSS for the control border
var controlUI = document.createElement('DIV');
controlUI.id = "fullScreenControl";
controlUI.title = "Cliquez pour passer en mode plein écran";
controlDiv.appendChild(controlUI);
// Set CSS for the control interior
var controlText = document.createElement('DIV');
controlText.id = "fullScreenText";
controlText.innerHTML = "Plein écran";
controlUI.appendChild(controlText);
// Setup the click event listener
google.maps.event.addDomListener(controlUI, 'click', function () {
var div = $("#mapContainer");
if (!div.hasClass("fullscreen")) {
controlUI.gMapsParent = div.parent();
$("fullScreenText").html("Mode normal");
div.appendTo('body');
controlUI.title = "Cliquez pour revenir en mode normal ";
controlText.innerHTML = "Mode normal";
}
else {
mapLegend = document.getElementById("mapLegend");
controlUI.title = "Cliquez pour passer en mode plein écran";
$("fullScreenText").html("Plein écran");
$('#mapLegend').before(div);
controlText.innerHTML = "Plein écran";
}
$("#global").toggleClass("hidden");
div.toggleClass("fullscreen");
google.maps.event.trigger(map, 'resize');
if (pointCenter != null)
{
var latlngCenter = new google.maps.LatLng(pointCenter.Latitude, pointCenter.Longitude);
map.setCenter(latlngCenter);
}
else if (markersArray.length == 0)
{
var center = new google.maps.LatLng(LAT_CENTER, LON_CENTER);
map.setCenter(center);
map.setZoom(ZOOM_LEVEL);
}
else
{
if(RUB_CODE != RUB_CARTE_INTERACTIVE )
SetBounds(markersArray);
}
window.location.hash="Carto";
});
// touche echap
google.maps.event.addDomListener(document, 'keyup', function (e) {
var div = $("#mapContainer");
if (div.hasClass("fullscreen") && e.keyCode == 27) {
controlUI.title = "Cliquez pour passer en mode plein écran";
controlUI.gMapsParent.prepend(div);
$("#global").toggleClass("hidden");
div.toggleClass("fullscreen");
google.maps.event.trigger(map, 'resize');
}
});
controlDiv.index = 1;
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv);
execCmd();
}
//Retourne le libellé
function getLib(lib)
{
var libelle = "";
switch(lib)
{
case "NO_STOP" : libelle = "Pas d'arrêt à proximité";
case "NO_PLACE" : libelle = "Pas de lieu à proximité";
break;
default : libelle = "";
break;
}
return libelle;
}
function getColorByMode(Mode)
{
var color = "#008AFF";
switch(Mode)
{
case "MARCHE", "FOOT" : color = "#00DBB9"; break;
case "WALK" : color = "#00DBB9"; break;
case "ROUTE", "PRIVATE_VEHICLE" : color = "#FF00BA"; break;
case "CAR_POOL" : color = "#FF00BA"; break;
case "TAD", "TOD" : color = "#008AFF"; break;
case "BIKE", "BICYCLE" : color = "#FF9600"; break;
case "BIKEWAY": color="#975900"; break;
case "BOAT" : color="#FF8040"; break;
}
return color;
}
function getImageMarker(image) {
var imageMarker = {
url: image,
size: new google.maps.Size(23, 23),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(10, 10),
scaledSize: new google.maps.Size(23, 23)
};
if (image == imgPointSelected || image == imgDepart || image == imgArrivee || image == imgVia) {
var imageMarker = {
url: image,
size: new google.maps.Size(24, 24),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(3, 24),
scaledSize: new google.maps.Size(22, 28)
};
}
return imageMarker;
}
function getOSMImageMarker(image) {
// jouer avec ce style suivant dans Carto.css pour le popupAnchor:
//.leaflet-popup-pane, .leaflet-control { margin-top:-20px; }
if (image != undefined)
{
if (image == imgTarget){
var imageMarker = L.icon({
iconUrl: image,
iconAnchor: [20, 10],
popupAnchor: [0, -10]
});
}
else {
var imageMarker = L.icon({
iconUrl: image,
iconSize: [24,24],
iconAnchor: [13, 10],
popupAnchor: [0, -10]
});
}
if (image == imgPointSelected || image == imgDepart || image == imgArrivee || image == imgVia) {
var imageMarker = L.icon({
iconUrl: image,
iconSize: [24,24],
iconAnchor: [3, 10],
popupAnchor: [0, -10]
});
}
if (image == imgStop) {
var imageMarker = L.icon({
iconUrl: image,
iconSize: [24,24],
iconAnchor: [13, 13],
popupAnchor: [0, -10]
});
}
}
else
{
var imageMarker = L.icon({
iconUrl: imgStop,
iconSize: [24,24],
iconAnchor: [13, 13],
popupAnchor: [0, -10]
});
}
return imageMarker;
}
function AffPOIDetails(Point)
{
$('#selectedPoi').removeClass('invisible');
$('#aroundSpan').html(Point.Name + ' ' + Point.Locality.Name);
}
function AffPOIInfos(Point)
{
$('#plusInfos' + Point.Id).click(function(){
alert("ok->" + $('#infosPoi').hasClass('invisible'));
$('#closeInfos').click (function(){ $('#infosPoi').addClass('invisible'); });
if ($('#infosPoi').hasClass('invisible'))
{
$('#infosPoi').removeClass('invisible');
}
else
{
$('#infosPoi').addClass('invisible');
}
});
}
function ShowInfosPoi()
{
if ($('#infosPoi').hasClass('invisible'))
{
$('#infosPoi').removeClass('invisible');
}
else
{
$('#infosPoi').addClass('invisible');
}
$('#closeInfos').click (function(){ $('#infosPoi').addClass('invisible'); });
}