GraphicBuilder Class
Provides methods for constructing a RenderGraphic or GraphicTemplate from geometric primitives and symbology. GraphicBuilder is primarily used for creating Decorations to be displayed inside a Viewport.
The typical process for constructing a RenderGraphic proceeds as follows:
- Use createGraphic or createGraphic to obtain a builder.
- Set up the symbology using activateGraphicParams or setSymbology.
- Add one or more geometric primitives using methods like addShape and addLineString, possibly setting new symbology in between.
- Use GraphicBuilder.finish to produce the finished RenderGraphic.
The process for constructing a GraphicTemplate is similar:
- Use createGraphic to obtain a builder.
- Set up the symbology using activateGraphicParams or setSymbology.
- Add one or more geometric primitives using methods like addShape and addLineString, possibly setting new symbology in between.
- Use finishTemplate to produce the finished GraphicTemplate.
@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.
Extends
Methods
Name | Description | |
---|---|---|
finish(): RenderGraphic Abstract | Processes the accumulated symbology and geometry to produce a renderable graphic. | |
finishTemplate(): GraphicTemplate Abstract | Processes the accumulated symbology and geometry to produce a reusable template for a RenderGraphic. |
Inherited methods
Name | Inherited from | Description |
---|---|---|
activateFeature(feature: Feature): void Inherited | GraphicAssembler | Change the Feature to be associated with subsequently-added geometry. |
activateGraphicParams(graphicParams: GraphicParams): void Inherited | GraphicAssembler | Sets the current active symbology for this builder. |
activatePickableId(id: string): void Inherited | GraphicAssembler | Change the pickable Id to be associated with subsequently-added geometry. |
add(geom: Geometry): void Inherited | GraphicAssembler | |
addArc(ellipse: Arc3d, isEllipse: boolean, filled: boolean): void Inherited | GraphicAssembler | Appends a 3d open arc or closed ellipse to the builder. |
addArc2d(ellipse: Arc3d, isEllipse: boolean, filled: boolean, zDepth: number): void Inherited | GraphicAssembler | Appends a 2d open arc or closed ellipse to the builder. |
addCurvePrimitive(curve: AnyCurvePrimitive): void Inherited | GraphicAssembler | Append a CurvePrimitive to the builder. |
addFrustum(frustum: Frustum): void Inherited | GraphicAssembler | Add Frustum edges. |
addFrustumSides(frustum: Frustum): void Inherited | GraphicAssembler | Add Frustum sides. |
addLineString(points: Point3d[]): void Inherited | GraphicAssembler | Appends a 3d line string to the builder. |
addLineString2d(points: Point2d[], zDepth: number): void Inherited | GraphicAssembler | Appends a 2d line string to the builder. |
addLoop(loop: Loop): void Inherited | GraphicAssembler | Append a 3d planar region to the builder. |
addPath(path: Path): void Inherited | GraphicAssembler | Append a 3d open path to the builder. |
addPointString(points: Point3d[]): void Inherited | GraphicAssembler | Appends a 3d point string to the builder. |
addPointString2d(points: Point2d[], zDepth: number): void Inherited | GraphicAssembler | Appends a 2d point string to the builder. |
addPolyface(meshData: Polyface, _filled: booleanfalse): void Inherited | GraphicAssembler | Append a mesh to the builder. |
addPrimitive(primitive: GraphicPrimitive): void Inherited | GraphicAssembler | Append any primitive to the builder. |
addRangeBox(range: Range3d, solid: booleanfalse): void Inherited | GraphicAssembler | Add a box representing a volume of space. |
addRangeBoxFromCorners(p: Point3d[]): void Inherited | GraphicAssembler | Add range edges from corner points |
addRangeBoxSidesFromCorners(p: Point3d[]): void Inherited | GraphicAssembler | Add range sides from corner points |
addShape(points: Point3d[]): void Inherited | GraphicAssembler | Appends a closed 3d planar region to the builder. |
addShape2d(points: Point2d[], zDepth: number): void Inherited | GraphicAssembler | Appends a closed 2d region to the builder. |
addSolidPrimitive(primitive: SolidPrimitive): void Inherited | GraphicAssembler | Append a solid primitive to the builder. |
setBlankingFill(fillColor: ColorDef): void Inherited | GraphicAssembler | 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: LinePixelsLinePixels.Solid): void Inherited | GraphicAssembler | Sets the current active symbology for this builder. |
Properties
Name | Type | Description | |
---|---|---|---|
iModel Readonly | IModelConnection | undefined | The iModel associated with this builder, if any. | |
pickId Accessor ReadOnly | undefined | string | The Id to be associated with the graphic for picking. |
Inherited properties
Name | Type | Inherited from | Description |
---|---|---|---|
isOverlay Accessor Inherited ReadOnly | boolean | GraphicAssembler | True if the builder produces a graphic of WorldOverlay or ViewOerlay. |
isSceneGraphic Accessor Inherited ReadOnly | boolean | GraphicAssembler | True if the builder produces a graphic of GraphicType.Scene. |
isViewBackground Accessor Inherited ReadOnly | boolean | GraphicAssembler | True if the builder produces a graphic of ViewBackground. |
isViewCoordinates Accessor Inherited ReadOnly | boolean | GraphicAssembler | Whether the builder's geometry is defined in CoordSystem.View coordinates. Only graphics of type ViewBackground or ViewOverlay are defined in view coordinates. |
isWorldCoordinates Accessor Inherited ReadOnly | boolean | GraphicAssembler | Whether the builder's geometry is defined in CoordSystem.World coordinates - the inverse of isViewCoordinates. |
pickable Readonly Inherited | Readonly<PickableGraphicOptions> | undefined | GraphicAssembler | If the graphic is to be interactive, specifies its Id and other options. |
placement Readonly Inherited | Transform | GraphicAssembler | The local-to-world transform in which the builder's geometry is to be defined. |
preserveOrder Readonly Inherited | boolean | GraphicAssembler | If true, the order in which geometry is added to the builder is preserved. |
type Readonly Inherited | GraphicType | GraphicAssembler | The type of graphic to be produced. |
wantEdges Readonly Inherited | boolean | GraphicAssembler | If true, edges are generated for surfaces, to be drawn if edge display is enabled for the view in which the graphic is drawn. |
wantNormals Readonly Inherited | boolean | GraphicAssembler | If true, normal vectors will be generated for surfaces, allowing 3d geometry to receive lighting and reduce z-fighting. |
Defined in
Last Updated: 17 December, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.