[postgis-users] Problem with controls on map (SelectFeature, Drawfeature) - OpenLayers, pgRouting
Paragon Corporation
lr at pcorp.us
Sat May 2 09:32:56 PDT 2009
Paul,
Have you also asked this question on the OpenLayers newsgroup? They might
be better able to help or at least you would get more answers.
While this crosses many boundaries -- I think there are more people familiar
with OpenLayers/PgRouting on the OpenLayers newsgroup than you will find on
the PostGIS newsgroup and even so it appears from below you think your issue
is an OpenLayers one.
Also you should probably note to them the version of OpenLayers you are
using.
Hope that helps,
Regina
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of paweluz
Sent: Saturday, May 02, 2009 7:05 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Problem with controls on map
(SelectFeature,Drawfeature) - OpenLayers, pgRouting
Hi!
First sorry for my poor english :). I am having some propblem with the
OpenLayer I guess.
My allpication 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
Everythink 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://www.nabble.com/Problem-with-controls-on-map-%28SelectFeature%2C-Drawf
eature%29---OpenLayers%2C-pgRouting-tp23345115p23345115.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list