addPrimitive
Adds a graphics primitive (a line, rectangle or ellipse) to the pad control list.
Primitives are drawn with the current borderColor and fillColor properties.
wizCtl.addPrimitive(type, x1, y1, x2, y2, lineWidth, options)
| Parameter | Description |
|---|---|
| type | A value from the sigSDK.PrimitiveType enum: Line, Rectangle or Ellipse. |
| x1, y1 | For a line, the start position.
For a rectangle or ellipse, the top-left corner of the bounding rectangle.
|
| x2, y2 | For a line, the end position.
For a rectangle or ellipse, the bottom-right corner of the bounding rectangle. |
| lineWidth | Line width in pixels. (Optional, default 1) |
| options | A combination of sigSDK.PrimitiveOptions values. (Optional, default LineSolid and Outline) |
| Return values |
|---|
| The added object. Throws an exception if an error occurs. |
The returned object has a rect property with the displayed area: upperLeftXpixel, upperLeftYpixel, lowerRightXpixel and lowerRightYpixel.
The following example draws a dashed line and a filled rectangle:
wizCtl.setProperty({fillColor: "green", borderColor: "blue"});
wizCtl.addPrimitive(sigSDK.PrimitiveType.Line, 10, 100, 200, 100, 2, sigSDK.PrimitiveOptions.LineDashed.value);
wizCtl.addPrimitive(sigSDK.PrimitiveType.Rectangle, 10, 120, "+80", "+40", 2,
sigSDK.PrimitiveOptions.LineSolid.value | sigSDK.PrimitiveOptions.Fill.value);