[Geomoose-users] Refresh Layers Automatically
Jay Kapalczynski
jkapalczynski at ci.maple-grove.mn.us
Mon Nov 17 13:06:31 EST 2008
Spoke to soon....the way I have it set up it start refreshing as soon as I open the app...
By placing this in the html page it fires the js
<script type="text/javascript" src="lib/Start_Listening.js"></script>
In that I have:
setInterval("setIntervalNow()", 5000);
function setIntervalNow()
{
Events.triggerEvent('refreshlayer', 'Database');
}
I can see how it is working but am missing why the code is running without me having the click the button
>From the demo.xml page: how do I get this to run only when the button is clicked...
<service name="refreshLayers3" title="Refresh Layer every 2 Seconds" type="internal" default="true" locked="true" command="setIntervalNow()" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>
Thank you for your help duck...very appreciated.
From: Jay Kapalczynski
Sent: Monday, November 17, 2008 11:59 AM
To: 'Dan Little'; 'geomoose-developers at lists.sourceforge.net'; 'geomoose-users at lists.sourceforge.net'
Subject: RE: [Geomoose-users] Refresh Layers Automatically
Got it
Thanks Duck
From: Jay Kapalczynski
Sent: Monday, November 17, 2008 11:53 AM
To: 'Dan Little'; 'geomoose-developers at lists.sourceforge.net'; 'geomoose-users at lists.sourceforge.net'
Subject: RE: [Geomoose-users] Refresh Layers Automatically
Can I do this?
function setIntervalNow()
{
//alert('Hello');
Events.triggerEvent('refreshlayer', 'Database');
}
From: Jay Kapalczynski
Sent: Monday, November 17, 2008 11:50 AM
To: 'Dan Little'; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: RE: [Geomoose-users] Refresh Layers Automatically
Thanks for the reply....nice foobar jab....
At one point I had something similar in there and it was calling this js pages function...
It was repeating the hello message every 5 seconds...
But I then got really confused how to call the refresh layer code from within the setIntervalNow function...
So what I need to do now, I am assuming is use the setInterval below which calls the function, which will run every 5 seconds as seen below. Once in the function I need to somehow call the RefreshLayer to refresh the database layer
command="Events.triggerEvent('refreshlayer', 'Database')
Any thoughts on how to trigger the refreshlayer? I assume that I have to trigger the refreshlayer as seen in the command above in a similar fashion....but now I am in a js page????
setIntervalNow();
setInterval("setIntervalNow()", 5000);
function setIntervalNow()
{
//TRIGGER THE 'Refreshlayer'
}
I have this in my html page so the connection the js page is there. I am getting the hello but just need to figure out how to trigger the 'refreshlayer'
<script type="text/javascript" src="lib/Start_Listening.js"></script>
Thanks Duck
From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Monday, November 17, 2008 10:23 AM
To: Jay Kapalczynski; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: Re: [Geomoose-users] Refresh Layers Automatically
Jay,
I can solidly say that you're off by a bit.
What you need to do in the command attribute is set it to call the function in StartListening.js, StartListening.js also needs to be included in your <head> ... </head> in the html page.
So, say you had a function called "foobar()" in Starting Listening.js, then the command attribute would be...
command="foobar()"
________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: "geomoose-developers at lists.sourceforge.net" <geomoose-developers at lists.sourceforge.net>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Monday, November 17, 2008 10:07:11 AM
Subject: Re: [Geomoose-users] Refresh Layers Automatically
Anyone with any thoughts on why I cant even get to the StartListening Function in the StartListening.js page from this call?
<service name="refreshLayers2" title="Refresh Layer every 5 Seconds" type="internal" default="true" locked="true" command="Events.triggerEvent('StartListening', 'DO I NEED SOMETHING HERE')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>
Thanks....
From: Jay Kapalczynski
Sent: Wednesday, November 12, 2008 11:09 AM
To: geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: RE: [Geomoose-users] Refresh Layers Automatically
Have been talking with Duck and this is where I am right now....thought maybe someone else out there might have a few thoughts....
I created two buttons....one that will start refreshing a layer every couple seconds, one that will stop the refreshing.
I created two js pages that will handle the code
Am I on the right path here? Right now I cant even get to the Start_Listening.js page, so I know I am not doing something correct.
Demo.xml makes the calls to the js pages.
Js pages do the work....just not sure how to call the refreshlayer from js page
This works currently but I need it to repeat and refresh every few seconds
<service name="refreshLayers2" title="Refresh Layer" type="internal" default="true" locked="true" command="Events.triggerEvent('refreshlayer', 'Database')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>
THanks
3 FILES:
MapleGrove.demo.xml
<service name="refreshLayers2" title="Refresh Layer every 5 Seconds" type="internal" default="true" locked="true" command="Events.triggerEvent('StartListening', 'DO I NEED SOMETHING HERE')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>
<service name="refreshLayers3" title="Stop the refreshing" type="internal" default="true" locked="true" command="Events.triggerEvent('StopListening ', 'DO I NEED SOMETHING HERE')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>
StartListening.js
StartListening();
setInterval("setIntervalNow()", 5000);
function setIntervalNow()
{
// Call the Events.triggerEvent('refreshlayer', 'Parcels');
alert('Hello');
}
Stop Listening.js
StopListening();
clearInterval("clearIntervalNow ()", 5000);
function clearIntervalNow ()
{
// clearInterval
alert('Hello');
}
From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Tuesday, November 11, 2008 9:25 AM
To: Jay Kapalczynski
Subject: Re: [Geomoose-users] Refresh Layers
Do a google search on setTimeout and setInterval, they aren't built-in to GeoMOOSE, they're native JS functions.
________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: Dan Little <danlittle at yahoo.com>
Sent: Monday, November 10, 2008 3:02:38 PM
Subject: RE: [Geomoose-users] Refresh Layers
I did a search in all the .js files, the main config, demos, and menu files and cant find a ... function setTimeout ()
Any thoughts as to where they are?
I suppose then I can just call the function and run the refresh code against the settimeout and set interval code (somehow)
Will cross that bridge when I get to it. For now just cant seem to find the functions....
VERY APPRECITED duck....
From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Monday, November 10, 2008 2:44 PM
To: Jay Kapalczynski; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: Re: [Geomoose-users] Refresh Layers
Jay,
You'll need to look into setTimeout or setInterval Javascript functions. You'll then need to write a couple of wrapper functions and attach that to two different buttons (easy to do with a service).
________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: Dan Little <danlittle at yahoo.com>; "geomoose-developers at lists.sourceforge.net" <geomoose-developers at lists.sourceforge.net>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Monday, November 10, 2008 2:28:16 PM
Subject: RE: [Geomoose-users] Refresh Layers
That works great....but I am trying to do something else. Hoping you can point me in the correct direction.
Was trying to get my hands on the code and modify it in another file. I want to click a button in the tool bar and it runs the refresh on a particular layer every 10 seconds (or some other specified time value)
So I would need a loop to run then stop when the another button was clicked.
Any thoughts?
From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Monday, November 10, 2008 2:16 PM
To: Jay Kapalczynski; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: Re: [Geomoose-users] Refresh Layers
Example:
One Layer - Events.triggerEvent('refreshlayer', 'Parcels');
All Layers - Events.triggerEvent('refreshlayers', '');
________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: "geomoose-developers at lists.sourceforge.net" <geomoose-developers at lists.sourceforge.net>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Monday, November 10, 2008 2:09:48 PM
Subject: [Geomoose-users] Refresh Layers
Where is the function that refreshes the layers?
Anyone out there know how I could configure the code the refresh a specific layer?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20081117/6ac05ca8/attachment.html
More information about the Geomoose-users
mailing list