0

Changing the Gmarker icon in Java

asked 2007-07-17 22:04:26 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

delete flag offensive retag edit

15 Replies

Sort by ยป oldest newest

answered 2007-08-18 14:07:00 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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>



link publish delete flag offensive edit

answered 2007-08-18 19:45:08 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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>


link publish delete flag offensive edit

answered 2007-08-19 11:36:57 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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>



link publish delete flag offensive edit

answered 2007-08-19 18:44:12 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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






link publish delete flag offensive edit

answered 2007-09-22 19:28:45 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-07-17 22:04:26 +0800

Seen: 1,023 times

Last updated: Sep 22 '07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More