GraphicBuilder Class

Provides methods for constructing a RenderGraphic 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:

  1. Use createGraphic or createGraphic to obtain a builder.
  2. Set up the symbology using activateGraphicParams or setSymbology.
  3. Add one or more geometric primitives using methods like addShape and addLineString, possibly setting new symbology in between.
  4. 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.

Extends

Methods

Name Description
finish(): RenderGraphic Abstract Processes the accumulated symbology and geometry to produce a renderable graphic.  

Inherited methods

Name Inherited from Description
activateFeature(feature: Feature): void GraphicAssembler Change the Feature to be associated with subsequently-added geometry.
activateGraphicParams(graphicParams: GraphicParams): void GraphicAssembler Sets the current active symbology for this builder.
activatePickableId(id: string): void GraphicAssembler Change the pickable Id to be associated with subsequently-added geometry.
add(geom: Geometry): void GraphicAssembler  
addArc(ellipse: Arc3d, isEllipse: boolean, filled: boolean): void GraphicAssembler Appends a 3d open arc or closed ellipse to the builder.
addArc2d(ellipse: Arc3d, isEllipse: boolean, filled: boolean, zDepth: number): void GraphicAssembler Appends a 2d open arc or closed ellipse to the builder.
addCurvePrimitive(curve: AnyCurvePrimitive): void GraphicAssembler Append a CurvePrimitive to the builder.
addFrustum(frustum: Frustum): void GraphicAssembler Add Frustum edges.
addFrustumSides(frustum: Frustum): void GraphicAssembler Add Frustum sides.
addLineString(points: Point3d[]): void GraphicAssembler Appends a 3d line string to the builder.
addLineString2d(points: Point2d[], zDepth: number): void GraphicAssembler Appends a 2d line string to the builder.
addLoop(loop: Loop): void GraphicAssembler Append a 3d planar region to the builder.
addPath(path: Path): void GraphicAssembler Append a 3d open path to the builder.
addPointString(points: Point3d[]): void GraphicAssembler Appends a 3d point string to the builder.
addPointString2d(points: Point2d[], zDepth: number): void GraphicAssembler Appends a 2d point string to the builder.
addPolyface(meshData: Polyface, _filled: booleanfalse): void GraphicAssembler Append a mesh to the builder.
addPrimitive(primitive: GraphicPrimitive): void GraphicAssembler Append any primitive to the builder.
addRangeBox(range: Range3d, solid: booleanfalse): void GraphicAssembler Add a box representing a volume of space.
addRangeBoxFromCorners(p: Point3d[]): void GraphicAssembler Add range edges from corner points
addRangeBoxSidesFromCorners(p: Point3d[]): void GraphicAssembler Add range sides from corner points
addShape(points: Point3d[]): void GraphicAssembler Appends a closed 3d planar region to the builder.
addShape2d(points: Point2d[], zDepth: number): void GraphicAssembler Appends a closed 2d region to the builder.
addSolidPrimitive(primitive: SolidPrimitive): void GraphicAssembler Append a solid primitive to the builder.
setBlankingFill(fillColor: ColorDef): void 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 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 ReadOnly boolean GraphicAssembler True if the builder produces a graphic of WorldOverlay or ViewOerlay.
isSceneGraphic Accessor ReadOnly boolean GraphicAssembler True if the builder produces a graphic of GraphicType.Scene.
isViewBackground Accessor ReadOnly boolean GraphicAssembler True if the builder produces a graphic of ViewBackground.
isViewCoordinates Accessor 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 ReadOnly boolean GraphicAssembler Whether the builder's geometry is defined in CoordSystem.World coordinates - the inverse of isViewCoordinates.
pickable Readonly Readonly<PickableGraphicOptions> | undefined GraphicAssembler If the graphic is to be interactive, specifies its Id and other options.
placement Readonly Transform GraphicAssembler The local-to-world transform in which the builder's geometry is to be defined.
preserveOrder Readonly boolean GraphicAssembler If true, the order in which geometry is added to the builder is preserved.
type Readonly GraphicType GraphicAssembler The type of graphic to be produced.
wantEdges Readonly 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 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: 04 October, 2024