Commit 64562187a52594d668ea5de1473195d135ea321d
- Diff rendering mode:
- inline
- side by side
static/myVector.js
(55 / 54)
  | |||
60 | 60 | }; | |
61 | 61 | function onFeatureSelect(feature) | |
62 | 62 | { | |
63 | for(var i in ans.ans) | ||
63 | for(var i in ans.ans) | ||
64 | 64 | { | |
65 | 65 | // if(feature.geometry.bounds['left'] == ans.ans[i]['left'] && feature.geometry.bounds['right'] == ans.ans[i]['right'] && feature.geometry.bounds['top'] == ans.ans[i]['top'] && feature.geometry.bounds['bottom'] == ans.ans[i]['bottom']) | |
66 | 66 | // { | |
67 | str = {}; | ||
68 | if(ans.ans[i]['character']) | ||
69 | str['character'] = ans.ans[i]['character']; | ||
70 | else | ||
71 | { | ||
72 | str['material'] = ans.ans[i]['material']; | ||
73 | // str['jewellery'] = ans.ans[i]['jewellery'] | ||
74 | } | ||
67 | str = {}; | ||
68 | if(ans.ans[i]['character']) | ||
69 | str['character'] = ans.ans[i]['character']; | ||
70 | else | ||
71 | { | ||
72 | str['material'] = ans.ans[i]['material']; | ||
73 | // str['jewellery'] = ans.ans[i]['jewellery'] | ||
74 | } | ||
75 | 75 | if(ans.ans[i]["how"]) | |
76 | 76 | { | |
77 | 77 | z = new OpenLayers.Popup.FramedCloud( | |
78 | 78 | "test", | |
79 | 79 | feature.geometry.getBounds().getCenterLonLat(), | |
80 | 80 | new OpenLayers.Size(640,480), | |
81 | '<iframe src='+config.indexer+"/search?flag=0&data="+JSON.stringify({'nodes': ans.ans[i]["how"]})+" ></iframe>",null,true); | ||
81 | '<iframe src='+config.indexer+"/search?flag=0&data="+JSON.stringify({'nodes': ans.ans[i]["how"]})+" ></iframe>",null,true); | ||
82 | 82 | } | |
83 | 83 | else | |
84 | 84 | { | |
… | … | ||
86 | 86 | "test", | |
87 | 87 | feature.geometry.getBounds().getCenterLonLat(), | |
88 | 88 | new OpenLayers.Size(640,480), | |
89 | '<iframe src='+config.indexer+"/search?flag=0&data="+JSON.stringify({'nodes': ans.ans[i]["nodes"]})+" ></iframe>",null,true); | ||
89 | '<iframe src='+config.indexer+"/search?flag=0&data="+JSON.stringify({'nodes': ans.ans[i]["nodes"]})+" ></iframe>",null,true); | ||
90 | 90 | ||
91 | 91 | } | |
92 | 92 | ||
93 | feature.popup = z; | ||
94 | z.panMapIfOutOfView = true; | ||
95 | map.addPopup(z); | ||
96 | break; | ||
93 | feature.popup = z; | ||
94 | z.panMapIfOutOfView = true; | ||
95 | map.addPopup(z); | ||
96 | break; | ||
97 | 97 | //} | |
98 | 98 | //else{ | |
99 | // if(i == ans.count-1) | ||
100 | // { | ||
101 | // z = new OpenLayers.Popup.FramedCloud( | ||
102 | // "test", | ||
103 | // feature.geometry.getBounds().getCenterLonLat(), | ||
104 | // new OpenLayers.Size(640,480), | ||
105 | // '<iframe width="480" height="360" src="http://www.youtube.com/embed/WwNUnmZ_aww" frameborder="0" allowfullscreen></iframe>',null,true); | ||
106 | // feature.popup = z; | ||
107 | // z.panMapIfOutOfView = true; | ||
108 | // map.addPopup(z); | ||
109 | // } | ||
99 | // if(i == ans.count-1) | ||
100 | // { | ||
101 | // z = new OpenLayers.Popup.FramedCloud( | ||
102 | // "test", | ||
103 | // feature.geometry.getBounds().getCenterLonLat(), | ||
104 | // new OpenLayers.Size(640,480), | ||
105 | // '<iframe width="480" height="360" src="http://www.youtube.com/embed/WwNUnmZ_aww" frameborder="0" allowfullscreen></iframe>',null,true); | ||
106 | // feature.popup = z; | ||
107 | // z.panMapIfOutOfView = true; | ||
108 | // map.addPopup(z); | ||
109 | // } | ||
110 | 110 | //} | |
111 | 111 | } | |
112 | 112 | ||
… | … | ||
196 | 196 | $.get(config.indexer+"/fetch",{uri:"default"} , function(data){ | |
197 | 197 | if (data != undefined) | |
198 | 198 | { | |
199 | console.log(data); | ||
200 | 199 | ans.ans = data; | |
201 | 200 | for(var i in ans.ans) | |
202 | 201 | { | |
… | … | ||
229 | 229 | ||
230 | 230 | ||
231 | 231 | /*addLabel('3759.0000','-1274.33337','Face'); | |
232 | addLabel('3719','-1771','Jewelery'); | ||
233 | addLabel('4263.0000','-1345.33337', 'Video'); | ||
232 | addLabel('3719','-1771','Jewelery'); | ||
233 | addLabel('4263.0000','-1345.33337', 'Video'); | ||
234 | 234 | ||
235 | for (var i = 0; i < box_extents.length; i++) { | ||
236 | ext = box_extents[i]; | ||
237 | bounds = OpenLayers.Bounds.fromArray(ext); | ||
235 | for (var i = 0; i < box_extents.length; i++) { | ||
236 | ext = box_extents[i]; | ||
237 | bounds = OpenLayers.Bounds.fromArray(ext); | ||
238 | 238 | ||
239 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
240 | box2.addFeatures(box); | ||
241 | } | ||
242 | for (var i = 0; i < box_extents1.length; i++) { | ||
243 | ext = box_extents1[i]; | ||
244 | bounds = OpenLayers.Bounds.fromArray(ext); | ||
239 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
240 | box2.addFeatures(box); | ||
241 | } | ||
242 | for (var i = 0; i < box_extents1.length; i++) { | ||
243 | ext = box_extents1[i]; | ||
244 | bounds = OpenLayers.Bounds.fromArray(ext); | ||
245 | 245 | ||
246 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
247 | box3.addFeatures(box); | ||
248 | }*/ | ||
246 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
247 | box3.addFeatures(box); | ||
248 | }*/ | ||
249 | 249 | ||
250 | 250 | } | |
251 | 251 | boxes = new OpenLayers.Layer.Vector( "Boxes" ); | |
… | … | ||
330 | 330 | { | |
331 | 331 | if(x.left) | |
332 | 332 | { | |
333 | bounds = new OpenLayers.Bounds(x['left'], x['bottom'], x['right'], x['top']); | ||
334 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
335 | box3.addFeatures(box); | ||
336 | addLabel(x['left'],x['top'],x['name']); | ||
333 | bounds = new OpenLayers.Bounds(x['left'], x['bottom'], x['right'], x['top']); | ||
334 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
335 | box3.addFeatures(box); | ||
336 | addLabel(x['left'],x['top'],x['name']); | ||
337 | 337 | } | |
338 | 338 | else if(x.where) | |
339 | 339 | { | |
340 | position = JSON.parse(x.where.split("#")[1]); | ||
341 | console.log(position); | ||
342 | bounds = new OpenLayers.Bounds(position[2], position[1], position[3], position[0]); | ||
343 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
344 | box3.addFeatures(box); | ||
345 | addLabel(position[2],position[0],x['name']); | ||
340 | try{ | ||
341 | position = JSON.parse(x.where.split("#")[1]); | ||
342 | bounds = new OpenLayers.Bounds(position[2], position[1], position[3], position[0]); | ||
343 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | ||
344 | box3.addFeatures(box); | ||
345 | addLabel(position[2],position[0],x['name']); | ||
346 | } | ||
347 | catch(e){ //This is a hack for mixed up data fields. FIXME! | ||
348 | } | ||
346 | 349 | ||
347 | 350 | } | |
348 | 351 | } | |
349 | // function onmouse(data){ | ||
350 | // console.log(data); | ||
351 | // } | ||
352 | |||
353 | |||
352 | 354 | function myfeatureadded(myObj) | |
353 | 355 | { | |
354 | 356 | var renderer = OpenLayers.Util.getParameters(window.location.href).renderer; |