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


Java PolylineOptions类代码示例

本文整理汇总了Java中com.amap.api.maps.model.PolylineOptions的典型用法代码示例。如果您正苦于以下问题:Java PolylineOptions类的具体用法?Java PolylineOptions怎么用?Java PolylineOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PolylineOptions类属于com.amap.api.maps.model包,在下文中一共展示了PolylineOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AmapManager

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
public AmapManager(Context conext, MapView mapView) {
    this.mContext = conext;
    dbManager = new MapDatebaseManager(conext);
    if (aMap == null) {
        aMap = mapView.getMap();
    }
    //设置线段属性
    polylineOptions = new PolylineOptions().width(10).color(lineColor);
    //设置锚点属性锚点
    markerOptions = new MarkerOptions();
    // 绑定 Marker 被点击事件
    aMap.setOnMarkerClickListener(markerClickListener);
    //绑定信息窗点击事件
    aMap.setOnInfoWindowClickListener(infoWindowClicklistener);

}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:17,代码来源:AmapManager.java

示例2: initAmapBeforeStart

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
/**
 * 每次开始定位前都需要初始化一下map
 */
public void initAmapBeforeStart() {
    //每次开始服务之前,进行数据库清空
    //dbManager.clear();
    //清空坐标集合
    latLngs.clear();
    //i = 0;
    aMap.clear();
    //
    SharedUtil.putValue(mContext, SharedUtil.stopBySever, false);
    //第一个点是否是起点
    isFirstPoint = true;
    //设置线段属性
    polylineOptions = new PolylineOptions().width(10).color(lineColor);
    aMap.addPolyline(polylineOptions);
    //恢复marker点为起点
    markerOptions.anchor(0.5f, 1.0f).icon(BitmapDescriptorFactory.fromResource(R.drawable.start2_80));
}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:21,代码来源:AmapManager.java

示例3: addOriginTrace

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
/**
 * 地图上添加原始轨迹线路及起终点、轨迹动画小人
 * 
 * @param startPoint
 * @param endPoint
 * @param originList
 */
private void addOriginTrace(LatLng startPoint, LatLng endPoint,
		List<LatLng> originList) {
	mOriginPolyline = mAMap.addPolyline(new PolylineOptions().color(
			Color.BLUE).addAll(originList));
	mOriginStartMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromResource(R.drawable.start)));
	mOriginEndMarker = mAMap.addMarker(new MarkerOptions().position(
			endPoint).icon(
			BitmapDescriptorFactory.fromResource(R.drawable.end)));

	try {
		mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(getBounds(),
				50));
	} catch (Exception e) {
		e.printStackTrace();
	}

	mOriginRoleMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromBitmap(BitmapFactory
					.decodeResource(getResources(), R.drawable.walk))));
}
 
开发者ID:amapapi,项目名称:RecordPath3D,代码行数:31,代码来源:RecordShowActivity.java

示例4: onCreate

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_multy_location);
	mapView = (MapView) findViewById(R.id.map);
	mapView.onCreate(savedInstanceState);// 此方法必须重写
	mapView.getMap().setOnMapLoadedListener(this);
	traceList = new ArrayList<LatLng>();
	for (int i = 0; i < trace.length - 1; i++) {
		LatLng mLatlng = new LatLng(trace[i], trace[++i]);
		traceList.add(mLatlng);
	}
	init();
	PolylineOptions po = new PolylineOptions();
	po.color(Color.BLUE);
	mapView.getMap().addPolyline(new PolylineOptions().addAll(traceList));
	addMarker(traceList.get(0), "起点");
	addMarker(traceList.get(traceList.size() - 1), "终点");
}
 
开发者ID:Extrace,项目名称:Extrace_UserApp,代码行数:20,代码来源:MultyLocationActivity.java

