吉安感知网项目-后端
xiebin
2026-01-06 d207a86cdf1ab52ef8cb7cd83bad8fceab8038cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
package org.sxkj.odm.constant;
 
import org.sxkj.common.enums.WaylineTypeEnum;
 
import java.util.*;
 
/**
 * odm 常量
 * @author zhongrj
 * @date 2024-09-11
 */
public class OdmConstant {
 
 
    /**
     * odm_user_token redis key
     */
    public static final String ODM_USER_TOKEN_KEY = "odm:user:token:";
 
    /**
     * odm_user_token redis 有效时长(默认是6个小时)
     */
    public static final Long ODM_USER_TOKEN_TIME = 6 * 60 * 60L;
 
    /**
     * 默认使用的登录账号
     */
    public static final String USERNAME = "admin";
 
    /**
     * 默认使用的登录密码
     */
    public static final String PASSWORD = "odm@2024";
 
    /**
     * 执行中的任务数量限制
     */
    public static final Integer MAX_PROCESS_TASK_NUM = 1;
 
    /**
     * 拼图任务最少图片数量限制
     */
    public static final Integer MIN_PIC_NUM = 2;
 
    /**
     * 拼图任务处理节点数量
     */
    public static final Integer PROCESS_NODE_NUM = 1;
 
    /**
     * 拼图任务图片缩放比例-不缩放
     */
    public static final Integer NO_RESIZE_VALUE = -1;
 
    /**
     * 拼图任务图片缩放比例
     */
    public static final Integer RESIZE_VALUE = 2048;
 
    /**
     * 拼图任务处理帧间隔
     */
    public static final Integer FRAME_INTERVAL = 30;
 
    /**
     * odm 登录获取token url
     */
    public static final String AUTH_TOKEN_API = "/api/token-auth/";
 
    /**
     * odm 创建任务 url
     */
    public static final String CREATE_TASK_API = "/api/projects/{0}/tasks/";
 
    /**
     * odm 任务查询 url
     */
    public static final String QUERY_TASK_API = "/api/projects/{0}/tasks/?ordering=-created_at";
 
    /**
     * odm 上传当前任务的图片
     */
    public static final String UPLOAD_PIC_BY_TASK_API = "/api/projects/{0}/tasks/{1}/upload/";
 
    /**
     * odm 任务提交
     */
    public static final String COMMIT_TASK_API = "/api/projects/{0}/tasks/{1}/commit/";
 
    /**
     * odm 正射影像图片导出 api
     */
    public static final String ORTHOPHOTO_EXPORT_API = "/api/projects/{0}/tasks/{1}/orthophoto/export";
 
 
    /**
     * 获取 odm 任务信息 api
     */
    public static final String GET_TASK_INFO_API =  "/api/projects/{0}/tasks/{1}/";
 
    /**
     * 重置 odm 任务信息 api
     */
    public static final String PATCH_TASK_INFO_API =  "/api/projects/{0}/tasks/{1}/";
 
    /**
     * 删除 odm 任务信息 api -POST
     */
    public static final String REMOVE_TASK_INFO_API =  "/api/projects/{0}/tasks/{1}/remove/";
 
    /**
     * 获取 odm 正射影像数据信息 api
     */
    public static final String GET_RTHOPHOTO_METADATA_API =  "/api/projects/{0}/tasks/{1}/orthophoto/metadata";
 
    /**
     * 重启任务 api
     */
    public static final String RESTART_TASK_API =  "/api/projects/{0}/tasks/{1}/restart/";
 
    /**
     * 获取正射影像图片地址
     */
    public static final String GET_PHONE_URL = "/workers/get/{0}";
 
    /**
     * webodm 数据集映射基础前缀路径
     */
    public static String WEB_ODM_VOLUMES_PRE_PATH = "/webodm_appmedia/_data";
 
    /**
     * 正射影像路径
     */
    public static String ORTHO_IMAGE_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/odm_orthophoto/odm_orthophoto.tif";
 
    /**
     * 正射影像图斑范围画面输出路径
     */
    public static String ORTHO_TB_IMAGE_PATH = WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/odm_orthophoto";
 
