Java 类com.google.android.gms.maps.model.Polygon 实例源码

项目:PhoneChat    文件:PluginPolygon.java   
/**
 * Remove the polygon
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void remove(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
    String id = args.getString(1);
    Polygon polygon = this.getPolygon(id);
    if (polygon == null) {
        this.sendNoResult(callbackContext);
        return;
    }
    this.objects.remove(id);

    id = "polygon_bounds_" + polygon.getId();
    this.objects.remove(id);

    polygon.remove();
    this.sendNoResult(callbackContext);
}
项目:PhoneChat    文件:PluginPolygon.java   
/**
 * Set holes
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setHoles(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
    String id = args.getString(1);
    Polygon polygon = this.getPolygon(id);

    JSONArray holesJSONArray = args.getJSONArray(2);
    List<List<LatLng>> holes = new LinkedList<List<LatLng>>();

    for (int i = 0; i < holesJSONArray.length(); i++) {
        JSONArray holeJSONArray = holesJSONArray.getJSONArray(i);
        holes.add(PluginUtil.JSONArray2LatLngList(holeJSONArray));
    }

    polygon.setHoles(holes);

    this.sendNoResult(callbackContext);
}
项目:PhoneChat    文件:PluginPolygon.java   
/**
 * Set points
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setPoints(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
    String id = args.getString(1);
    Polygon polygon = this.getPolygon(id);

    JSONArray points = args.getJSONArray(2);
    List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
    polygon.setPoints(path);

    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (int i = 0; i < path.size(); i++) {
        builder.include(path.get(i));
    }
    this.objects.put("polygon_bounds_" + polygon.getId(), builder.build());
    this.sendNoResult(callbackContext);
}
项目:RxGoogleMapsBinding    文件:PolygonClickOnSubscribe.java   
@Override public void call(final Subscriber<? super Polygon> subscriber) {
  GoogleMap.OnPolygonClickListener listener = new GoogleMap.OnPolygonClickListener() {
    @Override public void onPolygonClick(Polygon polygon) {
      if (!subscriber.isUnsubscribed()) {
        subscriber.onNext(polygon);
      }
    }
  };

  googleMap.setOnPolygonClickListener(listener);

  subscriber.add(Subscriptions.create(new Action0() {
    @Override public void call() {
      googleMap.setOnPolygonClickListener(null);
    }
  }));
}
项目:Tower-develop    文件:GoogleMapFragment.java   
@Override
public void updatePolygonsPaths(List<List<LatLong>> paths) {
    GoogleMap map = getMap();
    if (map == null) {
        return;
    }

    for (Polygon poly : polygonsPaths) {
        poly.remove();
    }

    for (List<LatLong> contour : paths) {
        PolygonOptions pathOptions = new PolygonOptions();
        pathOptions.strokeColor(POLYGONS_PATH_DEFAULT_COLOR).strokeWidth(
                POLYGONS_PATH_DEFAULT_WIDTH);
        final List<LatLng> pathPoints = new ArrayList<LatLng>(contour.size());
        for (LatLong coord : contour) {
            pathPoints.add(MapUtils.coordToLatLng(coord));
        }
        pathOptions.addAll(pathPoints);
        polygonsPaths.add(map.addPolygon(pathOptions));
    }

}
项目:AndroidMarkerClusteringMaps    文件:KmlRenderer.java   
/**
 * Adds a single geometry object to the map with its specified style
 *
 * @param geometry defines the type of object to add to the map
 * @param style    defines styling properties to add to the object when added to the map
 * @return the object that was added to the map, this is a Marker, Polyline, Polygon or an array
 * of either objects
 */
