当前位置: 首页>>代码示例>>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;未经允许,请勿转载。