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


Java Polyline.setVisible方法代碼示例

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


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

示例1: setTracksVisible

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void setTracksVisible(boolean visible) {
    for (Map.Entry<String, Polyline> entry :
            mRoutesMap.entrySet()) {
        Polyline route = entry.getValue();
        if (route != null) {
            Marker start = mRouteStartMarksMap.get(route);
            if (start != null) {
                start.setVisible(visible);
            }
            Marker end = mRouteEndMarksMap.get(route);
            if (end != null) {
                end.setVisible(visible);
            }
            route.setVisible(visible);
        }
    }
}
 
開發者ID:trigor74,項目名稱:travelers-diary,代碼行數:18,代碼來源:MapFragment.java

示例2: addToMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:josegury,項目名稱:AndroidMarkerClusteringMaps,代碼行數:32,代碼來源:KmlRenderer.java

示例3: drawMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
private void drawMap(HashMap<String, TrailObj> trailCollection,
		GoogleMap mMap2) {
	// TODO Auto-generated method stub

	for (TrailObj trail : trailCollection.values()) {
		for (PlacemarkObj p : trail.getPlacemarks()) {
			PolylineOptions rectOptions = new PolylineOptions();
			for (LatLng g : p.getCoordinates()) {
				rectOptions.add(g);
			}
			Polyline polyline = mMap2.addPolyline(rectOptions);
			polyline.setColor(Color.RED);
			polyline.setWidth(5);
			polyline.setVisible(true);
		}
	}
}
 
開發者ID:MainMethod1,項目名稱:TrailMix-for-peel-android,代碼行數:18,代碼來源:MapActivity.java

示例4: drawTrailByName

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void drawTrailByName(GoogleMap map, String trailName) {
	DatabaseHelper db;
	db = new DatabaseHelper(this);
	ArrayList<Placemark> placemarks = db.getTrailPlacemarks(trailName);
	ArrayList<GeoPoint> points;
	PolylineOptions rectOptions;
	for (Placemark p : placemarks) {
		rectOptions = new PolylineOptions();
		points = db.getPlacemarkGeoPoints(p.getId());
		for (GeoPoint g : points) {
			rectOptions.add(new LatLng(g.getLat(), g.getLng()));
		}
		Polyline polyline = map.addPolyline(rectOptions);
		polyline.setColor(Color.RED);
		polyline.setWidth(8);
		polyline.setVisible(true);
	}

}
 
開發者ID:MainMethod1,項目名稱:TrailMix-for-peel-android,代碼行數:20,代碼來源:MapActivity.java

示例5: drawTrail

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void drawTrail(GoogleMap map, TrailObj trail) {
	ArrayList<LatLng> allPoints = new ArrayList<LatLng>();
	ArrayList<GeoPoint> points;

	PolylineOptions rectOptions;
	for (PlacemarkObj p : trail.getPlacemarks()) {
		rectOptions = new PolylineOptions();
		allPoints.addAll(p.getCoordinates());
		for (LatLng g : p.getCoordinates()) {
			rectOptions.add(g);
		}
		Polyline polyline = map.addPolyline(rectOptions);
		polyline.setColor(Color.RED);
		polyline.setWidth(8);
		polyline.setVisible(true);
	}

	// map.addMarker(new MarkerOptions()
	// .position(center)
	// .title(trail.getTrailName()));
}
 
開發者ID:MainMethod1,項目名稱:TrailMix-for-peel-android,代碼行數:22,代碼來源:MapActivity.java

示例6: drawTrails

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void drawTrails(GoogleMap map) {
	DatabaseHelper db;
	db = new DatabaseHelper(this);
	ArrayList<ArrayList<GeoPoint>> sortedGeoPoints = db.getPlacemarks();
	int count = 0;
	int pCount = 0;
	PolylineOptions rectOptions;
	for (ArrayList<GeoPoint> p : sortedGeoPoints) {
		rectOptions = new PolylineOptions();
		pCount++;
		for (GeoPoint g : p) {
			rectOptions.add(new LatLng(g.getLat(), g.getLng()));
			count++;
		}
		Polyline polyline = map.addPolyline(rectOptions);
		polyline.setColor(Color.RED);
		polyline.setWidth(8);
		polyline.setVisible(true);
	}

	map.addMarker(new MarkerOptions().position(new LatLng(43.95, -79.95))
			.title(String.valueOf(count) + " " + String.valueOf(pCount)));
	System.out.println("When reading from db:" + count);
}
 