    /**
     * task 文件存放路径
     */
//    public static String TASK_FILE_PATH =  WEB_ODM_VOLUMES_BASE_PATH + WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task";
    public static String TASK_FILE_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task";
//    public static String TASK_FILE_PATH =  "E:\\work\\temp\\3";
 
    /**
     * 正射影像 api
     */
    public static String ORTHO_IMAGE_API =  "/projects/{0}/tasks/{1}/orthophoto/tiles/";
 
    /**
     * 正射影像 api 后缀
     */
    public static String ORTHO_IMAGE_API_SUX =  "{z}/{x}/{y}.png";
 
    /**
     * 3D-TILES 路径
     */
    public static String TILES_3D_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/3d_tiles/model/tileset.json";
 
    /**
     * 模型信息文件路径
     */
    public static String MODEL_INFO_FILE_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/odm_georeferencing/odm_georeferenced_model.info.json";
 
    /**
     * DEM TIF 文件路径
     */
    public static String DEM_TIF_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/odm_dem/dsm.tif";
 
    /**
     * obj 文件路径
     */
    public static String OBJ_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/odm_texturing/odm_textured_model_geo.obj";
 
    /**
     * pointcloud laz 文件路径
     */
    public static String POINT_CLOUD_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/odm_georeferencing/odm_georeferenced_model.laz";
 
    /**
     * 中心点 文件路径
     */
    public static String CENTER_FILE_PATH =  WEB_ODM_VOLUMES_PRE_PATH + "/project/{0}/task/{1}/assets/odm_georeferencing/odm_georeferencing_model_geo.txt";
 
    /**
     * 正射任务类型
     */
    public static final List<Integer> OTR_TASK_TYPES = createOrthoTasks();
 
    /**
     * 倾斜任务类型
     */
    public static final List<Integer> TILT_TASK_TYPES = createTiltTasks();
 
    /**
     * 白膜任务类型
     */
    public static final List<Integer> ALB_TASK_TYPES = createAlbTasks();
 
    /**
     * odm 配置处理类型
     */
    public static final List<Integer> ODM_TASK_OPTION_TYPE = createOdmTaskTypes();
 
    private static List<Integer> createOrthoTasks() {
        return Arrays.asList(
            WaylineTypeEnum.PLANAR_COL_HIS.getType(),
            WaylineTypeEnum.PLANAR_COL.getType(),
            WaylineTypeEnum.DISC_WAY.getType()
        );
    }
 
    private static List<Integer> createTiltTasks() {
        return Arrays.asList(
            WaylineTypeEnum.TILT_COL.getType(),
            WaylineTypeEnum.TILT_COL_SMART.getType(),
            WaylineTypeEnum.TILT_WAY.getType(),
            WaylineTypeEnum.GEO_WAY.getType()
        );
    }
 
    private static List<Integer> createAlbTasks() {
        return Arrays.asList(
            WaylineTypeEnum.ALB_COL.getType()
        );
    }
 
    private static List<Integer> createOdmTaskTypes() {
        List<Integer> result = new ArrayList<>();
        result.addAll(OTR_TASK_TYPES);
        result.addAll(TILT_TASK_TYPES);
        result.addAll(ALB_TASK_TYPES);
        return result;
    }
 
 
    /**
     * odm 选项配置 2: 正射举证  4:图斑正射举证  5: 实景倾斜三维航线  6:视频飞白膜
     */
    public static Map<Integer, List<Map<String,Object>>> ODM_TASK_OPTION = new HashMap<>() {
        {
            put(WaylineTypeEnum.PLANAR_COL_HIS.getType().intValue(),getOrthophotoOptions(false));
            put(WaylineTypeEnum.PLANAR_COL.getType().intValue(),getOrthophotoOptions(false));
            put(WaylineTypeEnum.DISC_WAY.getType().intValue(),getOrthophotoOptions(false));
            put(WaylineTypeEnum.TILT_COL.getType().intValue(),get3DOptions(false,"10"));
            put(WaylineTypeEnum.TILT_COL_SMART.getType().intValue(),get3DOptions(false,"10"));
            put(WaylineTypeEnum.TILT_WAY.getType().intValue(),get3DOptions(false, null));
            put(WaylineTypeEnum.GEO_WAY.getType().intValue(),get3DOptions(false,"1"));
            put(WaylineTypeEnum.ALB_COL.getType().intValue(),getAlbOptions(false,"10"));
        }
    };
 
 
    /**
     * odm 重置配置
     */
    public static Map<Integer, List<Map<String,Object>>> ODM_TASK_RESET_OPTIONS = new HashMap<>() {
        {
            put(WaylineTypeEnum.PLANAR_COL_HIS.getType().intValue(),getOrthophotoOptions(true));
            put(WaylineTypeEnum.PLANAR_COL.getType().intValue(),getOrthophotoOptions(true));
            put(WaylineTypeEnum.DISC_WAY.getType().intValue(),getOrthophotoOptions(true));
            put(WaylineTypeEnum.TILT_COL.getType().intValue(),get3DOptions(true,"10"));
            put(WaylineTypeEnum.TILT_COL_SMART.getType().intValue(),get3DOptions(true,"10"));
            put(WaylineTypeEnum.TILT_WAY.getType().intValue(),get3DOptions(true,null));
            put(WaylineTypeEnum.GEO_WAY.getType().intValue(),get3DOptions(true,"1"));
            put(WaylineTypeEnum.ALB_COL.getType().intValue(),getAlbOptions(true,"10"));
        }
    };
 
