Commit 64562187a52594d668ea5de1473195d135ea321d
Bug fix
- A hack for working around various data fields.
- static/myVector.js 109 ------------------------------------------------------+++++++++++++++++++++++++++++++++++++++++++++++++++++++
| | | | 60 | }; | 60 | }; |
---|
61 | function onFeatureSelect(feature) | 61 | function onFeatureSelect(feature) |
---|
62 | { | 62 | { |
---|
63 | for(var i in ans.ans) | | for(var i in ans.ans) |
---|
| | 63 | for(var i in ans.ans) | 64 | { | 64 | { |
---|
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']) | 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 = {}; | | str = {}; |
---|
68 | if(ans.ans[i]['character']) | | if(ans.ans[i]['character']) |
---|
69 | str['character'] = ans.ans[i]['character']; | | str['character'] = ans.ans[i]['character']; |
---|
70 | else | | else |
---|
71 | { | | { |
---|
72 | str['material'] = ans.ans[i]['material']; | | str['material'] = ans.ans[i]['material']; |
---|
73 | // str['jewellery'] = ans.ans[i]['jewellery'] | | // 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 | if(ans.ans[i]["how"]) | 75 | if(ans.ans[i]["how"]) |
---|
76 | { | 76 | { |
---|
77 | z = new OpenLayers.Popup.FramedCloud( | 77 | z = new OpenLayers.Popup.FramedCloud( |
---|
78 | "test", | 78 | "test", |
---|
79 | feature.geometry.getBounds().getCenterLonLat(), | 79 | feature.geometry.getBounds().getCenterLonLat(), |
---|
80 | new OpenLayers.Size(640,480), | 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); | | '<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 | else | 83 | else |
---|
84 | { | 84 | { |
---|
… | | … | |
---|
86 | "test", | 86 | "test", |
---|
87 | feature.geometry.getBounds().getCenterLonLat(), | 87 | feature.geometry.getBounds().getCenterLonLat(), |
---|
88 | new OpenLayers.Size(640,480), | 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); | | '<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; | | feature.popup = z; |
---|
94 | z.panMapIfOutOfView = true; | | z.panMapIfOutOfView = true; |
---|
95 | map.addPopup(z); | | map.addPopup(z); |
---|
96 | break; | | break; |
---|
| | 93 | feature.popup = z; | | | 94 | z.panMapIfOutOfView = true; |
---|
| | 95 | map.addPopup(z); |
---|
| | 96 | break; |
---|
97 | //} | 97 | //} |
---|
98 | //else{ | 98 | //else{ |
---|
99 | // if(i == ans.count-1) | | // if(i == ans.count-1) |
---|
100 | // { | | // { |
---|
101 | // z = new OpenLayers.Popup.FramedCloud( | | // z = new OpenLayers.Popup.FramedCloud( |
---|
102 | // "test", | | // "test", |
---|
103 | // feature.geometry.getBounds().getCenterLonLat(), | | // feature.geometry.getBounds().getCenterLonLat(), |
---|
104 | // new OpenLayers.Size(640,480), | | // 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); | | // '<iframe width="480" height="360" src="http://www.youtube.com/embed/WwNUnmZ_aww" frameborder="0" allowfullscreen></iframe>',null,true); |
---|
106 | // feature.popup = z; | | // feature.popup = z; |
---|
107 | // z.panMapIfOutOfView = true; | | // z.panMapIfOutOfView = true; |
---|
108 | // map.addPopup(z); | | // 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 | $.get(config.indexer+"/fetch",{uri:"default"} , function(data){ | 196 | $.get(config.indexer+"/fetch",{uri:"default"} , function(data){ |
---|
197 | if (data != undefined) | 197 | if (data != undefined) |
---|
198 | { | 198 | { |
---|
199 | console.log(data); | | console.log(data); |
---|
200 | ans.ans = data; | 199 | ans.ans = data; |
---|
201 | for(var i in ans.ans) | 200 | for(var i in ans.ans) |
---|
202 | { | 201 | { |
---|
… | | … | |
---|
229 | | 229 | |
---|
230 | | 230 | |
---|
231 | /*addLabel('3759.0000','-1274.33337','Face'); | 231 | /*addLabel('3759.0000','-1274.33337','Face'); |
---|
232 | addLabel('3719','-1771','Jewelery'); | | addLabel('3719','-1771','Jewelery'); |
---|
233 | addLabel('4263.0000','-1345.33337', 'Video'); | | 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++) { | | for (var i = 0; i < box_extents.length; i++) { |
---|
236 | ext = box_extents[i]; | | ext = box_extents[i]; |
---|
237 | bounds = OpenLayers.Bounds.fromArray(ext); | | 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()); | | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); |
---|
240 | box2.addFeatures(box); | | box2.addFeatures(box); |
---|
241 | } | | } |
---|
242 | for (var i = 0; i < box_extents1.length; i++) { | | for (var i = 0; i < box_extents1.length; i++) { |
---|
243 | ext = box_extents1[i]; | | ext = box_extents1[i]; |
---|
244 | bounds = OpenLayers.Bounds.fromArray(ext); | | 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()); | | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); |
---|
247 | box3.addFeatures(box); | | box3.addFeatures(box); |
---|
248 | }*/ | | }*/ |
---|
| | 246 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | | | 247 | box3.addFeatures(box); |
---|
| | 248 | }*/ |
---|
249 | | 249 | |
---|
250 | } | 250 | } |
---|
251 | boxes = new OpenLayers.Layer.Vector( "Boxes" ); | 251 | boxes = new OpenLayers.Layer.Vector( "Boxes" ); |
---|
… | | … | |
---|
330 | { | 330 | { |
---|
331 | if(x.left) | 331 | if(x.left) |
---|
332 | { | 332 | { |
---|
333 | bounds = new OpenLayers.Bounds(x['left'], x['bottom'], x['right'], x['top']); | | bounds = new OpenLayers.Bounds(x['left'], x['bottom'], x['right'], x['top']); |
---|
334 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); |
---|
335 | box3.addFeatures(box); | | box3.addFeatures(box); |
---|
336 | addLabel(x['left'],x['top'],x['name']); | | 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 | else if(x.where) | 338 | else if(x.where) |
---|
339 | { | 339 | { |
---|
340 | position = JSON.parse(x.where.split("#")[1]); | | position = JSON.parse(x.where.split("#")[1]); |
---|
341 | console.log(position); | | console.log(position); |
---|
342 | bounds = new OpenLayers.Bounds(position[2], position[1], position[3], position[0]); | | bounds = new OpenLayers.Bounds(position[2], position[1], position[3], position[0]); |
---|
343 | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); | | box = new OpenLayers.Feature.Vector(bounds.toGeometry()); |
---|
344 | box3.addFeatures(box); | | box3.addFeatures(box); |
---|
345 | addLabel(position[2],position[0],x['name']); | | 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){ | | // function onmouse(data){ |
---|
350 | // console.log(data); | | // console.log(data); |
---|
351 | // } | | // } |
---|
| | 352 | | | | 353 | |
---|
352 | function myfeatureadded(myObj) | 354 | function myfeatureadded(myObj) |
---|
353 | { | 355 | { |
---|
354 | var renderer = OpenLayers.Util.getParameters(window.location.href).renderer; | 356 | var renderer = OpenLayers.Util.getParameters(window.location.href).renderer; |
---|