FeatureSymbology.Overrides Class

Allows a Viewport to customize the appearance of individual Features within it.

The Viewport computes its base Overrides based on the following:

  • The set of categories enabled for display in its CategorySelectorState. Every SubCategory belonging to an enabled Category is added to the set of visible subcategories - all other subcategories are assumed to be invisible.
  • For the set of visible subcategories, any SubCategoryOverrides defined by the view's DisplayStyleState are applied. This may render some subcategories invisible, and change the symbology of others.
  • The visibility of each GeometryClass is set based on the view's ViewFlags.
  • The line weight is overridden to 1 pixel for all Features if line weight has been disabled by the view's ViewFlags.
  • The sets of elements which are always drawn and never drawn are initialized from the Viewport's sets. An application can further customize the symbology of any Features by registering a FeatureSymbology.Overrides.FeatureOverrideProvider with a Viewport. That provider's addFeatureOverrides function will be invoked whenever the Overrides need to be regenerated.

To override the symbology of most Features within a view, specify a FeatureSymbology.Overrides.defaultOverrides to be applied to any Feature not explicitly overridden. If default overrides are defined and some Features should draw normally without being affected by the default overrides, override that Feature with an Appearance which defines no overrides.

It is possible to override multiple aspects of a Feature. For example, you might specify that all elements belonging to subcategory "A" should be drawn in red, and that the element with Id "0x123" should be drawn with 0.25 transparency. In this case, when drawing a Feature with subcategory "A" and element Id "0x123", the two overrides will be merged, causing the Feature's geometry to draw 25% transparent red. On the other hand, if subcategory "A" is specified to draw in red and element "0x123" to draw in green, the color specified by the element override will take precedence over that specified for the subcategory, resulting in a green Feature.

see Viewport.alwaysDrawn

see Viewport.neverDrawn

Methods

Name Description
constructor(view?: ViewState | Viewport): FeatureSymbology.Overrides Construct a new Overrides.  
getElementOverridesById(id: Id64String): FeatureSymbology.Appearance | undefined Returns the overrides applied to geometry belonging to the specified element, if any such are defined.  
getFeatureAppearance(feature: Feature, modelId: Id64String, type: BatchType = BatchType.Primary): FeatureSymbology.Appearance | undefined Returns the feature's Appearance overrides, or undefined if the feature is not visible.  
getModelOverridesById(id: Id64String): FeatureSymbology.Appearance | undefined Returns the overrides applied to geometry belonging to the specified model, if any such are defined.  
getSubCategoryOverridesById(id: Id64String): FeatureSymbology.Appearance | undefined Returns the overrides applied to geometry belonging to the specified subcategory, if any such are defined.  
isFeatureVisible(feature: Feature): boolean Returns true if the specified Feature will be drawn.  
isSubCategoryIdVisible(id: Id64String): boolean Returns true if geometry belonging to the specified subcategory will be drawn.  
isSubCategoryVisible(idLo: number, idHi: number): boolean Returns true if the SubCategory specified by Id is in the set of visible subcategories.  
overrideAnimationNode(id: number, app: FeatureSymbology.Appearance): void Specify overrides for all geometry originating from the specified animation node.  
overrideElement(id: Id64String, app: FeatureSymbology.Appearance, replaceExisting: boolean = true): void Specify overrides for all geometry originating from the specified element.  
overrideModel(id: Id64String, app: FeatureSymbology.Appearance, replaceExisting: boolean = true): void Specify overrides for all elements within the specified model.  
overrideSubCategory(id: Id64String, app: FeatureSymbology.Appearance, replaceExisting: boolean = true): void Specify overrides for all geometry belonging to the specified SubCategory.  
setAlwaysDrawn(id: Id64String): void Specify the Id of an element which should always be drawn in this view.  
setAlwaysDrawnSet(ids: Id64Set, exclusive: boolean, ignoreSubCategory: boolean = true): void Specify the Ids of elements which should always be drawn in this view.  
setAnimationNodeNeverDrawn(id: number): void Specify the Id of a animation node which should never be drawn in this view.  
setDefaultOverrides(appearance: FeatureSymbology.Appearance, replaceExisting: boolean = true): void Defines a default Appearance to be applied to any Feature not explicitly overridden.  
setNeverDrawn(id: Id64String): void Specify the Id of an element which should never be drawn in this view.  
setNeverDrawnSet(ids: Id64Set): void Specify the Ids of elements which should never be drawn in this view.  
setVisibleSubCategory(id: Id64String): void Add a SubCategory to the set of visible subcategories.  

Properties

Name Type Description
_alwaysDrawn Protected Uint32Set Ids of elements which should always be drawn.  
_constructions Protected boolean Whether construction geometry should be drawn.  
_defaultOverrides Protected FeatureSymbology.Appearance Overrides applied to any feature not explicitly overridden.  
_dimensions Protected boolean Whether dimensions should be drawn.  
_elementOverrides Protected Uint32Map<FeatureSymbology.Appearance> Overrides applied to specific elements.  
_lineWeights Protected boolean Whether line weights should be applied.  
_modelOverrides Protected Uint32Map<FeatureSymbology.Appearance> Overrides applied to all elements belonging to each model.  
_neverDrawn Protected Uint32Set Ids of elements which should never be drawn.  
_patterns Protected boolean Whether area patterns should be drawn.  
_subCategoryOverrides Protected Uint32Map<FeatureSymbology.Appearance> Overrides applied to geometry belonging to each subcategory.  
_visibleSubCategories Protected Uint32Set The set of displayed subcategories.  
defaultOverrides Accessor ReadOnly FeatureSymbology.Appearance Overrides applied to features for which no other overrides are defined  
isAlwaysDrawnExclusive boolean If true, no elements except those defined in the "always drawn" set will be drawn.  
lineWeights Accessor ReadOnly boolean Whether or not line weights are applied.  

Defined in

Last Updated: 08 January, 2020