示例5: drawPolyLine

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
public void drawPolyLine(List<LatLng> latLngs, int color) {
    CFLog.e("TAG", "draw new Poly");
    PolylineOptions options = new PolylineOptions();
    options.addAll(latLngs);
    options.color(color);
    options.width(20);
    mAmap.addPolyline(options);
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:9,代码来源:MapDrawer.java

示例6: addPolyLine

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
protected void addPolyLine(PolylineOptions options){
    if (options == null){
        return;
    }
    Polyline polyline = mAMap.addPolyline(options);
    if (polyline != null){
        allPolyLines.add(polyline);
    }
}
 
开发者ID:yimiaoxiehou,项目名称:ZhuHaiBusApplication,代码行数:10,代码来源:RouteOverlay.java

示例7: addBusLineSteps

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
private void addBusLineSteps(List<LatLonPoint> listPoints) {
    if (listPoints.size() < 1) {
        return;
    }
    addPolyLine(new PolylineOptions().width(getRouteWidth())
            .color(getBusColor())
            .addAll(AMapUtil.convertArrList(listPoints)));
}
 
开发者ID:yimiaoxiehou,项目名称:ZhuHaiBusApplication,代码行数:9,代码来源:BusRouteOverlay.java

示例8: createPolylineOptions

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
private PolylineOptions createPolylineOptions() {
    PolylineOptions options = new PolylineOptions();
    options.addAll(coordinates);
    options.color(color);
    options.width(width);
    options.geodesic(geodesic);
    options.zIndex(zIndex);
    return options;
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:10,代码来源:AMapPolyline.java

示例9: addPolylineInPlayGround

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
private void addPolylineInPlayGround() {
    List<LatLng> list = readLatLngs();
    List<Integer> colorList = new ArrayList<Integer>();
    List<BitmapDescriptor> bitmapDescriptors = new ArrayList<BitmapDescriptor>();

    int[] colors = new int[]{Color.argb(255, 0, 255, 0), Color.argb(255, 255, 255, 0), Color
            .argb(255, 255, 0, 0)};

    //用一个数组来存放纹理
    List<BitmapDescriptor> textureList = new ArrayList<BitmapDescriptor>();
    textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.custtexture));

    List<Integer> texIndexList = new ArrayList<Integer>();
    texIndexList.add(0);//对应上面的第0个纹理
    texIndexList.add(1);
    texIndexList.add(2);

    Random random = new Random();
    for (int i = 0; i < list.size(); i++) {
        colorList.add(colors[random.nextInt(3)]);
        bitmapDescriptors.add(textureList.get(0));

    }

    aMap.addPolyline(new PolylineOptions().setCustomTexture(BitmapDescriptorFactory
            .fromResource(R.drawable.custtexture)) //setCustomTextureList(bitmapDescriptors)
            //				.setCustomTextureIndex(texIndexList)
            .addAll(list)
            .useGradient(true)
            .width(18));
}
 
开发者ID:facexxyz,项目名称:SmoothMove,代码行数:32,代码来源:MainActivity.java

示例10: addGraspTrace

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
/**
 * 地图上添加纠偏后轨迹线路及起终点、轨迹动画小人
 * 
 * @param startPoint
 * @param endPoint
 * @param originList
 */
private void addGraspTrace(List<LatLng> graspList, boolean mGraspChecked) {
	if (graspList == null || graspList.size() < 2) {
		return;
	}
	LatLng startPoint = graspList.get(0);
	LatLng endPoint = graspList.get(graspList.size() - 1);
	mGraspPolyline = mAMap.addPolyline(new PolylineOptions()
			.setCustomTexture(
					BitmapDescriptorFactory
							.fromResource(R.drawable.grasp_trace_line))
			.width(40).addAll(graspList));
	mGraspStartMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromResource(R.drawable.start)));
	mGraspEndMarker = mAMap.addMarker(new MarkerOptions()
			.position(endPoint).icon(
					BitmapDescriptorFactory.fromResource(R.drawable.end)));
	mGraspRoleMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromBitmap(BitmapFactory
					.decodeResource(getResources(), R.drawable.walk))));
	if (!mGraspChecked) {
		mGraspPolyline.setVisible(false);
		mGraspStartMarker.setVisible(false);
		mGraspEndMarker.setVisible(false);
		mGraspRoleMarker.setVisible(false);
	}
}
 
开发者ID:amapapi,项目名称:RecordPath3D,代码行数:36,代码来源:RecordShowActivity.java

示例11: addAPath

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
/**
 * @description: 添加一段轨迹
 * @author: chenshiqiang E-mail:[email protected]
 * @return
 */
public Polyline addAPath(PathConfig path){
	Polyline l = getMap().addPolyline(new PolylineOptions()
					.width(path.lineWidth)
					.color(path.lineColor)
					.visible(true)
					.geodesic(true)
					.addAll(path.points));
	polylineCaches.add(l);
	return l;
}
 
开发者ID:jp1017,项目名称:TheSceneryAlong,代码行数:16,代码来源:BaseMapFragment.java

示例12: onOptionsItemSelected

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	// TODO Auto-generated method stub

	int id = item.getItemId();
	if (id == R.id.location_details) {
		// 网络定位(Wifi+基站)
		Intent netIntent = new Intent(MultyLocationActivity.this,
				NetLocationActivity.class);
		startActivity(netIntent);
	}
	if (id == R.id.location_clear) {
		aMap.clear();
		return true;
	}
	if (id == R.id.location_trace) {
		PolylineOptions po = new PolylineOptions();
		po.color(Color.BLUE);
		mapView.getMap().addPolyline(
				new PolylineOptions().addAll(traceList));
		addMarker(traceList.get(0), "起点");
		addMarker(traceList.get(traceList.size() - 1), "终点");
		return true;
	}

	return super.onOptionsItemSelected(item);
}
 
开发者ID:Extrace,项目名称:Extrace_UserApp,代码行数:28,代码来源:MultyLocationActivity.java

