6.6.1. Generating XML

After generating your SoTVizRender node, call the writeToXML(“fileName”) method. It will write an XML file describing all of the required information (elevations and textures).

For instance, the XML file for Example 6.3, “ A simple example using textures” is:

<!-- TGS TerrainViz 3.0 -->
<TerrainViz>
    
    <!-- Elevation description -->
    
    <data>
        <fileName> "data/africa_binary.dat" </fileName>
        <!-- File is binary -->
        <openMode> "BINARY" </openMode>
        <!-- Data created on a little endian machine -->
        <encoding> "LITTLE_ENDIAN" </encoding>
        <!-- Data is coded as unsigned char -->
        <type> "UCHAR" </type>
        <!-- Units in World Coordinates -->
        <realOffset> (0.000000, 0.000000, 0.000000) </realOffset>
        <format> "REGULARGRID" </format>
        <step> (0.000244, 0.000167, 0.000244) </step>
    </data>
    
    <!-- Texture quadtree description (quadtree depth = 3) -->
    
    <!-- Texture level 0 -->
    <texture>
        <fileName> "data/africa_1_1.jpg" </fileName>
        <level> 0 </level>
        <position> (0,0) </position>
    </texture>
    
    <!-- Texture level 1 -->
    <texture>
        <fileName> "data/africa_1_4.jpg" </fileName>
        <level> 1 </level>
        <position> (0,0) </position>
    </texture>
    <texture>
        <fileName> "data/africa_2_4.jpg" </fileName>
        <level> 1 </level>
        <position> (0,1) </position>
    </texture>
    <texture>
        <fileName> "data/africa_3_4.jpg" </fileName>
        <level> 1 </level>
        <position> (1,0) </position>
    </texture>
    <texture>
        <fileName> "data/africa_4_4.jpg" </fileName>
        <level> 1 </level>
        <position> (1,1) </position>
    </texture>
    
    <!-- Texture level 2 -->
    <texture>
        <fileName> "data/africa_01_16.jpg" </fileName>
        <level> 2 </level>
        <position> (0,0) </position>
    </texture>
    <texture>
        <fileName> "data/africa_02_16.jpg" </fileName>
        <level> 2 </level>
        <position> (0,1) </position>
    </texture>
    <texture>
        <fileName> "data/africa_03_16.jpg" </fileName>
        <level> 2 </level>
        <position> (0,2) </position>
    </texture>
    <texture>
        <fileName> "data/africa_04_16.jpg" </fileName>
        <level> 2 </level>
        <position> (0,3) </position>
    </texture>
    <texture>
        <fileName> "data/africa_05_16.jpg" </fileName>
        <level> 2 </level>
        <position> (1,0) </position>
    </texture>
    <texture>
        <fileName> "data/africa_06_16.jpg" </fileName>
        <level> 2 </level>
        <position> (1,1) </position>
    </texture>
    <texture>
        <fileName> "data/africa_07_16.jpg" </fileName>
        <level> 2 </level>
        <position> (1,2) </position>
    </texture>
    <texture>
        <fileName> "data/africa_08_16.jpg" </fileName>
        <level> 2 </level>
        <position> (1,3) </position>
    </texture>
    <texture>
        <fileName> "data/africa_09_16.jpg" </fileName>
        <level> 2 </level>
        <position> (2,0) </position>
    </texture>
    <texture>
        <fileName> "data/africa_10_16.jpg" </fileName>
        <level> 2 </level>
        <position> (2,1) </position>
    </texture>
    <texture>
        <fileName> "data/africa_11_16.jpg" </fileName>
        <level> 2 </level>
        <position> (2,2) </position>
    </texture>
    <texture>
        <fileName> "data/africa_12_16.jpg" </fileName>
        <level> 2 </level>
        <position> (2,3) </position>
    </texture>
    <texture>
        <fileName> "data/africa_13_16.jpg" </fileName>
        <level> 2 </level>
        <position> (3,0) </position>
    </texture>
    <texture>
        <fileName> "data/africa_14_16.jpg" </fileName>
        <level> 2 </level>
        <position> (3,1) </position>
    </texture>
    <texture>
        <fileName> "data/africa_15_16.jpg" </fileName>
        <level> 2 </level>
        <position> (3,2) </position>
    </texture>
    <texture>
        <fileName> "data/africa_16_16.jpg" </fileName>
        <level> 2 </level>
        <position> (3,3) </position>
    </texture>

</TerrainViz>