var map; var icon; function load_int() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_i")); map.enableDoubleClickZoom(); map.setCenter(new GLatLng(30.071470887901302, -81.4361572265625), 9); map.addControl(new GSmallMapControl()); //overview = map.addControl(new GOverviewMapControl()); //var html='
'; var html = ''; mapkey=new HtmlControl(html); addMarker(map, 30.31984, -81.68197, "Interstate 10/Interstate 95 Interchange Reconstruction in Duval County", "/i95/projects/details.aspx?ProjectID=25", "construction"); addMarker(map, 30.458144351018078, -81.65176391601562, " Interstate 295 and Interstate 95", "/i95/projects/details.aspx?ProjectID=161", "construction"); addMarker(map, 30.320136880604423, -81.68128967285156, "Interstate 10 and 95 - Stockton St to Adams St", "/i95/projects/details.aspx?ProjectID=25", "construction"); addMarker(map, 30.38575916003863, -81.6697883605957, "Interstate 95 - Adding lanes at Trout River from Lem Turner Road to Zoo Parkway", "/i95/projects/details.aspx?ProjectID=185", "construction"); addMarker(map, 30.3856110780563, -81.6697883605957, "Interstate 95 - Adding lanes from Heckscher Drive to I-295", "/i95/projects/details.aspx?ProjectID=186", "construction"); addMarker(map, 30.151064813970038, -81.54670715332031, "Interstate 95 - Traveler Information System from St. Johns County line to I-295", "/i95/projects/details.aspx?ProjectID=182", "construction"); addMarker(map, 30.3995298034023, -81.6665267944336, "Interstate 95 - Landscape from Lem Turner Rd to Heckscher Dr", "/i95/projects/details.aspx?ProjectID=185", "construction"); addMarker(map, 30.406340371759537, -81.63700103759766, "Interstate 95 - Landscape from Heckscher Drive to I-295", "/i95/projects/details.aspx?ProjectID=186", "construction"); addMarker(map, 30.69224973107188, -81.6778564453125, "I-95 Southbound Rest Area in Nassau County - Mile Marker 378", "/i95/location.aspx?id=74", "rest"); addMarker(map, 30.104444807954294, -81.50447845458984, "I-95 North and Southbound Rest Areas at Mile Marker 331 ", "/i95/location.aspx?id=75", "rest"); addMarker(map, 29.691631763244675, -81.3262939453125, "I-95 Rest Area (northbound at MM 302 and southbound at MM 303)", "/i95/location.aspx?id=76", "rest"); //var bottomLeft = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(120,120)); //map.addControl(new GOverviewMapControl(), bottomLeft); } } function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.enableDoubleClickZoom(); map.setCenter(new GLatLng(30.071470887901302, -81.4361572265625), 9); map.addControl(new GSmallMapControl()); //map.addControl(new GOverviewMapControl()); var html=''; mapkey=new HtmlControl(html); map.addControl(mapkey, new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(3, 10))); // add i-10 line addMarker(map, 30.31984, -81.68197, "Interstate 10/Interstate 95 Interchange Reconstruction in Duval County", "/i95/projects/details.aspx?ProjectID=25", "construction"); addMarker(map, 30.458144351018078, -81.65176391601562, " Interstate 295 and Interstate 95", "/i95/projects/details.aspx?ProjectID=161", "construction"); addMarker(map, 30.320136880604423, -81.68128967285156, "Interstate 10 and 95 - Stockton St to Adams St", "/i95/projects/details.aspx?ProjectID=25", "construction"); addMarker(map, 30.38575916003863, -81.6697883605957, "Interstate 95 - Adding lanes at Trout River from Lem Turner Road to Zoo Parkway", "/i95/projects/details.aspx?ProjectID=185", "construction"); addMarker(map, 30.3856110780563, -81.6697883605957, "Interstate 95 - Adding lanes from Heckscher Drive to I-295", "/i95/projects/details.aspx?ProjectID=186", "construction"); addMarker(map, 30.151064813970038, -81.54670715332031, "Interstate 95 - Traveler Information System from St. Johns County line to I-295", "/i95/projects/details.aspx?ProjectID=182", "construction"); addMarker(map, 30.3995298034023, -81.6665267944336, "Interstate 95 - Landscape from Lem Turner Rd to Heckscher Dr", "/i95/projects/details.aspx?ProjectID=185", "construction"); addMarker(map, 30.406340371759537, -81.63700103759766, "Interstate 95 - Landscape from Heckscher Drive to I-295", "/i95/projects/details.aspx?ProjectID=186", "construction"); addMarker(map, 30.69224973107188, -81.6778564453125, "I-95 Southbound Rest Area in Nassau County - Mile Marker 378", "/i95/location.aspx?id=74", "rest"); addMarker(map, 30.104444807954294, -81.50447845458984, "I-95 North and Southbound Rest Areas at Mile Marker 331 ", "/i95/location.aspx?id=75", "rest"); addMarker(map, 29.691631763244675, -81.3262939453125, "I-95 Rest Area (northbound at MM 302 and southbound at MM 303)", "/i95/location.aspx?id=76", "rest"); } } function addMarker(m,lat,lng,tooltip,page,type) { icon = new GIcon(); icon.iconAnchor = new GPoint(0, 30); switch(type) { case 'exit': icon.iconSize = new GSize(19,30); icon.image = '/i295/images/mm_exit.png'; break; case 'rest': icon.iconSize = new GSize(19,30); icon.image = '/i295/images/mm_rest.png'; break; case 'construction': icon.iconSize = new GSize(19,30); icon.image = '/i295/images/mm_construction.png'; break; default: icon.iconSize = new GSize(12,20); icon.image = '/i295/images/mm_20_red.png'; break; } var marker = new GxMarker(new GLatLng(lat,lng), icon, tooltip); GEvent.addListener(marker, "click", function() { window.location = page; }); m.addOverlay(marker); } function createIcon(path_to_icon, path_to_icon_shadow) { icon = new GIcon(); icon.image = path_to_icon; icon.shadow = path_to_icon_shadow; icon.iconSize = new GSize(12, 20); icon.shadowSize = new GSize(22, 20); icon.iconAnchor = new GPoint(6, 20); icon.infoWindowAnchor = new GPoint(5, 1); } var __singleLabel; var __singleLabelRefCount = 0; function GxLabel( content, opts ) { if ( typeof opts != "object" ) throw "Invalid GxLabel configuration"; this.content = content; if ( opts.offset && typeof opts.offset.width != "undefined" ) this.offset = opts.offset else this.offset = new GSize(0,0); this.className = opts.className || "markerTooltip"; if ( opts.marker && typeof opts.marker.getPoint != "undefined" ) { this.marker = opts.marker; this.anchor = opts.marker.getPoint(); if ( opts.isStatic ) { this.isStatic = true; } else { __singleLabelRefCount++; GEvent.addListener(this.marker, "mouseover", this.createSingletonClosure(this.show, this.anchor, this.offset, this.content)); GEvent.addListener(this.marker, "mouseout", this.createSingletonClosure(this.hide, this.anchor, this.offset, this.content)); if ( !__singleLabel ) __singleLabel = this; return __singleLabel; } } else if ( opts.anchor && typeof opts.anchor.lat != "undefined" ) { if ( opts.isStatic ) { this.isStatic = true; } if ( opts.moveHandle ) { this.moveHandle = true; } if ( opts.deleteHandle ) { this.deleteHandle = true; } this.anchor = opts.anchor } if ( opts.pane ) this.pane = opts.pane; if ( !this.anchor ) throw "Invalid label configuration: no anchor point"; } GxLabel.prototype = new GOverlay(); GxLabel.prototype.initialize = function(map) { var t = this; if ( __singleLabel && !this.isStatic ) t = __singleLabel; t.map = map; t.pane = map.getPane(t.pane || G_MAP_MARKER_PANE) || map.getPane(G_MAP_MARKER_PANE); if ( !t.container ) { t.container = document.createElement("div"); t.container.className = t.className; t.container.style.position = "absolute"; if ( t.moveHandle && !t.moveHandleNode ) { t.moveHandlePanel = t.pane; t.contentNode = document.createElement("div"); t.moveHandleNode = document.createElement("div"); with ( t.moveHandleNode.style ) { background = "#ccc"; width = "8px"; height = "100%"; cssFloat = "left"; fontWeight = "bold"; textAlign = "center"; borderRight = "1px solid #555"; } t.contentNode.style.marginLeft = "10px"; t.moveHandleNode.innerHTML = ":"; t.container.appendChild(t.moveHandleNode); t.container.appendChild(t.contentNode); t.insertPoint = t.contentNode; GEvent.bindDom(t.moveHandleNode, "mousedown", this, this.mouseDown); } else { t.insertPoint = t.container; } t.setContent(t.content); t.pane.appendChild(t.container); var b = t.container; GEvent.addDomListener(b, "click", function(e) { stopEvent(e); GEvent.trigger(t, "click", e); }); GEvent.addDomListener(b, "mouseup", function(e) { stopEvent(e); t.mouseUp(e); GEvent.trigger(t, "mouseup", e); }); GEvent.addDomListener(b, "mousedown", function(e) { stopEvent(e); GEvent.trigger(t, "mousedown", e); }); } } GxLabel.prototype.setContent = function(content) { var t = this; if ( __singleLabel && !this.isStatic ) t = __singleLabel; if ( content ) { var point = t.insertPoint || t.container; point.innerHTML = ""; if ( typeof content == "object" ) { point.appendChild(content); t.content = point.innerHTML; } else { t.content = content; point.innerHTML = t.content; } if ( t.deleteHandle ) { var img = document.createElement("img"); img.src = "/static/images/close.png"; img.alt = ""; img.style.padding = "0px 2px"; GEvent.bindDom(img, "click", this, this.remove); point.appendChild(img); } } } GxLabel.prototype.setAnchor = function(anchor) { try { if ( anchor.lat() && anchor.lng() ) { this.anchor = anchor; this.redraw(); } } catch(E) {} } GxLabel.prototype.remove = function() { if ( this.isStatic || --__singleLabelRefCount <= 0 ) { this.container.parentNode.removeChild(this.container); GEvent.trigger(this, "remove"); } } GxLabel.prototype.copy = function() { } GxLabel.prototype.redraw = function(force) { if ( this.isStatic ) { this.show(); } else { /* Show dynamic tooltips only on events, not on redraws */ this.hide(); } } GxLabel.prototype.createSingletonClosure = function(fn, p, o, c) { var _t = this; var obj = fn; var _p = p; var _o = o; var _c = c; p = null; fn = null; o = null; c = null; return function() { _t.setContent(_c); obj.apply(_t, [ _p, _o ] ); }; } GxLabel.prototype.show = function(point, offset) { try { var t = this; if ( __singleLabel && !this.isStatic ) t = __singleLabel; var p = point || t.anchor; var o = offset || t.offset || new GSize(0,0); if ( p && p.lat ) { t.anchor = p; t.offset = o; var pix = t.map.fromLatLngToDivPixel(p); t.container.style.left = ( pix.x + o.width ) + "px"; t.container.style.top = ( (pix.y + o.height) - 50 ) + "px"; t.container.style.display = ""; } } catch(e) { } } /* Pointless Params! */ GxLabel.prototype.hide = function(point, offset) { var t = this; if ( __singleLabel && !this.isStatic ) t = __singleLabel; t.container.style.display = "none"; } GxLabel.prototype.mouseUp = function(e) { if ( this.mouseUpListener ) GEvent.removeListener(this.mouseUpListener); if ( this.mouseMoveListener ) GEvent.removeListener(this.mouseMoveListener); if ( this.startDrag ) { } GEvent.trigger(this, "moveend", this.anchor); this.startDrag = false; } GxLabel.prototype.mouseMove = function(e) { if ( !this.startDrag ) { if ( this.mouseUpListener ) GEvent.removeListener(this.mouseUpListener); if ( this.mouseMoveListener ) GEvent.removeListener(this.mouseMoveListener); return false; } var point = new GPoint( e.clientX - this.topLeftPoint.x, e.clientY - this.topLeftPoint.y); var anchor = this.map.fromDivPixelToLatLng(point); this.anchor = anchor; this.redraw(); } GxLabel.prototype.mouseDown = function(e) { stopEvent(e); this.startDrag = true; this.topLeftPoint = new GPoint( dojo.html.getAbsoluteX(document.getElementById("map")), dojo.html.getAbsoluteY(document.getElementById("map"))); if ( !this.mouseUpListener ) { this.mouseUpListener = GEvent.bindDom(document.getElementById("map"), "mouseup", this, this.mouseUp); } if ( !this.mouseMoveListener ) { this.mouseUpListener = GEvent.bindDom(document.getElementById("map"), "mousemove", this, this.mouseMove); } } function stopEvent(eventObject) { if (eventObject && eventObject.stopPropagation) { eventObject.stopPropagation(); } if (window.event && window.event.cancelBubble ) { window.event.cancelBubble = true; } if (eventObject && eventObject.preventDefault) { eventObject.preventDefault(); } if (window.event) { window.event.returnValue = false; } } function GxMarker(point, icon, tooltip, opts) { if ( tooltip ) { var oldInit = this.initialize; var _t = this; var offset = ( typeof opts == "object" ) ? (opts.offset || new GPoint(22,0)) : new GPoint(22,0); var isStatic = ( typeof opts == "object" ) ? (opts.isStatic || false ) : false; this.initialize = function(map) { var l = new GxLabel(tooltip, { "marker": _t, "offset": offset, "isStatic": isStatic }); map.addOverlay(l); oldInit.apply(_t, [ map ]); } } GMarker.apply(this, [ point, icon ]); } GxMarker.prototype = new GMarker(new GLatLng(1,1)); function debug(msg) { var d = document.getElementById("debug") ? document.getElementById("debug") : document.body; d.appendChild(document.createTextNode("[" + new Date() + "] ")); d.appendChild(document.createTextNode(msg)); d.appendChild(document.createElement("br")); }