private Object addToMap(KmlPlacemark placemark, KmlGeometry geometry, KmlStyle style,
        KmlStyle inlineStyle, boolean isVisible) {

    String geometryType = geometry.getGeometryType();
    if (geometryType.equals("Point")) {
        Marker marker = addPointToMap(placemark, (KmlPoint) geometry, style, inlineStyle);
        marker.setVisible(isVisible);
        return marker;
    } else if (geometryType.equals("LineString")) {
        Polyline polyline = addLineStringToMap((KmlLineString) geometry, style, inlineStyle);
        polyline.setVisible(isVisible);
        return polyline;
    } else if (geometryType.equals("Polygon")) {
        Polygon polygon = addPolygonToMap((KmlPolygon) geometry, style, inlineStyle);
        polygon.setVisible(isVisible);
        return polygon;
    } else if (geometryType.equals("MultiGeometry")) {
        return addMultiGeometryToMap(placemark, (KmlMultiGeometry) geometry, style, inlineStyle,
                isVisible);
    }

    return null;
}
项目:DroidPlanner-Tower    文件:GoogleMapFragment.java   
@Override
public void updatePolygonsPaths(List<List<LatLong>> paths) {
    for (Polygon poly : polygonsPaths) {
        poly.remove();
    }

    for (List<LatLong> contour : paths) {
        PolygonOptions pathOptions = new PolygonOptions();
        pathOptions.strokeColor(POLYGONS_PATH_DEFAULT_COLOR).strokeWidth(
                POLYGONS_PATH_DEFAULT_WIDTH);
        final List<LatLng> pathPoints = new ArrayList<LatLng>(contour.size());
        for (LatLong coord : contour) {
            pathPoints.add(DroneHelper.CoordToLatLang(coord));
        }
        pathOptions.addAll(pathPoints);
        polygonsPaths.add(getMap().addPolygon(pathOptions));
    }

}
项目:neo4art    文件:PluginPolygon.java   
/**
 * Remove the polygon
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void remove(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  Polygon polygon = this.getPolygon(id);
  if (polygon == null) {
    this.sendNoResult(callbackContext);
    return;
  }
  this.objects.remove(id);

  id = "polygon_bounds_" + polygon.getId();
  this.objects.remove(id);

  polygon.remove();
  this.sendNoResult(callbackContext);
}
项目:neo4art    文件:PluginPolygon.java   
/**
 * Set points
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setPoints(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  Polygon polygon = this.getPolygon(id);

  JSONArray points = args.getJSONArray(2);
  List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
  polygon.setPoints(path);

  LatLngBounds.Builder builder = new LatLngBounds.Builder();
  for (int i = 0; i < path.size(); i++) {
    builder.include(path.get(i));
  }
  this.objects.put("polygon_bounds_" + polygon.getId(), builder.build());
  this.sendNoResult(callbackContext);
}
项目:neo4art    文件:PluginPolygon.java   
/**
 * Remove the polygon
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void remove(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  Polygon polygon = this.getPolygon(id);
  if (polygon == null) {
    this.sendNoResult(callbackContext);
    return;
  }
  this.objects.remove(id);

  id = "polygon_bounds_" + polygon.getId();
  this.objects.remove(id);

  polygon.remove();
  this.sendNoResult(callbackContext);
}
项目:neo4art    文件:PluginPolygon.java   
/**
 * Set points
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setPoints(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  Polygon polygon = this.getPolygon(id);

  JSONArray points = args.getJSONArray(2);
  List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
  polygon.setPoints(path);

  LatLngBounds.Builder builder = new LatLngBounds.Builder();
  for (int i = 0; i < path.size(); i++) {
    builder.include(path.get(i));
  }
  this.objects.put("polygon_bounds_" + polygon.getId(), builder.build());
  this.sendNoResult(callbackContext);
}
项目:neo4art    文件:PluginPolygon.java   
/**
 * Remove the polygon
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void remove(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  Polygon polygon = this.getPolygon(id);
  if (polygon == null) {
    this.sendNoResult(callbackContext);
    return;
  }
  this.objects.remove(id);

  id = "polygon_bounds_" + polygon.getId();
  this.objects.remove(id);

  polygon.remove();
  this.sendNoResult(callbackContext);
}
项目:neo4art    文件:PluginPolygon.java   
/**
 * Set points
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setPoints(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  Polygon polygon = this.getPolygon(id);

  JSONArray points = args.getJSONArray(2);
  List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
  polygon.setPoints(path);

  LatLngBounds.Builder builder = new LatLngBounds.Builder();
  for (int i = 0; i < path.size(); i++) {
    builder.include(path.get(i));
  }
  this.objects.put("polygon_bounds_" + polygon.getId(), builder.build());
  this.sendNoResult(callbackContext);
}
项目:Umweltzone    文件:MapDrawer.java   
public void drawPolygons(
        List<Circuit> circuits,
        int fillColor,
        int strokeColor,
        int strokeWidth) {
    if (mZonePolygons != null && !mZonePolygons.isEmpty()) {
        mZonePolygons.clear();
        mZonePolygons = null;
    }

    int circuitsCount = circuits.size();
    mZonePolygons = new ArrayList<>(circuitsCount);
    for (int i = 0; i < circuitsCount; i++) {
        Circuit circuit = circuits.get(i);
        Polygon zonePolygon = drawPolygon(circuit, fillColor, strokeColor, strokeWidth);
        mZonePolygons.add(zonePolygon);
    }
}
项目:anti-piracy-android-app    文件:OfflineMap.java   
@Override
protected Collection<PolygonOptions> doInBackground(Geometry... features) {     
    Collection<PolygonOptions> polygons = new ArrayList<PolygonOptions>(features.length);
    for (Geometry feature : features) { 
        if (feature instanceof com.vividsolutions.jts.geom.Polygon) {      
            polygons.add(generatePolygon((com.vividsolutions.jts.geom.Polygon)feature));                    
        }
        else if(feature instanceof com.vividsolutions.jts.geom.MultiPolygon) {                  
            MultiPolygon multiPolygon = (MultiPolygon)feature;
            for(int i = 0; i < multiPolygon.getNumGeometries(); i++) {
                Geometry geometry = multiPolygon.getGeometryN(i);
                if(geometry instanceof com.vividsolutions.jts.geom.Polygon) {
                    polygons.add(generatePolygon((com.vividsolutions.jts.geom.Polygon)geometry));
                }

                //nested MultiPolygons are ignored for now.  Recursive solution has performance implications.                       
            }                   
        }
    }    

    return polygons;
}
项目:disconnected-content-explorer-android    文件:OfflineMap.java   
public void setVisible(boolean visible) {
    Log.d(TAG, "set visible " + visible);
    backgroundTileOverlay.setVisible(visible);

    if (polygonOptions == null) {
        Log.d(TAG, "waiting for polygons");
        waitingForPolygons.add(this);
        return;
    }
    else if (polygons == null) {
        polygonsReady();
    }
    else {
        for (Polygon polygon : polygons) {
            polygon.setVisible(visible);
        }
    }
}
项目:disconnected-content-explorer-android    文件:OfflineMap.java   
@Override
protected List<PolygonOptions> doInBackground(Void... voids) {
    startTime = System.currentTimeMillis();
    Log.d(TAG, "transforming geometries to polygons");

    List<PolygonOptions> polygons = new ArrayList<>(features.size());

    for (Geometry feature : features) {
        // For now all offline map features are polygons
        if ("Polygon".equals(feature.getGeometryType())) {
            polygons.add(transformPolygon((com.vividsolutions.jts.geom.Polygon) feature));
        }
        else if ("MultiPolygon".equals(feature.getGeometryType())) {
            MultiPolygon mp = (MultiPolygon) feature;
            for (int i = 0; i < mp.getNumGeometries(); i++) {
                com.vividsolutions.jts.geom.Polygon polygon = (com.vividsolutions.jts.geom.Polygon) mp.getGeometryN(i);
                polygons.add(transformPolygon(polygon));
            }
        }
    }

    return polygons;
}
项目:Zones    文件:GooglePolygonMap.java   
private void addPolygonsWithinBounds(LatLngBounds bounds) {
  TaggedPolygon<TaggedPoint> visiblePolygon;
  List<TaggedPolygon<TaggedPoint>> polygons;
  PolygonOptions mapPolygonOptions;
  Polygon mapPolygon;

  mapMarkers.clear();
  mapPolygons.clear();
  googleMap.clear();

  visiblePolygon = GoogleGeometryFactory.buildTaggedPolygon(bounds);
  polygons = applicationStorage.polygons.getPolygonsIntersectingPolygon(visiblePolygon);

  for(TaggedPolygon<TaggedPoint> polygon : polygons) {
    if(mapActivity.getState() != DrawState.NEW_POINTS || polygon.getID() != mapActivity.getSelectedPolygon().getID()) {
      mapPolygonOptions = GoogleGeometryFactory.buildPolygonOptions(polygon);
      mapPolygonOptions.fillColor(POLYGON_FILL_COLOR).strokeWidth(POLYGON_STROKE_WIDTH);
      mapPolygon = googleMap.addPolygon(mapPolygonOptions);
      mapPolygons.put(polygon.getID(), mapPolygon);
    }
  }
}
项目:ImproveMyCity-Mobile    文件:GEO.java   
/** 
 * Check whether a the marker position is inside the municipality borders (polygon)
 * 
 * @poly the polygon borders
 * @lng longitude of marker
 * @lat latitude of marker      
 */
