rain
2024-08-21 2db1aa88e8ab53096a936163d686b90d8e056a99
src/main/java/com/dji/sample/wayline/plane/PlaneCourseUtils.java
@@ -2,6 +2,7 @@
import com.dji.sample.patches.utils.GeoToolsUtil;
import com.dji.sample.wayline.plane.param.CreateWaylineParam;
import lombok.extern.slf4j.Slf4j;
import org.geotools.geometry.jts.JTSFactoryFinder;
import org.locationtech.jts.geom.*;
@@ -14,6 +15,7 @@
 * 面状航线
 * @Version 1.0
 */
@Slf4j
public class PlaneCourseUtils {
    /**
@@ -131,14 +133,19 @@
    private static List<MapLatLng> createPoint(MapLatLng mapLatLng, int intValue, double bearing, MapLatLng mapLatLngMin) {
        List<MapLatLng> pointList = new ArrayList<>();
        int index = 0;//防止死循环
        while (true) {
            if (index > 100)
                break ;
            MapLatLng newLocation = getBearingLatLng(mapLatLng, intValue, bearing);
            if (newLocation.getLatitude() <= mapLatLngMin.getLatitude())
                break;
            mapLatLng = newLocation;
            pointList.add(newLocation);
            System.out.println(newLocation + ",");
            index += 1;
            log.info("创建航点,当前index:{}", index);
        }
        return pointList;
    }
@@ -150,7 +157,7 @@
        // 航向重叠计算  待完成
        // 旁向重叠计算
        double distance2 = PlaneCourseUtils.get(param.getHeight(), param.getFrame(), param.getFocal(), 0.8);
        double distance2 = PlaneCourseUtils.get(param.getHeight(), param.getFrame(), param.getFocal(), param.getSideRatio());
        System.out.println("旁向重叠计算距离:" + distance2 * 100 / 100);
        int intValue = (int) distance2;
@@ -161,8 +168,8 @@
        //最南纬点经纬度
        MapLatLng mapLatLngMin = PlaneCourseUtils.minLatPoint(param.getPolygon());
        List<MapLatLng> topLeftPointList = PlaneCourseUtils.createPoint(boundingRectangle.topLeft, intValue, param.getBearing(), mapLatLngMin);
        List<MapLatLng> topRightPointList = PlaneCourseUtils.createPoint(boundingRectangle.topRight, intValue, param.getBearing(), mapLatLngMin);
        List<MapLatLng> topLeftPointList = PlaneCourseUtils.createPoint(boundingRectangle.topLeft, intValue, param.getBearing() * 2, mapLatLngMin);
        List<MapLatLng> topRightPointList = PlaneCourseUtils.createPoint(boundingRectangle.topRight, intValue, param.getBearing() * 2, mapLatLngMin);
        List<LineString> lineStrings = PlaneCourseUtils.createLine(topLeftPointList, topRightPointList);