AEC/GIS/ECAD

Organizing the Data

These types of applications primarily contain 2D geometry that exists in a single plane. When inserting such geometry into the HOOPS/3dGS database, the z-values of the insertion points should be zero. HOOPS/3dGS will detect this and automatically make some internal optimizations.

Since the geometry representing the model resides in the same plane, it must be distributed among different layers. The layers may need to be independently:

  • drawn with a specific order relative to other layers
  • highlighted
  • hidden
  • modified (their position my need to change, or they may need to be drawn with different attributes such as color, line style, line thickness, etc...)
  • deleted

Organizing the HOOPS/3dGS scene-graph to represent layers is quite easy. Underneath the main 'model' segment, we create a sibling segment for each layer in the model. Each layer segment would in turn contain geometry and any additional subsegment tree that represents that layer. All of the aforementioned functionality can easily be achieved by modifying the appropriate attributes in the top level segment for each layer. The following diagram shows how the scene-graph might look:

 

Reusing Objects

The scene-graph in the previous section implies that a layer's geometry is directly stored in the layer segment (or subsegment tree). This may be valid for some applications, but it is common for the model to contain 'template' objects that need to be referenced multiple times (perhaps by a single layer, or maybe by many layers). The more efficient way to represent this scenario is to store the template objects inside of separate segments, and then reference those objects into the main model hierarchy by using HC_Include_Segment as necessary:

When creating the model using HOOPS/MVO, the 'Model' segment already exists and the HOOPS/3dGS pseudo-code corresponding with the blue portions of the diagram is listed below. Notice that we set Visibility to 'off' at the top of the object library, since we don't want the contents of those segments to be automatically visible when the scene is drawn. We only want them to be visible as a result of being included into the model's 'layer' segments:

// define the model
HC_Open_Segment("?Include Library");
HC_Open_Segment("Model_0");
HC_Open_Segment("Object Library");
HC_Open_Segment("Object_1");
// define an object here
HC_Open_Segment("Object_2");
// define an object here
HC_Open_Segment("Layer_1");
// define the layer
HC_Open_Segment("Layer_2");
HC_Include_Segment("../Object Library/Object_1");
// define the remainder of the layer
HC_Open_Segment("Layer_3");
HC_Include_Segment("../Object Library/Object_2");
// define the remainder of the layer
HC_Close_Segment(); // close "Model_0"
HC_Close_Segment(); // close "?Include Library"
// include the model into the scene
HC_Open_Segment("?driver/opengl/window0");
HC_Open_Segment("Scene");
HC_Include_Segment("Model_0");

 

Ordering Layers

Ordering layers in a 2D scene is frequently necessary, as they may need a specific drawing order. (This would be similar to bringing 2D objects to the front or sending them to the back in an application like Visio or Word.) HOOPS/3dGS segments can be manually reordered w.r.t. one another using a variety of techniques, discussed in Section 6.1.1 of the HOOPS/3dGS Programming Guide.

The 2D Tutorial reviews creation of a sample 2D scene-graph, along with how to implement a variety of 2D application requirements mentioned at the beginning of this document. After compiling and running the tutorial, you can export the file to an ASCII readable HMF File and explore it's contents in a text editor. Additionally, you can read the HMF file into the HoopsPartViewer and launch the 'Segment Browser' to explore the scene-graph.