開發者ID:MainMethod1,項目名稱:TrailMix-for-peel-android,代碼行數:25,代碼來源:MapActivity.java

示例7: showUphillSectionsToMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void showUphillSectionsToMap(){
    Log.i("Info:", "showUphillSectionsToMap");
    for (Polyline line : uphillPolylines){
        line.setVisible(true);
        line.setZIndex(10);
    }
    isUphillPolylinesAdded = true;
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:9,代碼來源:ColorizeUphillSections.java

示例8: removeUphillSectionsFromMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void removeUphillSectionsFromMap(){
    Log.i("Info:", "removeUphillSectionsFromMap");
    if (!isUphillPolylinesAdded){
        return;
    }
    for (Polyline line : uphillPolylines) {
        line.setVisible(false);
        line.remove();
    }
    uphillPolylines.removeAll(uphillPolylines);
    uphillSections.removeAll(uphillSections);
    isUphillPolylinesAdded = false;
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:14,代碼來源:ColorizeUphillSections.java

示例9: hideUphillSectionsFromMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void hideUphillSectionsFromMap(){
    if (!isUphillPolylinesAdded){
        return;
    }
    for (Polyline line : uphillPolylines) {
        line.setVisible(false);
    }
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:9,代碼來源:ColorizeUphillSections.java

示例10: showBikePathOnMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void showBikePathOnMap() {
    if (!isBikePathPolylinesAdded){
        return;
    }
    Log.i("info", "inside show function");
    for (Polyline line : bikePathPolyLineInRoute){
        Log.i("info", "inside show function for");
        line.setVisible(true);
        line.setZIndex(10);
    }
    isBikePathShown = true;
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:13,代碼來源:BikeableRoute.java

示例11: hideBikePathFromMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void hideBikePathFromMap() {
    if (!isBikePathPolylinesAdded) {
        return;
    }
    for (Polyline line : bikePathPolyLineInRoute) {
        line.setVisible(false);
    }
    isBikePathShown = false;
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:10,代碼來源:BikeableRoute.java

示例12: showBikePathOnMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public static void showBikePathOnMap() {
    if (!isBikePathPolylinesAdded){
        return;
    }
    for (Polyline line : bikePathsPolylines){
        line.setVisible(true);
    }
    isBikePathShown = true;
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:10,代碼來源:IriaData.java

示例13: removeBikePathFromMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public static void removeBikePathFromMap() {
    if (!isBikePathPolylinesAdded) {
        return;
    }
    for (Polyline line : bikePathsPolylines) {
        line.setVisible(false);
    }
    isBikePathShown = false;
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:10,代碼來源:IriaData.java

示例14: loadKML

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public boolean loadKML(GoogleMap map) throws ParserConfigurationException,
		SAXException, IOException {
	SAXParserFactory factory = SAXParserFactory.newInstance();
	try {
		// create a parser
		SAXParser parser = factory.newSAXParser();
		// create the reader (scanner)
		XMLReader xmlreader = parser.getXMLReader();
		// instantiate our handler
		NavigationSaxHandler navSaxHandler = new NavigationSaxHandler();

		// parser.parse("/Users/D4RK/Dropbox/Study/MAPsPractice/KMLForAndroid/hiking_trails.kml",
		// navSaxHandler);
		// assign our handler
		xmlreader.setContentHandler(navSaxHandler);
		// get our data via the url class
		InputStream ins = getResources().openRawResource(
				getResources().getIdentifier("unpaved_multi_use_trails",
						"raw", getPackageName()));
		InputSource is = new InputSource(ins);
		// perform the synchronous parse
		xmlreader.parse(is);
		// get the results - should be a fully populated RSSFeed instance,
		// or null on error
		ArrayList<PlacemarkObj> ds = navSaxHandler.getPlacemarks();
		int counter = 0;
		int i = 0;
		System.out.println(ds.size());
		if (ds.isEmpty()) {
			System.out.println("It's still empty");
		} else {
			for (PlacemarkObj p : ds) {
				counter++;
				ArrayList<LatLng> coordinates = p.getCoordinates();

				for (LatLng lt : coordinates) {
					i++;
					/*
					 * map.addMarker(new MarkerOptions() .position(lt)
					 * .title(String.valueOf(lt.latitude) + " "
					 * +String.valueOf(lt.longitude)));
					 */
					// System.out.println(i + " "+"Lat:" +
					// String.valueOf(lt.latitude) + "  Lng:"+
					// String.valueOf(lt.longitude));
				}

				PolylineOptions rectOptions = new PolylineOptions();
				rectOptions.addAll(p.getCoordinates());
				Polyline polyline = map.addPolyline(rectOptions);
				polyline.setColor(Color.RED);
				polyline.setWidth(5);
				polyline.setVisible(true);
				Log.d("KMLParsing", counter + " "
						+ p.getCoordinates().size());
			}
			System.out.println("counter" + i);

		}
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;

}
 
開發者ID:MainMethod1,項目名稱:TrailMix-for-peel-android,代碼行數:67,代碼來源:MapActivity.java

示例15: addKmlPlacemarkToMap

import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
/**
 * Adds a single geometry object to the map with its specified style (used for KML)
 *
 * @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
 */
protected Object addKmlPlacemarkToMap(KmlPlacemark placemark, Geometry geometry, KmlStyle style,
                                      KmlStyle inlineStyle, boolean isVisible) {
    String geometryType = geometry.getGeometryType();
    boolean hasDrawOrder = placemark.hasProperty("drawOrder");
    float drawOrder = 0;

    if (hasDrawOrder) {
        try {
            drawOrder = Float.parseFloat(placemark.getProperty("drawOrder"));
        } catch (NumberFormatException e) {
            hasDrawOrder = false;
        }
    }
    switch (geometryType) {
        case "Point":
            MarkerOptions markerOptions = style.getMarkerOptions();
            if (inlineStyle != null) {
                setInlinePointStyle(markerOptions, inlineStyle, style.getIconUrl());
            } else if (style.getIconUrl() != null) {
                // Use shared style
                addMarkerIcons(style.getIconUrl(), markerOptions);
            }
            Marker marker = addPointToMap(markerOptions, (KmlPoint) geometry);
            marker.setVisible(isVisible);
            setMarkerInfoWindow(style, marker, placemark);
            if (hasDrawOrder) {
                marker.setZIndex(drawOrder);
            }
            return marker;
        case "LineString":
            PolylineOptions polylineOptions = style.getPolylineOptions();
            if (inlineStyle != null) {
                setInlineLineStringStyle(polylineOptions, inlineStyle);
            } else if (style.isLineRandomColorMode()) {
                polylineOptions.color(KmlStyle.computeRandomColor(polylineOptions.getColor()));
            }
            Polyline polyline = addLineStringToMap(polylineOptions, (LineString) geometry);
            polyline.setVisible(isVisible);
            if (hasDrawOrder) {
                polyline.setZIndex(drawOrder);
            }
            return polyline;
        case "Polygon":
            PolygonOptions polygonOptions = style.getPolygonOptions();
            if (inlineStyle != null) {
                setInlinePolygonStyle(polygonOptions, inlineStyle);
            } else if (style.isPolyRandomColorMode()) {
                polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor()));
            }
            Polygon polygon = addPolygonToMap(polygonOptions, (DataPolygon) geometry);
            polygon.setVisible(isVisible);
            if (hasDrawOrder) {
                polygon.setZIndex(drawOrder);
            }
            return polygon;
        case "MultiGeometry":
            return addMultiGeometryToMap(placemark, (KmlMultiGeometry) geometry, style, inlineStyle,
                    isVisible);
    }
    return null;
}
 
開發者ID:googlemaps,項目名稱:android-maps-utils,代碼行數:70,代碼來源:Renderer.java


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