3dcitydb / texture-atlas-creator

Java API for creating texture atlases from texture images stored in the 3D City Database
Apache License 2.0
3 stars 0 forks source link

Is there any example about how to use this tool ? #1

Closed shazidhasan closed 2 months ago

shazidhasan commented 4 years ago

Dear

I am very enthusiastic about this tool. I couldn't find any sample example of this tool usages. It would be highly helpful to have a sample code. I am able to make the jar file but struggling to use this API

thanks

yaozhihang commented 4 years ago

Hi @shazidhasan, we unfortunately don't have code example for the texture-atlas-creator API. However, a short documentation (see the link below) is available, which explains the main concept and CLI usage of the tool. I hope it could help you in using this tool. https://github.com/3dcitydb/texture-atlas-creator/blob/master/resources/doc/TextureAtlasCreator-Documentation.pdf

shazidhasan commented 4 years ago

Thanks a lot.

shazidhasan commented 4 years ago

Hi @yaozhihang,
I am a newbie to java. I have managed to build the jar file using gradle in VSCode. When I tried to use it (as described in the documentation), it says "no main manifest attribute, in tac.jar". Later I have included "TextureAtlasCreator.java" file as the main class attribute in the build.gradle file. Now it says "Main method not found in class org.citydb.textureAtlas.TextureAtlasCreator"

I have searched for the main method in each file in the source but not found. TextureAtlasCreator class has a constructor but it is taking algorithm name, width, height as input but not taking the input/output folder name as in the CLI usages described in the documentation.

I am confused whether I am missing something. Any help will be highly appreciable.

yaozhihang commented 4 years ago

Hi @shazidhasan, It seems that the CLI support has been removed from current version of the tool, and the documentation was not updated accordingly. I'm sorry for this unintuitive situation.

I found a code snippet about the use of the API (sorry again for the poor docs about the method) https://github.com/3dcitydb/importer-exporter/blob/master/impexp-kml-collada-plugin/src/main/java/org/citydb/modules/kml/database/KmlGenericObject.java#L1172

basant256 commented 2 years ago

Hello @yaozhihang, I am also looking to use this tool. I went through document, created executable jar and tried to run in cmd as per document. I am getting same issue as @shazidhasan. Can you help me how to use this tool directly without creating another java application and using this tool as API in the application? I mean, I want to use this tool directly. Do I need to create my own Main class to run this API or is there any other way to use it directly? Please help me.

Thank you.

yaozhihang commented 2 years ago

Hi @basant256,I would like to suggest that you create your own CLI interface and main class to use the texture atlas APIs.

basant256 commented 2 years ago

Thank you so much @yaozhihang, I am really pleased for your quick reply. I would like to know, can I create CLI interface and main class using maven or need to create in gradle?

yaozhihang commented 2 years ago

Both maven and gradle can be used. They are just build automation tools. To create CLI interface you need a good CLI java library like args4j, Picocli etc. You can find tons of docs and tutorials in the Internet.

basant256 commented 2 years ago

@yaozhihang Thank you so much for your guidance.

basant256 commented 2 years ago

@yaozhihang , I am not able to find below path https://github.com/3dcitydb/importer-exporter/blob/master/impexp-kml-collada-plugin/src/main/java/org/citydb/modules/kml/database/KmlGenericObject.java#L1172, please let me know at which path, it has been moved.

Thank you.

yaozhihang commented 2 years ago

That one is outdated. Here ist the new path https://github.com/3dcitydb/importer-exporter/blob/master/impexp-vis-plugin/src/main/java/org/citydb/vis/database/AbstractVisObject.java#L1130

basant256 commented 2 years ago

@yaozhihang Thank you so much for your quick response.

I have one doubt about using texture-atlas-creator.

  1. How can I pass multiple gml files as input( I mean which function I have to call inside my main method from TextureAtlasCreator.java file)?
yaozhihang commented 2 years ago

You may need to use citygml4j library for reading CityGML files. See the following link https://github.com/citygml4j/citygml4j Via the link below you can find some code examples: https://github.com/citygml4j/citygml4j/tree/master/citygml4j-samples/src/main/java/reading_citygml

basant256 commented 2 years ago

@Yaozhihang, Thank you so much for your quick replies. I hope, I would be able to use successfully Texture-Atlas-Creator library.

basant256 commented 2 years ago

@yaozhihang Thank you so much for your all helps. I want to pass folder (that is having gml file and images) from system, how can texture-atlas-creator tool read surface_id (seems surface id is mandatory)?

basant256 commented 2 years ago

Hi @yaozhihang, I hope you are doing well, Since I have implemented cli interface and able to read files. Now, I am having confusion after passing all the required inputs (Algorithm, maxWidth, maxHeight, input(gml/images) path, output path) from command line as per documentation which method of TextureAtlasCreator.java file will take all inputs. Please help me to know the method that I have to call in my main class to pass all inputs and create TextureAtlas.

yaozhihang commented 2 years ago

@basant256 sorry, i don't know how to help you further, since all the java source code and examples are avaliable there...