-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4418826
By: deborra
Greetings,
I'm trying to transform the existing GoogleMaps demo to a Java version with some slight added function, including supporting more than one type of icon....
Is there a way for me to associate a Gmarker object with an specific image file?
Thanks much,
Deborra
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4471846
By: henrichen
This is a simple example I test for change Gmarker icon image and it works for me.
/henri
---------
<?page xmlns:v="urn:schemas-microsoft-com:vml"?><!-- for IE --> <zk>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAmGxmY
R57XDAbAumS9tV5fxTwM0brOpm-All5BF6PoaKBxRWWERSynObNOWSyMNmLGAMZAO1WkDUubA"
type="text/javascript"></script>
<gmaps id="mymap" width="600px" height="360px"
lat="40.71213418976525" lng="-73.96785736083984" zoom="15" >
<gmarker id="mymarker" lat="40.71213418976525" lng="-73.96785736083984"/>
</gmaps>
<button label="change icon"
onClick="mymarker.setIconImage("http://www.google.com/mapfiles/markerA.png&
quot;)"/>
</zk>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4472140
By: jojovelas2005
Well, my issue is using the invalidate() method so I think I better rewrite my program.
Thanks for adding Icon attribute to Gmarker. Here is simple code that show invalidate issue. Adding, changing, and removing icon are all working fine except for wind.invalidate(). So, I will just rewrite my program and not to use invalidate().
Note: in my gmaps, I use TestGmap class to test invalidate()
public void onCreate() {
Gmarker marker = new Gmarker();
marker.setId("mymarker");
marker.setLat(40.71213418976525f);
marker.setLng(-73.96785736083984f);
marker.setIconImage("http://www.google.com/mapfiles/markerA.png");
marker.setParent(this);
}
<window id="mainWin" style="margin: 0 auto;" width="800px"
xmlns:h="http://www.w3.org/1999/xhtml">
<script src="http://maps.google.com/maps?file=api&v=2&key==ABQIAAAAmGxmY
R57XDAbAumS9tV5fxTwM0brOpm-All5BF6PoaKBxRWWERSynObNOWSyMNmLGAMZAO1WkDUubA"
type="text/javascript">
</script>
<zk>
<zscript>
void invalidate() {
mainWin.invalidate();
}
</zscript>
<gmaps id="mymap" width="600px" height="360px"
use="com.tracking.components.TestGmap"
lat="40.71213418976525" lng="-73.96785736083984" zoom="15" >
</gmaps>
<button label="invalidate GMAP" onClick="invalidate()"/>
</zk>
</window>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4472636
By: henrichen
Do not put <script> inside your invalidated window. Move it to the main page and specify it ONLY once.
I tried following (move script out the invalidated window) and it works.
-------------------
<zk>
<script src="http://maps.google.com/maps?file=api&v=2&key==ABQIAAAAmGxmY
R57XDAbAumS9tV5fxTwM0brOpm-All5BF6PoaKBxRWWERSynObNOWSyMNmLGAMZAO1WkDUubA"
type="text/javascript">
</script>
<zscript>
void invalidate() {
mainWin.invalidate();
}
</zscript>
<window id="mainWin" style="margin: 0 auto;" width="800px"
xmlns:h="http://www.w3.org/1999/xhtml">
<gmaps id="mymap" width="600px" height="360px" use="TestGmap"
lat="40.71213418976525" lng="-73.96785736083984" zoom="15" >
</gmaps>
<button label="invalidate GMAP" onClick="invalidate()"/> </window> </zk>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4472960
By: jojovelas2005
I used your script but why when I added or inserted this statement in my TestGmap
onCreate() method
System.out.println("use onCreate()" + new java.util.Date()) -- the message never show when I press my invalidate GMAP button. The only time it printed the message is during the opening of page. Is invalidate() will never again use the onCreate() method when I moved it to main page?
Thanks,
Narge
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4532315
By: henrichen
invalidate() has the browser to redraw the component's visual parts per the component's object part only. The object part in server is not touched at all.
/henri
Asked: 2007-07-17 22:04:26 +0800
Seen: 1,023 times
Last updated: Sep 22 '07