Ejemplo n.º 1
0
 public boolean isPointOnProvince(LatLng point, Province province) {
   if (province.getIsland() != null) {
     for (Island island : province.getIsland()) {
       if (Utils.isPointInPolygon(point, island.getBoundary())) {
         return true;
       }
     }
     return false;
   } else {
     return Utils.isPointInPolygon(point, province.getBoundary());
   }
 }
Ejemplo n.º 2
0
 public void paintProvince(Province province, int fillColor, boolean border) {
   if (province.getHoleBoundary() != null) {
     if (province.getIsland() != null) {
       for (Island island : province.getIsland()) {
         googleMap.addPolygon(
             new PolygonOptions()
                 .addAll(island.getBoundary())
                 .addHole(province.getHoleBoundary())
                 .fillColor(fillColor)
                 .strokeWidth(border ? 1 : 0)
                 .strokeColor(Color.BLACK));
       }
     }
     if (province.getBoundary() != null) {
       googleMap.addPolygon(
           new PolygonOptions()
               .addAll(province.getBoundary())
               .addHole(province.getHoleBoundary())
               .fillColor(fillColor)
               .strokeWidth(border ? 1 : 0)
               .strokeColor(Color.BLACK));
     }
   } else {
     if (province.getIsland() != null) {
       for (Island island : province.getIsland()) {
         googleMap.addPolygon(
             new PolygonOptions()
                 .addAll(island.getBoundary())
                 .fillColor(fillColor)
                 .strokeWidth(border ? 1 : 0)
                 .strokeColor(Color.BLACK));
       }
     }
     if (province.getBoundary() != null) {
       googleMap.addPolygon(
           new PolygonOptions()
               .addAll(province.getBoundary())
               .fillColor(fillColor)
               .strokeWidth(border ? 1 : 0)
               .strokeColor(Color.BLACK));
     }
   }
 }