@itwin/core-backend 5.10.0-dev.10 → 5.10.0-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Category.d.ts +4 -4
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts +6 -6
- package/lib/cjs/ChangesetECAdaptor.js +4 -4
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +3 -3
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +2 -2
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/Element.d.ts +10 -10
- package/lib/cjs/Element.js +2 -2
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +5 -5
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +2 -2
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +33 -23
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +32 -20
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +6 -6
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +6 -0
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +23 -0
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/Material.d.ts +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +6 -6
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +10 -10
- package/lib/cjs/Relationship.js +6 -6
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SheetIndex.d.ts +4 -4
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/Texture.d.ts +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +6 -6
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/FrameGeometry.js +2 -3
- package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +2 -2
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts +2 -2
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/HubMock.d.ts +24 -1
- package/lib/cjs/internal/HubMock.d.ts.map +1 -1
- package/lib/cjs/internal/HubMock.js +60 -39
- package/lib/cjs/internal/HubMock.js.map +1 -1
- package/lib/esm/Category.d.ts +4 -4
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts +6 -6
- package/lib/esm/ChangesetECAdaptor.js +4 -4
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +3 -3
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +2 -2
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/Element.d.ts +10 -10
- package/lib/esm/Element.js +2 -2
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +1 -1
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts +5 -5
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/ExternalSource.d.ts +2 -2
- package/lib/esm/ExternalSource.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +33 -23
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +32 -20
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/LineStyle.d.ts +6 -6
- package/lib/esm/LineStyle.js.map +1 -1
- package/lib/esm/LocalHub.d.ts +6 -0
- package/lib/esm/LocalHub.d.ts.map +1 -1
- package/lib/esm/LocalHub.js +23 -0
- package/lib/esm/LocalHub.js.map +1 -1
- package/lib/esm/Material.d.ts +1 -1
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +6 -6
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/Relationship.d.ts +10 -10
- package/lib/esm/Relationship.js +6 -6
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SheetIndex.d.ts +4 -4
- package/lib/esm/SheetIndex.js.map +1 -1
- package/lib/esm/Texture.d.ts +1 -1
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +6 -6
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/FrameGeometry.js +2 -3
- package/lib/esm/annotations/FrameGeometry.js.map +1 -1
- package/lib/esm/domains/FunctionalElements.d.ts +1 -1
- package/lib/esm/domains/FunctionalElements.js.map +1 -1
- package/lib/esm/domains/GenericElements.d.ts +2 -2
- package/lib/esm/domains/GenericElements.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts +2 -2
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/HubMock.d.ts +24 -1
- package/lib/esm/internal/HubMock.d.ts.map +1 -1
- package/lib/esm/internal/HubMock.js +61 -40
- package/lib/esm/internal/HubMock.js.map +1 -1
- package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts +2 -0
- package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts.map +1 -0
- package/lib/esm/test/SchemaChangesetCanBeReversed.test.js +239 -0
- package/lib/esm/test/SchemaChangesetCanBeReversed.test.js.map +1 -0
- package/lib/esm/test/annotations/FrameGeometry.test.js +2 -1
- package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
- package/lib/esm/test/standalone/DeleteElements.test.js +45 -0
- package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -1
- package/package.json +13 -13
package/lib/cjs/LineStyle.d.ts
CHANGED
|
@@ -279,7 +279,7 @@ export declare namespace LineStyleDefinition {
|
|
|
279
279
|
*/
|
|
280
280
|
static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;
|
|
281
281
|
/** Create a file property for a new stroke pattern component.
|
|
282
|
-
* @deprecated in 5.
|
|
282
|
+
* @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createStrokePatternComponent(txn, ...) instead.
|
|
283
283
|
*/
|
|
284
284
|
static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;
|
|
285
285
|
/** Create a file property for a new point symbol component using an explicit EditTxn.
|
|
@@ -289,7 +289,7 @@ export declare namespace LineStyleDefinition {
|
|
|
289
289
|
static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;
|
|
290
290
|
/** Create a file property for a new point symbol component.
|
|
291
291
|
* If base and size parameters are not supplied, queries GeometryPart by id to set them.
|
|
292
|
-
* @deprecated in 5.
|
|
292
|
+
* @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createPointSymbolComponent(txn, ...) instead.
|
|
293
293
|
*/
|
|
294
294
|
static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;
|
|
295
295
|
/** Create a file property for a new stroke point component using an explicit EditTxn.
|
|
@@ -297,7 +297,7 @@ export declare namespace LineStyleDefinition {
|
|
|
297
297
|
*/
|
|
298
298
|
static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;
|
|
299
299
|
/** Create a file property for a new stroke point component.
|
|
300
|
-
* @deprecated in 5.
|
|
300
|
+
* @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createStrokePointComponent(txn, ...) instead.
|
|
301
301
|
*/
|
|
302
302
|
static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;
|
|
303
303
|
/** Create a file property for a new compound component using an explicit EditTxn.
|
|
@@ -305,7 +305,7 @@ export declare namespace LineStyleDefinition {
|
|
|
305
305
|
*/
|
|
306
306
|
static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;
|
|
307
307
|
/** Create a file property for a new compound component.
|
|
308
|
-
* @deprecated in 5.
|
|
308
|
+
* @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createCompoundComponent(txn, ...) instead.
|
|
309
309
|
*/
|
|
310
310
|
static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;
|
|
311
311
|
/** Create a file property for a new raster image component using an explicit EditTxn.
|
|
@@ -313,7 +313,7 @@ export declare namespace LineStyleDefinition {
|
|
|
313
313
|
*/
|
|
314
314
|
static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;
|
|
315
315
|
/** Create a file property for a new raster image component.
|
|
316
|
-
* @deprecated in 5.
|
|
316
|
+
* @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createRasterComponent(txn, ...) instead.
|
|
317
317
|
*/
|
|
318
318
|
static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;
|
|
319
319
|
/** Query for an existing line style with the supplied name. */
|
|
@@ -325,7 +325,7 @@ export declare namespace LineStyleDefinition {
|
|
|
325
325
|
static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;
|
|
326
326
|
/** Insert a new line style with the supplied name.
|
|
327
327
|
* @throws [[IModelError]] if unable to insert the line style definition element.
|
|
328
|
-
* @deprecated in 5.
|
|
328
|
+
* @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createStyle(txn, ...) instead.
|
|
329
329
|
*/
|
|
330
330
|
static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;
|
|
331
331
|
/** Get the name that can be use to query for an existing continuous line style. */
|
package/lib/cjs/LineStyle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+D;AAC/D,oDAAgG;AAChG,uCAAoC;AACpC,uCAAoD;AAEpD,gDAAkD;AAElD,SAAS,qBAAqB,CAAC,UAAsB;IACnD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB;IAClC,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,IAAiB,mBAAmB,CA6dnC;AA7dD,WAAiB,mBAAmB;IAElC,4CAA4C;IAC5C,IAAY,aAaX;IAbD,WAAY,aAAa;QACvB,kEAAkE;QAClE,+DAAe,CAAA;QACf,+DAA+D;QAC/D,yDAAY,CAAA;QACZ,oEAAoE;QACpE,mEAAiB,CAAA;QACjB,kEAAkE;QAClE,+DAAe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MAAM,EAAE,CAAC,CAAC;QACtL,CAAC;QAED;;UAEE;QACK,MAAM,CAAC,sBAAsB,CAAC,UAAsB;YACzD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,OAAO,SAAS,CAAC;YAEnB,OAAO,wBAAwB,QAAQ,EAAE,CAAC;QAC5C,CAAC;QAED;;;;;;WAMG;QACI,MAAM,CAAC,0BAA0B,CAAC,MAAgB,EAAE,YAAwB,EAAE,UAAsB,EAAE,GAAa;YACxH,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;YAEnE,MAAM,IAAI,GAAG,wBAAwB,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,MAAM,CAAC,sBAAY,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjK,CAAC;KACF;IArMY,yBAAK,QAqMjB,CAAA;AACH,CAAC,EA7dgB,mBAAmB,mCAAnB,mBAAmB,QA6dnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\nimport { Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { GeometryPart, LineStyle } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\r\n switch (linePixels) {\r\n case LinePixels.Code1:\r\n return 1;\r\n case LinePixels.Code2:\r\n return 2;\r\n case LinePixels.Code3:\r\n return 3;\r\n case LinePixels.Code4:\r\n return 4;\r\n case LinePixels.Code5:\r\n return 5;\r\n case LinePixels.Code6:\r\n return 6;\r\n case LinePixels.Code7:\r\n return 7;\r\n default:\r\n return -1; // Invalid value...\r\n }\r\n}\r\n\r\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\r\n * There are three varieties of line styles:\r\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\r\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\r\n * - A style that uses a texture.\r\n *\r\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\r\n * by file property id and type and is saved as a dictionary element.\r\n * @public\r\n */\r\nexport namespace LineStyleDefinition {\r\n\r\n /** Line style component type identifiers */\r\n export enum ComponentType {\r\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\r\n PointSymbol = 1,\r\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\r\n Compound = 2,\r\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\r\n StrokePattern = 3,\r\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\r\n StrokePoint = 4,\r\n /** Component type for [[LinePixels]], never saved as a file property */\r\n Internal = 6,\r\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\r\n RasterImage = 7,\r\n }\r\n\r\n /** Mask of values for StrokeMode */\r\n export enum StrokeMode {\r\n /** Stroke represents a blank space */\r\n Gap = 0x00,\r\n /** Stroke represents a solid dash */\r\n Dash = 0x01,\r\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\r\n Ray = 0x02,\r\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\r\n Scale = 0x04,\r\n /** Invert stroke in first stroke pattern */\r\n FirstInvert = 0x08,\r\n /** Invert stroke in last stroke pattern */\r\n LastInvert = 0x10,\r\n }\r\n\r\n /** Define constant width or tapered strokes with distance specified in meters */\r\n export enum StrokeWidth {\r\n /** Stroke draws as one pixel wide line */\r\n None = 0,\r\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\r\n Left = 1,\r\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\r\n Right = 2,\r\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\r\n Full = 3,\r\n }\r\n\r\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\r\n * StrokeCap indicates the number of vectors in the arc.\r\n */\r\n export enum StrokeCap {\r\n /** Stroke displays as a closed polygon */\r\n Closed = 0,\r\n /** Stroke displays lines at specified width instead of a polygon */\r\n Open = 1,\r\n /** Stroke length extended by half the stroke width */\r\n Extended = 2,\r\n /** Stroke end cap is a hexagon */\r\n Hexagon = 3,\r\n /** Stroke end cap is an octagon */\r\n Octagon = 4,\r\n /** Stroke end cap is a decagon */\r\n Decagon = 5,\r\n /** Stroke end cap is an arc */\r\n Arc = 30,\r\n }\r\n\r\n /** A stroke representing either a dash or gap in a stroke pattern */\r\n export interface StrokeProps {\r\n /** Length of stroke in meters */\r\n length: number;\r\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\r\n orgWidth?: number;\r\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\r\n endWidth?: number;\r\n /** Type and behavior of stroke */\r\n strokeMode?: StrokeMode;\r\n /** How to apply orgWidth and endWidth to stroke */\r\n widthMode?: StrokeWidth;\r\n /** Appearance of stroke end cap */\r\n capMode?: StrokeCap;\r\n }\r\n\r\n export type Strokes = StrokeProps[];\r\n\r\n /** Options to control how stroke pattern is applied to underlying curve */\r\n export enum StrokePatternOptions {\r\n /** Use default stroke behavior */\r\n None = 0x00,\r\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\r\n AutoPhase = 0x01,\r\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\r\n Iteration = 0x08,\r\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\r\n Segment = 0x10,\r\n /** Center the line style and stretch the ends */\r\n CenterStretch = 0x20,\r\n }\r\n\r\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\r\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\r\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\r\n */\r\n export interface StrokePatternProps {\r\n /** Name for this stroke pattern */\r\n descr: string;\r\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\r\n phase?: number;\r\n /** Options mask for this stroke pattern */\r\n options?: StrokePatternOptions;\r\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\r\n maxIter?: number;\r\n /** Array of strokes, maximum number that will be used is 32 */\r\n strokes: Strokes;\r\n }\r\n\r\n /** Flags to identify point symbol behavior */\r\n export enum PointSymbolFlags {\r\n /** Default symbol behavior */\r\n None = 0x0,\r\n /** Symbol includes 3d geometry */\r\n Is3d = 0x01,\r\n /** Symbol does not allow scaling */\r\n NoScale = 0x02,\r\n }\r\n\r\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\r\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\r\n */\r\n export interface PointSymbolProps {\r\n /** GeometryPart Id to use as a pattern symbol */\r\n geomPartId: Id64String;\r\n /** GeometryPart.bbox.low.x */\r\n baseX?: number;\r\n /** GeometryPart.bbox.low.y */\r\n baseY?: number;\r\n /** GeometryPart.bbox.low.z */\r\n baseZ?: number;\r\n /** GeometryPart.bbox.high.x */\r\n sizeX?: number;\r\n /** GeometryPart.bbox.high.y */\r\n sizeY?: number;\r\n /** GeometryPart.bbox.high.z */\r\n sizeZ?: number;\r\n /** Symbol behavior flags */\r\n symFlags?: PointSymbolFlags;\r\n /** Symbol scale, defaults to 1 */\r\n scale?: number;\r\n }\r\n\r\n /** Symbol options for location, orientation, and behavior */\r\n export enum SymbolOptions {\r\n /** No point symbol */\r\n None = 0x00,\r\n /** Symbol at origin of stroke */\r\n Origin = 0x01,\r\n /** Symbol at end of stroke */\r\n End = 0x02,\r\n /** symbol at center of stroke */\r\n Center = 0x03,\r\n /** Symbol at curve start point */\r\n CurveOrigin = 0x0004,\r\n /** Symbol at curve end point */\r\n CurveEnd = 0x0008,\r\n /** Symbol at each vertex */\r\n CurveVertex = 0x0010,\r\n /** Adjust symbol rotation left->right */\r\n AdjustRotation = 0x0020,\r\n /** Angle of symbol not relative to stroke direction */\r\n AbsoluteRotation = 0x0040,\r\n /** No scale on variable strokes */\r\n NoScale = 0x0100,\r\n /** No clip on partial strokes */\r\n NoClip = 0x0200,\r\n /** No partial strokes */\r\n NoPartial = 0x0400,\r\n /** Project partial origin */\r\n ProjectOrigin = 0x0800,\r\n /** Use color from symbol instead of inheriting curve color */\r\n UseColor = 0x4000,\r\n /** Use weight from symbol instead of inheriting curve weight */\r\n UseWeight = 0x8000,\r\n }\r\n\r\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\r\n export interface SymbolProps {\r\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\r\n symId: number;\r\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\r\n symType?: ComponentType;\r\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\r\n strokeNum?: number;\r\n /** Symbol x offset distance in meters */\r\n xOffset?: number;\r\n /** Symbol y offset distance in meters */\r\n yOffset?: number;\r\n /** Symbol rotation in radians */\r\n angle?: number;\r\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\r\n mod1?: SymbolOptions;\r\n }\r\n\r\n export type Symbols = SymbolProps[];\r\n\r\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\r\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\r\n */\r\n export interface StrokePointProps {\r\n /** Name for this stroke point component */\r\n descr: string;\r\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\r\n lcId: number;\r\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\r\n lcType?: ComponentType;\r\n /** Array of symbols */\r\n symbols: Symbols;\r\n }\r\n\r\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\r\n * A raster component identifies a texture for a line style.\r\n */\r\n export interface RasterImageProps {\r\n /** Name for this raster image component */\r\n descr: string;\r\n /** Raster width */\r\n x: number;\r\n /** Raster height */\r\n y: number;\r\n /** True width flag */\r\n trueWidth?: number;\r\n /** Raster flags */\r\n flags?: number;\r\n /** The file property id of raster image */\r\n imageId?: number;\r\n }\r\n\r\n /** Identifies a component by file property id and type */\r\n export interface ComponentProps {\r\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\r\n id: number;\r\n /** The type of component for specified file property id */\r\n type: ComponentType;\r\n /** Offset distance for this component, default is 0 */\r\n offset?: number;\r\n }\r\n\r\n export type Components = ComponentProps[];\r\n\r\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\r\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\r\n */\r\n export interface CompoundProps {\r\n comps: Components;\r\n }\r\n\r\n /** Flags to describe a style or control style behavior */\r\n export enum StyleFlags {\r\n /** Use defaults */\r\n None = 0x00,\r\n /** Only snap to center line and not individual strokes and symbols of line style */\r\n NoSnap = 0x04,\r\n /** Style represents a continuous line with width (determined by looking at components if not set) */\r\n Continuous = 0x08,\r\n /** Style represents physical geometry and should be scaled as such */\r\n Physical = 0x80,\r\n }\r\n\r\n /** The line style definition element data */\r\n export interface StyleProps {\r\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\r\n compId: number;\r\n /** The type of component for specified file property id */\r\n compType: ComponentType;\r\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\r\n flags?: StyleFlags;\r\n /** Style scale, defaults to 1 */\r\n unitDef?: number;\r\n }\r\n\r\n /** Helper methods for creating and querying line styles */\r\n export class Utils {\r\n /** Create a file property for a new stroke pattern component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;\r\n /** Create a file property for a new stroke pattern component.\r\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStrokePatternComponent(txn, ...) instead.\r\n */\r\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;\r\n public static createStrokePatternComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePatternProps): StyleProps {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\r\n }\r\n\r\n /** Create a file property for a new point symbol component using an explicit EditTxn.\r\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\r\n * @beta\r\n */\r\n public static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;\r\n /** Create a file property for a new point symbol component.\r\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\r\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createPointSymbolComponent(txn, ...) instead.\r\n */\r\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;\r\n public static createPointSymbolComponent(txnOrIModel: EditTxn | IModelDb, props: PointSymbolProps): StyleProps | undefined {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const iModel = txn.iModel;\r\n // if part extents weren't supplied, set them up now.\r\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\r\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\r\n if (!geomPart)\r\n return undefined;\r\n\r\n props.baseX = geomPart.bbox.low.x;\r\n props.baseY = geomPart.bbox.low.y;\r\n props.baseZ = geomPart.bbox.low.z;\r\n\r\n props.sizeX = geomPart.bbox.high.x;\r\n props.sizeY = geomPart.bbox.high.y;\r\n props.sizeZ = geomPart.bbox.high.z;\r\n }\r\n\r\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\r\n }\r\n\r\n /** Create a file property for a new stroke point component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;\r\n /** Create a file property for a new stroke point component.\r\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStrokePointComponent(txn, ...) instead.\r\n */\r\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;\r\n public static createStrokePointComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePointProps): StyleProps {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\r\n }\r\n\r\n /** Create a file property for a new compound component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;\r\n /** Create a file property for a new compound component.\r\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createCompoundComponent(txn, ...) instead.\r\n */\r\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;\r\n public static createCompoundComponent(txnOrIModel: EditTxn | IModelDb, props: CompoundProps): StyleProps {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.Compound };\r\n }\r\n\r\n /** Create a file property for a new raster image component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\r\n /** Create a file property for a new raster image component.\r\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createRasterComponent(txn, ...) instead.\r\n */\r\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\r\n public static createRasterComponent(txnOrIModel: EditTxn | IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const iModel = txn.iModel;\r\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\r\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\r\n txn.saveFileProperty(rasterFileProps, undefined, image);\r\n props.imageId = rasterFileProps.id;\r\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\r\n }\r\n\r\n /** Query for an existing line style with the supplied name. */\r\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\r\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\r\n }\r\n\r\n /** Insert a new line style with the supplied name using an explicit EditTxn.\r\n * @throws [[IModelError]] if unable to insert the line style definition element.\r\n * @beta\r\n */\r\n public static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\r\n /** Insert a new line style with the supplied name.\r\n * @throws [[IModelError]] if unable to insert the line style definition element.\r\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStyle(txn, ...) instead.\r\n */\r\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\r\n public static createStyle(txnOrIModel: EditTxn | IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const imodel = txn.iModel;\r\n if (undefined === props.flags)\r\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\r\n\r\n const lsProps: LineStyleProps = {\r\n classFullName: \"BisCore:LineStyle\",\r\n model: scopeModelId,\r\n code: LineStyle.createCode(imodel, scopeModelId, name),\r\n data: JSON.stringify(props),\r\n };\r\n\r\n return txn.insertElement(lsProps);\r\n }\r\n\r\n /** Get the name that can be use to query for an existing continuous line style. */\r\n public static getContinuousStyleName(width?: number): string {\r\n if (width === undefined)\r\n return \"Continuous\";\r\n\r\n return `Continuous-${width}`;\r\n }\r\n\r\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\r\n * There are 2 ways to define a continuous line style:\r\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\r\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\r\n * - Width is specified in the style.\r\n * - Defined using a single stroke component that is a long dash.\r\n * @param txn Optional explicit EditTxn to use if the style must be created.\r\n * @throws [[IModelError]] if unable to insert the line style definition element.\r\n * @beta\r\n */\r\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number, txn?: EditTxn): Id64String {\r\n const writeTxn = txn ?? imodel[_implicitTxn];\r\n const name = this.getContinuousStyleName(width);\r\n const lsId = this.queryStyle(imodel, scopeModelId, name);\r\n if (undefined !== lsId)\r\n return lsId;\r\n\r\n if (width === undefined)\r\n return this.createStyle(writeTxn, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\r\n\r\n const strokePatternData = this.createStrokePatternComponent(writeTxn, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\r\n if (undefined === strokePatternData)\r\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\r\n\r\n return this.createStyle(writeTxn, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\r\n }\r\n\r\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\r\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\r\n */\r\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\r\n const lineCode = getLinePixelsLineCode(linePixels);\r\n if (-1 === lineCode)\r\n return undefined;\r\n\r\n return `LinePixelsCodeNumber-${lineCode}`;\r\n }\r\n\r\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\r\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\r\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\r\n * @param txn Optional explicit EditTxn to use if the style must be created.\r\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\r\n * @beta\r\n */\r\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels, txn?: EditTxn): Id64String {\r\n const lineCode = getLinePixelsLineCode(linePixels);\r\n if (-1 === lineCode)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\r\n\r\n const name = `LinePixelsCodeNumber-${lineCode}`;\r\n const lsId = this.queryStyle(imodel, scopeModelId, name);\r\n return (undefined === lsId ? this.createStyle(txn ?? imodel[_implicitTxn], scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":";AAA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,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;YAEnE,MAAM,IAAI,GAAG,wBAAwB,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,MAAM,CAAC,sBAAY,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjK,CAAC;KACF;IArMY,yBAAK,QAqMjB,CAAA;AACH,CAAC,EA7dgB,mBAAmB,mCAAnB,mBAAmB,QA6dnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\nimport { Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { GeometryPart, LineStyle } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\r\n switch (linePixels) {\r\n case LinePixels.Code1:\r\n return 1;\r\n case LinePixels.Code2:\r\n return 2;\r\n case LinePixels.Code3:\r\n return 3;\r\n case LinePixels.Code4:\r\n return 4;\r\n case LinePixels.Code5:\r\n return 5;\r\n case LinePixels.Code6:\r\n return 6;\r\n case LinePixels.Code7:\r\n return 7;\r\n default:\r\n return -1; // Invalid value...\r\n }\r\n}\r\n\r\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\r\n * There are three varieties of line styles:\r\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\r\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\r\n * - A style that uses a texture.\r\n *\r\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\r\n * by file property id and type and is saved as a dictionary element.\r\n * @public\r\n */\r\nexport namespace LineStyleDefinition {\r\n\r\n /** Line style component type identifiers */\r\n export enum ComponentType {\r\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\r\n PointSymbol = 1,\r\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\r\n Compound = 2,\r\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\r\n StrokePattern = 3,\r\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\r\n StrokePoint = 4,\r\n /** Component type for [[LinePixels]], never saved as a file property */\r\n Internal = 6,\r\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\r\n RasterImage = 7,\r\n }\r\n\r\n /** Mask of values for StrokeMode */\r\n export enum StrokeMode {\r\n /** Stroke represents a blank space */\r\n Gap = 0x00,\r\n /** Stroke represents a solid dash */\r\n Dash = 0x01,\r\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\r\n Ray = 0x02,\r\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\r\n Scale = 0x04,\r\n /** Invert stroke in first stroke pattern */\r\n FirstInvert = 0x08,\r\n /** Invert stroke in last stroke pattern */\r\n LastInvert = 0x10,\r\n }\r\n\r\n /** Define constant width or tapered strokes with distance specified in meters */\r\n export enum StrokeWidth {\r\n /** Stroke draws as one pixel wide line */\r\n None = 0,\r\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\r\n Left = 1,\r\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\r\n Right = 2,\r\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\r\n Full = 3,\r\n }\r\n\r\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\r\n * StrokeCap indicates the number of vectors in the arc.\r\n */\r\n export enum StrokeCap {\r\n /** Stroke displays as a closed polygon */\r\n Closed = 0,\r\n /** Stroke displays lines at specified width instead of a polygon */\r\n Open = 1,\r\n /** Stroke length extended by half the stroke width */\r\n Extended = 2,\r\n /** Stroke end cap is a hexagon */\r\n Hexagon = 3,\r\n /** Stroke end cap is an octagon */\r\n Octagon = 4,\r\n /** Stroke end cap is a decagon */\r\n Decagon = 5,\r\n /** Stroke end cap is an arc */\r\n Arc = 30,\r\n }\r\n\r\n /** A stroke representing either a dash or gap in a stroke pattern */\r\n export interface StrokeProps {\r\n /** Length of stroke in meters */\r\n length: number;\r\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\r\n orgWidth?: number;\r\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\r\n endWidth?: number;\r\n /** Type and behavior of stroke */\r\n strokeMode?: StrokeMode;\r\n /** How to apply orgWidth and endWidth to stroke */\r\n widthMode?: StrokeWidth;\r\n /** Appearance of stroke end cap */\r\n capMode?: StrokeCap;\r\n }\r\n\r\n export type Strokes = StrokeProps[];\r\n\r\n /** Options to control how stroke pattern is applied to underlying curve */\r\n export enum StrokePatternOptions {\r\n /** Use default stroke behavior */\r\n None = 0x00,\r\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\r\n AutoPhase = 0x01,\r\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\r\n Iteration = 0x08,\r\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\r\n Segment = 0x10,\r\n /** Center the line style and stretch the ends */\r\n CenterStretch = 0x20,\r\n }\r\n\r\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\r\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\r\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\r\n */\r\n export interface StrokePatternProps {\r\n /** Name for this stroke pattern */\r\n descr: string;\r\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\r\n phase?: number;\r\n /** Options mask for this stroke pattern */\r\n options?: StrokePatternOptions;\r\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\r\n maxIter?: number;\r\n /** Array of strokes, maximum number that will be used is 32 */\r\n strokes: Strokes;\r\n }\r\n\r\n /** Flags to identify point symbol behavior */\r\n export enum PointSymbolFlags {\r\n /** Default symbol behavior */\r\n None = 0x0,\r\n /** Symbol includes 3d geometry */\r\n Is3d = 0x01,\r\n /** Symbol does not allow scaling */\r\n NoScale = 0x02,\r\n }\r\n\r\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\r\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\r\n */\r\n export interface PointSymbolProps {\r\n /** GeometryPart Id to use as a pattern symbol */\r\n geomPartId: Id64String;\r\n /** GeometryPart.bbox.low.x */\r\n baseX?: number;\r\n /** GeometryPart.bbox.low.y */\r\n baseY?: number;\r\n /** GeometryPart.bbox.low.z */\r\n baseZ?: number;\r\n /** GeometryPart.bbox.high.x */\r\n sizeX?: number;\r\n /** GeometryPart.bbox.high.y */\r\n sizeY?: number;\r\n /** GeometryPart.bbox.high.z */\r\n sizeZ?: number;\r\n /** Symbol behavior flags */\r\n symFlags?: PointSymbolFlags;\r\n /** Symbol scale, defaults to 1 */\r\n scale?: number;\r\n }\r\n\r\n /** Symbol options for location, orientation, and behavior */\r\n export enum SymbolOptions {\r\n /** No point symbol */\r\n None = 0x00,\r\n /** Symbol at origin of stroke */\r\n Origin = 0x01,\r\n /** Symbol at end of stroke */\r\n End = 0x02,\r\n /** symbol at center of stroke */\r\n Center = 0x03,\r\n /** Symbol at curve start point */\r\n CurveOrigin = 0x0004,\r\n /** Symbol at curve end point */\r\n CurveEnd = 0x0008,\r\n /** Symbol at each vertex */\r\n CurveVertex = 0x0010,\r\n /** Adjust symbol rotation left->right */\r\n AdjustRotation = 0x0020,\r\n /** Angle of symbol not relative to stroke direction */\r\n AbsoluteRotation = 0x0040,\r\n /** No scale on variable strokes */\r\n NoScale = 0x0100,\r\n /** No clip on partial strokes */\r\n NoClip = 0x0200,\r\n /** No partial strokes */\r\n NoPartial = 0x0400,\r\n /** Project partial origin */\r\n ProjectOrigin = 0x0800,\r\n /** Use color from symbol instead of inheriting curve color */\r\n UseColor = 0x4000,\r\n /** Use weight from symbol instead of inheriting curve weight */\r\n UseWeight = 0x8000,\r\n }\r\n\r\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\r\n export interface SymbolProps {\r\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\r\n symId: number;\r\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\r\n symType?: ComponentType;\r\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\r\n strokeNum?: number;\r\n /** Symbol x offset distance in meters */\r\n xOffset?: number;\r\n /** Symbol y offset distance in meters */\r\n yOffset?: number;\r\n /** Symbol rotation in radians */\r\n angle?: number;\r\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\r\n mod1?: SymbolOptions;\r\n }\r\n\r\n export type Symbols = SymbolProps[];\r\n\r\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\r\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\r\n */\r\n export interface StrokePointProps {\r\n /** Name for this stroke point component */\r\n descr: string;\r\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\r\n lcId: number;\r\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\r\n lcType?: ComponentType;\r\n /** Array of symbols */\r\n symbols: Symbols;\r\n }\r\n\r\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\r\n * A raster component identifies a texture for a line style.\r\n */\r\n export interface RasterImageProps {\r\n /** Name for this raster image component */\r\n descr: string;\r\n /** Raster width */\r\n x: number;\r\n /** Raster height */\r\n y: number;\r\n /** True width flag */\r\n trueWidth?: number;\r\n /** Raster flags */\r\n flags?: number;\r\n /** The file property id of raster image */\r\n imageId?: number;\r\n }\r\n\r\n /** Identifies a component by file property id and type */\r\n export interface ComponentProps {\r\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\r\n id: number;\r\n /** The type of component for specified file property id */\r\n type: ComponentType;\r\n /** Offset distance for this component, default is 0 */\r\n offset?: number;\r\n }\r\n\r\n export type Components = ComponentProps[];\r\n\r\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\r\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\r\n */\r\n export interface CompoundProps {\r\n comps: Components;\r\n }\r\n\r\n /** Flags to describe a style or control style behavior */\r\n export enum StyleFlags {\r\n /** Use defaults */\r\n None = 0x00,\r\n /** Only snap to center line and not individual strokes and symbols of line style */\r\n NoSnap = 0x04,\r\n /** Style represents a continuous line with width (determined by looking at components if not set) */\r\n Continuous = 0x08,\r\n /** Style represents physical geometry and should be scaled as such */\r\n Physical = 0x80,\r\n }\r\n\r\n /** The line style definition element data */\r\n export interface StyleProps {\r\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\r\n compId: number;\r\n /** The type of component for specified file property id */\r\n compType: ComponentType;\r\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\r\n flags?: StyleFlags;\r\n /** Style scale, defaults to 1 */\r\n unitDef?: number;\r\n }\r\n\r\n /** Helper methods for creating and querying line styles */\r\n export class Utils {\r\n /** Create a file property for a new stroke pattern component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;\r\n /** Create a file property for a new stroke pattern component.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createStrokePatternComponent(txn, ...) instead.\r\n */\r\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;\r\n public static createStrokePatternComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePatternProps): StyleProps {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\r\n }\r\n\r\n /** Create a file property for a new point symbol component using an explicit EditTxn.\r\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\r\n * @beta\r\n */\r\n public static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;\r\n /** Create a file property for a new point symbol component.\r\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createPointSymbolComponent(txn, ...) instead.\r\n */\r\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;\r\n public static createPointSymbolComponent(txnOrIModel: EditTxn | IModelDb, props: PointSymbolProps): StyleProps | undefined {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const iModel = txn.iModel;\r\n // if part extents weren't supplied, set them up now.\r\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\r\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\r\n if (!geomPart)\r\n return undefined;\r\n\r\n props.baseX = geomPart.bbox.low.x;\r\n props.baseY = geomPart.bbox.low.y;\r\n props.baseZ = geomPart.bbox.low.z;\r\n\r\n props.sizeX = geomPart.bbox.high.x;\r\n props.sizeY = geomPart.bbox.high.y;\r\n props.sizeZ = geomPart.bbox.high.z;\r\n }\r\n\r\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\r\n }\r\n\r\n /** Create a file property for a new stroke point component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;\r\n /** Create a file property for a new stroke point component.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createStrokePointComponent(txn, ...) instead.\r\n */\r\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;\r\n public static createStrokePointComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePointProps): StyleProps {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\r\n }\r\n\r\n /** Create a file property for a new compound component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;\r\n /** Create a file property for a new compound component.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createCompoundComponent(txn, ...) instead.\r\n */\r\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;\r\n public static createCompoundComponent(txnOrIModel: EditTxn | IModelDb, props: CompoundProps): StyleProps {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.Compound };\r\n }\r\n\r\n /** Create a file property for a new raster image component using an explicit EditTxn.\r\n * @beta\r\n */\r\n public static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\r\n /** Create a file property for a new raster image component.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createRasterComponent(txn, ...) instead.\r\n */\r\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\r\n public static createRasterComponent(txnOrIModel: EditTxn | IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const iModel = txn.iModel;\r\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\r\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\r\n txn.saveFileProperty(rasterFileProps, undefined, image);\r\n props.imageId = rasterFileProps.id;\r\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\r\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\r\n txn.saveFileProperty(fileProps, JSON.stringify(props));\r\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\r\n }\r\n\r\n /** Query for an existing line style with the supplied name. */\r\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\r\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\r\n }\r\n\r\n /** Insert a new line style with the supplied name using an explicit EditTxn.\r\n * @throws [[IModelError]] if unable to insert the line style definition element.\r\n * @beta\r\n */\r\n public static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\r\n /** Insert a new line style with the supplied name.\r\n * @throws [[IModelError]] if unable to insert the line style definition element.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use createStyle(txn, ...) instead.\r\n */\r\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\r\n public static createStyle(txnOrIModel: EditTxn | IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\r\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\r\n const imodel = txn.iModel;\r\n if (undefined === props.flags)\r\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\r\n\r\n const lsProps: LineStyleProps = {\r\n classFullName: \"BisCore:LineStyle\",\r\n model: scopeModelId,\r\n code: LineStyle.createCode(imodel, scopeModelId, name),\r\n data: JSON.stringify(props),\r\n };\r\n\r\n return txn.insertElement(lsProps);\r\n }\r\n\r\n /** Get the name that can be use to query for an existing continuous line style. */\r\n public static getContinuousStyleName(width?: number): string {\r\n if (width === undefined)\r\n return \"Continuous\";\r\n\r\n return `Continuous-${width}`;\r\n }\r\n\r\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\r\n * There are 2 ways to define a continuous line style:\r\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\r\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\r\n * - Width is specified in the style.\r\n * - Defined using a single stroke component that is a long dash.\r\n * @param txn Optional explicit EditTxn to use if the style must be created.\r\n * @throws [[IModelError]] if unable to insert the line style definition element.\r\n * @beta\r\n */\r\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number, txn?: EditTxn): Id64String {\r\n const writeTxn = txn ?? imodel[_implicitTxn];\r\n const name = this.getContinuousStyleName(width);\r\n const lsId = this.queryStyle(imodel, scopeModelId, name);\r\n if (undefined !== lsId)\r\n return lsId;\r\n\r\n if (width === undefined)\r\n return this.createStyle(writeTxn, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\r\n\r\n const strokePatternData = this.createStrokePatternComponent(writeTxn, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\r\n if (undefined === strokePatternData)\r\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\r\n\r\n return this.createStyle(writeTxn, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\r\n }\r\n\r\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\r\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\r\n */\r\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\r\n const lineCode = getLinePixelsLineCode(linePixels);\r\n if (-1 === lineCode)\r\n return undefined;\r\n\r\n return `LinePixelsCodeNumber-${lineCode}`;\r\n }\r\n\r\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\r\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\r\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\r\n * @param txn Optional explicit EditTxn to use if the style must be created.\r\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\r\n * @beta\r\n */\r\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels, txn?: EditTxn): Id64String {\r\n const lineCode = getLinePixelsLineCode(linePixels);\r\n if (-1 === lineCode)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\r\n\r\n const name = `LinePixelsCodeNumber-${lineCode}`;\r\n const lsId = this.queryStyle(imodel, scopeModelId, name);\r\n return (undefined === lsId ? this.createStyle(txn ?? imodel[_implicitTxn], scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\r\n }\r\n }\r\n}\r\n"]}
|
package/lib/cjs/LocalHub.d.ts
CHANGED
|
@@ -109,6 +109,12 @@ export declare class LocalHub {
|
|
|
109
109
|
getCheckpoints(range?: ChangesetRange): ChangesetIndex[];
|
|
110
110
|
/** Find the checkpoint that is no newer than a changesetIndex */
|
|
111
111
|
queryPreviousCheckpoint(changesetIndex: ChangesetIndex): ChangesetIndex;
|
|
112
|
+
/**
|
|
113
|
+
* Find the checkpoint nearest to `changesetIndex` (searching both backward and forward).
|
|
114
|
+
* When the previous and next checkpoints are equidistant, the newer (next) checkpoint is preferred,
|
|
115
|
+
* which enables the tip-then-reverse download path in [[V2CheckpointManager]].
|
|
116
|
+
*/
|
|
117
|
+
queryNearestCheckpoint(changesetIndex: ChangesetIndex): ChangesetIndex;
|
|
112
118
|
/** "download" a checkpoint */
|
|
113
119
|
downloadCheckpoint(arg: {
|
|
114
120
|
changeset: ChangesetIndexOrId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalHub.d.ts","sourceRoot":"","sources":["../../src/LocalHub.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,UAAU,EAAE,UAAU,EAA2C,MAAM,qBAAqB,CAAC;AACxH,OAAO,EACL,WAAW,EAAoB,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EACxI,cAAc,EAAe,YAAY,EAAE,aAAa,EAAE,SAAS,EACpE,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAgB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQtF,gBAAgB;AAChB,UAAU,oBAAoB;IAC5B,EAAE,EAAE,WAAW,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,gBAAgB;AAChB,UAAU,aAAa;IACrB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;CACzB;AAED,UAAU,+BAA+B;IACvC,kCAAkC,CAAC,EAAE,cAAc,CAAC;IACpD,+BAA+B,CAAC,EAAE,cAAc,CAAC;CAClD;AAED,UAAU,UAAW,SAAQ,+BAA+B;IAC1D,EAAE,EAAE,UAAU,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC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B;IAW/D,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,uBAAuB;IAMhE,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE;QAAE,WAAW,EAAE,WAAW,CAAC;QAAC,cAAc,EAAE,cAAc,CAAA;KAAE;IAMlG,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc;IAMhD,eAAe,CAAC,GAAG,EAAE;QAAE,WAAW,EAAE,WAAW,CAAC;QAAC,cAAc,EAAE,cAAc,CAAA;KAAE;IAKjF,eAAe,CAAC,GAAG,EAAE,cAAc;IAM1C,OAAO,CAAC,UAAU;IAQX,gBAAgB,IAAI,MAAM;IAE1B,UAAU,IAAI,MAAM;IAGpB,mBAAmB,IAAI;QAAE,EAAE,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,WAAW,CAAA;KAAE,EAAE;IAUrE,UAAU,IAAI,UAAU,EAAE;IAe1B,SAAS,CAAC,OAAO,EAAE,MAAM;IAOzB,OAAO;CAaf"}
|
package/lib/cjs/LocalHub.js
CHANGED
|
@@ -331,6 +331,29 @@ class LocalHub {
|
|
|
331
331
|
return stmt.getValueInteger(0);
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Find the checkpoint nearest to `changesetIndex` (searching both backward and forward).
|
|
336
|
+
* When the previous and next checkpoints are equidistant, the newer (next) checkpoint is preferred,
|
|
337
|
+
* which enables the tip-then-reverse download path in [[V2CheckpointManager]].
|
|
338
|
+
*/
|
|
339
|
+
queryNearestCheckpoint(changesetIndex) {
|
|
340
|
+
const prev = this.queryPreviousCheckpoint(changesetIndex); // always ≥ 0; returns 0 when none found
|
|
341
|
+
const next = this.db.withSqliteStatement("SELECT min(csIndex) FROM checkpoints WHERE csIndex >= ?", (stmt) => {
|
|
342
|
+
stmt.bindInteger(1, changesetIndex);
|
|
343
|
+
stmt.step();
|
|
344
|
+
const val = stmt.getValue(0);
|
|
345
|
+
return val.isNull ? undefined : val.getInteger();
|
|
346
|
+
});
|
|
347
|
+
if (next === undefined)
|
|
348
|
+
return prev; // no checkpoint at or after requested index
|
|
349
|
+
if (next === prev)
|
|
350
|
+
return prev; // exact match
|
|
351
|
+
// Prefer the newer (next) checkpoint when equidistant so that CheckpointManager
|
|
352
|
+
// will reverse from a tip checkpoint rather than apply from an old seed.
|
|
353
|
+
const distPrev = changesetIndex - prev;
|
|
354
|
+
const distNext = next - changesetIndex;
|
|
355
|
+
return distNext <= distPrev ? next : prev;
|
|
356
|
+
}
|
|
334
357
|
/** "download" a checkpoint */
|
|
335
358
|
downloadCheckpoint(arg) {
|
|
336
359
|
const index = this.getIndexFromChangeset(arg.changeset);
|