Layer Settings

A layer is like a sketchbook that holds objects. To create and render objects, a layer is necessary. If an object is created and not inserted into a layer, it will not be rendered. Additionally, visibility settings can be adjusted to render only the necessary layers.

Layer Type List

Step 1. Create a Layer

A layer is needed to create and render objects, so the first step is to create one.

For descriptions of layer types, please refer here.

var userlayer = new Module.JSLayerList(true);
userlayer = layerList.createLayer("layerName", Module.ELT_POLYHEDRON);

Step 2 - 1. Set Layer Visibility

Set the visibility of the layer created in step 1.

  • true: Render all objects in the layer

  • false: Do not render any objects in the layer

userlayer.setVisible(false);

Step 2 - 2. Set Layer Visibility Distance

Set the visibility distance for the layer created in step 1.

  • getMaxDistance: Returns the maximum visibility distance

  • setMaxDistance: Sets the maximum visibility distance

  • getMinDistance: Returns the minimum visibility distance

  • setMinDistance: Sets the minimum visibility distance

userlayer.setMaxDistance(10);
userlayer.setMaxDistance(2000);

Step 2 - 3. Set Layer Selectability

Set whether the layer created in step 1 can be selected.

  • setSelectable: Sets the layer's selectability

  • getSelectable: Returns the layer's selectability

userlayer.setSelectable(true);

Step 2 - 4. Add Objects to the Layer

Add objects to the layer created in step 1.

var object = create object;
userlayer.addObject(object, 0);	// (object, insertion level)

Step 3 - 1. Set Color Expression Priority

The color priority of the objects added in step 2-4 is as follows:

  • 1st Priority: Object selection color

  • 2nd Priority: Object original face color

  • 3rd Priority: Object color set externally

  • 4th Priority: Layer color

  • 5th Priority: Object original color

var userlayer = create layer;
var object = create object;
/**
 *  1st Priority
 *  Color specified, expressed when object is selected
 */
Module.getOption().selectColor = new Module.JSColor(255, 255, 0, 0);
/**
 *  2nd Priority
 *  Used in JSPolygon Type
 */
var style = object.getStyle();
style.setOutLineColor(new Module.JSColor(255, 255, 255, 255));
style.setFillColor(new Module.JSColor(255, 255, 0, 0));
object.setStyle(style);
/**
 *  3rd Priority
 */
object.setObjectColor(new Module.JSColor(255, 255, 255, 255));
/**
 *  4th Priority
 *  Feature implementation planned for the future
 */
/**
 *  5th Priority
 *  Changing to original object color is not possible, can be substituted with 3rd priority
 */

Last updated