public static boolean insidePoly(Polygon poly, double lng, double  lat){

    List<LatLng> p = poly.getPoints();

    int polyPoints = poly.getPoints().size();
    int polySides  = polyPoints - 1;

    double[] polyY = new double[polyPoints];
    double[] polyX = new double[polyPoints];

    for (int i = 0; i < polyPoints; i++){
        polyY[i] = p.get(i).latitude;
        polyX[i] = p.get(i).longitude;
    }

    boolean oddTransitions = false;
    for( int i = 0, j = polySides -1; i < polySides; j = i++ ) {
        if( ( polyY[ i ] < lat && polyY[ j ] >= lat ) || ( polyY[ j ] < lat && polyY[ i ] >= lat ) ) {
            if( polyX[ i ] + ( lat - polyY[ i ] ) / ( polyY[ j ] - polyY[ i ] ) * ( polyX[ j ] - polyX[ i ] ) < lng ) {
                oddTransitions = !oddTransitions;          
            }
        }
    }
    return oddTransitions;
}
项目:VennTracker    文件:Circles.java   
public static void clearPolygons(Context context) {
    // Remove all polygons from map
    for (Polygon polygon : mPolygonsToClear) {
        polygon.remove();
    }
    for (Circle circle : mPolygonsRedToClear) {
        circle.remove();
    }
    for (Marker marker : mIntersectingToClear) {
        marker.remove();
    }
    mIntersecting.clear();
    mIntersectingToClear.clear();
    mPolygonsRedToClear.clear();
    mPolygonsRed.clear();
    // Clear ArrayList holding polygons
    mPolygonsToClear.clear();
    // Clear ArrayList holding polygon point LatLng objects
    mPolygonPointsGreen.clear();

    DatabaseHelper myDb = DatabaseHelper.getInstance(context);
    // Clear ArrayList containing hole LatLng objects
    mHoles.clear();
    // Reset transparency on all markers
    SpawnLocation.markerResetTransparency();

    // Remove from database
    myDb.removeAllHoles();
    myDb.removePolygons();
    myDb.removeCircles();
    myDb.removeIntersections();
    myDb.close();
}
项目:GoogleMapsLayout-Android    文件:MapLayout.java   
public void removeZone(String name) {
    synchronized (zoneVsMarkerAndPolygonMap) {
        for (Zone zone : zoneVsMarkerAndPolygonMap.keySet()) {
            if (zone.getName().equals(name)) {
                Pair<Marker, Polygon> markerAndPolygon = zoneVsMarkerAndPolygonMap.get(zone);
                Marker m = markerAndPolygon.first;
                Polygon p = markerAndPolygon.second;
                m.remove();
                p.remove();
                zoneVsMarkerAndPolygonMap.remove(zone);
                break;
            }
        }
    }
}
项目:GoogleMapsLayout-Android    文件:MapLayout.java   
/**
 * Removes all zones
 */
