HTML Drawing Control

Programmatically highlight assets in a drawing

The HTML drawing control supports highlighting both room and non-room assets, such as equipment (eq), Jack (jk), and so on.

You can highlight assets either through a UI action (such as mouse-click or panel action) or programmatically through drawing control API.

HighlightController provides several APIs to support programmatically highlighting assets.

Highlight

API

 Example

Highlight a single asset with specified fill options

highlightAsset: function(assetId, options);

Where

  • assetId - the specified asset's id.
  • options – an JSON option map of these key values:
    • color: Highlight color. Default to drawingControlConfig's bean property highlight/selected/fill.color in /WEB- INF/config/context/controls/drawing/controls-drawing.xml
    • persistFill: True if mouseover event cannot overwrite it, false otherwise. Default to false.
    • ignorePersistFill: if set to true, will not clear the fill even though the 'persistFill' is set to false.Default to false. This option allows to exclude certain highlighted assets with persist fill property from being cleared.
    • overwriteFill: true to overwrite the existing color in highlight/select, false otherwise. Default to true.

Returns

  • True if the asset is highlighted successfully, false otherwise.
drawingController.getController("HighlightController").highlightAsset('SRL;03;365B', {svgId: 'svgDiv-srl03-svg', color: 'blue', persistFill: true, overwriteFill: true});

Clear a single highlighted asset

clearAsset: function(assetId, options);

drawingController.getController("HighlightController")
.clearAsset('SRL;03;365B', {persistFill: false, overwriteFill: true});

Highlight a set of assets with asset IDs as keys along with their fill options in JSON format.

highlightAssets: function(assetsData);

Where

• assetData - a map of asset id and its fill options.

Returns

  • number of assets highlighted successfully.
var numHighlighted =  drawingController.getController("HighlightController")
.highlightAssets({'745361110481': {color: 'green', persistFill: true, overwriteFill: true},
'745361110482': {color: 'yellow', persistFill: true, overwriteFill: true}});

Clear a set of highlighted assets.

clearAssets: function(assetIds, options);

Where

• assetIds - an array of assets

• options - Map of the fill option for the specified assets.

drawingController.getController("HighlightController")
.clearAssets(['745361110481', '745361110482'], {persistFill: false, overwriteFill: true});

Highlight all assets of the specified asset type with the specified fill options.

highlightAssetsByType: function(assetType, options);

Where

• assetType - the specified asset's type, such as eq.

• options - a map of the fill options such as defaultColor, color, prevColor, persistFill, overwriteFill, ignorePersistFill etc.

Returns

Number the number of assets highlighted

var numHighlighted =  drawingController()
.highlightAssetsByType('jk', {color: 'red', persistFill: true, overwriteFill: true});

Clear all assets highlights of the specified asset type.

clearAssetsByType: function(assetType, options);

Where

• assetType - the specified asset's type, such as eq.

• options - a map of the fill options such as defaultColor, color, prevColor, persistFill, overwriteFill, ignorePersistFill etc.

Returns

Number the number of assets highlighted

 drawingController.getController("HighlightController")
.clearAssetsByType('jk', {persistFill: false, overwriteFill: true});

Clear the color of all the highlighted assets and restore to their default color when the drawing is loaded.

Remove all trace lines and their linked highlighted assets.

resetAll: function();

drawingController.getController("HighlightController").resetAll();

Retrieves all the assets that are not found by trace or highlight.

getMissingAssets: function(type);

Where 

  • type – possible values are 'highlight','trace' or not specified (all will be retrieved).

Returns

  • If type is 'highlight', in JSON format of: {assets: []}
  • If type is ‘trace’, in JSON format of:

    {assetFrom: [], assetTo:[]}

var missingAssets =  drawingController.getController("HighlightController")
.getMissingAssets("highlight");

Reset the JSON map for the missing assets of the specified type.

 

 

 

Resets the specified asset color to its default color, removes it from the highlighted asset map.

 resetMissingAssets: function(type);

Where

• type – possible values are 'highlight','trace' or not specified (all will be retrieved).

 

resetAsset: function(svgId, assetId);

Where

• svgId - the drawing SVG's id

• assetId - the specified asset's id.

 drawingController.getController("HighlightController").resetMissingAssets('highlight');

 

drawingController.getController("HighlightController").resetAsset('svgDiv-srl03-svg’, 'SRL;03;365B’);

From the panel action bar, you can also highlight multiple assets using Highlight Lablel/Selector.

Note that clearAsset(), clearAssets(), and resetAll() will not clear the highlights set by highlight selector.

Example view: http://localhost:8080/archibus/schema/ab-products/solutions/programming/drawing/ab-ex-dwg-html-control-highlightselector.axvw

Copyright © 1984-2018, ARCHIBUS, Inc. All rights reserved.