zoukankan      html  css  js  c++  java
  • android 两坐标画直线

    引用:http://wang-peng1.iteye.com/blog/789958

    /** Called when the activity is first created. */@Overridepublicvoid onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        linearLayout =(LinearLayout) findViewById(R.id.zoomview);
        mapView =(MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
    
        mapOverlays = mapView.getOverlays();        
        projection = mapView.getProjection();
        mapOverlays.add(newMyOverlay());        
    
    }@Overrideprotectedboolean isRouteDisplayed(){
        returnfalse;}classMyOverlayextendsOverlay{
    
        publicMyOverlay(){
    
        }   
    
        publicvoid draw(Canvas canvas,MapView mapv,boolean shadow){
            super.draw(canvas, mapv, shadow);
    
            mPaint =newPaint();
            mPaint.setDither(true);
            mPaint.setColor(Color.RED);
            mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
            mPaint.setStrokeJoin(Paint.Join.ROUND);
            mPaint.setStrokeCap(Paint.Cap.ROUND);
            mPaint.setStrokeWidth(2);
    
            GeoPoint gP1 =newGeoPoint(19240000,-99120000);
            GeoPoint gP2 =newGeoPoint(37423157,-122085008);
    
            Point p1 =newPoint();
            Point p2 =newPoint();
    
            path =newPath();
    
            projection.toPixels(gP1, p1);
            projection.toPixels(gP2, p2);
    
            path.moveTo(p2.x, p2.y);
            path.lineTo(p1.x,p1.y);
    
            canvas.drawPath(path, mPaint);
        }

     
  • 相关阅读:
    COGS727 [网络流24题] 太空飞行计划
    Bzoj1692 洛谷P2870 [Usaco2007 Dec]队列变换
    Bzoj1029 [JSOI2007]建筑抢修
    Bzoj3168 [Heoi2013]钙铁锌硒维生素
    Bzoj4566 [Haoi2016]找相同字符
    Bzoj4771 七彩树
    Bzoj2597 [Wc2007]剪刀石头布
    Bzoj4773 负环
    HDU5772 String problem
    Bzoj1324 Exca王者之剑
  • 原文地址:https://www.cnblogs.com/sode/p/2321804.html
Copyright © 2011-2022 走看看