// markers holder function MarkerArray (map, mapi) { this.map = map; this.mapi = mapi; this.markers = new Array(); this.markerindex = 0; this.removeMarker = removeMarker; function removeMarker(id) { google.maps.event.clearInstanceListeners(this.markers[id]); //this.map.removeOverlay(this.markers[id]); this.markers[id].setMap(null); this.markers[id] = null; } this.CreateSearchMarker = CreateSearchMarker; function CreateSearchMarker(tool, item) { var shape = { coord: [0, 0, 29, 0, 29, 39, 0, 39], type: 'poly' }; var marker = new google.maps.Marker({ anchorPoint: new google.maps.Point(15, 40), shape: shape, position: item.pos, icon: icoSearchResult, draggable: false, //map: this.map }); marker.ico = icoSearchResult; marker.icoSel = icoSearchResultSel; marker.tool = tool; marker.item = item; marker.idplace = item.id; marker.idarray = this.markerindex; marker.onPlaceMouseOver = function () { this.tool.onResultMouseOver(this.item); } marker.onPlaceMouseOut = function () { this.tool.onResultMouseOut(this.item); } marker.onPlaceClick = function () { this.tool.onResultClick(this.item); } google.maps.event.addListener(marker, "mouseover", marker, function() { this.onPlaceMouseOver(); }); google.maps.event.addListener(marker, "mouseout", marker, function() { this.onPlaceMouseOut(); }); google.maps.event.addListener(marker, "click", marker, function() { this.onPlaceClick(); }); item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } this.CreatePlaceMarker = CreatePlaceMarker; function CreatePlaceMarker(tool, item) { var shape = { coord: [9, 4, 41, 4, 41, 51, 9, 51], type: 'poly' }; var marker = new google.maps.Marker({ anchorPoint: new google.maps.Point(24, 50), shape: shape, position: item.pos, icon: icoPlace, draggable: false, //map: this.map }); marker.ico = icoPlace; marker.icoSel = icoPlaceSel; marker.tool = tool; marker.item = item; marker.idplace = item.id; marker.idarray = this.markerindex; marker.onPlaceMouseOver = function () { this.tool.onResultMouseOver(this.item); } marker.onPlaceMouseOut = function () { this.tool.onResultMouseOut(this.item); } marker.onPlaceClick = function () { this.tool.onResultClick(this.item); } google.maps.event.bind(marker, "mouseover", marker, function() { this.onPlaceMouseOver(); }); google.maps.event.bind(marker, "mouseout", marker, function() { this.onPlaceMouseOut(); }); google.maps.event.bind(marker, "click", marker, function() { this.onPlaceClick(); }); item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } this.CreatePoiMarker = CreatePoiMarker; function CreatePoiMarker(tool, item) { var shape = { coord: [0, 0, 29, 0, 29, 39, 0, 39], type: 'poly' }; var marker = new google.maps.Marker({ anchorPoint: new google.maps.Point(15, 40), shape: shape, position: item.pos, icon: icoPoi, draggable: true, //map: this.map }); marker.ico = icoPoi; marker.icoSel = icoPoiSel; marker.tool = tool; marker.item = item; marker.idarray = this.markerindex; marker.onClick = function () { this.tool.onPoiClick(this); } marker.onMouseOver = function () { if (this.item.name.length > 0) { this.tool.showInfo(this.item); } } marker.onMouseOut = function () { this.tool.clearInfos(); } marker.onDragEnd = function (latlng) { this.item.pos = latlng; } google.maps.event.bind(marker, "mouseover", marker, function() { this.onMouseOver(); }); google.maps.event.bind(marker, "mouseout", marker, function() { this.onMouseOut(); }); google.maps.event.bind(marker, "click", marker, function() { this.onClick(); }); google.maps.event.bind(marker, "dragend", marker, function(event) { this.onDragEnd(event.latLng); }); item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } this.CreatePointMarker = CreatePointMarker; function CreatePointMarker(tool, item, wtext) { if (wtext) { var shape = { coord: [0, 0, 10, 0, 10, 10, 0, 10], type: 'poly' }; var marker = new google.maps.Marker({ anchorPoint: new google.maps.Point(5, 5), shape: shape, position: item.pos, icon: icoPointName, draggable: true, //map: this.map }); } else { var shape = { coord: [0, 0, 5, 0, 5, 5, 0, 5], type: 'poly' }; var marker = new google.maps.Marker({ anchorPoint: new google.maps.Point(3, 3), shape: shape, position: item.pos, icon: icoPoint, draggable: true, map: this.map }); } if (wtext) { marker.ico = icoPointName; marker.icoSel = icoPointNameSel; } else { marker.ico = icoPoint; marker.icoSel = icoPointSel; } marker.tool = tool; marker.item = item; marker.idarray = this.markerindex; marker.onClick = function () { this.tool.onPointClick(this); } marker.onMouseOver = function () { if (this.item.name.length > 0) { this.tool.showInfo(this.item); } } marker.onMouseOut = function () { this.tool.clearInfos(); } marker.onDragEnd = function (latlng) { this.item.pos = latlng; this.tool.mapi.tour.refreshPoly(); } google.maps.event.bind(marker, "mouseover", marker, function() { this.onMouseOver(); }); google.maps.event.bind(marker, "mouseout", marker, function() { this.onMouseOut(); }); google.maps.event.bind(marker, "click", marker, function() { this.onClick(); }); google.maps.event.bind(marker, "dragend", marker, function(event) { this.onDragEnd(event.latLng); }); item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } this.CreatePointMarkerStart = CreatePointMarkerStart; function CreatePointMarkerStart(tool, item, ico, icoSel) { var marker = new google.maps.Marker({ position: item.pos, icon: ico, draggable:true, //map: this.map }); marker.ico = ico; marker.icoSel = icoSel; marker.tool = tool; marker.item = item; marker.idarray = this.markerindex; marker.onClick = function () { this.tool.onPointClick(this); } marker.onMouseOver = function () { if (this.item.name.length > 0) { this.tool.showInfo(this.item); } } marker.onMouseOut = function () { this.tool.clearInfos(); } marker.onDragEnd = function (latlng) { this.item.pos = latlng; this.tool.mapi.tour.refreshPoly(); } google.maps.event.bind(marker, "mouseover", marker, function() { this.onMouseOver(); }); google.maps.event.bind(marker, "mouseout", marker, function() { this.onMouseOut(); }); google.maps.event.bind(marker, "click", marker, function() { this.onClick(); }); google.maps.event.bind(marker, "dragend", marker, function(event) { this.onDragEnd(event.latLng); }); item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } this.CreatePointMarkerEnd = CreatePointMarkerEnd; function CreatePointMarkerEnd(tool, item, ico) { var marker = new google.maps.Marker({ position: item.pos, icon: ico, draggable: true, //map: this.map }); marker.ico = ico; marker.icoSel = ico; marker.tool = tool; marker.item = item; marker.idarray = this.markerindex; marker.onClick = function () { this.tool.onPointClick(this); } marker.onMouseOver = function () { if (this.item.name.length > 0) { this.tool.showInfo(this.item); } } marker.onMouseOut = function () { this.tool.clearInfos(); } marker.onDragEnd = function (latlng) { this.item.pos = latlng; this.tool.mapi.tour.refreshPoly(); } google.maps.event.bind(marker, "mouseover", marker, function() { this.onMouseOver(); }); google.maps.event.bind(marker, "mouseout", marker, function() { this.onMouseOut(); }); google.maps.event.bind(marker, "click", marker, function() { this.onClick(); }); google.maps.event.bind(marker, "dragend", marker, function(event) { this.onDragEnd(event.latLng); }); item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } this.CreatePointMarkerStartSearch = CreatePointMarkerStartSearch; function CreatePointMarkerStartSearch(tool, item, ico, icoSel) { var marker = new google.maps.Marker({ position: item.pos, icon: ico, draggable: false, //map: this.map }); marker.ico = ico; marker.icoSel = icoSel; marker.tool = tool; marker.item = item; marker.idarray = this.markerindex; marker.onClick = function () { this.tool.onTrackStartClick(this); } marker.onMouseOver = function () { var ico = this.getIcon(); //this.setIcon(ico.imageSelected); this.setIcon(this.icoSel); this.tool.onTrackStartMouseOver(this); } marker.onMouseOut = function () { var ico = this.getIcon(); //this.setIcon(this.imageDefault); this.setIcon(this.ico); this.tool.onTrackStartMouseOut(this); } google.maps.event.bind(marker, "mouseover", marker, function() { this.onMouseOver(); }); google.maps.event.bind(marker, "mouseout", marker, function() { this.onMouseOut(); }); google.maps.event.bind(marker, "click", marker, function() { this.onClick(); }); item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } this.CreatePointMarkerStartTSearch = CreatePointMarkerStartTSearch; function CreatePointMarkerStartTSearch(tool, item, ico) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(item.info.lat, item.info.lng), icon: ico, draggable: false, //map: this.map }); marker.ico = ico; marker.icoSel = ico; marker.tool = tool; marker.item = item; marker.idarray = this.markerindex; item.idmarker = this.markerindex; this.markers[this.markerindex] = marker; //this.map.addOverlay(this.markers[this.markerindex]); // To add the marker to the map, call setMap(); this.markers[this.markerindex].setMap(this.map); return this.markerindex++; } }