PropertySet
The PropertySet class allows for aggregation of properties with the same names and categories. To get an instance of this class use Model#getPropertySetAsync.
new PropertySet(result)
Parameters
| result* Object |
Examples
// Use the model's getPropertySetAsync to get the PropertySet instance for the selected dbIds
for (const { model, selection } of viewer.getAggregateSelection()) {
const propSet = await model.getPropertySetAsync(selection);
// iterate, aggregate, etc
}
Methods
forEach(callback)
Iterates over all of the common properties. The callback is invoked on each key in the property map.
Parameters
| callback* | Called for each entry in the map |
getAggregation(properties)
Returns an object containing aggregated values. see PropertySet#forEach
Parameters
| properties* Array.<Object>, String | either the key in the object or an array of properties |
Returns
| type | description |
|---|---|
| AggregatedResult |
|
Examples
propertySet.forEach((key, properties) => {
const aggregation = propertySet.getAggregation(key);
});
getValue2PropertiesMap(properties)
Returns an object with a key representing the property’s displayValue and the value being all of the property names associated with it.
see PropertySet#forEach see PropertyResult
Parameters
| properties* Array.<Object>, String | either the key in the object or an array of properties |
Returns
| type | description |
|---|---|
| Object |
|
Examples
propertySet.forEach((name, properties) => {
const commonValues = propertySet.getValue2PropertiesMap(key);
});
getValidIds(displayName, displayCategory)
Searches all of the keys in the map object and returns all valid keys that either match the displayName or categoryName.
Parameters
| displayName* String | the display name |
| displayCategory* String | the category name |
Returns
| type | description |
|---|---|
| Array.<String> |
|
getDbIds()
Get the dbIds that are associated with the propertySet
Returns
| type | description |
|---|---|
| Array.<number> |
|
getVisibleKeys()
Returns an array of keys that contain visible properties
Returns
| type | description |
|---|---|
| Array.<string> |
|
getKeysWithCategories()
Returns an array of keys that have properties with displayCategories
Returns
| type | description |
|---|---|
| Array.<string> |
|
merge(propertySet)
Merges the passed in PropertySet map with the current PropertySet’s map.
Parameters
| propertySet* | A PropertySet instance |
Returns
| type | description |
|---|---|
| PropertySet |
|