Lesson 8: Create your own modeler

In this lesson you will finally learn how to create your own modeler in the dimension of your choice with as many embeddings as you like !  Follow these seven steps to create your modeler while replacing « GenericModeler » by the name of your modeler and make sure to use lower case characters when they are used in the lesson.

For this lesson you will need some specific java classes which are provided. Download them and unpack the directory. You will also need the JogAmp libraries for the 3D graphics of the viewer. Download them before creating your modeler. Finally you will need to download the Jerboa libraries.

You will need an IDE ( Integrated Development Environment). This tutorial is written for the use of Eclipse but you can use the IDE of your choosing, just remember to adjust certain instructions to fit.

Step 1: Create a new Java Project

project name: “GenericModeler”
Add a “gen” source folder for the code generated by the editor.
Add a “lib” folder for the Jerboa depencies.

Right click on the project and go to « Build Path » and « Configure build path » and add external jars from the downloaded folder “jogamp-all-platforms ». Apply and close.

Copy the “Jerboa.jar” and “JerboaModelerViewer-nodeps.jar” files into the lib folder (copy and paste or drag and drop), right click on them and go to « Build Path » and « add to build path ».

Step 2: Create an embeddings package

In the “src” source folder create a package called  “genericmodeler.embeddings”.
Retrieve the “Points” java class from the unpacked directory and add it to the package.

Step 3: Create a main package

In the “src” source folder create a package called “genericmodeler”.
Retrieve the “Bridge” java class and “Launcher” java class from the unpacked directory and add them to the package.

Step 4: Create a new Modeler

Open the editor and create a new modeler (File – New Modeler) name it “Modeler” and chose the package “genericmodeler.modeler”. Choose any dimension you like.

Go to File, Create a new embedding then right click on the created embedding and modify it. Name it “point”, give it the  orbit <1,2,3> and the type “genericmodeler.embeddings.Points”. Apply.
Create another embedding called color with the <0,1,3> orbit and « java.awt.Color » type. Apply.

Fill in the save file text field with “GenericModeler.jme” in your java project directory. Fill in the destination folder text field with “gen” in your java project directory. Fill in the project directory text field with your java project directory and check “java generation” then click on “Apply”.

Step 5: Save and Export the modeler

Click on File, Save and then Export (java).

Step 6: Modify the Bridge and Launcher to fit your modeler

In the Bridge you will find lots of errors and warnings, use them to find and replace « genericmodeler » with the name you chose for your modeler in the imports at the top of the file.
Do the same in the Launcher.

Step 7: Modify the serializer in the second half of the Bridge

 

 

Now you can write rules in the editor, export them to your new modeler and launch the viewer just like you have been doing with the provided modeler in the previous lessons.