-
Notifications
You must be signed in to change notification settings - Fork 208
/
ElementProperties.ts
133 lines (119 loc) · 3.96 KB
/
ElementProperties.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module RPC
*/
import { Id64String } from "@itwin/core-bentley";
/**
* Data structure for storing element properties information in a simplified format.
* @see [[Content]] for a format that stores all available element property data.
* @public
*/
export interface ElementProperties {
/** Label of element's ECClass. */
class: string;
/** Element's ID. */
id: Id64String;
/** Element's label. */
label: string;
/** Container of property values */
items: { [label: string]: ElementPropertiesItem };
}
/**
* Base type for all [[ElementPropertiesItem]] types.
* @public
*/
export interface ElementPropertiesItemBase {
/** Type of the properties item. */
type: "category" | ElementPropertiesPropertyValueType;
}
/**
* Definition for a category. A category can nest other property items, including categories.
* @public
*/
export interface ElementPropertiesCategoryItem extends ElementPropertiesItemBase {
/** Type of the properties item. */
type: "category";
/** Container of property values */
items: { [label: string]: ElementPropertiesItem };
}
/**
* Base type for all [[ElementPropertiesPropertyItem]] types.
* @public
*/
export interface ElementPropertiesPropertyItemBase extends ElementPropertiesItemBase {
/** Type of the properties item. */
type: ElementPropertiesPropertyValueType;
}
/**
* Definition for a primitive property value.
* @public
*/
export interface ElementPropertiesPrimitivePropertyItem extends ElementPropertiesPropertyItemBase {
/** Type of the properties item. */
type: "primitive";
/** Display value of the property. */
value: string;
}
/**
* Base type for all [[ElementPropertiesArrayPropertyItem]] types.
* @public
*/
export interface ElementPropertiesArrayPropertyItemBase extends ElementPropertiesPropertyItemBase {
/** Type of the properties item. */
type: "array";
/** Type of values contained in this array. */
valueType: "primitive" | "struct";
}
/**
* Definition for a primitives' array property value.
* @public
*/
export interface ElementPropertiesPrimitiveArrayPropertyItem extends ElementPropertiesArrayPropertyItemBase {
/** Type of values contained in this array. */
valueType: "primitive";
/** Array of display values. */
values: string[];
}
/**
* Definition for a structs' array property value.
* @public
*/
export interface ElementPropertiesStructArrayPropertyItem extends ElementPropertiesArrayPropertyItemBase {
/** Type of values contained in this array. */
valueType: "struct";
/** Array of structs. */
values: Array<{ [memberLabel: string]: ElementPropertiesPropertyItem }>;
}
/**
* Definition for an array property value.
* @public
*/
export type ElementPropertiesArrayPropertyItem = ElementPropertiesPrimitiveArrayPropertyItem | ElementPropertiesStructArrayPropertyItem;
/**
* Definition for an struct property value.
* @public
*/
export interface ElementPropertiesStructPropertyItem extends ElementPropertiesPropertyItemBase {
/** Type of the properties item. */
type: "struct";
/** Container of struct members. */
members: { [memberLabel: string]: ElementPropertiesPropertyItem };
}
/**
* Available element property types.
* @public
*/
export type ElementPropertiesPropertyValueType = "primitive" | "array" | "struct";
/**
* Definition of a property value.
* @public
*/
export type ElementPropertiesPropertyItem = ElementPropertiesPrimitivePropertyItem | ElementPropertiesArrayPropertyItem | ElementPropertiesStructPropertyItem;
/**
* Definition of a property item, including a property category.
* @public
*/
export type ElementPropertiesItem = ElementPropertiesCategoryItem | ElementPropertiesPropertyItem;