Skip to content

Commit 2647d7b

Browse files
committed
refactor : refactor modules
1 parent 893abb5 commit 2647d7b

33 files changed

+2706
-2199
lines changed
File renamed without changes.

MANUAL-EN.md renamed to MANUAL.md

File renamed without changes.
File renamed without changes.

common/src/main/java/com/gaia3d/ExtensionModuleFrame.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public interface ExtensionModuleFrame {
1717
String getName();
1818
boolean isSupported();
19-
GaiaScene executePhotorealistic(GaiaScene gaiaScene, Map<String, Object> options);
19+
void executePhotogrammetry(GaiaScene gaiaScene, Map<String, Object> options);
2020
void getColorAndDepthRender(List<SceneInfo> sceneInfos, int bufferedImageType, List<BufferedImage> resultImages, GaiaBoundingBox nodeBBox, Matrix4d nodeTMatrix, int maxScreenSize, int maxDepthScreenSize);
2121

2222
void makeNetSurfacesWithBoxTexturesObliqueCamera(List<GaiaScene> scenes, List<HalfEdgeScene> resultHalfEdgeScenes, DecimateParameters decimateParameters, double depthTexPixelsForMeter, double screenPixelsForMeter);

common/src/main/java/com/gaia3d/basic/halfedge/HalfEdgeSurface.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ private void cutByPlaneXY(Vector3d planePosition, double error) {
14671467
}
14681468

14691469
}
1470-
log.info("[Tile][PhotoRealistic][cut][cutByPlaneXY] hedgesCount = " + hedgesCount + " , hedgesCutCount = " + hedgesCutCount);
1470+
log.info("[Tile][Photogrammetry][cut][cutByPlaneXY] hedgesCount = " + hedgesCount + " , hedgesCutCount = " + hedgesCutCount);
14711471
}
14721472

14731473
private void cutByPlaneXZ(Vector3d planePosition, double error) {
@@ -1487,7 +1487,7 @@ private void cutByPlaneXZ(Vector3d planePosition, double error) {
14871487
hedgesCutCount++;
14881488
}
14891489
}
1490-
log.info("[Tile][PhotoRealistic][cut][cutByPlaneXZ] hedgesCount = " + hedgesCount + " , hedgesCutCount = " + hedgesCutCount);
1490+
log.info("[Tile][Photogrammetry][cut][cutByPlaneXZ] hedgesCount = " + hedgesCount + " , hedgesCutCount = " + hedgesCutCount);
14911491
}
14921492

14931493
private void cutByPlaneYZ(Vector3d planePosition, double error) {
@@ -1507,7 +1507,7 @@ private void cutByPlaneYZ(Vector3d planePosition, double error) {
15071507
hedgesCutCount++;
15081508
}
15091509
}
1510-
log.info("[Tile][PhotoRealistic][cut][cutByPlaneYZ] hedgesCount = " + hedgesCount + " , hedgesCutCount = " + hedgesCutCount);
1510+
log.info("[Tile][Photogrammetry][cut][cutByPlaneYZ] hedgesCount = " + hedgesCount + " , hedgesCutCount = " + hedgesCutCount);
15111511
}
15121512

