I use the following code to try to create different GMarkers
GMarker marker = new GMarker(latLng); // Use the G_DEFAULT_ICON
if (addr.getTicketCount() > 0) {
marker.getIcon().setImage("http://www.google.com/mapfiles/
markerT.png");
}
But, after the setImage(url) statement is executed, all markers shown
on GoogleMap are globally changed to the "T" marker.
Any suggestion?
Thanks,
Dennis
marker.getIcon().setImage("http://www.google.com/mapfiles/
markerT.png");
to this line:
marker.setImage("http://www.google.com/mapfiles/markerT.png");
-krispy
On Jun 4, 3:36 pm, "dennis.ji...@qwest.com" <dennis.ji...@qwest.com>
wrote:
- Dennis
On Jun 4, 1:56 pm, krispy <cplum...@integrity-apps.com> wrote:
> Callmarker.setImage(String url) - calling the icon.setImage(String)
> function changes the icon's foreground URL globally. Change this
> line:
>
> marker.getIcon().setImage("http://www.google.com/mapfiles/
> markerT.png");
>
> to this line:
>
> marker.setImage("http://www.google.com/mapfiles/markerT.png");
>
> -krispy
>
> On Jun 4, 3:36 pm, "dennis.ji...@qwest.com" <dennis.ji...@qwest.com>
> wrote:
>
>
>
> > We use the GoogleMaps-GWT2.1.4 package to develop a GeoMap
> > application. It needs to place a differentmarkeron an address with a
> > trouble ticket. How can wecreateanon-defaultGMarker using
> > GoogleMaps-GWT?
>
> > I use the following code to try tocreatedifferent GMarkers
>
> > GMarkermarker= new GMarker(latLng); // Use the G_DEFAULT_ICON
> > if (addr.getTicketCount() > 0) {
> > marker.getIcon().setImage("http://www.google.com/mapfiles/
> > markerT.png");
> > }
>
> > But, after the setImage(url) statement is executed, all markers shown
> > on GoogleMap are globally changed to the "T"marker.
>
> > Any suggestion?
>
> > Thanks,
> > Dennis- Hide quoted text -
>
> - Show quoted text -
-krispy
On Jun 4, 4:53 pm, "dennis.ji...@qwest.com" <dennis.ji...@qwest.com>
wrote:
-krispy
-Dennis
> > > > - Show quoted text -- Hide quoted text -
1.) Create a new GIcon class referencing your images
2.) Create a GMarkerOptions class (and set the GIcon you created in
the step before in that)
3.) When you create your GMarkers... pass the GLatLng and the
GMarkerOptions class you just created.
Cheers,
Aglaforge
On Jun 4, 12:36 pm, "dennis.ji...@qwest.com" <dennis.ji...@qwest.com>
wrote:
You could copy the setImage(String) implementation into your current
version of googlemaps_gwt (if you want to stay with GWT 1.3) or just
migrate to GWT 1.4 and use the newest 2.2.1 jar file. I believe that
2.2.1 requires GWT 1.4 only b/c of the constructors to
JavaScriptObject (which have no parameters in GWT 1.4, but use to have
an int parameter in GWT 1.3). That's the scoop.
Or, you could do what Aglaforge says and just create new icons for
each marker : ) Probably that's just simpler - you wouldn't have to
change any of the source code or do crazy things like what I'm
saying. But you would get the additional overhead of a new GIcon
object for each marker.
Put simply, either you have to give each GMarker a new GIcon with the
right image URL, or you'd have to call setImage(String) on each of the
markers.
-krispy
On Jun 4, 7:46 pm, "dennis.ji...@qwest.com" <dennis.ji...@qwest.com>
wrote:
> The GWTGoogleMaps2JavaDocs.zip athttp://sourceforge.net/project/showfiles.php?group_id=169331
GLatLng latLng = new GLatLng(gAddr.getLatitude(),
gAddr.getLongitude());
if (gAddr.getTicketCount() > 0)
marker = createGMarker(latLng, "http://www.google.com/mapfiles/
markerT.png");
else
marker = new GMarker(latLng);
.......
public GMarker createGMarker(GLatLng point, String iconUrl) {
GIcon icon = new GIcon(new GIcon(), iconUrl);
GMarkerOptions opt = new GMarkerOptions();
opt.setIcon(icon);
GMarker marker = new GMarker(point, opt);
return marker;
}
......
But, nothing was displayed on the GoogleMap for those gAddr whose
TicketCount > 0.
Any suggestions?
Thanks,
Dennis
On Jun 4, 10:00 pm, aglaforge <aglafo...@gmail.com> wrote:
> Pretty straight forward:
>
> 1.) Create a new GIcon class referencing your images
> 2.) Create a GMarkerOptions class (and set the GIcon you created in
> the step before in that)
> 3.) When you create your GMarkers... pass the GLatLng and the
> GMarkerOptions class you just created.
>
> Cheers,
>
> Aglaforge
>
> On Jun 4, 12:36 pm, "dennis.ji...@qwest.com" <dennis.ji...@qwest.com>
> wrote:
>
>
>
> > We use the GoogleMaps-GWT 2.1.4 package to develop a GeoMap
> > application. It needs to place a different marker on an address with a
> > trouble ticket. How can we create a non-default GMarker using
> > GoogleMaps-GWT?
>
> > I use the following code to try to create different GMarkers
>
> > GMarker marker = new GMarker(latLng); // Use the G_DEFAULT_ICON
> > if (addr.getTicketCount() > 0) {
> > marker.getIcon().setImage("http://www.google.com/mapfiles/
> > markerT.png");
> > }
>
> > But, after thesetImage(url) statement is executed, all markers shown
> > on GoogleMap are globally changed to the "T" marker.
>
> > Any suggestion?
>
> > Thanks,
new GIcon(new GIcon().G_DEFAULT_ICON(), iconUrl);
I think that should cause your markers to show up.
-krispy
P.S. Enhancement request to Aglaforge! Could you please create a
static method:
public static GIcon G_DEFAULT_ICON()
{
return GIcon.narrowToGIcon(GIconImpl.G_DEFAULT_ICON());
}
so that we don't have to create an empty icon just to get the default
one.
On Jun 8, 12:26 pm, "dennis.ji...@qwest.com" <dennis.ji...@qwest.com>
wrote:
> > > - Show quoted text -- Hide quoted text -