GraphicBuilder Class
Provides methods for constructing a RenderGraphic from geometric primitives. GraphicBuilder is primarily used for creating Decorations to be displayed inside a Viewport.
The typical process for constructing a RenderGraphic proceeds as follows:
- Use DecorateContext.createGraphic or RenderSystem.createGraphic to obtain a builder.
- Set up the symbology using GraphicBuilder.activateGraphicParams or GraphicBuilder.setSymbology.
- Add one or more geometric primitives using methods like GraphicBuilder.addShape and GraphicBuilder.addLineString, possibly setting new symbology in between.
- Use GraphicBuilder.finish to produce the finished RenderGraphic.
note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them. So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.
extensions
Methods
Name | Description | |
---|---|---|
_activateFeature(_feature: Feature): void Protected | Called by GraphicBuilder.activateFeature after validation to change the Feature to be associated with subsequently-added geometry. | |
activateFeature(feature: Feature): void | Change the Feature to be associated with subsequently-added geometry. | |
activateGraphicParams(graphicParams: GraphicParams): void Abstract | Sets the current active symbology for this builder. | |
activatePickableId(id: string): void | Change the pickable Id to be associated with subsequently-added geometry. | |
addArc(arc: Arc3d, isEllipse: boolean, filled: boolean): void Abstract | Appends a 3d open arc or closed ellipse to the builder. | |
addArc2d(ellipse: Arc3d, isEllipse: boolean, filled: boolean, zDepth: number): void Abstract | Appends a 2d open arc or closed ellipse to the builder. | |
addCurvePrimitive(curve: AnyCurvePrimitive): void | Append a CurvePrimitive to the builder. | |
addFrustum(frustum: Frustum): void | Add Frustum edges. | |
addLineString(points: Point3d[]): void Abstract | Appends a 3d line string to the builder. | |
addLineString2d(points: Point2d[], zDepth: number): void Abstract | Appends a 2d line string to the builder. | |
addLoop(loop: Loop): void Abstract | Append a 3d planar region to the builder. | |
addPath(path: Path): void Abstract | Append a 3d open path to the builder. | |
addPointString(points: Point3d[]): void Abstract | Appends a 3d point string to the builder. | |
addPointString2d(points: Point2d[], zDepth: number): void Abstract | Appends a 2d point string to the builder. | |
addPolyface(meshData: Polyface, filled: boolean): void Abstract | Append a mesh to the builder. | |
addPrimitive(primitive: GraphicPrimitive): void | Append any primitive to the builder. | |
addRangeBox(range: Range3d, solid: boolean = false): void | Add a box representing a volume of space. | |
addRangeBoxFromCorners(p: Point3d[]): void | Add range edges from corner points | |
addShape(points: Point3d[]): void Abstract | Appends a closed 3d planar region to the builder. | |
addShape2d(points: Point2d[], zDepth: number): void Abstract | Appends a closed 2d region to the builder. | |
addSolidPrimitive(solidPrimitive: SolidPrimitive): void Abstract | Append a solid primitive to the builder. | |
finish(): RenderGraphic Abstract | Processes the accumulated symbology and geometry to produce a renderable graphic. | |
setBlankingFill(fillColor: ColorDef): void | Set the current active symbology for this builder to be a blanking fill before adding a planar region. | |
setSymbology(lineColor: ColorDef, fillColor: ColorDef, lineWidth: number, linePixels: LinePixels = LinePixels.Solid): void | Sets the current active symbology for this builder. |
Properties
Name | Type | Description | |
---|---|---|---|
_computeChordTolerance ProtectedReadonly | (args: ComputeChordToleranceArgs) => number | ||
_options ProtectedReadonly | CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions | ||
iModel Readonly | undefined | IModelConnection | The iModel associated with this builder, if any. | |
isOverlay Accessor ReadOnly | boolean | True if the builder produces a graphic of GraphicType.WorldOverlay or GraphicType.ViewOerlay. | |
isSceneGraphic Accessor ReadOnly | boolean | True if the builder produces a graphic of GraphicType.Scene. | |
isViewBackground Accessor ReadOnly | boolean | True if the builder produces a graphic of GraphicType.ViewBackground. | |
isViewCoordinates Accessor ReadOnly | boolean | Whether the builder's geometry is defined in CoordSystem.View coordinates. | |
isWorldCoordinates Accessor ReadOnly | boolean | Whether the builder's geometry is defined in CoordSystem.World coordinates. | |
pickable Readonly | undefined | Readonly<PickableGraphicOptions> | If the graphic is to be pickable, specifies the pickable Id and other options. | |
pickId Accessor ReadOnly | undefined | string | The Id to be associated with the graphic for picking. | |
placement Readonly | Transform | The local coordinate system transform applied to this builder's geometry. | |
preserveOrder Readonly | boolean | If true, the order in which geometry is added to the builder is preserved. | |
type Readonly | GraphicType | The type of graphic to be produced by this builder. | |
wantEdges Readonly | boolean | Controls whether edges are generated for surfaces. | |
wantNormals Readonly | boolean | Controls whether normals are generated for surfaces. |
Defined in
Last Updated: 20 June, 2023