Runt
2021-01-04 0e8ecae4a1140c5e23475bbd589f591208e9ed65
app/src/main/java/com/demo/navtogether/MainActivity.java
@@ -84,12 +84,13 @@
    }
    /**
     * 创建随机位置
     * 创建一个随机位置  坐标限制在 x 和  y内
     * @param maxX
     * @param maxY
     * @return
     */
    public Point random(int maxX,int maxY){
        //设计边框距离,已避免部分地点名称出界
        int marginX = (int) (getResources().getDisplayMetrics() .density*15)*2;
        Point point = new Point();
@@ -122,7 +123,7 @@
    }
    int index = 0 ;
    ArrayList<ArrayList<PathPlan.Place>> customLists;
    ArrayList<ArrayList<PathPlan.Place>> customLists = new ArrayList<>();
    /**
     * 自定义算法画线
     * @param view
@@ -156,6 +157,9 @@
    }
    /**
     * 自定义算法画线
     */
    public void drawLineCustome(){
        if(customLists.size()>1){
            Toast.makeText(MainActivity.this,"当前有"+customLists.size()+"路线规划",Toast.LENGTH_SHORT).show();
@@ -174,20 +178,15 @@
        }
    }
    /**
     * 刷新 重新加载地点
     * @param view
     */
    public void refresh(View view) {
        planPathView.clear();
        customLists.clear();
        int width = planPathView.getWidth();
        int height = planPathView.getHeight();
        ArrayList<PathPlan.Place> places = new ArrayList<>();
        places.add(new PathPlan.Place("A",random(width,height),0));
        places.add(new PathPlan.Place("B",random(width,height),0));
        places.add(new PathPlan.Place("C",random(width,height),0));
        places.add(new PathPlan.Place("D",random(width,height),0));
        places.add(new PathPlan.Place("E",random(width,height),0));
        places.add(new PathPlan.Place("F",random(width,height),0));
        places.add(new PathPlan.Place("G",random(width,height),0));
        places.add(new PathPlan.Place("H",random(width,height),0));
        animD = false;
        animC = false;
        planPathView.setAnimPoints(randomList(width,height),listener);