Skip to content

Commit f9a63d3

Browse files
committed
PR comments
1 parent e36c295 commit f9a63d3

4 files changed

Lines changed: 99 additions & 97 deletions

File tree

packages/scenes-client/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ console.log(`Processed ${totalObjects} total objects`);
212212
import { SceneObject, StandardObjectCreate, ITwinScopedObjectCreate ResourceStylingObjectCreate } from "@bentley/scenes-client";
213213

214214
// Create objects with strongly typed interfaces
215-
const layer: StandardObjectCreate<"Layer", "1.0.0"> = {
215+
// Note: LayerCreate is an alias for StandardObjectCreate<"Layer", "1.0.0">
216+
const layer: LayerCreate = {
216217
id: "<layer_id>",
217218
kind: "Layer",
218219
version: "1.0.0",
@@ -222,7 +223,8 @@ const layer: StandardObjectCreate<"Layer", "1.0.0"> = {
222223
},
223224
};
224225

225-
const iModelResource: ITwinScopedObjectCreate<"RepositoryResource", "1.0.0"> = {
226+
// Note: RepositoryResourceCreate is an alias for ITwinScopedObjectCreate<"RepositoryResource", "1.0.0">
227+
const iModelResource: RepositoryResourceCreate = {
226228
id: "<imodel_object_id>",
227229
kind: "RepositoryResource",
228230
version: "1.0.0",
@@ -237,7 +239,8 @@ const iModelResource: ITwinScopedObjectCreate<"RepositoryResource", "1.0.0"> = {
237239
},
238240
};
239241

240-
const iModelStyling: ResourceStylingObjectCreate<"iModelVisibility", "1.0.0"> = {
242+
// Note: iModelVisibilityCreate is an alias for ResourceStylingObjectCreate<"iModelVisibility", "1.0.0">
243+
const iModelStyling: iModelVisibilityCreate = {
241244
kind: "iModelVisibility",
242245
version: "1.0.0",
243246
displayName: "Hide Building Elements",
@@ -255,7 +258,8 @@ const iModelStyling: ResourceStylingObjectCreate<"iModelVisibility", "1.0.0"> =
255258
},
256259
};
257260

258-
const view3d: StandardObjectCreate<"View3d", "1.0.0"> = {
261+
// Note: iModelVisibilityCreate is an alias for StandardObjectCreate<"View3d", "1.0.0">
262+
const view3d: View3dCreate = {
259263
kind: "View3d",
260264
version: "1.0.0",
261265
displayName: "Aerial View",

packages/scenes-client/src/models/object/types/sceneObjectSchemas.ts

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,56 @@
33

44
// CommonTypes interfaces
55
/** GUID string */
6-
export type guid = string;
6+
export type Guid = string;
77

88
/** String containing only alphanumeric characters */
9-
export type alphaNumericString = string;
9+
export type AlphaNumericString = string;
1010

1111
/** String containing only web safe characters */
12-
export type safeString = string;
12+
export type SafeString = string;
1313

1414
/** A JavaScript (JSEP) expression for frontend rendering that excludes potentially dangerous constructs. It's up to the frontend to validate and execute this expression safely. */
15-
export type expressionString = string;
15+
export type ExpressionString = string;
1616

1717
/** Expression that determines styling conditions or a single expression. */
18-
export type expressionOrConditions =
19-
| expressionString
20-
| { conditions: [expressionString, expressionString][] };
18+
export type ExpressionOrConditions =
19+
| ExpressionString
20+
| { conditions: [ExpressionString, ExpressionString][] };
2121

2222
/** Date time in format: YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss.sssZ */
23-
export type dateTime = string;
23+
export type DateTime = string;
2424

2525
/** Id64 string. See https://www.itwinjs.org/learning/common/id64/ */
26-
export type id64 = string;
26+
export type Id64 = string;
2727

2828
/** Compressed Id64 set. */
29-
export type compressedId64Set = string;
29+
export type CompressedId64Set = string;
3030

31-
export type vector3d = { x: number; y: number; z: number };
31+
export type Vector3d = { x: number; y: number; z: number };
3232

3333
/** Array of 16 numbers representing a 4x4 matrix in row-major order */
34-
export type transform = number[];
34+
export type Transform = number[];
3535

3636
/** A single plane represented as an inward unit normal and a signed distance */
37-
export type clipPlane = {
38-
normal?: vector3d;
37+
export type ClipPlane = {
38+
normal?: Vector3d;
3939
distance?: number;
4040
invisible?: boolean;
4141
interior?: boolean;
4242
};
4343

4444
/** Collection of ClipPlanes, often used for bounding regions of space. */
45-
export type clipPlaneSet = { planes: clipPlane[] };
45+
export type ClipPlaneSet = { planes: ClipPlane[] };
4646

4747
/** An unsigned 32-bit integer in 0xTTBBGGRR format. */
48-
export type colorDef = number;
48+
export type ColorDef = number;
4949

5050
/** An immutable representation of a color with r, g, and b components each in the integer range [0, 255] */
51-
export type rgbColor = { r: number; g: number; b: number };
51+
export type RgbColor = { r: number; g: number; b: number };
5252

5353
/** If defined and not equal to -1 (Invalid), the pixel pattern used to draw the edges. If undefined, edges are drawn using the element's line pattern. The patterns are, in order:
5454
0: Code0 (Solid), 2155905152 (0x80808080): Code1 (1 lit pixel followed by 7 unlit pixels), 4177066232 (0xf8f8f8f8): Code2 (5 lit pixels followed by 3 unlit pixels), 4292935648 (0xffe0ffe0): Code3 (11 lit pixels followed by 5 unlit pixels), 4262526480 (0xfe10fe10): Code4 (7 lit pixels followed by 4 unlit pixels followed by 1 lit pixel followed by 1 lit pixel), 3772834016 (0xe0e0e0e0): Code5 (3 lit pixels followed by 5 unlit pixels), 4169726088 (0xf888f888): Code6 (5 lit pixels followed by 3 unlit followed by 1 lit followed by 3 unlit followed by 1 lit followed by 3 unlit), 4279828248 (0xff18ff18): Code7 (8 lit pixels followed by 3 unlit followed by 2 lit followed by 3 unlit), 3435973836 (0xcccccccc): HiddenLine (2 lit pixels followed by 2 unlit pixels - default style for drawing hidden edges), 1 (0x00000001): Invisible, -1: Invalid */
55-
export type linePixels =
55+
export type LinePixels =
5656
| 0
5757
| 2155905152
5858
| 4177066232
@@ -66,10 +66,10 @@ export type linePixels =
6666
| -1;
6767

6868
/** JSON representation of a hidden line style, which can be used to define how hidden lines are rendered in a view. */
69-
export type hiddenLineStyle = {
69+
export type HiddenLineStyle = {
7070
ovrColor?: boolean;
71-
color?: colorDef;
72-
pattern?: linePixels;
71+
color?: ColorDef;
72+
pattern?: LinePixels;
7373
width?: number;
7474
};
7575

@@ -97,11 +97,11 @@ export interface ScenesApiSchemas {
9797
/** A polygon-defined area projected along the Z-axis on 3D tiles, used to exclude specific regions from rendering. It's primarily used to prevent visual conflicts between overlapping data layers. */
9898
"1.0.0": {
9999
/** The points describing the polygon. */
100-
polygon: vector3d[];
100+
polygon: Vector3d[];
101101
/** Transform from local to world. */
102-
transformFromClip?: transform;
102+
transformFromClip?: Transform;
103103
/** Transform from world to local. */
104-
transformToClip?: transform;
104+
transformToClip?: Transform;
105105
/** Upper bound on Z. */
106106
zHigh?: number;
107107
/** Lower bound on Z. */
@@ -111,7 +111,7 @@ export interface ScenesApiSchemas {
111111
/** True if this shape is a masking set. */
112112
mask: boolean;
113113
/** The union of convex regions. */
114-
clipPlanes?: { convexSets: clipPlaneSet[] };
114+
clipPlanes?: { convexSets: ClipPlaneSet[] };
115115
};
116116
};
117117
Layer: {
@@ -125,14 +125,14 @@ export interface ScenesApiSchemas {
125125
/** Reference to material mapping stored in the decoration service */
126126
"1.0.0": {
127127
/** Id of the material decoration for usage with the Decorations API */
128-
decorationId?: guid;
128+
decorationId?: Guid;
129129
};
130130
};
131131
Movie: {
132132
/** A sequence of camera animations, or clips, which can be played independently or sequentially */
133133
"1.0.0": {
134134
/** Series of CameraAnimations in the movie. */
135-
animations: guid[];
135+
animations: Guid[];
136136
};
137137
};
138138
RepositoryResource: {
@@ -141,34 +141,34 @@ export interface ScenesApiSchemas {
141141
/** Whether the layer is turned on or off */
142142
visible: boolean;
143143
/** Id of the repository. Should be the same as class for internal repos and a GUID for custom repos */
144-
repositoryId: safeString;
144+
repositoryId: SafeString;
145145
/** Id of the individual resource */
146-
id: safeString;
146+
id: SafeString;
147147
/** Class of the repository, such as iModels or RealityData */
148-
class: safeString;
148+
class: SafeString;
149149
/** SubClass of the repository if applicable */
150-
subClass?: safeString;
150+
subClass?: SafeString;
151151
};
152152
};
153153
View3d: {
154154
/** Representation of a 3D view */
155155
"1.0.0": {
156156
/** Location of the eye of the camera. */
157-
position: vector3d;
157+
position: Vector3d;
158158
/** Whether the view is orthographic or perspective */
159159
isOrthographic: boolean;
160160
/** Aspect ratio of the view */
161161
aspectRatio: number;
162162
/** Direction the camera is pointing towards */
163-
direction: vector3d;
163+
direction: Vector3d;
164164
/** Defines 'up' direction relative to camera in the view */
165-
up: vector3d;
165+
up: Vector3d;
166166
/** Near plane distance */
167167
near: number;
168168
/** Far plane distance */
169169
far: number;
170170
/** Earth-Centered, Earth-Fixed transform */
171-
ecefTransform: transform;
171+
ecefTransform: Transform;
172172
};
173173
};
174174
GoogleTilesStyling: {
@@ -184,9 +184,9 @@ export interface ScenesApiSchemas {
184184
/** Global setting to control iModel styling when visualizing the scene in iTwin viewer applications. */
185185
"1.0.0": {
186186
/** Background color */
187-
backgroundColor?: colorDef;
187+
backgroundColor?: ColorDef;
188188
/** Monochrome color */
189-
monochromeColor?: colorDef;
189+
monochromeColor?: ColorDef;
190190
/** Monochrome mode. Flat = 0 and Scaled = 1 */
191191
monochromeMode?: 0 | 1;
192192
/** JSON representation of the view flags for the iTwin */
@@ -250,25 +250,25 @@ export interface ScenesApiSchemas {
250250
lighting?: boolean;
251251
};
252252
hiddenLine?: {
253-
visible?: hiddenLineStyle;
254-
hidden?: hiddenLineStyle;
253+
visible?: HiddenLineStyle;
254+
hidden?: HiddenLineStyle;
255255
transThreshold?: number;
256256
};
257257
appearance?: {
258-
rgb?: rgbColor;
259-
lineRgb?: rgbColor;
258+
rgb?: RgbColor;
259+
lineRgb?: RgbColor;
260260
weight?: number;
261261
transparency?: number;
262262
lineTransparency?: number;
263-
linePixels?: linePixels;
263+
linePixels?: LinePixels;
264264
ignoresMaterial?: boolean;
265265
nonLocatable?: boolean;
266266
emphasized?: boolean;
267267
};
268268
};
269-
insideColor?: rgbColor;
270-
outsideColor?: rgbColor;
271-
intersectionStyle?: { color?: rgbColor; width?: number };
269+
insideColor?: RgbColor;
270+
outsideColor?: RgbColor;
271+
intersectionStyle?: { color?: RgbColor; width?: number };
272272
};
273273
/** Controls how white-on-white reversal is applied to make white geometry more visible in the view.
274274
By default, pure white geometry is displayed as black instead if the backgroundColor is also pure white.
@@ -285,7 +285,7 @@ export interface ScenesApiSchemas {
285285
sunPitch: number;
286286
heliodonLongitude: number;
287287
heliodonLatitude: number;
288-
heliodonDate: dateTime;
288+
heliodonDate: DateTime;
289289
weather: number;
290290
windOrientation: number;
291291
windForce: number;
@@ -302,22 +302,22 @@ export interface ScenesApiSchemas {
302302
stylingOptions?:
303303
| {
304304
styleType: "Expression";
305-
defines?: { [key: string]: expressionString };
306-
show?: expressionOrConditions;
307-
color: expressionOrConditions;
308-
lineWeight?: expressionString;
309-
lineColor?: expressionOrConditions;
305+
defines?: { [key: string]: ExpressionString };
306+
show?: ExpressionOrConditions;
307+
color: ExpressionOrConditions;
308+
lineWeight?: ExpressionString;
309+
lineColor?: ExpressionOrConditions;
310310
}
311311
| {
312312
styleType: "Category";
313313
rules: {
314-
name: safeString;
315-
value: expressionString | number | boolean;
314+
name: SafeString;
315+
value: ExpressionString | number | boolean;
316316
symbology: {
317-
lineColor: colorDef;
318-
fillColor: colorDef;
317+
lineColor: ColorDef;
318+
fillColor: ColorDef;
319319
weight: number;
320-
linePixels?: linePixels;
320+
linePixels?: LinePixels;
321321
};
322322
}[];
323323
};
@@ -327,7 +327,7 @@ export interface ScenesApiSchemas {
327327
/** 4D scheduling simulation for a specific iModel. */
328328
"1.0.0": {
329329
/** The Id of a RenderTimeline element containing a RenderSchedule.Script used to animate the schedule of a specific iModel */
330-
timelineId: id64;
330+
timelineId: Id64;
331331
/** The point in time expressed in seconds in the Unix epoch */
332332
timePoint: number;
333333
};
@@ -337,11 +337,11 @@ export interface ScenesApiSchemas {
337337
"1.0.0": {
338338
/** Object maintaining visibility of categories in an iModel */
339339
categories: {
340-
shownList: compressedId64Set;
341-
hiddenList: compressedId64Set;
340+
shownList: CompressedId64Set;
341+
hiddenList: CompressedId64Set;
342342
};
343343
/** Object maintaining visibility of models in an iModel */
344-
models: { shownList: compressedId64Set; hiddenList: compressedId64Set };
344+
models: { shownList: CompressedId64Set; hiddenList: CompressedId64Set };
345345
/** Matrix used for adjusting the positioning of the iModel */
346346
adjustment?: number[];
347347
/** Quality of iModel rendering */

packages/scenes-client/src/models/object/types/sceneObjectTypes.ts

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Copyright (c) Bentley Systems, Incorporated. All rights reserved.
2-
// THIS FILE HAS BEEN GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT IT DIRECTLY.
32
import type {
43
ResourceStylingObject,
54
ITwinScopedObject,
@@ -194,34 +193,34 @@ export type iModelVisibilityV1 = ResourceStylingObject<
194193
/** Latest iModelVisibility response type. Currently points to 1.0.0. */
195194
export type iModelVisibility = iModelVisibilityV1;
196195

197-
/** Union of all scene object creation types using latest versions. */
198-
export type LatestSceneObjectCreateType =
199-
| CameraAnimationCreate
200-
| CutoutCreate
201-
| LayerCreate
202-
| MaterialDecorationCreate
203-
| MovieCreate
204-
| RepositoryResourceCreate
205-
| View3dCreate
206-
| GoogleTilesStylingCreate
207-
| ITwinDisplayStyleOptionsCreate
208-
| UnrealAtmosphericStylingCreate
209-
| ExpressionStylingCreate
210-
| ScheduleSimulationCreate
211-
| iModelVisibilityCreate;
212-
213-
/** Union of all scene object types using latest versions. */
214-
export type LatestSceneObjectType =
215-
| CameraAnimation
216-
| Cutout
217-
| Layer
218-
| MaterialDecoration
219-
| Movie
220-
| RepositoryResource
221-
| View3d
222-
| GoogleTilesStyling
223-
| ITwinDisplayStyleOptions
224-
| UnrealAtmosphericStyling
225-
| ExpressionStyling
226-
| ScheduleSimulation
227-
| iModelVisibility;
196+
/** Union of all scene object creation types. */
197+
export type SceneObjectCreateType =
198+
| CameraAnimationCreateV1
199+
| CutoutCreateV1
200+
| LayerCreateV1
201+
| MaterialDecorationCreateV1
202+
| MovieCreateV1
203+
| RepositoryResourceCreateV1
204+
| View3dCreateV1
205+
| GoogleTilesStylingCreateV1
206+
| ITwinDisplayStyleOptionsCreateV1
207+
| UnrealAtmosphericStylingCreateV1
208+
| ExpressionStylingCreateV1
209+
| ScheduleSimulationCreateV1
210+
| iModelVisibilityCreateV1;
211+
212+
/** Union of all scene object types */
213+
export type SceneObjectType =
214+
| CameraAnimationV1
215+
| CutoutV1
216+
| LayerV1
217+
| MaterialDecorationV1
218+
| MovieV1
219+
| RepositoryResourceV1
220+
| View3dV1
221+
| GoogleTilesStylingV1
222+
| ITwinDisplayStyleOptionsV1
223+
| UnrealAtmosphericStylingV1
224+
| ExpressionStylingV1
225+
| ScheduleSimulationV1
226+
| iModelVisibilityV1;

0 commit comments

Comments
 (0)