Controlling the node’s shape

The basic shape of the general node is controlled by the shapeType property. The possible values are as listed in the following table.
Available shape types for a node
shapeType : “Rectangle”;
Rectangle
shape.
shapeType : “RoundRectangle”;
Rectangle
shape with rounded edges.
shapeType : “Ellipse”;
Ellipse
shape.
shapeType : “Diamond”;
Diamond
shape.
shapeType : “TriangleUp”;
Triangle
pointing upward.
shapeType : “TriangleDown”;
Triangle
pointing downward.
shapeType : “TriangleLeft”;
Triangle
pointing to the left.
shapeType : “TriangleRight”;
Triangle
pointing to the right.
shapeType : “Marker”;
Marker
in the shape of a plus sign.
If needed, you can set the shape of the node directly through the setShape method. This lets you use any custom shape. You can specify a custom shapes in any of the following ways:
  • By referring to an SVG file in the style sheet:
    node {
       shape : "url(myCustomShape.svg)";
    }
    
  • In Java code:
    IlvGeneralPath myShape = new IlvGeneralPath(...);
    generalNode.setShape(myShape);
    
The horizontal and vertical sizes of the shape are controlled through the properties shapeWidth , shapeHeight , and shapeAspectRatio .
There are basically two policies to set the width and height of the shape:
  • You can set the properties shapeWidth and shapeHeight . In this case the aspect ratio of the shape will not be preserved. For example:
    node {
        class       : "ilog.views.sdm.graphic.IlvGeneralNode";
        shapeType   : "RoundRectangle";
        shapeWidth  : "100";
        shapeHeight : "50";
    }
    
  • You can set the property shapeWidth to the desired width and the property shapeAspectRatio to the desired width/height ratio. For example:
    node {
        class            : "ilog.views.sdm.graphic.IlvGeneralNode";
        shapeType        : "RoundRectangle";
        shapeWidth       : "100";
        shapeAspectRatio : "2";
    }
    
    If you change the shape width in another rule, the aspect ratio will be preserved.