@@ -690,103 +690,36 @@ private static void interpretInfoWindowOptions(
690
690
infoWindowAnchor .getDx ().floatValue (), infoWindowAnchor .getDy ().floatValue ());
691
691
}
692
692
693
- static String interpretPolygonOptions (Map <String , ?> data , PolygonOptionsSink sink ) {
694
- final Object consumeTapEvents = data .get ("consumeTapEvents" );
695
- if (consumeTapEvents != null ) {
696
- sink .setConsumeTapEvents (toBoolean (consumeTapEvents ));
697
- }
698
- final Object geodesic = data .get ("geodesic" );
699
- if (geodesic != null ) {
700
- sink .setGeodesic (toBoolean (geodesic ));
701
- }
702
- final Object visible = data .get ("visible" );
703
- if (visible != null ) {
704
- sink .setVisible (toBoolean (visible ));
705
- }
706
- final Object fillColor = data .get ("fillColor" );
707
- if (fillColor != null ) {
708
- sink .setFillColor (toInt (fillColor ));
709
- }
710
- final Object strokeColor = data .get ("strokeColor" );
711
- if (strokeColor != null ) {
712
- sink .setStrokeColor (toInt (strokeColor ));
713
- }
714
- final Object strokeWidth = data .get ("strokeWidth" );
715
- if (strokeWidth != null ) {
716
- sink .setStrokeWidth (toInt (strokeWidth ));
717
- }
718
- final Object zIndex = data .get ("zIndex" );
719
- if (zIndex != null ) {
720
- sink .setZIndex (toFloat (zIndex ));
721
- }
722
- final Object points = data .get ("points" );
723
- if (points != null ) {
724
- sink .setPoints (toPoints (points ));
725
- }
726
- final Object holes = data .get ("holes" );
727
- if (holes != null ) {
728
- sink .setHoles (toHoles (holes ));
729
- }
730
- final String polygonId = (String ) data .get ("polygonId" );
731
- if (polygonId == null ) {
732
- throw new IllegalArgumentException ("polygonId was null" );
733
- } else {
734
- return polygonId ;
735
- }
693
+ static String interpretPolygonOptions (Messages .PlatformPolygon polygon , PolygonOptionsSink sink ) {
694
+ sink .setConsumeTapEvents (polygon .getConsumesTapEvents ());
695
+ sink .setGeodesic (polygon .getGeodesic ());
696
+ sink .setVisible (polygon .getVisible ());
697
+ sink .setFillColor (polygon .getFillColor ().intValue ());
698
+ sink .setStrokeColor (polygon .getStrokeColor ().intValue ());
699
+ sink .setStrokeWidth (polygon .getStrokeWidth ());
700
+ sink .setZIndex (polygon .getZIndex ());
701
+ sink .setPoints (pointsFromPigeon (polygon .getPoints ()));
702
+ sink .setHoles (toHoles (polygon .getHoles ()));
703
+ return polygon .getPolygonId ();
736
704
}
737
705
738
706
static String interpretPolylineOptions (
739
- Map <String , ?> data , PolylineOptionsSink sink , AssetManager assetManager , float density ) {
740
- final Object consumeTapEvents = data .get ("consumeTapEvents" );
741
- if (consumeTapEvents != null ) {
742
- sink .setConsumeTapEvents (toBoolean (consumeTapEvents ));
743
- }
744
- final Object color = data .get ("color" );
745
- if (color != null ) {
746
- sink .setColor (toInt (color ));
747
- }
748
- final Object endCap = data .get ("endCap" );
749
- if (endCap != null ) {
750
- sink .setEndCap (toCap (endCap , assetManager , density ));
751
- }
752
- final Object geodesic = data .get ("geodesic" );
753
- if (geodesic != null ) {
754
- sink .setGeodesic (toBoolean (geodesic ));
755
- }
756
- final Object jointType = data .get ("jointType" );
757
- if (jointType != null ) {
758
- sink .setJointType (toInt (jointType ));
759
- }
760
- final Object startCap = data .get ("startCap" );
761
- if (startCap != null ) {
762
- sink .setStartCap (toCap (startCap , assetManager , density ));
763
- }
764
- final Object visible = data .get ("visible" );
765
- if (visible != null ) {
766
- sink .setVisible (toBoolean (visible ));
767
- }
768
- final Object width = data .get ("width" );
769
- if (width != null ) {
770
- sink .setWidth (toInt (width ));
771
- }
772
- final Object zIndex = data .get ("zIndex" );
773
- if (zIndex != null ) {
774
- sink .setZIndex (toFloat (zIndex ));
775
- }
776
- final Object points = data .get ("points" );
777
- if (points != null ) {
778
- sink .setPoints (toPoints (points ));
779
- }
780
- final Object pattern = data .get ("pattern" );
781
- if (pattern != null ) {
782
- sink .setPattern (toPattern (pattern ));
783
- }
784
- final String polylineId = (String ) data .get ("polylineId" );
785
- if (polylineId == null ) {
786
- throw new IllegalArgumentException ("polylineId was null" );
787
- } else {
788
- return polylineId ;
789
- }
707
+ Messages .PlatformPolyline polyline ,
708
+ PolylineOptionsSink sink ,
709
+ AssetManager assetManager ,
710
+ float density ) {
711
+ sink .setConsumeTapEvents (polyline .getConsumesTapEvents ());
712
+ sink .setColor (polyline .getColor ().intValue ());
713
+ sink .setEndCap (toCap (polyline .getEndCap (), assetManager , density ));
714
+ sink .setStartCap (toCap (polyline .getStartCap (), assetManager , density ));
715
+ sink .setGeodesic (polyline .getGeodesic ());
716
+ sink .setJointType (polyline .getJointType ().intValue ());
717
+ sink .setVisible (polyline .getVisible ());
718
+ sink .setWidth (polyline .getWidth ());
719
+ sink .setZIndex (polyline .getZIndex ());
720
+ sink .setPoints (pointsFromPigeon (polyline .getPoints ()));
721
+ sink .setPattern (toPattern (polyline .getPatterns ()));
722
+ return polyline .getPolylineId ();
790
723
}
791
724
792
725
static String interpretCircleOptions (Messages .PlatformCircle circle , CircleOptionsSink sink ) {
@@ -850,14 +783,11 @@ static String interpretHeatmapOptions(Map<String, ?> data, HeatmapOptionsSink si
850
783
}
851
784
}
852
785
853
- @ VisibleForTesting
854
- static List <LatLng > toPoints (Object o ) {
855
- final List <?> data = toList (o );
786
+ static List <LatLng > pointsFromPigeon (List <Messages .PlatformLatLng > data ) {
856
787
final List <LatLng > points = new ArrayList <>(data .size ());
857
788
858
- for (Object rawPoint : data ) {
859
- final List <?> point = toList (rawPoint );
860
- points .add (new LatLng (toDouble (point .get (0 )), toDouble (point .get (1 ))));
789
+ for (Messages .PlatformLatLng rawPoint : data ) {
790
+ points .add (new LatLng (rawPoint .getLatitude (), rawPoint .getLongitude ()));
861
791
}
862
792
return points ;
863
793
}
@@ -918,12 +848,11 @@ static Gradient toGradient(Object o) {
918
848
return new Gradient (colors , startPoints , colorMapSize );
919
849
}
920
850
921
- private static List <List <LatLng >> toHoles (Object o ) {
922
- final List <?> data = toList (o );
851
+ private static List <List <LatLng >> toHoles (List <List <Messages .PlatformLatLng >> data ) {
923
852
final List <List <LatLng >> holes = new ArrayList <>(data .size ());
924
853
925
- for (Object rawHole : data ) {
926
- holes .add (toPoints ( rawHole ));
854
+ for (List < Messages . PlatformLatLng > hole : data ) {
855
+ holes .add (pointsFromPigeon ( hole ));
927
856
}
928
857
return holes ;
929
858
}
0 commit comments