Commit 64562187a52594d668ea5de1473195d135ea321d

  • avatar
  • arvind
  • Tue Jul 16 15:35:12 IST 2013
Bug fix
  - A hack for working around various data fields.
  
6060};
6161function onFeatureSelect(feature)
6262{
63 for(var i in ans.ans)
63 for(var i in ans.ans)
6464 {
6565 // 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'])
6666 // {
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 }
7575 if(ans.ans[i]["how"])
7676 {
7777 z = new OpenLayers.Popup.FramedCloud(
7878 "test",
7979 feature.geometry.getBounds().getCenterLonLat(),
8080 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);
8282 }
8383 else
8484 {
8686 "test",
8787 feature.geometry.getBounds().getCenterLonLat(),
8888 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);
9090
9191 }
9292
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;
9797 //}
9898 //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 // }
110110 //}
111111 }
112112
196196 $.get(config.indexer+"/fetch",{uri:"default"} , function(data){
197197 if (data != undefined)
198198 {
199 console.log(data);
200199 ans.ans = data;
201200 for(var i in ans.ans)
202201 {
229229
230230
231231 /*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');
234234
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);
238238
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);
245245
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 }*/
249249
250250 }
251251 boxes = new OpenLayers.Layer.Vector( "Boxes" );
330330{
331331 if(x.left)
332332 {
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']);
337337 }
338338 else if(x.where)
339339 {
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 }
346349
347350 }
348351}
349// function onmouse(data){
350// console.log(data);
351// }
352
353
352354function myfeatureadded(myObj)
353355{
354356 var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;