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:

  1. Use DecorateContext.createGraphic or RenderSystem.createGraphic to obtain a builder.
  2. Set up the symbology using GraphicBuilder.activateGraphicParams or GraphicBuilder.setSymbology.
  3. Add one or more geometric primitives using methods like GraphicBuilder.addShape and GraphicBuilder.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.

Methods

Name Description
activateGraphicParams(graphicParams: GraphicParams): void Abstract Sets the current active symbology for this builder.  
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): void Add Range3d edges.  
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
applyAspectRatioSkew Accessor boolean If true, ViewState.getAspectRatioSkew will be taken into account when computing the level of detail for the produced graphics.  
iModel Accessor ReadOnly IModelConnection The iModel of the Viewport in which the RenderGraphic is to be drawn.  
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.  
pickId Accessor Id64String | undefined The Id to be associated with the graphic for picking.  
placement Accessor Transform The local coordinate system transform applied to this builder's geometry.  
preserveOrder Accessor boolean If true, the order in which geometry is added to the builder is preserved.  
type Accessor ReadOnly GraphicType The type of graphic to be produced by this builder.  
viewport Accessor ReadOnly Viewport The viewport in which the resultant RenderGraphic will be drawn.  
wantEdges Accessor boolean Controls whether edges are generated for surfaces.  
wantNormals Accessor boolean Controls whether normals are generated for surfaces.  

Defined in

Last Updated: 25 August, 2021