// (C)opyright N-Gine Innovation 2008 - Tous droits réservés
// http://www.ngine-innovation.com
var DebugPoly = new Array();
var baseIconSingles = new Array(); // une icone pour chaque catégorie de lieu (musée, monument, etc.)
var baseIconMultiple = null; // une seule icone pour les regroupements
// variables à surcharger
var ImgMarkerMultiple = 'Images/GMarker/bleu.png';
var ImgMarkerMultipleHighlight = 'Images/GMarker/bleub.png';
var MWCloseBtnAction = null;
var MWZoomBtnAction = null;
// ----------------------------------------------------------------------------------------------------------------------
function getImgSize(imgSrc)
{
Size = imgSrc.split( '_');
return new Array( Size[1], Size[2]);
}
// ----------------------------------------------------------------------------------------------------------------------
function removeDOMElement(Parent) {
if (!Parent) return;
while (Parent.firstChild) Parent.removeChild(Parent.firstChild);
}
// **********************************************************************************************************************
// **********************************************************************************************************************
// Classe GeoMap
// **********************************************************************************************************************
// **********************************************************************************************************************
// ----------------------------------------------------------------------------------------------------------------------
// Constructeur :
// DivID : id du div conteneur de la carte
// Tableau des évènements
// MapType : optionnel. Spécifie le type de carte. Valeurs possibles : G_NORMAL_MAP (par défaut), G_SATELLITE_MAP, G_HYBRID_MAP, G_PHYSICAL_MAP
function GeoMap( DivID, Tab, MapType)
{
this.IDGMap = DivID;
this.GMap = null;
this.ZoomControlMoteur=null;
this.MTControlMoteur=null;
this.geocoder = null;
// Tableau des marqueurs
this.MarkerList = null;
this.ImgMarkerSingles = new Array(); //ImgMarkerSingles;
this.IconSingle = null;
this.ImgMarkerSingleHighlights = new Array(); //ImgMarkerSingleHighlights;
this.IconSingleH = null;
this.ImgMarkerMultiple = ImgMarkerMultiple;
this.IconMultiple = null;
this.ImgMarkerMultipleHighlight = ImgMarkerMultipleHighlight;
this.IconMultipleH = null;
// 04/02/2008
// this.TabEvent = Tab;
this.TabEvent = new Array;
this.MouseOverMark = null;
this.MouseOutMark = null;
this.MouseClickMark = null;
// Creation de la carte Google
this.GMap = new GMap2(document.getElementById( this.IDGMap));
// Cache par défaut : la carte est doublée
this.CacheX = 1;
this.CacheY = 1;
this.CacheBound = new GBounds;
// Création de la zone d'affichage du tooltip
this.GMap.TooltipDiv = document.createElement("div");
this.GMap.TooltipDiv.className = "ToolTip";
this.GMap.TooltipDiv.style.zIndex = 2;
document.getElementById(this.IDGMap).appendChild(this.GMap.TooltipDiv);
this.GMap.TooltipDiv.style.visibility="hidden";
// Création de la zone d'affichage de la bulle d'aide
// MegaWindow appartient à GMAp pour pouvoir y accéder depuis les évènements
this.GMap.MegaMarker = null;
this.GMap.MegaWindowDiv = document.createElement("div");
//this.GMap.MegaWindowDiv.className = "MegaWindow";
this.GMap.MegaWindowDiv.style.zIndex = 2;
this.GMap.MegaWindowDiv.innerHTML = '
';
this.GMap.MegaWindowContentDiv = document.getElementById("MegaWindowContent1");
document.getElementById(this.IDGMap).appendChild(this.GMap.MegaWindowDiv);
//document.getElementsByTagName("body")[0].appendChild(this.GMap.MegaWindowDiv);
this.GMap.MegaWindowDiv.style.visibility="hidden";
/*if (this.TabEvent)
{
for (var i = 0; i < this.TabEvent.TabEvt.length; i++)
{
if ( this.TabEvent.TabEvt[i].EventName == "onMarkerClick")
this.MouseClickMark = this.TabEvent.TabEvt[i].Fonction;
else
{
GEvent.addListener( this.GMap, this.TabEvent.TabEvt[i].EventName, this.TabEvent.TabEvt[i].Fonction);
}
}
}*/
this.click = GEvent.addListener(this.GMap, 'click', this.OnClick);
this.move = GEvent.addListener(this.GMap, 'move', this.OnMove);
if (Tab)
{
for (var i = 0; i < Tab.TabEvt.length; i++)
{
if ( Tab.TabEvt[i].EventName == "onMarkerClick")
this.MouseClickMark = Tab.TabEvt[i].Fonction;
else
{
this.TabEvent.push( GEvent.addListener( this.GMap, Tab.TabEvt[i].EventName, Tab.TabEvt[i].Fonction));
}
}
this.GMap.addMapType(G_PHYSICAL_MAP);
if (MapType)
this.GMap.setMapType(MapType);
else
this.GMap.setMapType(G_NORMAL_MAP);
}
// --------------------------------------------------------------------------------------------------------------------
this.setCacheSize = function( X, Y){
// 04/02/2008
if ( this.MarkerList != null)
this.MarkerList.Clear();
this.CacheX = X;
this.CacheY = Y;
var Lng1, Lng2, Lat1, Lat2;
var X1, X2, Y1, Y2;
var DeltaX, DeltaY;
X1 = this.getCoordLeft();
X2 = this.getCoordRight();
Y1 = this.getCoordTop();
Y2 = this.getCoordBottom();
Lng1 = Math.min( X1, X2);
Lng2 = Math.max( X1, X2);
Lat1 = Math.min( Y1, Y2);
Lat2 = Math.max( Y1, Y2);
DeltaX = ( Lng2 - Lng1) / (1/this.CacheX);
DeltaY = ( Lat2 - Lat1) / (1/this.CacheY);
Lng1 -= DeltaX;
Lng2 += DeltaX;
Lat1 -= DeltaY;
Lat2 += DeltaY;
if ( this.CacheBounds != null)
delete this.CacheBounds;
this.CacheBounds = new GLatLngBounds();
this.CacheBounds.extend( new GLatLng( Lat1, Lng1));
this.CacheBounds.extend( new GLatLng( Lat2, Lng2));
}
// --------------------------------------------------------------------------------------------------------------------
this.isViewPortInCache = function(){
if ( this.CacheBounds)
return( this.CacheBounds.containsBounds( this.GMap.getBounds()));
else
return false;
}
// --------------------------------------------------------------------------------------------------------------------
this.isMarkerVisible = function(lat, lng){
return this.GMap.getBounds().containsLatLng( new GLatLng( lat, lng));
}
// --------------------------------------------------------------------------------------------------------------------
this.setMouseOverMark = function (fn){
this.MouseOverMark = fn;
}
// --------------------------------------------------------------------------------------------------------------------
this.setMouseOutMark = function (fn){
this.MouseOutMark = fn;
}
// --------------------------------------------------------------------------------------------------------------------
this.setMouseClickMark = function (fn){
this.MouseClickMark = fn;
}
// --------------------------------------------------------------------------------------------------------------------
// Images des marqueurs
this.setSingleMarkUrl = function (Category, url){
baseIconSingles[Category] = new GIcon();
var size = getImgSize( url);
if ( (size[0] == 0) || ( size[1]==0))
{
size[0] = 32;
size[1] = 32;
}
baseIconSingles[Category].iconSize = new GSize(size[0], size[1]);
baseIconSingles[Category].iconAnchor = new GPoint(size[0] / 2, size[1] / 2);
baseIconSingles[Category].infoWindowAnchor = new GPoint(size[0] / 2, size[1] / 2);
this.ImgMarkerSingles[Category] = url;
}
// --------------------------------------------------------------------------------------------------------------------
this.setMultipleMarkUrl = function ( url){
baseIconMultiple = new GIcon();
var size = getImgSize( url);
if ( (size[0] == 0) || ( size[1]==0))
{
size[0] = 32;
size[1] = 32;
}
baseIconMultiple.iconSize = new GSize(size[0], size[1]);
baseIconMultiple.iconAnchor = new GPoint(size[0] / 2, size[1] / 2);
baseIconMultiple.infoWindowAnchor = new GPoint(size[0] / 2, size[1] / 2);
this.ImgMarkerMultiple = url;
}
// --------------------------------------------------------------------------------------------------------------------
this.setSingleMarkHighlighUrl = function (Category, url){
this.ImgMarkerSingleHighlights[Category] = url;
}
// --------------------------------------------------------------------------------------------------------------------
this.setMultipleMarkHighlightUrl = function ( url){
this.ImgMarkerMultipleHighlight = url;
}
// --------------------------------------------------------------------------------------------------------------------
// Récupération des coordonnées de la carte
this.getCoordLeft = function(){
if (this.GMap)
return this.GMap.getBounds().getNorthEast().lng();
}
// --------------------------------------------------------------------------------------------------------------------
this.getCoordTop = function(){
if (this.GMap)
return this.GMap.getBounds().getNorthEast().lat();
}
// --------------------------------------------------------------------------------------------------------------------
this.getCoordBottom = function(){
if (this.GMap)
return this.GMap.getBounds().getSouthWest().lat();
}
// --------------------------------------------------------------------------------------------------------------------
this.getCoordRight = function(){
if (this.GMap)
return this.GMap.getBounds().getSouthWest().lng();
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.ShowTooltip = function(MyMarker) {
// on affiche un tooltip seulement :
// - s'il y a du texte à afficher ET
// - si la MegaWindow n'est pas visible (La MegaWindow a la priorité sur le tooltip)
if ((MyMarker.TooltipContent == null) || (this.MegaWindowDiv.style.visibility == "visible"))
return;
this.TooltipDiv.innerHTML = MyMarker.TooltipContent;
var point=this.getCurrentMapType().getProjection().fromLatLngToPixel(this.getBounds().getSouthWest(),this.getZoom());
var offset=this.getCurrentMapType().getProjection().fromLatLngToPixel(MyMarker.GMark.getPoint(),this.getZoom());
var anchor=MyMarker.GMark.getIcon().iconAnchor;
var width=MyMarker.GMark.getIcon().iconSize.width;
var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x - anchor.x, -offset.y + point.y + anchor.y));
pos.apply(this.TooltipDiv);
this.TooltipDiv.style.visibility="visible";
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.HideTooltip = function() {
this.TooltipDiv.style.visibility="hidden";
removeDOMElement(this.TooltipDiv);
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.UpdateMegaWindowInnerHTML = function(InnerHTML) {
removeDOMElement(this.MegaWindowContentDiv);
this.MegaWindowContentDiv.innerHTML = InnerHTML;
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.ShowMegaWindowPrivate = function(MyMarker, InnerHTML, ZoomAction, CloseAction) {
this.HideTooltip();
this.MegaMarker = MyMarker;
// GDownloadUrl(Url, function(data, responseCode) {
// // To ensure against HTTP errors that result in null or bad data,
// // always check status code is equal to 200 before processing the data
// if(responseCode == 200) {
// this.MegaWindowContentDiv = document.getElementById("MegaWindowContent1");
// this.MegaWindowContentDiv.innerHTML = data;
// } else if(responseCode == -1) {
// this.MegaWindowContentDiv.innerHTML = "Data request timed out. Please try later.";
// } else {
// this.MegaWindowContentDiv.innerHTML = "Request resulted in error. Check XML file is retrievable.";
// }
// });
this.MegaWindowContentDiv = document.getElementById("MegaWindowContent1");
this.UpdateMegaWindowInnerHTML(InnerHTML);
MWZoomBtnAction = ZoomAction;
MWCloseBtnAction = CloseAction;
this.UpdateMegaWindowPosition();
this.MegaWindowDiv.style.visibility="visible";
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.UpdateMegaWindowPosition = function() {
var point=this.getCurrentMapType().getProjection().fromLatLngToPixel(this.getBounds().getSouthWest(),this.getZoom());
var offset=this.getCurrentMapType().getProjection().fromLatLngToPixel(this.MegaMarker.getPoint(),this.getZoom());
var anchor=this.MegaMarker.getIcon().iconAnchor;
var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x, -offset.y + point.y + anchor.y));
pos.apply(this.MegaWindowDiv);
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.ShowMegaWindow = function(MyMarker, InnerHTML, ZoomAction, CloseAction) {
this.savePosition();
this.ShowMegaWindowPrivate(MyMarker, InnerHTML, ZoomAction, CloseAction);
}
// --------------------------------------------------------------------------------------------------------------------
// Pan sur la carte de facon à ce que le marqueur soit positionné dans la zone délimitée par (MinX, MaxX, MinY, MaxY) exprimés en % de 0 à 1
this.GMap.ShowMegaWindowAndPan = function(MyMarker, InnerHTML, ZoomAction, CloseAction, MinX, MaxX, MinY, MaxY) {
var latlng = MyMarker.getLatLng();
var coord = this.fromLatLngToContainerPixel(latlng);
var dim = this.getSize();
var deltaX = 0;
var deltaY = 0;
if (coord.x > dim.width * MaxX)
deltaX = dim.width * MaxX - coord.x;
else if (coord.x < dim.width * MinX)
deltaX = dim.width * MinX - coord.x;
if (coord.y > dim.height * MaxY)
deltaY = dim.height * MaxY - coord.y;
else if (coord.y < dim.height * MinY)
deltaY = dim.height * MinY - coord.y;
//alert (deltaX + ', ' + deltaY);
this.savePosition();
this.panBy(new GSize(deltaX, deltaY));
this.ShowMegaWindowPrivate(MyMarker, InnerHTML, ZoomAction, CloseAction);
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.HideMegaWindow = function() {
this.MegaMarker = null;
this.MegaWindowDiv.style.visibility="hidden";
removeDOMElement(this.MegaWindowContentDiv);
this.returnToSavedPosition();
}
// --------------------------------------------------------------------------------------------------------------------
this.GMap.IsMegaWindowVisible = function() {
return (this.MegaWindowDiv.style.visibility == "visible");
}
}
// ----------------------------------------------------------------------------------------------------------------------
//04/02/2008
GeoMap.prototype.Clear = function(){
// Nettoyage mémoire
this.DeleteMarkers();
delete CacheBounds;
delete this.Center;
for (var j= this.TabEvent.length-1; j>=0; j--)
{
GEvent.removeListener(this.TabEvent[j]);
}
delete this.TabEvent;
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.OnClick = function(overlay, latlng, overlaylatlng){
//alert(overlay);
if ((overlay == null) && (this.MegaWindowDiv.style.visibility == "visible"))
this.HideMegaWindow();
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.OnMove = function(){
if (this.MegaMarker == null)
return;
var visible = this.IsMegaWindowVisible();
var shouldBeVisible = this.getBounds().containsLatLng(this.MegaMarker.getLatLng());
if (visible && shouldBeVisible)
this.UpdateMegaWindowPosition();
else if (visible && !shouldBeVisible)
this.MegaWindowDiv.style.visibility = "hidden";
else if (!visible && shouldBeVisible) {
this.MegaWindowDiv.style.visibility = "visible";
this.UpdateMegaWindowPosition();
}
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.GetMarker = function( ID)
{
if ( this.MarkerList == null)
return null;
return this.MarkerList.GetMarker( ID);
}
// ----------------------------------------------------------------------------------------------------------------------
// Tri des marqueurs du nord vers le sud
GeoMap.prototype.SortMarker = function()
{
if ( this.MarkerList == null)
return null;
return this.MarkerList.SortMarker();
}
// ----------------------------------------------------------------------------------------------------------------------
// Rajoute une donnée
GeoMap.prototype.AddMark = function( ID, lat, lng, W, Zone, Category, TooltipContent)
{
// Rajoute les nouveles coordonnées
var latlng = new GLatLng( lat, lng);
if ( this.MarkerList == null)
this.MarkerList = new MarkerList();
var iMarker = this.MarkerList.AddMarker( this, latlng, ID, Zone, Category, TooltipContent);
iMarker.Weight = W;
return iMarker.GMark;
// 04/02/2008
delete latlng;
}
// ----------------------------------------------------------------------------------------------------------------------
// Positionne la carte à une adresse données
// ex :
// address = 75000 Paris
// zoom = niveau de zoom
GeoMap.prototype.SetAddress = function( address, zoom)
{
if ( this.geocoder == null)
this.geocoder = new GClientGeocoder();
var temp = this;
this.geocoder.getLatLng( address,
function(point){
if (!point)
alert("L'adresse spécifiée est introuvable");
else
temp.GMap.setCenter(point, zoom);
});
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.DeletePolys = function()
{
for ( var i = 0; i < DebugPoly.length; i++)
this.GMap.removeOverlay( DebugPoly[i]);
while( DebugPoly.length != 0)
{
DebugPoly.pop();
}
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.DeleteMarkers = function()
{
if ( this.MarkerList != null)
this.MarkerList.Clear();
delete this.MarkerList;
this.MarkerList = null;
}
// ----------------------------------------------------------------------------------------------------------------------
// Affichage des marqueurs
GeoMap.prototype.DisplayMarks = function()
{
if ( this.MarkerList != null)
this.MarkerList.ShowMarkers();
}
// ----------------------------------------------------------------------------------------------------------------------
// Création de la carte et affichage
GeoMap.prototype.Show = function()
{
// Pour pallier au pb de redimensionnement de la carte
this.GMap.checkResize();
// Rajoute le zoom à la carte
if ( this.ZoomControlMoteur == null)
this.ZoomControlMoteur = this.GMap.addControl(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0)));
// rajoute un indicateur d'echelle sur la carte
if ( this.MTControlMoteur == null)
this.MTControlMoteur = new GScaleControl();
this.GMap.addControl( this.MTControlMoteur, new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(5,20)));
// rajoute le choix du type de carte
this.GMap.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(0,0)));
this.GMap.addMapType(G_PHYSICAL_MAP);
// On positionne la carte au "centre" de la france
this.SetAddress( 'Bourges', 5);
}
// ----------------------------------------------------------------------------------------------------------------------
// Recalcule les zones de la carte, refait l'aggrégation et affiche les marqueurs
GeoMap.prototype.Invalidate = function()
{
this.DisplayMarks(); // Affichage
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.AddPoly = function( X1, Y1, X2, Y2, borderColor, fillColor, fillOpacity)
{
if (! borderColor)
borderColor = "#ff0000";
if (! fillColor)
fillColor = "#ffaaaa";
if (! fillOpacity)
fillOpacity = 0.2;
var Poly = new GPolygon( [new GLatLng( Y1, X1), new GLatLng( Y1, X2), new GLatLng( Y2, X2), new GLatLng( Y2, X1), new GLatLng( Y1, X1)], borderColor, 1, 1, fillColor, fillOpacity);
DebugPoly.push( Poly);
this.GMap.addOverlay( Poly);
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.SetDetail = function( lng, lat, zoom, mode, nom, url){
if (this.Center != null)
delete this.Center;
this.Center = new GLatLng( lat, lng);
this.ZoomLevel = zoom;
this.DetailName = nom;
this.DetailMode = mode;
this.DetailURL = url;
// Positionnement
this.GMap.setCenter( this.Center, this.ZoomLevel);
}
// ----------------------------------------------------------------------------------------------------------------------
GeoMap.prototype.DisplayDetailMap = function(){
this.GMap.checkResize();
// Changement du mode de la carte
this.GMap.setMapType( this.GMap.getMapTypes()[parseInt(this.DetailMode)]);
var GlobCurrentMark = new GMarker(this.Center, { draggable:false});
// Rajoute le marqueur
this.GMap.addOverlay( GlobCurrentMark);
// Création du texte
var InfoText = '';
// InfoText = InfoText + 'Cliquez sur le lien pour visiter le site';
GlobCurrentMark.infoWindow = InfoText;
GlobCurrentMark.openInfoWindowHtml(GlobCurrentMark.infoWindow, {maxWidth:250});
// 04/02/2008
delete GlobCurrentMark;
}
// **********************************************************************************************************************
// **********************************************************************************************************************
// Classe Marker
// **********************************************************************************************************************
// **********************************************************************************************************************
// ----------------------------------------------------------------------------------------------------------------------
// Permet de matérialiser un marqueur de type GMarker
function Marker(geomap, Id, Category, TooltipContent)
{
this.ID = Id;
this.GeoMap = geomap;
this.GMark = null;
this.Coord = null;
this.Bounds = null;
this.Weight = 0;
this.Category = Category; // musée, monument, etc.
this.TooltipContent = null;
if (TooltipContent != null)
this.TooltipContent = '' + TooltipContent + '
';
}
// ----------------------------------------------------------------------------------------------------------------------
Marker.prototype.OnMouseOver = function(){
// récupère le marker (type Marker) qui encapsule le GMarker "this"
var MyMarker = this.GeoMap.GetMarker(this.ID);
if ( this.Weight == 1)
this.setImage( this.GeoMap.ImgMarkerSingleHighlights[MyMarker.Category]);
else
this.setImage( this.GeoMap.ImgMarkerMultipleHighlight);
this.GeoMap.GMap.ShowTooltip(MyMarker);
if ( this.GeoMap.MouseOverMark != null)
this.GeoMap.MouseOverMark( this);
}
// ----------------------------------------------------------------------------------------------------------------------
Marker.prototype.OnMouseOut = function(){
// récupère le marker (type Marker) qui encapsule le GMarker "this"
var MyMarker = this.GeoMap.GetMarker(this.ID);
if ( this.Weight == 1)
this.setImage( this.GeoMap.ImgMarkerSingles[MyMarker.Category]);
else
this.setImage( this.GeoMap.ImgMarkerMultiple);
this.GeoMap.GMap.HideTooltip();
if ( this.GeoMap.MouseOutMark != null)
this.GeoMap.MouseOutMark( this);
}
// ----------------------------------------------------------------------------------------------------------------------
Marker.prototype.OnClick = function(){
if ( this.GeoMap.MouseClickMark != null)
this.GeoMap.MouseClickMark( this);
}
// ----------------------------------------------------------------------------------------------------------------------
Marker.prototype.ShowMarker = function(){
if ( this.GMark == null)
{
if ( this.Weight == 1)
{
var Icon = new GIcon(baseIconSingles[this.Category]);
Icon.image = this.GeoMap.ImgMarkerSingles[this.Category];
markerOptions = { icon:Icon };
this.GMark = new GMarker( new GPoint( this.Coord.lng(), this.Coord.lat()), markerOptions);
}
else
{
var Icon = new GIcon(baseIconMultiple);
Icon.image = this.GeoMap.ImgMarkerMultiple;
markerOptions = { icon:Icon };
this.GMark = new GMarker( new GPoint( this.Coord.lng(), this.Coord.lat()), markerOptions);
}
// Repporte les données sur le marqueur
this.GMark.ID = this.ID; // ID du site touristique
this.GMark.Bounds = this.Bounds; // zone englobante
this.GMark.Weight = this.Weight; // Pondération
this.GMark.GeoMap = this.GeoMap; // Carte google
this.GeoMap.GMap.addOverlay( this.GMark, { draggable:false});
// 04/02/2008
/*
GEvent.addListener( this.GMark, 'click', this.OnClick);
GEvent.addListener( this.GMark, 'mouseover', this.OnMouseOver);
GEvent.addListener( this.GMark, 'mouseout', this.OnMouseOut);
*/
this.GMark.click = GEvent.addListener( this.GMark, 'click', this.OnClick);
this.GMark.mouseover = GEvent.addListener( this.GMark, 'mouseover', this.OnMouseOver);
this.GMark.mouseout = GEvent.addListener( this.GMark, 'mouseout', this.OnMouseOut);
}
return (this.GMark);
}
// ----------------------------------------------------------------------------------------------------------------------
Marker.prototype.HideMarker = function(){
if ( this.GMark != null)
{
this.GeoMap.GMap.removeOverlay( this.GMark);
// 04/02/2008
GEvent.removeListener( this.GMark.click);
GEvent.removeListener( this.GMark.mouseover);
GEvent.removeListener( this.GMark.mouseout);
delete this.GMark;
this.GMark = null;
}
}
// **********************************************************************************************************************
// **********************************************************************************************************************
// Classe MarkerList
// **********************************************************************************************************************
// **********************************************************************************************************************
// ----------------------------------------------------------------------------------------------------------------------
// Contient la totalité des marqueurs
function MarkerList()
{
this.Index = 0;
this.List = new Array;
}
// ----------------------------------------------------------------------------------------------------------------------
// Rajoute un marqueur aux coordoonées spécifiées
MarkerList.prototype.AddMarker = function( geomap, latlng, nID, Zone, Category, TooltipContent){
var iItem = new Marker(geomap, nID, Category, TooltipContent);
iItem.Coord = latlng;
// Découpage de la zone englobante
var Bound = Zone.split( "|");
var bounds2=new GLatLngBounds();
bounds2.extend(new GLatLng( Bound[1], Bound[0]));
bounds2.extend(new GLatLng( Bound[3], Bound[2]));
iItem.Bounds = bounds2;
this.List.push( iItem);
this.Index++;
return iItem;
}
// ----------------------------------------------------------------------------------------------------------------------
// Affiche tous les marqueurs de la liste
MarkerList.prototype.ShowMarkers = function(){
for (var i = 0; i < this.List.length; i++)
this.List[i].ShowMarker();
}
// ----------------------------------------------------------------------------------------------------------------------
// Affiche le marqueur d'index nIndex
MarkerList.prototype.ShowMarker = function( nIndex){
if ( nIndex < this.List.length)
this.List[ nIndex].ShowMarker();
}
// ----------------------------------------------------------------------------------------------------------------------
// Masque les marqueurs
MarkerList.prototype.HideMarkers = function(){
for (var i = 0; i < this.List.length; i++)
this.List[i].HideMarker();
}
// ----------------------------------------------------------------------------------------------------------------------
// Retourne un marker
MarkerList.prototype.GetMarker = function( ID){
var bFound = false;
for ( i = 0; i < this.List.length; i++)
{
if ( this.List[i].ID == ID)
return this.List[i];
}
return null;
}
// ----------------------------------------------------------------------------------------------------------------------
// Efface toute la liste
MarkerList.prototype.Clear = function(){
while( this.List.length != 0)
{
var iMark = this.List.pop();
iMark.HideMarker();
delete iMark.Coord;
this.Index--;
}
}
// -----------------------------------------------------------------------------------------------------------------------
MegaWindowZoomClick = function() {
if (MWZoomBtnAction != null)
MWZoomBtnAction();
}
// -----------------------------------------------------------------------------------------------------------------------
MegaWindowCloseClick = function() {
if (MWCloseBtnAction != null)
MWCloseBtnAction();
}
// **********************************************************************************************************************
// **********************************************************************************************************************
// **********************************************************************************************************************
// **********************************************************************************************************************
// **********************************************************************************************************************
// **********************************************************************************************************************
// Marqueur Interface.inc.js
// Ne pas effacer les deux premières lignes du fichier qui servent de marqueur afin de déterminer si l'interface a déjà été chargée lors d'un appel précédent
// (C)opyright N-Gine Innovation 2008 - Tous droits réservés
// http://www.ngine-innovation.com
function AppelCrossDomain(URL)
{
var BaliseScript = document.createElement('script');
BaliseScript.language="JavaScript";
BaliseScript.src = URL;
BaliseScript.type = 'text/javascript';
document.body.appendChild(BaliseScript);
}
gSpotEmploiNdd = "www.spotemploi.com";
gContractKey = "23a58cfee5456ea1272b1cbe289316f8"
// (C)opyright N-Gine Innovation 2008 - Tous droits réservé.
// http://www.ngine-innovation.com
// fichier créé le 30/09/2008 par m.c.
// ------------------------------------------------------------------------------------------------
// Variables globales
var markerCount = 3; // nombre d'images différentes pour les marqueurs
var markerDefault = 1; // category par défaut (quand le champ categorie1 n'est pas renseigné) -- attention : indicé à partir de 1
var markerSingle = "/api2/pictures/marker2-s_18_18_.png";
var markerSingleHighlight = "/api2/pictures/marker2-h_20_19_.png";
var markerMultiple = "/api2/pictures/marker2-m-s_21_20_.png";
var markerMultipleHighlight = "/api2/pictures/marker2-m-h_21_21_.png";
var useMegaWindow = true;
//var divSearchHeight = 30; // px
//var divSearchMarginBottom = 10; // px
var markerURLs = Array();
var markerRawBounds = Array();
var maxLinkCount = 4; // nombre de liens dans le cadre de navigation dans la liste des résultats
// ------------------------------------------------------------------------------------------------
// créé une closure
// code magique qui permet de lier une méthode à un contexte (il est ainsi possible de différer
// l'exécution d'une méthode d'instance pour un évènement par ex)
// param object : le contexte d'exécution (le plus souvent this)
// method : la méthode à lier au contexte
function bindMethod(object, method) {
return function() {
return method.apply(object, arguments);
}
}
// ------------------------------------------------------------------------------------------------
// Appel cross-domain
// permet de passer outre la limitation du httpRequest et de de faire des requètes ajax sur d'autres
// domaines. La solution est d'ajouter une balise