Created
July 27, 2012 08:59
-
-
Save otarza/3186929 to your computer and use it in GitHub Desktop.
map.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>OpenLayers Example</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<script src="http://openlayers.org/api/2.12/OpenLayers.js" type="text/javascript"></script> | |
<style type="text/css"> | |
body { | |
background: url("http://itblog.ge/pin/map-background.png") | |
} | |
* { | |
padding: 0; | |
margin: 0; | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; /* Disable selection/Copy of UIWebView */ | |
} | |
#poi-popup_close { | |
width: 50px; | |
height: 50px; | |
} | |
#featurePopup { | |
width: 175px !important; | |
height: 60px !important; | |
margin-left: 57px !important; | |
margin-top: -23px; | |
background: url("http://itblog.ge/pin/popup.png"); | |
} | |
#pop-arrow { | |
margin-top: 5px; | |
float: right; | |
width: 28px; | |
height: 28px; | |
background: url("http://itblog.ge/pin/button.png"); | |
} | |
#pop-title { | |
float: left; | |
overflow: hidden; | |
padding-right: 5px; | |
width: 130px; | |
} | |
#featurePopup_FrameDecorationImg_0 { | |
display: none; | |
} | |
#featurePopup_FrameDecorationImg_1 { | |
display: none; | |
} | |
#featurePopup_FrameDecorationImg_2 { | |
display: none; | |
} | |
#featurePopup_FrameDecorationImg_3 { | |
display: none; | |
} | |
#featurePopup_FrameDecorationImg_4 { | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<img src="images/android/add-icon.png"> | |
<div id="map"></div> | |
<script defer="defer" type="text/javascript"> | |
OpenLayers.DOTS_PER_INCH = 90.71428571428572; | |
var imagesDir = "http://pinpoint.ge/img/" | |
var map; | |
var default_point_image = imagesDir + 'images/p.png'; | |
var vector = new OpenLayers.Layer.Vector("Vector Layer", {}); | |
var idsMap = []; | |
//var bounds = new OpenLayers.Bounds(40.008, 41.055, 46.736, 43.585); | |
var options = { | |
projection:new OpenLayers.Projection("EPSG:4326"), | |
numZoomLevels:14, | |
maxResolution:0.0054931640625, | |
maxExtent:new OpenLayers.Bounds(-180, -90, 180, 90), | |
units:"degrees", | |
controls:[new OpenLayers.Control.TouchNavigation({ | |
dragPanOptions:{ | |
enableKinetic:true | |
} | |
}) | |
, new OpenLayers.Control.ZoomPanel()], | |
zoom:2 | |
}; | |
map = new OpenLayers.Map('map', options); | |
var a = [ | |
"http://t1.pinpoint.ge:8080/geowebcache/service/wms", | |
"http://t2.pinpoint.ge:8080/geowebcache/service/wms", | |
"http://t3.pinpoint.ge:8080/geowebcache/service/wms" | |
]; | |
var map_layer = new OpenLayers.Layer.WMS("Geoserver layers - Pinpoint DEV", a, { | |
LAYERS:"Pinpoint-dev-roads-cities-blds", | |
format:"image/png", | |
tileSize:new OpenLayers.Size(256, 256) | |
}, { | |
singleTile:false, | |
ratio:1, | |
isBaseLayer:true, | |
transitionEffect:"resize", | |
attribution:"" | |
}); | |
var point_layer = new OpenLayers.Layer.Vector("point_layer", { | |
styleMap:new OpenLayers.StyleMap({ | |
externalGraphic:default_point_image, | |
pointRadius:10, | |
graphicZIndex:150 | |
}), | |
isBaseLayer:false, | |
rendererOptions:{ | |
yOrdering:true | |
} | |
}); | |
var embed_layer = new OpenLayers.Layer.Vector("embed_layer", { | |
styleMap:new OpenLayers.StyleMap({ | |
externalGraphic:default_point_image, | |
pointRadius:10, | |
graphicZIndex:150 | |
}), | |
isBaseLayer:false, | |
rendererOptions:{ | |
yOrdering:true | |
} | |
}); | |
var point360_layer = new OpenLayers.Layer.Vector("point360_layer", { | |
isBaseLayer:false, | |
rendererOptions:{ | |
yOrdering:true | |
} | |
}); | |
function showView(target) { | |
Ti.App.fireEvent('showpoi', {id:target.href}); //show native view | |
return false; | |
} | |
var onFeatureSelect = function (e) { | |
Ti.API.info(e.gid); | |
var title = e.name; | |
var href = e.gid; | |
var html = '<p id="pop-title"><a href="' + href + '" onclick="return showView(this)">' + title + '</a></p>'; | |
popup = new OpenLayers.Popup.FramedCloud( | |
"featurePopup", | |
e.coords, | |
new OpenLayers.Size(300, 400), | |
html, | |
null, | |
true | |
); | |
popup.calculateRelativePosition = function () { | |
return 'tl'; | |
}; | |
map.addPopup(popup, true); | |
}; | |
var onFeatureUnselect = function (evt) { | |
if (evt.popup) { | |
popup.feature = null; | |
map.removePopup(evt.popup); | |
e.popup.destroy(); | |
e.popup = null; | |
} | |
//Ti.App.fireEvent('showpoi', {name: 'otar poi'}) | |
}; | |
map.addLayers([vector, map_layer, point_layer]); | |
//map.addLayers([point360_layer]); | |
map.zoomToExtent(new OpenLayers.Bounds(40.008, 41.055, 46.736, 43.585)); | |
selectControl = new OpenLayers.Control.SelectFeature(point_layer, {onSelect:onFeatureSelect, onUnselect:onFeatureUnselect}); | |
map.addControl(selectControl); | |
selectControl.activate(); | |
var style = { | |
fillOpacity:0.1, | |
fillColor:'#000', | |
strokeColor:'#f00', | |
strokeOpacity:0.6 | |
}; | |
function reloadMap(coords) { | |
//var center = new OpenLayers.LonLat(coords.longitude, coords.latitude);//.transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); | |
//map.setCenter(center); | |
var point = new OpenLayers.Geometry.Point(coords.longitude, coords.latitude); | |
vector.removeAllFeatures(); | |
vector.addFeatures([new OpenLayers.Feature.Vector(point, {}, { | |
graphicName:'cross', | |
strokeColor:'#f00', | |
strokeWidth:2, | |
fillOpacity:0, | |
pointRadius:10 | |
}), new OpenLayers.Feature.Vector(OpenLayers.Geometry.Polygon.createRegularPolygon(point, coords.accuracy, 50, 0), {}, style)]); | |
map.zoomToExtent(vector.getDataExtent()); | |
} | |
function putMarker(c) { | |
point_layer.removeAllFeatures(); | |
var a, d, b; | |
for (a = 0; a < c.length; a++) { | |
/*alert("HERE!!!!!!!!!!!!!!!!!!!!!!!!!!" + JSON.stringify(c, null, ' '));*/ | |
var entry = c[a]; | |
var href = entry.links[0].href; | |
//var split = href.split("/"); | |
//var id = split.pop(); | |
b = (/pin-dot\.png$/.test(entry.icon)); | |
d = setPoint({ | |
x:String(entry.point.longitude), | |
y:String(entry.point.latitude), | |
gid:href, | |
gtype:1, | |
image:entry.icon, | |
yoffset:(b) ? 0 : -31, | |
popup_content:" ", | |
Title:entry.title | |
}); | |
d.name = entry.title; | |
} | |
map.zoomToExtent(point_layer.getDataExtent()); | |
} | |
Titanium.App.addEventListener('removeallpois', function () { | |
point_layer.removeAllFeatures(); | |
}); | |
Titanium.App.fireEvent('getFeed'); | |
Titanium.App.addEventListener('homeShowpois', function (entry) { | |
entry.from = "homeShowPois"; | |
alert(JSON.stringify(entry, null, " ")); | |
try { | |
putMarker(entry); | |
} catch (e) { | |
Ti.API.info(JSON.stringify(e, null, " ")); | |
} | |
}); | |
Titanium.App.addEventListener('detailShowpoi', function (entry) { | |
entry.from = "detailShowPois"; | |
alert(JSON.stringify(entry, null, " ")); | |
try { | |
putMarker(entry); | |
} catch (e) { | |
Ti.API.info(JSON.stringify(e, null, " ")); | |
} | |
}); | |
function getBounds() { | |
alert(map.getExtent()); | |
return JSON.stringify(map.getExtent()); | |
} | |
/* | |
var data = eval({"NumRows":45, "PageStart":0, "JS":"[{\"x\":\"44.827434340381\",\"y\":\"41.687121624862\",\"id\":\"38359\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.770147565429\",\"y\":\"41.750435163504\",\"id\":\"38343\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.778757862098\",\"y\":\"41.719533454894\",\"id\":\"38331\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.792072525931\",\"y\":\"41.716985537767\",\"id\":\"38389\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.787948031638\",\"y\":\"41.755627934865\",\"id\":\"38383\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.878428413811\",\"y\":\"41.688601214705\",\"id\":\"50703\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.758673115175\",\"y\":\"41.710338537773\",\"id\":\"38337\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.817882780909\",\"y\":\"41.700907215246\",\"id\":\"38373\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.852748994061\",\"y\":\"41.676687217796\",\"id\":\"38338\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.886256602024\",\"y\":\"41.697185922722\",\"id\":\"38361\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"liberty-pin.png\"},{\"x\":\"44.870365782654\",\"y\":\"41.691487966682\",\"id\":\"38363\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.778058920794\",\"y\":\"41.74451480478\",\"id\":\"38387\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.772314840898\",\"y\":\"41.757383386328\",\"id\":\"38392\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.822152355618\",\"y\":\"41.734394767015\",\"id\":\"38386\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.784675930434\",\"y\":\"41.732112270295\",\"id\":\"38388\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.803166650171\",\"y\":\"41.713836311615\",\"id\":\"38391\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.775104607248\",\"y\":\"41.725849021847\",\"id\":\"38324\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.762579009357\",\"y\":\"41.711079892023\",\"id\":\"38332\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.882918766983\",\"y\":\"41.688100647445\",\"id\":\"50704\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.843989185337\",\"y\":\"41.709577095029\",\"id\":\"50707\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.78951377204\",\"y\":\"41.752449818576\",\"id\":\"38379\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.717180055588\",\"y\":\"41.725402428907\",\"id\":\"38340\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.73375367919\",\"y\":\"41.723548548501\",\"id\":\"38342\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.843318633084\",\"y\":\"41.69584686708\",\"id\":\"38372\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.72932952849\",\"y\":\"41.725515940591\",\"id\":\"38336\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.796911052711\",\"y\":\"41.723331462858\",\"id\":\"38395\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.738130674186\",\"y\":\"41.705208536491\",\"id\":\"38326\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.769254416048\",\"y\":\"41.725981838545\",\"id\":\"38323\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.770105287853\",\"y\":\"41.708791967734\",\"id\":\"38328\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.763116730005\",\"y\":\"41.72693024216\",\"id\":\"38330\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.704830817227\",\"y\":\"41.699915778157\",\"id\":\"38345\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.786718011489\",\"y\":\"41.706366055722\",\"id\":\"38350\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.785390318029\",\"y\":\"41.708487683051\",\"id\":\"38351\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.749111132334\",\"y\":\"41.760972254192\",\"id\":\"38347\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.821885573205\",\"y\":\"41.683984886925\",\"id\":\"38349\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.846984802487\",\"y\":\"41.687974689349\",\"id\":\"38357\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.797774127313\",\"y\":\"41.707549374344\",\"id\":\"38390\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.794014078118\",\"y\":\"41.74280748553\",\"id\":\"38382\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.798703438882\",\"y\":\"41.690570961952\",\"id\":\"38352\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.864724644946\",\"y\":\"41.693379685288\",\"id\":\"38368\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.82147045342\",\"y\":\"41.686850427295\",\"id\":\"38353\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.765627711557\",\"y\":\"41.729316529674\",\"id\":\"38341\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.744943855199\",\"y\":\"41.725085454267\",\"id\":\"38335\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.814283995122\",\"y\":\"41.691756116056\",\"id\":\"38325\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"},{\"x\":\"44.7688380177\",\"y\":\"41.708249132161\",\"id\":\"38327\",\"name\":\"\\u10da\\u10d8\\u10d1\\u10d4\\u10e0\\u10d7\\u10d8 \\u10d1\\u10d0\\u10dc\\u10d9\\u10d8\",\"type\":1,\"icon\":\"lb-dot.png\"}]"}); | |
var js = eval(data.JS); | |
putMarker(js); | |
*/ | |
function setPoint(g) { | |
var f = ""; | |
if (g.Title !== undefined) { | |
f = g.Title | |
} | |
if (typeof (g.x) == "undefined") { | |
return undefined; | |
} | |
if (typeof (g.y) == "undefined") { | |
return undefined; | |
} | |
if (typeof (g.gid) == "undefined") { | |
g.gid = this.point_layer.features.length | |
} | |
if (typeof (g.gtype) == "undefined") { | |
g.gtype = 1 | |
} | |
if (typeof (g.image) == "undefined") { | |
g.image = this.default_point_image | |
} | |
if (typeof (g.yoffset) == "undefined") { | |
g.yoffset = -49 | |
} | |
if (typeof (g.radius) == "undefined") { | |
g.radius = 25 | |
} | |
if (g.StreetViewMan === undefined) { | |
g.StreetViewMan = false | |
} | |
var e = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(g.x, g.y)); | |
e.Image360 = g.Image360; | |
e.gid = g.gid; | |
e.gtype = g.gtype; | |
e.style = { | |
graphicZIndex:3100, | |
graphicYOffset:g.yoffset, | |
externalGraphic:g.image, | |
cursor:"pointer", | |
graphicTitle:f | |
}; | |
e.coords = new OpenLayers.LonLat(g.x, g.y); | |
if (g.StreetViewMan) { | |
e.style.graphicWidth = 29; | |
e.style.graphicHeight = 41 | |
} else { | |
if (g.image != imagesDir + "pin-dot.png" && g.image != imagesDir + "lb-dot.png") { | |
e.style.backgroundGraphic = imagesDir + "pin_shadow.png"; | |
e.style.backgroundGraphicZIndex = 10; | |
e.style.backgroundWidth = 25; | |
e.style.backgroundHeight = 14; | |
e.style.backgroundYOffset = -10; | |
e.style.backgroundXOffset = 1; | |
e.style.graphicWidth = 22; | |
e.style.graphicHeight = 35 | |
} else { | |
if (g.image == imagesDir + "lb-dot.png") { | |
e.style.pointRadius = 8 | |
} else { | |
e.style.pointRadius = 3 | |
} | |
} | |
} | |
//alert(JSON.stringify(e)); | |
this.point_layer.addFeatures([e]); | |
return e; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment