當前位置: 首頁>>代碼示例>>Java>>正文


Java PolygonOptions類代碼示例

本文整理匯總了Java中com.google.android.gms.maps.model.PolygonOptions的典型用法代碼示例。如果您正苦於以下問題:Java PolygonOptions類的具體用法?Java PolygonOptions怎麽用?Java PolygonOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PolygonOptions類屬於com.google.android.gms.maps.model包,在下文中一共展示了PolygonOptions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupPoly

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
private void setupPoly(double lattd, double longtd)
    {
        mMaps.addPolygon(new PolygonOptions()
                .add(new LatLng(-6.235615, 106.747218))
                .add(new LatLng(-6.236727, 106.747207))
                .add(new LatLng(-6.236052, 106.747848))
                .strokeColor(Color.RED)
                .fillColor(0x5500ff00));

//        mMaps.addPolygon(new PolygonOptions()
//                .add(new LatLng(-6.236727, 106.747207))
//                .strokeColor(Color.RED)
//                .fillColor(0x5500ff00));
//
//        mMaps.addPolygon(new PolygonOptions()
//                .add(new LatLng(-6.236052, 106.747848))
//                .strokeColor(Color.RED)
//                .fillColor(0x5500ff00));

    }
 
開發者ID:PandhuWibowo,項目名稱:HackJakRawan,代碼行數:21,代碼來源:MapsActivity.java

示例2: isPointOnPolygon

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
/**
 * Is the point of the polygon
 *
 * @param point     point
 * @param polygon   polygon
 * @param geodesic  geodesic check flag
 * @param tolerance distance tolerance
 * @return true if on the polygon
 */
public static boolean isPointOnPolygon(LatLng point, PolygonOptions polygon, boolean geodesic, double tolerance) {

    boolean onPolygon = PolyUtil.containsLocation(point, polygon.getPoints(), geodesic) ||
            PolyUtil.isLocationOnEdge(point, polygon.getPoints(), geodesic, tolerance);

    if (onPolygon) {
        for (List<LatLng> hole : polygon.getHoles()) {
            if (PolyUtil.containsLocation(point, hole, geodesic)) {
                onPolygon = false;
                break;
            }
        }
    }

    return onPolygon;
}
 
開發者ID:ngageoint,項目名稱:geopackage-android-map,代碼行數:26,代碼來源:MapUtils.java

示例3: addMultiPolygonToMapAsMarkers

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
/**
 * Add a MultiPolygonOptions to the map as markers
 *
 * @param shapeMarkers
 * @param map
 * @param multiPolygon
 * @param polygonMarkerOptions
 * @param polygonMarkerHoleOptions
 * @param globalPolygonOptions
 * @return
 */
public MultiPolygonMarkers addMultiPolygonToMapAsMarkers(
        GoogleMapShapeMarkers shapeMarkers, GoogleMap map,
        MultiPolygonOptions multiPolygon,
        MarkerOptions polygonMarkerOptions,
        MarkerOptions polygonMarkerHoleOptions,
        PolygonOptions globalPolygonOptions) {
    MultiPolygonMarkers multiPolygonMarkers = new MultiPolygonMarkers();
    for (PolygonOptions polygon : multiPolygon.getPolygonOptions()) {
        PolygonMarkers polygonMarker = addPolygonToMapAsMarkers(
                shapeMarkers, map, polygon, polygonMarkerOptions,
                polygonMarkerHoleOptions, globalPolygonOptions);
        shapeMarkers.add(polygonMarker);
        multiPolygonMarkers.add(polygonMarker);
    }
    return multiPolygonMarkers;
}
 
開發者ID:ngageoint,項目名稱:geopackage-android-map,代碼行數:28,代碼來源:GoogleMapShapeConverter.java

示例4: comparePolygonAndMapPolygon

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
/**
 * Compare Polygon with Map Polygon
 *
    * @param converter
 * @param polygon
 * @param polygon2
 */
private static void comparePolygonAndMapPolygon(GoogleMapShapeConverter converter,
           Polygon polygon,
		PolygonOptions polygon2) {
	List<LineString> rings = polygon.getRings();
	List<LatLng> points = polygon2.getPoints();
	List<List<LatLng>> holes = polygon2.getHoles();

	TestCase.assertEquals(polygon.numRings(), 1 + holes.size());

	LineString polygonRing = rings.get(0);
	compareLineStringAndLatLngs(converter, polygonRing, points);

	for (int i = 1; i < rings.size(); i++) {
		LineString ring = rings.get(i);
		List<LatLng> hole = holes.get(i - 1);
		compareLineStringAndLatLngs(converter, ring, hole);
	}
}
 
開發者ID:ngageoint,項目名稱:geopackage-android-map,代碼行數:26,代碼來源:GoogleMapShapeConverterUtils.java

示例5: onSharedPreferenceChanged

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
    mainPrefs = prefs;
    loadPrefs();
    for (Marker m : new ArrayList<>(markers)) {
        if (m == null || !pokemonMarkers.containsKey(m.getId())) continue;
        PMarker marker = pokemonMarkers.get(m.getId());
        if ((marker.type == PMarker.MarkerType.POKEMON && !showPokemons)
                || ((marker.type == PMarker.MarkerType.POKESTOP || marker.type == PMarker.MarkerType.LUREDPOKESTOP) && !showPokestops)
                || (marker.type == PMarker.MarkerType.GYM && !showGyms)
                || (marker.type == PMarker.MarkerType.SPAWNPOINT && !showSpawnpoints)) {
            forts.remove(marker.getId());
            luredPokemon.remove(marker.getId());
            if (marker.type == PMarker.MarkerType.POKEMON)
                pokemon.remove(Long.parseLong(marker.getId()));
            spawnpoints.remove(marker.getId());

            removeMarker(m);
        }
    }
    if (scanArea != null) scanArea.remove();
    if (showScanArea)
        scanArea = mMap.addPolygon(new PolygonOptions().addAll(createRectangle(location, steps * gpsOffset)).fillColor(Color.argb(20, 50, 0, 255)));
}
 
開發者ID:guipenedo,項目名稱:PokeRadar,代碼行數:25,代碼來源:MapsActivity.java

示例6: setupDeelgebied

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
public void setupDeelgebied(Deelgebied deelgebied) {
    if(!deelgebied.getCoordinates().isEmpty()) {
        PolygonOptions options = new PolygonOptions().addAll(deelgebied.getCoordinates());
        if(JappPreferences.getAreasColorEnabled()) {
            int alphaPercent = JappPreferences.getAreasColorAlpha();
            float alpha = ((float)(100 - alphaPercent))/100 * 255;
            options.fillColor(deelgebied.alphaled(Math.round(alpha)));
        } else {
            options.fillColor(Color.TRANSPARENT);
        }

        options.strokeColor(deelgebied.getColor());
        if(JappPreferences.getAreasEdgesEnabled()) {
            options.strokeWidth(JappPreferences.getAreasEdgesWidth());
        } else {
            options.strokeWidth(0);
        }
        options.visible(true);

        areas.put(deelgebied.getName(), jotiMap.addPolygon(options));
    }
}
 
開發者ID:RSDT,項目名稱:Japp16,代碼行數:23,代碼來源:JappMapFragment.java

示例7: Result

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
/**
 * Reconstructs the result.
 *
 * @param in The parcel where the result was written to
 */
protected Result(Parcel in) {
    bundleId = in.readString();
    markers = new ArrayList<>();
    ArrayList<MarkerOptions> optionsList = in.createTypedArrayList(MarkerOptions.CREATOR);
    ArrayList<Bitmap> bitmapList = in.createTypedArrayList(Bitmap.CREATOR);
    ArrayList<Pair<MarkerOptions, Bitmap>> markers = new ArrayList<>();

    polylines = in.createTypedArrayList(PolylineOptions.CREATOR);
    polygons = in.createTypedArrayList(PolygonOptions.CREATOR);
    circles = in.createTypedArrayList(CircleOptions.CREATOR);
    if (bitmapList.size() != optionsList.size()){
        throw new RuntimeException("optionlist and bitmapList are not equal in size");
    }
    for (int i = 0; i < optionsList.size(); i++){
        markers.add(new Pair<MarkerOptions, Bitmap>(optionsList.get(i),bitmapList.get(i)));
    }
    this.markers = markers;
}
 
開發者ID:RSDT,項目名稱:Japp16,代碼行數:24,代碼來源:AbstractTransducer.java

示例8: updatePolygonsPaths

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
@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));
    }

}
 
開發者ID:mxiao6,項目名稱:Tower-develop,代碼行數:25,代碼來源:GoogleMapFragment.java

示例9: addPolygon

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
private void addPolygon(String name, Polygon poly, int color) {
    final PolygonOptions polyOptions = new PolygonOptions();
    final LineString exteriorRing = poly.getExteriorRing();
    for (int iPnt = 0; iPnt < exteriorRing.getNumPoints(); iPnt++) {
        final Point p = exteriorRing.getPointN(iPnt);
        polyOptions.add(new LatLng(p.getY(), p.getX()));
    }

    for (int iHole = 0; iHole < poly.getNumInteriorRing(); iHole++) {
        final LineString interiorRing = poly.getInteriorRingN(iHole);
        final List<LatLng> holePnts = new ArrayList<LatLng>();
        for (int iPnt = 0; iPnt < interiorRing.getNumPoints(); iPnt++) {
            final Point pnt = interiorRing.getPointN(iPnt);
            holePnts.add(new LatLng(pnt.getY(), pnt.getX()));
        }

        polyOptions.addHole(holePnts);
    }

    mMap.addPolygon(polyOptions
            .strokeWidth(1)
            .strokeColor(Color.DKGRAY)
            .fillColor(color));
}
 
開發者ID:sevar83,項目名稱:SpatiAtlas,代碼行數:25,代碼來源:MapFragment.java

示例10: drawPolygon

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
private void drawPolygon() {
    googleMap.clear();

    for (LatLng point : arrayPoints) {
        googleMap.addMarker(new MarkerOptions().position(point));
    }

    if (arrayPoints.size() >= 3) {
        PolygonOptions polygonOptions = new PolygonOptions();
        polygonOptions.addAll(arrayPoints);
        polygonOptions.strokeColor(Color.argb(0, 0, 0, 100));
        polygonOptions.strokeWidth(7);
        polygonOptions.fillColor(Color.argb(100, 0, 0, 100));
        googleMap.addPolygon(polygonOptions);
    }
}
 
開發者ID:davidcampelo,項目名稱:PublicOpenSpaceToolApp,代碼行數:17,代碼來源:ProjectAddEditFragment.java

示例11: outlineGraticule

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
private void outlineGraticule(Graticule g) {
    // If we had an outline, remove it.
    if(mPolygon != null)
        mPolygon.remove();

    // A null Graticule means either there's no valid input or we're in
    // globalhash mode, so we just don't draw the outline at all.
    if(g == null) return;

    // And with that Graticule, we can get a Polygon.
    PolygonOptions opts = g.getPolygon()
            .strokeColor(ContextCompat.getColor(mCentralMap, R.color.graticule_stroke))
            .strokeWidth(2)
            .fillColor(ContextCompat.getColor(mCentralMap, R.color.graticule_fill));

    if(mMap != null) {
        mPolygon = mMap.addPolygon(opts);

        zoomToPoint(g.getCenterLatLng());
    }
}
 
開發者ID:CaptainSpam,項目名稱:geohashdroid,代碼行數:22,代碼來源:SelectAGraticuleMode.java

