[OpenLayers-Users] Problem with controls on map (SelectFeature, Drawfeature) - OpenLayers, pgRouting

paweluz paweluz at o2.pl
Sun May 3 16:12:22 EDT 2009


Can anyone please help me... I still can't figure it out. Please any idea? 
Anything .... I would really appreciate...

Regards,
Paul 


paweluz wrote:
> 
> Hi!
> 
> First sorry for my poor english :). I am having some problem with the
> OpenLayers I guess.
> My application looks like this:
> 
>  http://img245.imageshack.us/img245/3273/aplikacja.jpg
> http://img245.imageshack.us/img245/3273/aplikacja.jpg 
> 
> It provides searchinkg bus stops and bus lines in my city. Also I recently
> added finding the shortest path 
> using the pgRouting. Before I add finding the shortest path my application
> worked fine. I chose the bus 
> stop from the select element, like this:
> 
>  http://img6.imageshack.us/img6/6494/ptrzystanki.jpg
> http://img6.imageshack.us/img6/6494/ptrzystanki.jpg 
> 
> After I choose the bus stops, it appears on the map. When I click it shows
> the popup with the picture, 
> name and the bus lines like this:
> 
>  http://img13.imageshack.us/img13/4089/popul.jpg
> http://img13.imageshack.us/img13/4089/popul.jpg 
> 
> Everything was fine upon the time I added the pgRouting part. Now the
> popul menu does not work unles I:
> - first click on select the start point radiobutton
> - second click on the navigation radiobutton
> 
> 
> When I do this everything is working fine. 
> Without this I click, click and click on the bus stop and the popup menu
> does not appear!!!!
> So there must be somethink wrong with the controls. In my application it
> looks like this:
> 
> - code for popul menu (vector layer):
> 			vector.events.register("featureselected", vector, onFeatureSelect);
> 			vector.events.register("featureunselected", vector, onFeatureUnselect);
> 
> 			control = new OpenLayers.Control.SelectFeature(vector);
> 
> 			map.addControl(control);
> 			control.activate();
> 
> 
> - code for pgRouting
> 
>             controls = {
>               start: new OpenLayers.Control.DrawFeature(start,
> SinglePoint),
>               stop: new OpenLayers.Control.DrawFeature(stop, SinglePoint)
> 
>             }
>             for (var key in controls) {
>                 map.addControl(controls[key]);
>             }
> 
> - html code for radiobuttons looks like this
> 
> 	<form action="rout.php" method="get">
> 		        <input type="radio" name="control" id="noneToggle"
> value="navigation"
> 		               onclick="toggleControl(this);"  />
> 		        <label for="noneToggle">navigate</label><br>
> 
> 		        <input type="radio" name="control" value="start"
> id="startToggle"
> 		               onclick="toggleControl(this);" />
> 		        <label for="startToggle">set start point</label><br>
> 
> 		        <input type="radio" name="control" value="stop" id="stopToggle"
> 		               onclick="toggleControl(this);" />
> 		        <label for="stopToggle">set stop point</label><br>
>     	</form>
> 
> - the toggleControl() function
> 
>     function toggleControl(element) {
>         for (key in controls) {
>             if (element.value == key && element.checked) {
>                 controls[key].activate();
>             } else {
>                 controls[key].deactivate();
>             }
>         }
> 	}
> 
> 
> So I think there is probolem with OpenLayers.Control.SelectFeature and
> OpenLayers.Control.DrawFeature I 
> 
> guess. I try to force clicking on 'select start point' and 'navigate' from
> code like this:
> 
>             document.getElementById("startToggle").select();
>             document.getElementById("startToggle").focus();
> 	    document.getElementById("startToggle").click();
> 
>             document.getElementById("noneToggle").select();
>             document.getElementById("noneToggle").focus();
> 	    document.getElementById("noneToggle").click();
> 
> But it does not work. Only clicking with mouse does it right.
> Does anyone please can help me? Maybe someone had similar issue?
> Please help ...
> 
> Regards,
> Paul
> 

-- 
View this message in context: http://n2.nabble.com/Problem-with-controls-on-map-%28SelectFeature%2C-Drawfeature%29---OpenLayers%2C-pgRouting-tp2777336p2781747.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list