public void removeZones() {
    synchronized (zoneVsMarkerAndPolygonMap) {
        for (Zone zone : zoneVsMarkerAndPolygonMap.keySet()) {
            Pair<Marker, Polygon> markerAndPolygon = zoneVsMarkerAndPolygonMap.get(zone);
            Marker m = markerAndPolygon.first;
            Polygon p = markerAndPolygon.second;
            m.remove();
            p.remove();
            zoneVsMarkerAndPolygonMap.remove(zone);
        }
    }
}
项目:GoogleMapsLayout-Android    文件:MapLayout.java   
/**
 * Refreshes the polygon and  label marker of the given zone according to zone's appearance options.
 *
 * @param zone zone object
 */
private void refreshZone(Zone zone) {
    Pair<Marker,Polygon> markerAndPolygon = zoneVsMarkerAndPolygonMap.get(zone);
    ZoneOptions zoneOptions = zone.getOptions();
    //update polygon
    Polygon p = markerAndPolygon.second;
    PolygonOptions polygonOptions = zoneOptions.getPolygonOptions();
    p.setStrokeColor(polygonOptions.getStrokeColor());
    p.setStrokeWidth(polygonOptions.getStrokeWidth());
    p.setFillColor(polygonOptions.getFillColor());
    p.setGeodesic(polygonOptions.isGeodesic());
    p.setHoles(polygonOptions.getHoles());
    p.setVisible(polygonOptions.isVisible());
    p.setZIndex(polygonOptions.getZIndex());
    p.setClickable(polygonOptions.isClickable());

    Log.i(TAG,"updated polygon id: "+p.getId());

    //update label marker
    Marker m = markerAndPolygon.first;
    ZoneLabelOptions zoneLabelOptions = zoneOptions.getZoneLabelOptions();
    MarkerOptions mO = zoneLabelOptions.getLabelMarkerOptions();

    if(zoneLabelOptions.isDisplayLabel())
        mO.icon(BitmapDescriptorFactory.fromBitmap(getLabelBitmap(zone.getName(),zoneLabelOptions)));

    m.setIcon(mO.getIcon());
    m.setZIndex(mO.getZIndex());
    m.setVisible(mO.isVisible());
    m.setAlpha(mO.getAlpha());
    m.setAnchor(mO.getAnchorV(),mO.getAnchorU());
    m.setDraggable(mO.isDraggable());
    m.setFlat(mO.isFlat());
    m.setInfoWindowAnchor(mO.getInfoWindowAnchorV(),mO.getInfoWindowAnchorU());
    m.setRotation(mO.getRotation());
    m.setSnippet(mO.getSnippet());
    m.setTitle(zone.getName());
}
项目:GoogleMapsLayout-Android    文件:MapLayout.java   
@Override
public void onPolygonClick(Polygon polygon) {
    for (Zone zone : zoneVsMarkerAndPolygonMap.keySet()) {
        if (zoneVsMarkerAndPolygonMap.get(zone).second.equals(polygon)) {
            zone.setHighLighted(!zone.isHighLighted());
            refreshZone(zone);
            if (eventListener != null)
                eventListener.onZoneClicked(zone, polygon);
            break;
        }
    }
}
项目:GoogleMapsLayout-Android    文件:MapLayout.java   
@Override
public boolean onMarkerClick(Marker marker) {
    // check if not position marker
    if(marker.getTitle().equals(TITLE_LOCATION_MARKER))
        return true;

    // check if zone label marker
    for (Zone zone : zoneVsMarkerAndPolygonMap.keySet()) {
        if (zone.getName().equals(marker.getTitle())) {
            Pair<Marker, Polygon> markerAndPolygon = zoneVsMarkerAndPolygonMap.get(zone);
            onPolygonClick(markerAndPolygon.second);
            return true;
        }
    }

    // check marker click
    for (com.ubudu.gmaps.model.Marker myMarker : customMarkersMap.keySet()) {
        if (customMarkersMap.get(myMarker).equals(marker)) {
            myMarker.setHighLighted(!myMarker.isHighLighted());
            refreshMarker(myMarker);
            if (eventListener != null)
                eventListener.onMarkerClicked(myMarker, marker);
            return !myMarker.getMarkerOptionsStrategy().isInforWindowEnabled();
        }
    }
    return false;
}
项目:RxGoogleMaps    文件:PolygonClickFuncTest.java   
@Test
public void shouldEmmitPolygon() throws Exception {
    TestSubscriber<Polygon> testSubscriber = new TestSubscriber<>();
    new PolygonClickFunc().call(googleMap)
            .subscribe(testSubscriber);
    verify(googleMap).setOnPolygonClickListener(argumentCaptor.capture());
    argumentCaptor.getValue().onPolygonClick(null);
    testSubscriber.assertNoErrors();
    testSubscriber.assertValueCount(1);
    argumentCaptor.getValue().onPolygonClick(null);
    testSubscriber.assertValueCount(2);
}
项目:mage-android    文件:StaticGeometryCollection.java   
public Polygon addPolygon(String layerId, Polygon polygon, String popupHTML) {
    if (featurePolygons.get(layerId) == null) {
        featurePolygons.put(layerId, new ArrayList<Polygon>());
    }

    featurePolygons.get(layerId).add(polygon);
    featurePolygonDescriptions.put(polygon, popupHTML);
    return polygon;
}
项目:mage-android    文件:StaticGeometryCollection.java   
public Collection<Polygon> getPolygons() {
    Collection<Polygon> polygons = new ArrayList<Polygon>();
    for (Map.Entry<String, Collection<Polygon>> entry : featurePolygons.entrySet()) {
        for (Polygon p : entry.getValue()) {
            polygons.add(p);
        }
    }
    return polygons;
}
项目:AndroidMarkerClusteringMaps    文件:GeoJsonRenderer.java   
/**
 * Given a Marker, Polyline, Polygon or an array of these and removes it from the map
 *
 * @param mapObject map object or array of map objects to remove from the map
 */
