本文整理匯總了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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
示例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()));
}
示例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);
}
示例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;
}
示例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;
}
示例9: hideUphillSectionsFromMap
import com.google.android.gms.maps.model.Polyline; //導入方法依賴的package包/類
public void hideUphillSectionsFromMap(){
if (!isUphillPolylinesAdded){
return;
}
for (Polyline line : uphillPolylines) {
line.setVisible(false);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}