当前位置: 首页>>代码示例>>Java>>正文


Java Polyline.setColor方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.model.Polyline.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java Polyline.setColor方法的具体用法?Java Polyline.setColor怎么用?Java Polyline.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.model.Polyline的用法示例。


在下文中一共展示了Polyline.setColor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawGraph

import com.google.android.gms.maps.model.Polyline; //导入方法依赖的package包/类
/**
 * @param graph to use in drawing polyOptions on the graph.
 */

@Override
public void drawGraph(Graph graph) {
    PolylineOptions graphOptions = new PolylineOptions();
    List<Location> locationList = graph.getLocations();

    for (Location location: locationList){
        LatLng currentPosition = new LatLng(location.getLatitude(), location.getLongitude());
        MarkerOptions options = new MarkerOptions();
        options.position(currentPosition)
                .icon(BitmapDescriptorFactory.defaultMarker())
                .title("Position")
                .snippet("Some Position");
        googleMap.addMarker(options);
        graphOptions.add(currentPosition);
    }

    Polyline graphPolygon = googleMap.addPolyline(graphOptions);

    graphPolygon.setGeodesic(true);
    graphPolygon.setColor(Color.DKGRAY);
    graphPolygon.setWidth(20);
}
 
开发者ID:aumarbello,项目名称:WalkGraph,代码行数:27,代码来源:MapFragmentImpl.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: parseRoute

import com.google.android.gms.maps.model.Polyline; //导入方法依赖的package包/类
private void parseRoute(XmlResourceParser xpp, String routeName) throws IOException, XmlPullParserException {
    PolylineOptions polylineOptions = new PolylineOptions();

    while (xpp.nextTag() == XmlPullParser.START_TAG) {
        if (xpp.getName().equals("LatLng")) {
            String coords[] = xpp.nextText().split(",");
            polylineOptions.add(new LatLng(Double.valueOf(coords[0]), Double.valueOf(coords[1])));
        } else if (xpp.getName().equals("Color")) {
            Polyline polyline = mMap.addPolyline(polylineOptions);
            String color = xpp.nextText();
            polyline.setColor(Color.parseColor(color));
            setPolyline(polyline, routeName);
        } else if (xpp.getName().equals("Width")) {
            getPolyline(routeName).setWidth(Float.valueOf(xpp.nextText()));
        }
    }
}
 
开发者ID:jordannick,项目名称:shuttleAndroid,代码行数:18,代码来源:MapState.java

示例7: unselect

import com.google.android.gms.maps.model.Polyline; //导入方法依赖的package包/类
private void unselect(){
    for (Polyline l: lineList){
        if (l!=selectedLine){
            l.setColor(Color.GRAY);
            l.setWidth(4);
        }
    }
}
 
开发者ID:alexdao,项目名称:footstep,代码行数:9,代码来源:PathsMap.java

示例8: 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


注:本文中的com.google.android.gms.maps.model.Polyline.setColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。