15131513
public boolean checkHalfEdgesFaces() {
@@ -2822,7 +2822,7 @@ public void scissorTextures_test(GaiaMaterial material) {
28222822
int imageType = existPngTextures ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;
28232823

28242824
GaiaTexture textureAtlas = new GaiaTexture();
2825-
log.info("[Tile][PhotoRealistic][Atlas] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
2825+
log.info("[Tile][Photogrammetry][Atlas] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
28262826
textureAtlas.createImage(maxWidth, maxHeight, imageType);
28272827
// fill the textureAtlas with fuchia color
28282828
// Color fuchiaColor = new Color(255, 255, 0);
@@ -3217,7 +3217,7 @@ public void scissorTextures(GaiaMaterial material) {
32173217
int imageType = existPngTextures ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;
32183218

32193219
GaiaTexture textureAtlas = new GaiaTexture();
3220-
log.info("[Tile][PhotoRealistic][Atlas] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
3220+
log.info("[Tile][Photogrammetry][Atlas] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
32213221
textureAtlas.createImage(maxWidth, maxHeight, imageType);
32223222
// fill the textureAtlas with fuchia color
32233223
// Color fuchiaColor = new Color(255, 255, 0);
@@ -3580,7 +3580,7 @@ public void scissorTexturesByMotherScene(GaiaMaterial material, GaiaMaterial mot
35803580
int imageType = existPngTextures ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;
35813581

35823582
GaiaTexture textureAtlas = new GaiaTexture();
3583-
log.info("[Tile][PhotoRealistic][Atlas] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
3583+
log.info("[Tile][Photogrammetry][Atlas] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
35843584
textureAtlas.createImage(maxWidth, maxHeight, imageType);
35853585
// fill the textureAtlas with fuchia color
35863586
//Color fuchiaColor = new Color(255, 255, 0);
@@ -3737,14 +3737,14 @@ private void doTextureAtlasProcess(List<GaiaTextureScissorData> textureScissorDa
37373737
// here calculates the batchedBoundaries of each textureScissorData
37383738
//*********************************************************************
37393739
int textureScissorDatasCount = textureScissorDates.size();
3740-
log.info("[Tile][PhotoRealistic][Atlas] doTextureAtlasProcess() : textureScissorDatasCount = " + textureScissorDatasCount);
3740+
log.info("[Tile][Photogrammetry][Atlas] doTextureAtlasProcess() : textureScissorDatasCount = " + textureScissorDatasCount);
37413741

37423742
GillotinePacker gillotinePacker = new GillotinePacker();
37433743

37443744
for (int i = 0; i < textureScissorDatasCount; i++) {
37453745
GaiaTextureScissorData textureScissorData = textureScissorDates.get(i);
37463746
if(!gillotinePacker.insert(textureScissorData)) {
3747-
log.info("[Tile][PhotoRealistic][Atlas] doTextureAtlasProcess() : gillotinePacker.insert() failed.");
3747+
log.info("[Tile][Photogrammetry][Atlas] doTextureAtlasProcess() : gillotinePacker.insert() failed.");
37483748
}
37493749
}
37503750
}

extension/src/main/java/com/gaia3d/TilerExtensionModule.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public boolean isSupported() {
3030
}
3131

3232
@Override
33-
public GaiaScene executePhotorealistic(GaiaScene gaiaScene, Map<String, Object> options) {
34-
// TODO: Implement this method
33+
public GaiaScene executePhotogrammetry(GaiaScene gaiaScene, Map<String, Object> options) {
3534
log.info("+ Extension has been applied.");
3635
log.info("----------------------------------------");
3736
return null;

extension/src/main/java/com/gaia3d/renderer/MainRenderer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,12 @@ public void makeNetSurfacesWithBoxTexturesObliqueCamera(List<GaiaScene> scenes,
504504
//double gridSpacing = 50.0; // original
505505
double gridSpacing = bboxMaxSize / 3.0;
506506
HalfEdgeOctree resultOctree = new HalfEdgeOctree(null);
507-
log.info("[Tile][PhotoRealistic][Decimate] Engine.decimate() : cutHalfEdgeSceneGridXYZ.");
507+
log.info("[Tile][Photogrammetry][Decimate] Engine.decimate() : cutHalfEdgeSceneGridXYZ.");
508508
HalfEdgeScene cuttedScene = HalfEdgeCutter.cutHalfEdgeSceneGridXYZ(halfEdgeScene, gridSpacing, resultOctree);
509509
// cuttedScene.splitFacesByBestPlanesToProject();
510510
//
511511
// // now make box textures for the cuttedScene
512-
// log.info("[Tile][PhotoRealistic][Decimate] Engine.decimate() : makeBoxTexturesForHalfEdgeScene.");
512+
// log.info("[Tile][Photogrammetry][Decimate] Engine.decimate() : makeBoxTexturesForHalfEdgeScene.");
513513
// engine.makeBoxTexturesForHalfEdgeScene(cuttedScene);
514514
//
515515
// // delete glBuffers of the material

extension/src/main/java/com/gaia3d/renderer/engine/Engine.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ private GaiaTexture makeAtlasTexture(List<TexturesAtlasData> texAtlasDatasList)
848848
}
849849

850850
GaiaTexture textureAtlas = new GaiaTexture();
851-
log.info("[Tile][PhotoRealistic][makeAtlasTexture] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
851+
log.info("[Tile][Photogrammetry][makeAtlasTexture] Atlas maxWidth : " + maxWidth + " , maxHeight : " + maxHeight);
852852
textureAtlas.createImage(maxWidth, maxHeight, imageType);
853853

854854
// draw the images into textureAtlas

non-extension/src/main/java/com/gaia3d/TilerExtensionModule.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ public boolean isSupported() {
2929
}
3030

3131
@Override
32-
public GaiaScene executePhotorealistic(GaiaScene gaiaScene, Map<String, Object> options) {
33-
log.debug("Cannot execute photorealistic extension module.");
32+
public void executePhotogrammetry(GaiaScene gaiaScene, Map<String, Object> options) {
33+
log.debug("Cannot execute Photogrammetry extension module.");
3434
log.debug("This module is not implemented.");
3535
log.debug("----------------------------------------");
36-
return null;
3736
}
3837

3938
@Override

tiler/src/main/java/com/gaia3d/command/mago/GlobalOptions.java

+18-7
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public class GlobalOptions {
143143
// [Experimental] 3D Data Options
144144
private boolean largeMesh = false; // [Experimental] large mesh splitting mode flag
145145
private boolean voxelLod = false; // [Experimental] voxel level of detail flag
146-
private boolean photorealistic = false; // [Experimental] photorealistic mode flag
146+
private boolean isPhotogrammetry = false; // [Experimental] isPhotogrammetry mode flag
147147

148148
/* 2D Data Column Options */
149149
private String nameColumn;
@@ -163,10 +163,21 @@ public static GlobalOptions getInstance() {
163163
return instance;
164164
}
165165

166-
public static void init(CommandLine command) throws IOException {
166+
public static void init(CommandLine command) throws IOException, RuntimeException {
167+
168+
if (command == null) {
169+
throw new IllegalArgumentException("Command line argument is null.");
170+
}
171+
if (command.getOptions() == null || command.getOptions().length == 0) {
172+
throw new IllegalArgumentException("Command line argument is empty.");
173+
}
174+
String inputPath = command.getOptionValue(ProcessOptions.INPUT.getArgName());
175+
String outputPath = command.getOptionValue(ProcessOptions.OUTPUT.getArgName());
176+
if (inputPath == null || outputPath == null) {
177+
throw new IllegalArgumentException("Please enter the value of the input and output arguments.");
178+
}
167179
File input = new File(command.getOptionValue(ProcessOptions.INPUT.getArgName()));
168180
File output = new File(command.getOptionValue(ProcessOptions.OUTPUT.getArgName()));
169-
170181
if (command.hasOption(ProcessOptions.INPUT.getArgName())) {
171182
instance.setInputPath(command.getOptionValue(ProcessOptions.INPUT.getArgName()));
172183
OptionsCorrector.checkExistInputPath(input);
@@ -295,7 +306,7 @@ public static void init(CommandLine command) throws IOException {
295306
instance.setMaxNodeDepth(DEFAULT_MAX_NODE_DEPTH);
296307
instance.setLargeMesh(command.hasOption(ProcessOptions.LARGE_MESH.getArgName()));
297308
instance.setVoxelLod(command.hasOption(ProcessOptions.VOXEL_LOD.getArgName()));
298-
instance.setPhotorealistic(command.hasOption(ProcessOptions.PHOTOREALISTIC.getArgName()));
309+
instance.setPhotogrammetry(command.hasOption(ProcessOptions.PHOTOGRAMMETRY.getArgName()));
299310
instance.setLeaveTemp(command.hasOption(ProcessOptions.LEAVE_TEMP.getArgName()));
300311
instance.setUseQuantization(command.hasOption(ProcessOptions.MESH_QUANTIZATION.getArgName()) || DEFAULT_USE_QUANTIZATION);
301312

@@ -368,8 +379,8 @@ public static void init(CommandLine command) throws IOException {
368379
instance.printDebugOptions();
369380

370381
TilerExtensionModule extensionModule = new TilerExtensionModule();
371-
extensionModule.executePhotorealistic(null, null);
372-
if (!extensionModule.isSupported() && instance.isPhotorealistic()) {
382+
extensionModule.executePhotogrammetry(null, null);
383+
if (!extensionModule.isSupported() && instance.isPhotogrammetry()) {
373384
log.error("[ERROR] *** Extension Module is not supported ***");
374385
throw new IllegalArgumentException("Extension Module is not supported.");
375386
} else {
@@ -439,7 +450,7 @@ public void printDebugOptions() {
439450
log.debug("Max Node Depth: {}", maxNodeDepth);
440451
log.debug("LargeMesh: {}", largeMesh);
441452
log.debug("Voxel LOD: {}", voxelLod);
442-
log.debug("Photorealistic: {}", photorealistic);
453+
log.debug("Photogrammetry: {}", isPhotogrammetry);
443454
log.debug("Point Cloud Horizontal Grid: {}", POINTSCLOUD_HORIZONTAL_GRID);
444455
log.debug("Point Cloud Vertical Grid: {}", POINTSCLOUD_VERTICAL_GRID);
445456
log.debug("========================================");

tiler/src/main/java/com/gaia3d/command/mago/Mago3DTiler.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void execute() {
1919
FormatType outputFormat = globalOptions.getOutputFormat();
2020
try {
2121
ProcessFlowModel processFlow = getProcessModel(inputFormat, outputFormat);
22-
log.info("Starting process flow: {}", processFlow.getModelName());
22+
log.info("[Init] Starting process flow: {}", processFlow.getModelName());
2323
processFlow.run();
2424
} catch (IOException e) {
2525
log.error("Failed to run process.", e);
@@ -44,9 +44,9 @@ private ProcessFlowModel getProcessModel(FormatType inputFormat, FormatType outp
4444
if (FormatType.I3DM == outputFormat) {
4545
processFlow = new InstancedProcessModel();
4646
} else if (FormatType.B3DM == outputFormat) {
47-
boolean isPhotorealistic = GlobalOptions.getInstance().isPhotorealistic();
48-
if (isPhotorealistic) {
49-
processFlow = new BatchedProcessModelPhR();
47+
boolean isPhotogrammetry= GlobalOptions.getInstance().isPhotogrammetry();
48+
if (isPhotogrammetry) {
49+
processFlow = new PhotogrammetryModel();
5050
} else {
5151
processFlow = new BatchedProcessModel();
5252
}

tiler/src/main/java/com/gaia3d/command/mago/Mago3DTilerMain.java

+16-10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
@Slf4j
1717
public class Mago3DTilerMain {
18+
private static final String PROGRAM_NAME = "mago-3d-tiler";
19+
1820
public static void main(String[] args) {
1921
try {
2022
Options options = Configurator.createOptions();
@@ -70,7 +72,10 @@ public static void main(String[] args) {
7072
throw new RuntimeException("Failed to parse command line options, Please check the arguments.", e);
7173
} catch (IOException e) {
7274
log.error("[ERROR] Failed to run process, Please check the arguments.", e);
73-
throw new RuntimeException("Failed to run process, Please check the arguments.", e);
75+
throw new RuntimeException("Failed to run main process, Please check the arguments.", e);
76+
} catch (Exception e) {
77+
log.error("[ERROR] Failed to run main process.", e);
78+
throw new RuntimeException("Failed to run main process.", e);
7479
}
7580
printEnd();
7681
Configurator.destroyLogger();
@@ -82,12 +87,9 @@ public static void main(String[] args) {
8287
private static void printStart() {
8388
GlobalOptions globalOptions = GlobalOptions.getInstance();
8489
String programInfo = globalOptions.getProgramInfo();
85-
log.info("\n" +
86-
"┳┳┓┏┓┏┓┏┓ ┏┓┳┓ ┏┳┓┳┓ ┏┓┳┓\n" +
87-
"┃┃┃┣┫┃┓┃┃ ┫┃┃ ┃ ┃┃ ┣ ┣┫\n" +
88-
"┛ ┗┛┗┗┛┗┛ ┗┛┻┛ ┻ ┻┗┛┗┛┛┗\n" +
89-
programInfo + "\n" +
90-
"----------------------------------------");
90+
drawLine();
91+
log.info(PROGRAM_NAME);
92+
drawLine();
9193
}
9294

9395
/**
@@ -98,7 +100,7 @@ private static void printVersion() {
98100
String programInfo = globalOptions.getProgramInfo();
99101
String javaVersionInfo = globalOptions.getJavaVersionInfo();
100102
log.info(programInfo + "\n" + javaVersionInfo);
101-
log.info("----------------------------------------");
103+
drawLine();
102104
}
103105

104106
/**
@@ -109,18 +111,22 @@ private static void printEnd() {
109111
Reporter reporter = globalOptions.getReporter();
110112
long startTime = globalOptions.getStartTime();
111113
long endTime = System.currentTimeMillis();
112-
log.info("----------------------------------------");
114+
drawLine();
113115
log.info("[Process Summary]");
114116
log.info("End Process Time : {}", DecimalUtils.millisecondToDisplayTime(endTime - startTime));
115117
log.info("Total tile contents count : {}", globalOptions.getTileCount());
116118
log.info("Total 'tileset.json' File Size : {}", DecimalUtils.byteCountToDisplaySize(globalOptions.getTilesetSize()));
117-
log.info("----------------------------------------");
119+
drawLine();
118120
log.info("[Report Summary]");
119121
log.info("Info : {}", reporter.getInfoCount());
120122
log.info("Warning : {}", reporter.getWarningCount());
121123
log.info("Error : {}", reporter.getErrorCount());
122124
log.info("Fatal : {}", reporter.getFatalCount());
123125
log.info("Total Report Count : {}", reporter.getReportList().size());
126+
drawLine();
127+
}
128+
129+
public static void drawLine() {
124130
log.info("----------------------------------------");
125131
}
126132
}

tiler/src/main/java/com/gaia3d/command/mago/OptionsCorrector.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static FormatType findInputFormatType(File path, boolean isRecursive) {
6464
if (file.isFile()) {
6565
String extension = getExtension(file);
6666
if (FormatType.KML.getExtension().equalsIgnoreCase(extension) || FormatType.KML.getSubExtension().equalsIgnoreCase(extension)) {
67-
log.info("Auto Selected Format type: {}", FormatType.KML);
67+
log.info("[Init] Auto Selected Format type: {}", FormatType.KML);
6868
return FormatType.KML;
6969
}
7070
}
@@ -74,7 +74,7 @@ public static FormatType findInputFormatType(File path, boolean isRecursive) {
7474
String extension = getExtension(file);
7575
FormatType formatType = FormatType.fromExtension(extension);
7676
if (Objects.nonNull(formatType)) {
77-
log.info("Auto Selected Format type: {}", formatType);
77+
log.info("[Init] Auto Selected Format type: {}", formatType);
7878
return formatType;
7979
}
8080
}
@@ -83,7 +83,7 @@ public static FormatType findInputFormatType(File path, boolean isRecursive) {
8383
String extension = getExtension(path);
8484
FormatType formatType = FormatType.fromExtension(extension);
8585
if (Objects.nonNull(formatType)) {
86-
log.info("Auto Selected Format type: {}", formatType);
86+
log.info("[Init] Auto Selected Format type: {}", formatType);
8787
return formatType;
8888
} else {
8989
throw new IllegalArgumentException("Unsupported format: " + extension);

0 commit comments

Comments
 (0)