Commit 2a0eb0139368e05a4bd1a3e352a494a16c64c52c

  • avatar
  • arvind
  • Thu Jun 07 13:50:18 IST 2012
JSON pretty print
myVector.js
(21 / 104)
  
1818 check1: false,
1919 check2: false,
2020 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);
6034 },
6135 trigger1: function() {
62 if(handler.check1 == false)
63 {
64 handler.check1 = true;
6536 myjson = {"face":[
6637 {"character":"Shiva"}
6738 ],
6839 "size": "310px X 460px" // jewellery:earring; material: silver,
6940 };
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);
9342 },
9443 trigger2: function() {
95 if(handler.check2 == false)
96 {
97 handler.check2 = true;
9844 myjson = {"ornament":[
9945 {"jewelery":"Pendant"},
10046 {"Material":"Silver"}
10147 ],
10248 "size": "50px X 90px"
10349 };
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)
12651 }
127 }
12852
12953};
13054function onFeatureSelect(feature)
6262 z.panMapIfOutOfView = true;
6363 map.addPopup(z);
6464}
65function onMyFeatureSelect(feature)
65function onMyFeatureSelect(feature, json, x, y)
6666{
67// str = "";
68// x = 1;
6769 z = new OpenLayers.Popup.FramedCloud(
6870 "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.
7072 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>"
8174 ,null,true);
8275 feature.popup = z;
8376 z.panMapIfOutOfView = true;
226226 console.log(labelFeature.attributes['name']);
227227 if(labelFeature.attributes['name'])
228228 {
229 console.log("here");
229 //console.log(myObj.feature.geometry.bounds.top); Use this to get the bounds.
230230 map.addLayer(vectorLayer);
231231 vectorLayer.drawFeature(labelFeature);
232232 vectorLayer.addFeatures([labelFeature]);
  
1515 <script type="text/javascript" src="myVector.js"></script>
1616 </head>
1717 <body onload="init()">
18 <div id="header"><h1>world.png</h1></div>
18 <div id="header"><h1>Lepakshi Mural</h1></div>
1919 <div id="subheader">Generated by <a href="http://www.maptiler.org/">MapTiler</a>/<a href="http://www.klokan.cz/projects/gdal2tiles/">GDAL2Tiles</a>, Copyright &copy; 2008 <a href="http://www.klokan.cz/">Klokan Petr Pridal</a>, <a href="http://www.gdal.org/">GDAL</a> &amp; <a href="http://www.osgeo.org/">OSGeo</a> <a href="http://code.google.com/soc/">GSoC</a>
2020 <!-- PLEASE, LET THIS NOTE ABOUT AUTHOR AND PROJECT SOMEWHERE ON YOUR WEBSITE, OR AT LEAST IN THE COMMENT IN HTML. THANK YOU -->
2121 </div>