示例12: pointInPolygon

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
public boolean pointInPolygon(LatLng point, PolygonOptions polygon) {
    // ray casting alogrithm http://rosettacode.org/wiki/Ray-casting_algorithm
    int crossings = 0;
    List<LatLng> path = polygon.getPoints();
    //path.remove(path.size()); //remove the last point that is added automatically by getPoints()

    // for each edge
    for (int i = 0; i < path.size(); i++) {
        LatLng a = path.get(i);
        int j = i + 1;
        //to close the last edge, you have to take the first point of your polygon
        if (j >= path.size()) {
            j = 0;
        }
        LatLng b = path.get(j);
        if (rayCrossesSegment(point, a, b)) {
            crossings++;
        }
    }

    // odd number of crossings?
    return (crossings % 2 == 1);
}
 
開發者ID:derekriley,項目名稱:UWP-navigation,代碼行數:24,代碼來源:MapObject.java

示例13: BuildingList

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
public BuildingList() {
        buildingHashMap = new HashMap<>();
        for (Map.Entry<String, PolygonOptions> entry : CONSTANTS.buildingOutlines.entrySet()) {
            Building b = new Building(entry.getKey(), entry.getValue());
            buildingHashMap.put(b.getName(), b);
        }
        buildingHashMap.get("Student Center").setNavId("Student_Center");
        buildingHashMap.get("Molinaro Hall").setNavId("Molinaro_Hall");
        buildingHashMap.get("Greenquist Hall").setNavId("Greenquist_Hall");
        buildingHashMap.get("Wyllie Hall").setNavId("Wyllie_Hall");
        buildingHashMap.get("The Rita").setNavId("The_Rita");
        buildingHashMap.get("Sports and Activity Center").setNavId("Sports_and_Activity_Center");
//        FUTURE BUILDINGS
//        buildingHashMap.get("Tallent Hall").setNavId("Tallent_Hall");
//        buildingHashMap.get("Student Health and Counseling Center").setNavId("Student_Health_and_Counseling_Center");
    }
 
開發者ID:derekriley,項目名稱:UWP-navigation,代碼行數:17,代碼來源:BuildingList.java

示例14: setInlinePolygonStyle

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
/**
 * Sets the inline polygon style by copying over the styles that have been set
 *
 * @param polygonOptions polygon options object to add inline styles to
 * @param inlineStyle    inline styles to apply
 */
private void setInlinePolygonStyle(PolygonOptions polygonOptions, KmlStyle inlineStyle) {
    PolygonOptions inlinePolygonOptions = inlineStyle.getPolygonOptions();
    if (inlineStyle.hasFill() && inlineStyle.isStyleSet("fillColor")) {
        polygonOptions.fillColor(inlinePolygonOptions.getFillColor());
    }
    if (inlineStyle.hasOutline()) {
        if (inlineStyle.isStyleSet("outlineColor")) {
            polygonOptions.strokeColor(inlinePolygonOptions.getStrokeColor());
        }
        if (inlineStyle.isStyleSet("width")) {
            polygonOptions.strokeWidth(inlinePolygonOptions.getStrokeWidth());
        }
    }
    if (inlineStyle.isPolyRandomColorMode()) {
        polygonOptions.fillColor(KmlStyle.computeRandomColor(inlinePolygonOptions.getFillColor()));
    }
}
 
開發者ID:josegury,項目名稱:AndroidMarkerClusteringMaps,代碼行數:24,代碼來源:KmlRenderer.java

示例15: updatePolygonsPaths

import com.google.android.gms.maps.model.PolygonOptions; //導入依賴的package包/類
@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));
    }

}
 
開發者ID:sommishra,項目名稱:DroidPlanner-Tower,代碼行數:20,代碼來源:GoogleMapFragment.java


注:本文中的com.google.android.gms.maps.model.PolygonOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。