Hi Tom,
you need to pass a valid URL (as a string) to GIcon, e.g.:
Icon hotelIcon = new GIcon("http://www.yourdomain/img/Hotel.png");
In case you are using Maven and Spring I would suggest that you inject
the base-URL depending on the Maven-profile into a variable so that you
don't have to worry about setting the right URL.
I defined a variable
public static String IMAGES_URL = "";
in my Wicket-Application-class and in my applicationContext.xml I
defined the bean:
<bean id="wicketApplication" class="com.test.MyApplication">
<property name="imageUrl">
<value>${myapplication.imgUrl}</value>
</property>
</bean>
In my pom.xml I have two profiles:
<profile>
<id>production</id>
<properties>
<myapplication.imgUrl>http://mydomain.com/myapplication/images/</myapplication.imgUrl>
<wicket.configuration>deployment</wicket.configuration>
</properties>
</profile>
<profile>
<id>development</id>
<properties>
<myapplication.imgUrl>http://localhost:8084/myapplication/images/</myapplication.imgUrl>
<wicket.configuration>development</wicket.configuration>
</properties>
</profile>
If I want to create a GIcon now, I do it like this:
new GIcon(MyApplication.IMAGES_URL + "Hotel.png");
This way you can keep your custom images within your project without
worrying if you are on your development machine or deploying your
application to a productive server. You just need to choose the right
Maven profile.
Joachim
On 07/17/2013 03:55 PM, tomatconvien wrote:
Hi to all,
I am trying to customize the default marker.png by defining GIcon with a
custom xxx.png but it just doesn´t want to show up in my map.
The default marker.png is shown without problems. I am getting no errors.
Can someone help me out on this one? I am using wicket 6.8.0 with
wicketstuff-gmap3 6.8.0.
My code is:
gmap = new ExtendedGmap("gmap");
add(gmap);
gmap.setOutputMarkupId(true);
gmap.setPanControlEnabled(true);
gmap.setMapType(GMapType.ROADMAP);
gmap.setDraggingEnabled(true);
gmap.setMapTypeControlEnabled(true);
gmap.setStreetViewControlEnabled(true);
gmap.setScaleControlEnabled(true);
gmap.setScrollWheelZoomEnabled(true);
GIcon hotelIcon = new GIcon("Hotel.png");
GLatLng centerLatLng = new
GLatLng(offerModel.getObject().getHotel().getLatitude(),
offerModel.getObject().getHotel().getLongitude());
GMarkerOptions centerOptions = new GMarkerOptions(gmap, centerLatLng,
"Hotel", hotelIcon, null);
GMarker centerMarker = new GMarker(centerOptions);
gmap.addOverlay(centerMarker);
gmap.setCenter(centerLatLng);
Thanks for your advice.
Tom
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Gmap3-custom-Icon-tp4660309.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org