Placing Tool

This application is used to create the city layout and generate an output XML that is ready to be used by CodeMetropolis Render Tool.

Usage: java –jar placing.jar –i <inputFile> [-o <outputFile>] [-m]

Command line options:

  • -h: help, shows basic info.
  • -i: input, input from this file. Exactly this is the path of the input XML file, which is generated by the Mapping Tool. Required.
  • -o: output, output to this file. Output will be generated to the given path. Default: “placingToRendering.xml”. Optional.
  • -l: layout, layout algorithm. Layout can be PACK or TETRIS. Optional. Default value is PACK.
  • -m: map, whether or not the map should be shown.

If we use the –m option, the following popup window will appear:

placing_map

On the map the structure of the virtual city is represented, generated from the source code. Different colors represent different types of objects.

Colors Objects
orange ground
blue garden
green floor
red cellar

After closing this window, the building process will be finished.

The input of Placing Tool contains only the structure and the main attributes of the city, while the output XML describes the size of inner buildings, like floor and cellar. Here is an example:

Part of mappingToPlacing.xml:

<buildable id="8b224e44-26f8-4ab3-94b0-7831238e3d7a" name="void performExp()" type="floor">
    <position x="0" y="0" z="0"/>
    <size x="9" y="17" z="11"/>
    <attributes>
        <attribute name="external_character" value="metal"/>
        <attribute name="character" value="glass"/>
        <attribute name="torches" value="1"/>
    </attributes>
    <children/>
</buildable>

In the buildable tag there is an id, a name and a type, which defines the the buildable object, for example a method. Position tag defines the place of the object, and the size specify the size of the object. Every object can have attributes.

Part of placingToRendering.xml:

<buildable id="8b224e44-26f8-4ab3-94b0-7831238e3d7a" name="void performExp()" type="floor">
    <position x="26" y="63" z="76"/>
    <size x="9" y="17" z="11"/>
    <attributes>
        <attribute name="external_character" value="metal"/>
        <attribute name="character" value="glass"/>
        <attribute name="torches" value="1"/>
    </attributes>
    <children/>
</buildable>

In placingToRendering.xml a buildable object has got the same parameters and attributes, only the position will be exactly specified in addition.