yugalatea / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

Maps: PolyStyleOptions when setting stroke style fails #249

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reported by julia:

https://groups.google.com/group/gwt-google-apis/browse_thread/thread/c6e2ff58c05
16596

I found that
   Polygon polygon= new Polygon(points, "red", 5, 1, "white", 0);
   map.addOverlay(polygon);
works, but
  Polygon polygon = new Polygon(points);
   map.addOverlay(polygon);
   PolyStyleOptions style = PolyStyleOptions.newInstance("red", 5,
1);
   polygon.setStrokeStyle(style);
does not (appended the complete EntryPoint).
I am using gwt 1.5.3 and google gwt-maps 1.0.3
Am I missing something?

-Julia

P.S.: It is a real joy working with com.google.gwt.maps, thanks for
making this possible.
---------------------------------------------
package playground.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.LargeMapControl;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.PolyStyleOptions;
import com.google.gwt.maps.client.overlay.Polygon;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;

public class GWTPlaygroundEntryPoint implements EntryPoint {

 public void onModuleLoad() {
   HorizontalPanel panel = new HorizontalPanel();

   LatLng melbourne = LatLng.newInstance(-37.817, 144.967);
   MapWidget map1;
   map1 = new MapWidget(melbourne, 8);
   map1.setSize("300px", "300px");
   map1.addControl(new LargeMapControl());
   panel.add(map1);
   MapWidget map2;
   map2 = new MapWidget(melbourne, 8);
   map2.setSize("300px", "300px");
   map2.addControl(new LargeMapControl());
   panel.add(map2);

   LatLng points[] = new LatLng[]{
       LatLng.newInstance(-37.692, 144.684),
       LatLng.newInstance(-37.522, 145.299),
       LatLng.newInstance(-37.991, 145.305),
       LatLng.newInstance(-37.692, 144.684),
       };

   //works:
   Polygon polygon1= new Polygon(points, "red", 5, 1, "white", 0);
   map1.addOverlay(polygon1);

   //doesn't work:
   Polygon polygon2 = new Polygon(points);
   map1.addOverlay(polygon2);
   PolyStyleOptions style = PolyStyleOptions.newInstance("red", 5,
1);
   polygon2.setStrokeStyle(style);

   RootPanel.get().add(panel);
 }
}

Original issue reported on code.google.com by galgwt.reviews@gmail.com on 5 Mar 2009 at 10:45

GoogleCodeExporter commented 9 years ago
I was able to reproduce the problem.  I changed the demo slightly to create 2
polygons in one map as there are problems with using polygons/polylines in 
multiple
maps on some versions of the Maps API.

In Linux hosted mode, I see 2 blue triangles - the color settings aren't having 
an
effect at all.  In FF3 on Linux, I see a red triangle, and I bumped the opacity
setting, it works too.  I changed the color of the second triangle to "green" 
and it
doesn't show at all.  

I did a small test to see that properties in PolyStyleOptions were being set
correctly.   I played around with Maps API versions too.  The next step I'll 
try is
to try to reproduce this in JavaScript.

Original comment by galgwt.reviews@gmail.com on 5 Mar 2009 at 10:51

GoogleCodeExporter commented 9 years ago
internal ref: 1695818

I was able to reproduce this in JavaScript.  The workaround is to not use the
Polygon(LatLng[]) constructor, but to instead always specify color and line 
weight.

Original comment by galgwt.reviews@gmail.com on 6 Mar 2009 at 1:17

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in recent version of the JavaScript Maps API.

Original comment by galgwt.reviews@gmail.com on 18 May 2009 at 8:08

GoogleCodeExporter commented 9 years ago
Updating account names

Original comment by zundel@google.com on 21 Dec 2009 at 2:00