    /**
     * 正射举证类型的配置
     * @param includeRerunFrom 是否包含 rerun-from
     * @return
     */
    private static List<Map<String, Object>> getOrthophotoOptions(boolean includeRerunFrom) {
        return new ArrayList<>() {{
            add(new HashMap<>() {{
                put("name", "dsm");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "dtm");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "skip-3dmodel");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "orthophoto-cutline");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "skip-report");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "optimize-disk-space");
                put("value", true);
            }});
            if (includeRerunFrom) {
                add(new HashMap<>() {{
                    put("name", "rerun-from");
                    put("value", "dataset");
                }});
            }
        }};
    }
 
    /**
     * 实景倾斜三维航线类型的配置
     * @param includeRerunFrom 是否包含 rerun-from
     * @param authBoundaryDistance 自动边界 距离(图片所在位置点组成的面缓冲距离)
     * @return
     */
    private static List<Map<String, Object>> get3DOptions(boolean includeRerunFrom,String authBoundaryDistance) {
        return new ArrayList<>() {{
            add(new HashMap<>() {{
                put("name", "dsm");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "dtm");
                put("value", true);
            }});
            if (null != authBoundaryDistance) {
                add(new HashMap<>() {{
                    put("name", "auto-boundary");
                    put("value", true);
                }});
                add(new HashMap<>() {{
                    put("name", "auto-boundary-distance");
                    put("value", authBoundaryDistance);
                }});
            }
            add(new HashMap<>() {{
                put("name", "skip-orthophoto");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "skip-report");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "optimize-disk-space");
                put("value", true);
            }});
            // 如果需要3D相关选项,可以取消注释或添加
            // add(new HashMap<>(){{
            //     put("name","3d-tiles");
            //     put("value",true);
            // }});
            if (includeRerunFrom) {
                add(new HashMap<>() {{
                    put("name", "rerun-from");
                    put("value", "dataset");
                }});
            }
        }};
    }
 
 
    /**
     * 视频飞白膜类型的配置
     * @param includeRerunFrom 是否包含 rerun-from
     * @param authBoundaryDistance 自动边界 距离(图片所在位置点组成的面缓冲距离)
     * @return
     */
    private static List<Map<String, Object>> getAlbOptions(boolean includeRerunFrom,String authBoundaryDistance) {
        return new ArrayList<>() {{
            add(new HashMap<>() {{
                put("name", "dsm");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "dtm");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "skip-orthophoto");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "skip-report");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "auto-boundary");
                put("value", true);
            }});
            add(new HashMap<>() {{
                put("name", "auto-boundary-distance");
                put("value", authBoundaryDistance);
            }});
            add(new HashMap<>() {{
                put("name", "optimize-disk-space");
                put("value", true);
            }});
            // 根据参数决定是否添加rerun-from选项
            if (includeRerunFrom) {
                add(new HashMap<>() {{
                    put("name", "rerun-from");
                    put("value", "dataset");
                }});
            }
        }};
    }
 
 
}