示例13: drawPolyLineWithTexture

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
public void drawPolyLineWithTexture(List<LatLng> latLngs, int textureId) {
    mAmap.addPolyline(new PolylineOptions().setCustomTexture(BitmapDescriptorFactory.fromResource(textureId))
            .addAll(latLngs)
            .useGradient(true)
            .width(18));
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:7,代码来源:MapDrawer.java

示例14: initRoadData

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
private void initRoadData() {
		// 116.504505 39.931057
		double centerLatitude = 39.916049;
		double centerLontitude = 116.399792;
		
/*		
		ArrayList<Points> points = new ArrayList<>();
		
		double a_x = 39.916049;
		double a_y = 116.399792;
		
		double b_x = 35.616049;
		double b_y = 120.339792;*/
		
		//我想写个循环求的这两个点之间的很多点
		
		PolylineOptions polylineOptions = new PolylineOptions();
		/*double deltaAngle = Math.PI / 180 * 5;
		double radius = 0.02;
		PolylineOptions polylineOptions = new PolylineOptions();
		for (double i = 0; i < Math.PI * 2; i = i + deltaAngle) {
			float latitude = (float) (-Math.cos(i) * radius + centerLatitude);
			float longtitude = (float) (Math.sin(i) * radius + centerLontitude);
			polylineOptions.add(new LatLng(latitude, longtitude));
			if (i > Math.PI) {
				deltaAngle = Math.PI / 180 * 30;
			}
			Log.e("TAG_POINT", "latitude-->" + latitude + "-----longtitude--》" + longtitude);
		}
		
		float latitude = (float) (-Math.cos(0) * radius + centerLatitude);
		float longtitude = (float) (Math.sin(0) * radius + centerLontitude);
		*/
		polylineOptions.add(new LatLng(centerLatitude, centerLontitude));
		 polylineOptions.add(new LatLng(39.528049, 117.589038));
		 distance = GetDistance(new LatLng(centerLatitude, centerLontitude),new LatLng(39.528049, 117.589038));
//		 TIME_INTERVAL = (int)(10/distance) * 10;
//		 polylineOptions.add(new LatLng(39.92515, 116.510997));
//		 polylineOptions.add(new LatLng(39.892198, 116.439449));
//		 polylineOptions.add(new LatLng(39.919324, 116.379367));
//		 polylineOptions.add(new LatLng(39.951704, 116.356708));
//		//
//		//
//		
//		//
//		 polylineOptions.add(new LatLng(39.970914, 116.408206));
//		
//		 polylineOptions.add(new LatLng(40.005899, 116.467601));
//		 polylineOptions.add(new LatLng(39.954368, 116.478038));
//		 polylineOptions.add(new LatLng(40.009368, 116.678038));
		polylineOptions.width(10);
		polylineOptions.color(Color.RED);
		
		mVirtureRoad = mAmap.addPolyline(polylineOptions);
		
		MarkerOptions markerOptions = new MarkerOptions();
		markerOptions.setFlat(true);
		markerOptions.anchor(0.5f, 0.5f);
		markerOptions.icon(BitmapDescriptorFactory
				.fromResource(R.drawable.marker));
		markerOptions.position(polylineOptions.getPoints().get(0));
		
		mMoveMarker = mAmap.addMarker(markerOptions);
		mMoveMarker.setRotateAngle((float) getAngle(0));

	}
 
开发者ID:KellenHu,项目名称:Amap-Move-Example,代码行数:67,代码来源:MainActivity.java

示例15: onAmapLocationSucces

import com.amap.api.maps.model.PolylineOptions; //导入依赖的package包/类
/**
 * 在mapservice成功定位后回调的业务逻辑
 */
public void onAmapLocationSucces(Location location) {
    //真实路径点
    LatLng mTemplatLng = new LatLng(location.lat, location.lng);


    //测试
   // dbManager.add(location);
    //模拟路径点
    // LatLng mTemplatLng = new LatLng(31.972 + i, 118.755 + i);
    //i = i + 0.01;
   // latLngs.add(mTemplatLng);
    //如果第一个点是起点,先画个起点
    if (isFirstPoint) {
        // markerOptions.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.start2_32)));
        markerOptions.anchor(0.5f, 1.0f).icon(BitmapDescriptorFactory.fromResource(R.drawable.start2_80));
        //添加锚点
        markerOptions.position(mTemplatLng).title("位置:" + location.address).snippet("时间" + location.time);
        //画锚点
        aMap.addMarker(markerOptions);
        isFirstPoint = false;
    }
    //画完第一个起始点后,将marker点改为小圆点
    markerOptions.anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromResource(R.drawable.point_32));
    //添加锚点
   markerOptions.position(mTemplatLng).title("位置:" + location.address).snippet("时间" + location.time);
    //画锚点
 aMap.addMarker(markerOptions);
    //添加坐标
    polylineOptions.add(mTemplatLng);
    //链接坐标
    aMap.addPolyline(polylineOptions);
    //第一个参数是缩放比例,0是倾斜度,30显示比例
   mUpdate = CameraUpdateFactory.newCameraPosition(new CameraPosition(mTemplatLng, 17, 0, 0));
    aMap.moveCamera(mUpdate);//移动摄像头


//解决持续绘制时越来越卡顿的算法
    count++;
    if (count==2){
        mlastlatLng=mTemplatLng;
        polylineOptions = new PolylineOptions().width(10).color(lineColor);
        polylineOptions.add(mlastlatLng);
        count=0;
    }

}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:50,代码来源:AmapManager.java


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