|
@@ -0,0 +1,193 @@
|
|
|
+package com.ecnu.platform.test
|
|
|
+
|
|
|
+import com.ecnu.alg.pojo.path.data.AlgPathStrategyInputData
|
|
|
+import com.ecnu.alg.pojo.path.inputs.AlgBaseMap
|
|
|
+import com.ecnu.alg.pojo.path.inputs.AlgBaseMapArea
|
|
|
+import com.three.common.utils.GsonUtil
|
|
|
+
|
|
|
+class TestPortGraph {
|
|
|
+
|
|
|
+ static void main(String[] args) {
|
|
|
+
|
|
|
+ ArrayList<Integer> xUnitList = new ArrayList<>()
|
|
|
+ ArrayList<Integer> yUnitList = new ArrayList<>()
|
|
|
+ // int[] xUnit = {0 1 1 0 0}
|
|
|
+ xUnitList.add(0)
|
|
|
+ xUnitList.add(1)
|
|
|
+ xUnitList.add(1)
|
|
|
+ xUnitList.add(0)
|
|
|
+ xUnitList.add(0)
|
|
|
+ // int[] yUnit = {0 0 1 1 0}
|
|
|
+ yUnitList.add(0)
|
|
|
+ yUnitList.add(0)
|
|
|
+ yUnitList.add(1)
|
|
|
+ yUnitList.add(1)
|
|
|
+ yUnitList.add(0)
|
|
|
+ double multiple = 1
|
|
|
+ double xInitial = 0
|
|
|
+ double yInitial = 0
|
|
|
+
|
|
|
+
|
|
|
+ AlgPathStrategyInputData algPathStrategyInputData = new AlgPathStrategyInputData()
|
|
|
+
|
|
|
+ // 港口测试底图
|
|
|
+ AlgBaseMap algBaseMap = new AlgBaseMap()
|
|
|
+ algBaseMap.setId("testPort")
|
|
|
+ algBaseMap.setName("港口测试底图")
|
|
|
+
|
|
|
+ double xBaseMap = xInitial + 0 * multiple
|
|
|
+ double yBaseMap = yInitial + 0 * multiple
|
|
|
+ double widthBaseMap = 920 * multiple
|
|
|
+ double heightBaseMap = 138 * multiple
|
|
|
+ String coordinateBaseMap = new String()
|
|
|
+ for (int i = 0; i < 5; i++){
|
|
|
+ coordinateBaseMap += xBaseMap + xUnitList.get(i) * widthBaseMap + ","
|
|
|
+ coordinateBaseMap += yBaseMap + yUnitList.get(i) * heightBaseMap
|
|
|
+ if (i != 4){
|
|
|
+ coordinateBaseMap += ";"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ algBaseMap.setPcsBorder(coordinateBaseMap)
|
|
|
+
|
|
|
+
|
|
|
+ // 作业车道
|
|
|
+ ArrayList<AlgBaseMapArea> jobLaneList = new ArrayList<>()
|
|
|
+ double xJobLane = xInitial + 3.3 * multiple
|
|
|
+ double yJobLane = yInitial + 2.6 * multiple
|
|
|
+ double widthJobLane = 914.5 * multiple
|
|
|
+ double heightJobLane = 4 * multiple
|
|
|
+ double gapJobLane = 0 * multiple
|
|
|
+ int sizeJobLane = 8
|
|
|
+
|
|
|
+ for (int i = 0; i < sizeJobLane; i++){
|
|
|
+ AlgBaseMapArea algBaseMapArea = new AlgBaseMapArea()
|
|
|
+ algBaseMapArea.setMapId("testPort")
|
|
|
+ String jobLaneId = "JOB" + (i)
|
|
|
+ algBaseMapArea.setId(jobLaneId)
|
|
|
+ // algBaseMapArea.setType("lane")
|
|
|
+
|
|
|
+ double yNext = yJobLane + i * (heightJobLane + gapJobLane)
|
|
|
+ String coordinateJobLane = new String()
|
|
|
+ for (int j = 0;j < 5; j++){
|
|
|
+ coordinateJobLane += xJobLane + xUnitList.get(j) * widthJobLane + ","
|
|
|
+ coordinateJobLane += yNext + yUnitList.get(j) * heightJobLane
|
|
|
+ if (j != 4){
|
|
|
+ coordinateJobLane += ";"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ algBaseMapArea.setPcsBorder(coordinateJobLane)
|
|
|
+ jobLaneList.add(algBaseMapArea)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 缓冲区BUF
|
|
|
+ ArrayList<AlgBaseMapArea> bufferAreaList = new ArrayList<>()
|
|
|
+ double xBufferArea = xInitial + 3.3 * multiple
|
|
|
+ double yBufferArea = yInitial + 35.8 * multiple
|
|
|
+ double widthBufferArea = 2.5 * multiple
|
|
|
+ double heightBufferArea = 25.5 * multiple
|
|
|
+ double gapBufferArea = 3.5 * multiple
|
|
|
+ int sizeBufferArea = 153
|
|
|
+
|
|
|
+ for (int i = 0; i < sizeBufferArea; i++){
|
|
|
+ AlgBaseMapArea algBaseMapArea = new AlgBaseMapArea()
|
|
|
+ algBaseMapArea.setMapId("testPort")
|
|
|
+ String bufferAreaId = "BUF" + (i)
|
|
|
+ algBaseMapArea.setId(bufferAreaId)
|
|
|
+ // algBaseMapArea.setType("lane")
|
|
|
+
|
|
|
+ double xNext = xBufferArea + i * (widthBufferArea + gapBufferArea)
|
|
|
+ String coordinateBufferArea = new String()
|
|
|
+ for (int j = 0;j < 5; j++){
|
|
|
+ coordinateBufferArea += xNext + xUnitList.get(j) * widthBufferArea + ","
|
|
|
+ coordinateBufferArea += yBufferArea + yUnitList.get(j) * heightBufferArea
|
|
|
+ if (j != 4){
|
|
|
+ coordinateBufferArea += ";"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ algBaseMapArea.setPcsBorder(coordinateBufferArea)
|
|
|
+ bufferAreaList.add(algBaseMapArea)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 行车道T
|
|
|
+ ArrayList<AlgBaseMapArea> trafficLaneList = new ArrayList<>()
|
|
|
+ double xTrafficLane = xInitial + 3.3 * multiple
|
|
|
+ double yTrafficLane = yInitial + 61.8 * multiple
|
|
|
+ double widthTrafficLane = 914.5 * multiple
|
|
|
+ double heightTrafficLane = 4 * multiple
|
|
|
+ double gapTrafficLane = 0 * multiple
|
|
|
+ int sizeTrafficLane = 7
|
|
|
+
|
|
|
+ for (int i = 0; i < sizeTrafficLane; i++){
|
|
|
+ AlgBaseMapArea algBaseMapArea = new AlgBaseMapArea()
|
|
|
+ algBaseMapArea.setMapId("testPort")
|
|
|
+ String trafficLaneId = "T" + (i)
|
|
|
+ algBaseMapArea.setId(trafficLaneId)
|
|
|
+ // algBaseMapArea.setType("lane")
|
|
|
+
|
|
|
+ double yNext = yTrafficLane + i * (heightTrafficLane + gapTrafficLane)
|
|
|
+ String coordinateTrafficLane = new String()
|
|
|
+ for (int j = 0;j < 5; j++){
|
|
|
+ coordinateTrafficLane += xTrafficLane + xUnitList.get(j) * widthTrafficLane + ","
|
|
|
+ coordinateTrafficLane += yNext + yUnitList.get(j) * heightTrafficLane
|
|
|
+ if (j != 4){
|
|
|
+ coordinateTrafficLane += ";"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ algBaseMapArea.setPcsBorder(coordinateTrafficLane)
|
|
|
+ trafficLaneList.add(algBaseMapArea)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 箱区BOX
|
|
|
+ ArrayList<AlgBaseMapArea> boxAreaList = new ArrayList<>()
|
|
|
+ double xBoxArea = xInitial + 7.8 * multiple
|
|
|
+ double yBoxArea = yInitial + 90.8 * multiple
|
|
|
+ double widthBoxArea = 2.5 * multiple
|
|
|
+ double heightBoxArea = 43 * multiple
|
|
|
+ double gapBoxArea = 2.5 * multiple
|
|
|
+ double gapBlock = 36.8 * multiple
|
|
|
+ int sizeBoxArea = 5
|
|
|
+ int sizeBlock = 25
|
|
|
+
|
|
|
+ for(int k = 0; k < sizeBlock; k++){
|
|
|
+ for (int i = 0; i < sizeBoxArea; i++){
|
|
|
+ AlgBaseMapArea algBaseMapArea = new AlgBaseMapArea()
|
|
|
+ algBaseMapArea.setMapId("testPort")
|
|
|
+ String boxAreaId = "BOX" + (k * sizeBoxArea + i)
|
|
|
+ algBaseMapArea.setId(boxAreaId)
|
|
|
+ // algBaseMapArea.setType("area")
|
|
|
+
|
|
|
+ double xNext = xBoxArea + k * gapBlock + i * (widthBoxArea + gapBoxArea)
|
|
|
+ String coordinateBoxArea = new String()
|
|
|
+ for (int j = 0;j < 5; j++){
|
|
|
+ coordinateBoxArea += xNext + xUnitList.get(j) * widthBoxArea + ","
|
|
|
+ coordinateBoxArea += yBoxArea + yUnitList.get(j) * heightBoxArea
|
|
|
+ if (j != 4){
|
|
|
+ coordinateBoxArea += ";"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ algBaseMapArea.setPcsBorder(coordinateBoxArea)
|
|
|
+ boxAreaList.add(algBaseMapArea)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 合并底图区域数据
|
|
|
+ ArrayList<Integer> mergedList = new ArrayList<>()
|
|
|
+ mergedList.addAll(jobLaneList)
|
|
|
+ mergedList.addAll(bufferAreaList)
|
|
|
+ mergedList.addAll(trafficLaneList)
|
|
|
+ mergedList.addAll(boxAreaList)
|
|
|
+
|
|
|
+ // 输入数据
|
|
|
+ algPathStrategyInputData.setAlgBaseMap(algBaseMap)
|
|
|
+ algPathStrategyInputData.setAlgBaseMapAreaList(mergedList)
|
|
|
+
|
|
|
+ println(GsonUtil.toJson(algPathStrategyInputData))
|
|
|
+ }
|
|
|
+}
|