Commit 2a0eb0139368e05a4bd1a3e352a494a16c64c52c
- Diff rendering mode:
- inline
- side by side
myVector.js
(21 / 104)
  | |||
18 | 18 | check1: false, | |
19 | 19 | check2: false, | |
20 | 20 | trigger: function() { | |
21 | // if(handler.check == false) | ||
22 | // { | ||
23 | // handler.check = true; | ||
24 | // myjson = {"temple":[ | ||
25 | // {"period": "16th century"}, | ||
26 | // {"location":"13.80338 - 77.61067"}, | ||
27 | // {"sthapati":"Shivakumar"}, | ||
28 | // {"innerloc": "MaharangaMandapa"} | ||
29 | // ], | ||
30 | // "size": "311110px X 4668 px", | ||
31 | // "narrative": "Narrative", | ||
32 | // "muralTradition": "XYZ", | ||
33 | // "muralTechnique": "Foo", | ||
34 | // "muralContent": "Bar" | ||
35 | // }; | ||
36 | // var x = document.getElementById("content"); | ||
37 | // for (var i in myjson) | ||
38 | // { | ||
39 | // if(i == "temple") | ||
40 | // { | ||
41 | // for(var y =0; y <myjson[i].length;y++) | ||
42 | // { | ||
43 | // for(var z in myjson[i][y]) | ||
44 | // { | ||
45 | // x.innerHTML += z+': '+'<i>'+myjson[i][y][z]+'</i>; '; | ||
46 | // } | ||
47 | // } | ||
48 | // } | ||
49 | // else{ | ||
50 | // x.innerHTML += i+': '+'<i>'+myjson[i]+'</i>; '; | ||
51 | // } | ||
52 | // } | ||
53 | // } | ||
54 | // else{ | ||
55 | // var x = document.getElementById("content"); | ||
56 | // x.innerHTML =''; | ||
57 | // handler.check = false; | ||
58 | // } | ||
59 | onMyFeatureSelect(map); | ||
21 | myjson = {"temple":[ | ||
22 | {"period": "16th century"}, | ||
23 | {"location":"13.80338 - 77.61067"}, | ||
24 | {"sthapati":"Shivakumar"}, | ||
25 | {"innerloc": "MaharangaMandapa"} | ||
26 | ], | ||
27 | "size": "311110px X 4668 px", | ||
28 | "narrative": "Narrative", | ||
29 | "muralTradition": "XYZ", | ||
30 | "muralTechnique": "Foo", | ||
31 | "muralContent": "Bar" | ||
32 | }; | ||
33 | onMyFeatureSelect(map,myjson,15555, -2334); | ||
60 | 34 | }, | |
61 | 35 | trigger1: function() { | |
62 | if(handler.check1 == false) | ||
63 | { | ||
64 | handler.check1 = true; | ||
65 | 36 | myjson = {"face":[ | |
66 | 37 | {"character":"Shiva"} | |
67 | 38 | ], | |
68 | 39 | "size": "310px X 460px" // jewellery:earring; material: silver, | |
69 | 40 | }; | |
70 | var x = document.getElementById("content1"); | ||
71 | for (var i in myjson) | ||
72 | { | ||
73 | if(i == "face") | ||
74 | { | ||
75 | for(var y =0; y <myjson[i].length;y++) | ||
76 | { | ||
77 | for(var z in myjson[i][y]) | ||
78 | { | ||
79 | x.innerHTML += z+': '+'<i>'+myjson[i][y][z]+'</i>; '; | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | else{ | ||
84 | x.innerHTML += i+': '+'<i>'+myjson[i]+'</i>; '; | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | else{ | ||
89 | var x = document.getElementById("content1"); | ||
90 | x.innerHTML =''; | ||
91 | handler.check1 = false; | ||
92 | } | ||
41 | onMyFeatureSelect(map,myjson,3915,- 1438); | ||
93 | 42 | }, | |
94 | 43 | trigger2: function() { | |
95 | if(handler.check2 == false) | ||
96 | { | ||
97 | handler.check2 = true; | ||
98 | 44 | myjson = {"ornament":[ | |
99 | 45 | {"jewelery":"Pendant"}, | |
100 | 46 | {"Material":"Silver"} | |
101 | 47 | ], | |
102 | 48 | "size": "50px X 90px" | |
103 | 49 | }; | |
104 | var x = document.getElementById("content2"); | ||
105 | for (var i in myjson) | ||
106 | { | ||
107 | if(i == "ornament") | ||
108 | { | ||
109 | for(var y =0; y <myjson[i].length;y++) | ||
110 | { | ||
111 | for(var z in myjson[i][y]) | ||
112 | { | ||
113 | x.innerHTML += z+': '+'<i>'+myjson[i][y][z]+'</i>; '; | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | else{ | ||
118 | x.innerHTML += i+': '+'<i>'+myjson[i]+'</i>; '; | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | else{ | ||
123 | var x = document.getElementById("content2"); | ||
124 | x.innerHTML =''; | ||
125 | handler.check2 = false; | ||
50 | onMyFeatureSelect(map,myjson,3751,-1802) | ||
126 | 51 | } | |
127 | } | ||
128 | 52 | ||
129 | 53 | }; | |
130 | 54 | function onFeatureSelect(feature) | |
… | … | ||
62 | 62 | z.panMapIfOutOfView = true; | |
63 | 63 | map.addPopup(z); | |
64 | 64 | } | |
65 | function onMyFeatureSelect(feature) | ||
65 | function onMyFeatureSelect(feature, json, x, y) | ||
66 | 66 | { | |
67 | // str = ""; | ||
68 | // x = 1; | ||
67 | 69 | z = new OpenLayers.Popup.FramedCloud( | |
68 | 70 | "test", | |
69 | new OpenLayers.LonLat(15555, -2334), // Always should be at the center of the map, not the center of viewport. | ||
71 | new OpenLayers.LonLat(x, y), // Always should be at the center of the map, not the center of viewport. | ||
70 | 72 | new OpenLayers.Size(640,480), | |
71 | "<pre><b><center>Temple</center></b>\n"+ | ||
72 | "period: 16th century\n"+ | ||
73 | "location: 13.80338 - 77.61067\n"+ | ||
74 | "sthapati: Shivakumar\n"+ | ||
75 | "innerloc: MaharangaMandapa\n"+ | ||
76 | "size: 311110px X 4668 px\n"+ | ||
77 | "narrative: Narrative\n"+ | ||
78 | "muralTradition: XYZ\n"+ | ||
79 | "muralTechnique: Foo\n"+ | ||
80 | "muralContent: Bar</pre>" | ||
73 | "<pre>"+JSON.stringify(json,null,'\t')+"</pre>" | ||
81 | 74 | ,null,true); | |
82 | 75 | feature.popup = z; | |
83 | 76 | z.panMapIfOutOfView = true; | |
… | … | ||
226 | 226 | console.log(labelFeature.attributes['name']); | |
227 | 227 | if(labelFeature.attributes['name']) | |
228 | 228 | { | |
229 | console.log("here"); | ||
229 | //console.log(myObj.feature.geometry.bounds.top); Use this to get the bounds. | ||
230 | 230 | map.addLayer(vectorLayer); | |
231 | 231 | vectorLayer.drawFeature(labelFeature); | |
232 | 232 | vectorLayer.addFeatures([labelFeature]); |
openlayers.html
(1 / 1)
  | |||
15 | 15 | <script type="text/javascript" src="myVector.js"></script> | |
16 | 16 | </head> | |
17 | 17 | <body onload="init()"> | |
18 | <div id="header"><h1>world.png</h1></div> | ||
18 | <div id="header"><h1>Lepakshi Mural</h1></div> | ||
19 | 19 | <div id="subheader">Generated by <a href="http://www.maptiler.org/">MapTiler</a>/<a href="http://www.klokan.cz/projects/gdal2tiles/">GDAL2Tiles</a>, Copyright © 2008 <a href="http://www.klokan.cz/">Klokan Petr Pridal</a>, <a href="http://www.gdal.org/">GDAL</a> & <a href="http://www.osgeo.org/">OSGeo</a> <a href="http://code.google.com/soc/">GSoC</a> | |
20 | 20 | <!-- PLEASE, LET THIS NOTE ABOUT AUTHOR AND PROJECT SOMEWHERE ON YOUR WEBSITE, OR AT LEAST IN THE COMMENT IN HTML. THANK YOU --> | |
21 | 21 | </div> |