lizhanwei
2020-06-18 8a9fc88104727c821832dfdaec4f66901c66bdb8
app/src/main/java/safeluck/drive/evaluation/fragment/JiaXiaoFragment.java
@@ -3,6 +3,8 @@
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -53,6 +55,9 @@
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import me.yokeyword.fragmentation.SupportFragment;
import safeluck.drive.evaluation.R;
@@ -75,12 +80,27 @@
    private static final String TAG = JiaXiaoFragment.class.getSimpleName();
    private MapView mMapView ;
    private static final int MSG_CAR = 100;
    double yaw = 0;
    GraphicsOverlay mGraphicsOverlay;
    private int count =0;
    private double startX = -8647.003,startY = 14590.7213;
    private Handler mHandler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case MSG_CAR:
                    count++;
                    yaw +=count;
                    addGraphicLayer(yaw,startX+count,startY+count);
                    sendEmptyMessageDelayed(MSG_CAR,1000);
                    break;
            }
        }
    };
    PointCollection mPointCollection = new PointCollection(SpatialReference.create(4544));
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -91,7 +111,9 @@
        setupMap();
        addTrailheadsLayer();
//        addImageLayer();
        addGraphicLayer();
        mHandler.sendEmptyMessageDelayed(MSG_CAR,1000);
//        drawPolygon();
        return view;
    }
@@ -128,11 +150,13 @@
            }
        });
    }
    private void addGraphicLayer(){
    private void addGraphicLayer(double yaw,double x,double y){
        SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.rgb(232,0,0), 0.5f);
        SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.argb(255,232,0,0), lineSymbol);
@@ -144,7 +168,7 @@
                Log.i(TAG,"giscar="+buffer.toString());
                GisCarModel gisCarModel= new Gson().fromJson(buffer.toString(),GisCarModel.class);
//                List<safeluck.drive.evaluation.bean.Point> carNew=Utils.getCarPoint(0,45,new safeluck.drive.evaluation.bean.Point(-8633.77199999988,14471.793700000271));
                List<safeluck.drive.evaluation.bean.Point> carNew=Utils.getCarPoint(0,45,new safeluck.drive.evaluation.bean.Point(-8647.003,14590.7213));
                List<safeluck.drive.evaluation.bean.Point> carNew=Utils.getCarPoint(0,yaw,new safeluck.drive.evaluation.bean.Point(x,y));
                List<Integer> bodys =gisCarModel.getBody();
                for (int i = 0; i <bodys.size(); i++) {
                    Log.i(TAG,String.format("车身点位置:%d",bodys.get(i)));
@@ -163,7 +187,7 @@
                        drawrightCenterGls(gisCarModel,carNew);
                        drawPoint(new Point(-8647.003,14590.7213));
                        drawPoint(new Point(x,y));
                    }
                });