private static void removeFromMap(Object mapObject) {
    if (mapObject instanceof Marker) {
        ((Marker) mapObject).remove();
    } else if (mapObject instanceof Polyline) {
        ((Polyline) mapObject).remove();
    } else if (mapObject instanceof Polygon) {
        ((Polygon) mapObject).remove();
    } else if (mapObject instanceof ArrayList) {
        for (Object mapObjectElement : (ArrayList) mapObject) {
            removeFromMap(mapObjectElement);
        }
    }
}
项目:AndroidMarkerClusteringMaps    文件:GeoJsonRenderer.java   
/**
 * Adds a GeoJsonPolygon to the map as a Polygon
 *
 * @param polygonStyle contains relevant styling properties for the Polygon
 * @param polygon      contains coordinates for the Polygon
 * @return Polygon object created from given GeoJsonPolygon
 */
private Polygon addPolygonToMap(GeoJsonPolygonStyle polygonStyle, GeoJsonPolygon polygon) {
    PolygonOptions polygonOptions = polygonStyle.toPolygonOptions();
    // First array of coordinates are the outline
    polygonOptions.addAll(polygon.getCoordinates().get(POLYGON_OUTER_COORDINATE_INDEX));
    // Following arrays are holes
    for (int i = POLYGON_INNER_COORDINATE_INDEX; i < polygon.getCoordinates().size();
            i++) {
        polygonOptions.addHole(polygon.getCoordinates().get(i));
    }
    return mMap.addPolygon(polygonOptions);
}
项目:AndroidMarkerClusteringMaps    文件:GeoJsonRenderer.java   
/**
 * Adds all GeoJsonPolygon in the GeoJsonMultiPolygon to the map as multiple Polygons
 *
 * @param polygonStyle contains relevant styling properties for the Polygons
 * @param multiPolygon contains an array of GeoJsonPolygons
 * @return array of Polygons that have been added to the map
 */
private ArrayList<Polygon> addMultiPolygonToMap(GeoJsonPolygonStyle polygonStyle,
        GeoJsonMultiPolygon multiPolygon) {
    ArrayList<Polygon> polygons = new ArrayList<Polygon>();
    for (GeoJsonPolygon geoJsonPolygon : multiPolygon.getPolygons()) {
        polygons.add(addPolygonToMap(polygonStyle, geoJsonPolygon));
    }
    return polygons;
}
项目:AndroidMarkerClusteringMaps    文件:KmlRenderer.java   
/**
 * Removes all given KML placemarks from the map and clears all stored placemarks.
 *
 * @param placemarks placemarks to remove
 */
private static void removePlacemarks(HashMap<KmlPlacemark, Object> placemarks) {
    // Remove map object from the map
    for (Object mapObject : placemarks.values()) {
        if (mapObject instanceof Marker) {
            ((Marker) mapObject).remove();
        } else if (mapObject instanceof Polyline) {
            ((Polyline) mapObject).remove();
        } else if (mapObject instanceof Polygon) {
            ((Polygon) mapObject).remove();
        }
    }
}
项目:AndroidMarkerClusteringMaps    文件:KmlRenderer.java   
/**
 * Adds a KML Polygon to the map as a Polygon by combining the styling and coordinates
 *
 * @param polygon contains coordinates for the Polygon
 * @param style   contains relevant styling properties for the Polygon
 * @return Polygon object
 */
