GraphicPrimitive Type
GraphicPrimitive = GraphicLineString | GraphicLineString2d | GraphicPointString | GraphicPointString2d | GraphicShape | GraphicShape2d | GraphicArc | GraphicArc2d | GraphicPath | GraphicLoop | GraphicPolyface | GraphicSolidPrimitive
Union type representing a graphic primitive that can be supplied to addPrimitive.
Each primitive type corresponds to one of GraphicBuilder's addXXX
methods. This is useful when the precise type of
geometry is not known at the point at which it is added to the builder. As a simple example:
function getPrimitives(): GraphicPrimitive[] {
const primitives: GraphicPrimitive[] = [{ type: "polyface", polyface: getPolyface(), filled: true }];
if (someCondition())
primitives.push({ type: "linestring", points: getPoints() });
else
primitives.push({ type: "arc", arc: getArc(), isEllipse: true });
return primitives;
}
function addGraphics(builder: GraphicBuilder) {
for (const primitive of getPrimitives())
builder.addPrimitive(primitive);
}
Defined in
Last Updated: 21 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.