private Polygon addPolygonToMap(KmlPolygon polygon, KmlStyle style, KmlStyle inlineStyle) {
    PolygonOptions polygonOptions = style.getPolygonOptions();
    polygonOptions.addAll(polygon.getOuterBoundaryCoordinates());
    for (ArrayList<LatLng> innerBoundary : polygon.getInnerBoundaryCoordinates()) {
        polygonOptions.addHole(innerBoundary);
    }
    if (inlineStyle != null) {
        setInlinePolygonStyle(polygonOptions, inlineStyle);
    } else if (style.isPolyRandomColorMode()) {
        polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor()));
    }
    return mMap.addPolygon(polygonOptions);
}
项目:MAST-MOBILE    文件:MapFeature.java   
public com.vividsolutions.jts.geom.Polygon getWktPolygon() {
    if(wktPolygon == null && points != null && points.size() > 0){
        try {
            wktPolygon = (com.vividsolutions.jts.geom.Polygon) CommonFunctions.getInstance().getWktReader()
                    .read("POLYGON ((" + feature.getCoordinates() + "))");
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
    return wktPolygon;
}
项目:Umweltzone    文件:MapDrawer.java   
protected Polygon drawPolygon(
        Circuit circuit,
        int fillColor,
        int strokeColor,
        int strokeWidth) {
    return mMap.addPolygon(new PolygonOptions()
            .addAll(circuit.getCoordinates())
            .strokeWidth(strokeWidth)
            .fillColor(fillColor)
            .strokeColor(strokeColor));
}
项目:esnavi    文件:WarningAreaManager.java   
/**
 * 形状を全削除する。
 */
private void removeAllShapes() {
    for (final Object shape : mShapes) {
        if (shape instanceof Polygon) {
            ((Polygon) shape).remove();
        } else if (shape instanceof Polyline) {
            ((Polyline) shape).remove();
        } else if (shape instanceof Circle) {
            ((Circle) shape).remove();
        } else {
            Log.w(TAG, "想定していない形状。" + shape.getClass().getSimpleName());
        }
    }
    mShapes.clear();
}
项目:QuizUpWinner    文件:GoogleMap.java   
public final Polygon addPolygon(PolygonOptions paramPolygonOptions)
{
  try
  {
    Polygon localPolygon = new Polygon(this.Br.addPolygon(paramPolygonOptions));
    return localPolygon;
  }
  catch (RemoteException localRemoteException)
  {
    throw new RuntimeRemoteException(localRemoteException);
  }
}
项目:anti-piracy-android-app    文件:SubregionMapActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    AsamLog.i(SubregionMapActivity.class.getName() + ":onCreate");
    setContentView(R.layout.subregion_map);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    Bundle extras = getIntent().getExtras();
    mLaunchedExpectingResultCode = false;
    if (extras != null) {
        mLaunchedExpectingResultCode = extras.getBoolean(AsamConstants.SUBREGION_MAP_EXPECTING_RESULT_CODE_KEY, false);
    }

    mMapUI = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.subregion_map_map_view_ui)).getMap();
    mMapUI.setOnMapClickListener(this);

    offlineAlertFragment = new OfflineBannerFragment();
    getSupportFragmentManager().beginTransaction()
        .add(android.R.id.content, offlineAlertFragment)
        .commit();

    // Initialize subregions and place on map.
    mSubregions = new SubregionTextParser().parseSubregions(this);
    for (SubregionBean subregion : mSubregions) {
        PolygonOptions polygonOptions = new PolygonOptions().zIndex(100);
        polygonOptions.addAll(subregion.getMapCoordinates()).strokeColor(OUTLINE_COLOR).strokeWidth(OUTLINE_WIDTH).fillColor(UNSELECTED_FILL_COLOR);
        Polygon polygon = mMapUI.addPolygon(polygonOptions);
        subregion.setMapPolygon(polygon);
    }
}
项目:anti-piracy-android-app    文件:OfflineMap.java   
public void clear() {
    backgroundTileOverlay.clearTileCache();
    backgroundTileOverlay.remove();

    for (Polygon polygon : offlinePolygons) {
        polygon.remove();
    }
    offlinePolygons.clear();
}
项目:anti-piracy-android-app    文件:OfflineMap.java   
@Override
  protected void onPostExecute(Collection<PolygonOptions> polygons) {
offlinePolygons = new ArrayList<Polygon>(polygons.size());
    for (PolygonOptions polygon : polygons) {
          offlinePolygons.add(mMapUI.addPolygon(polygon));  
    }

    progressDialog.dismiss();
  }