@mlightcad/data-model 1.3.3 → 1.3.4
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/dist/data-model.cjs +5 -0
- package/dist/data-model.js +25523 -0
- package/dist/dxf-parser-worker.js +1715 -0
- package/lib/base/AcDbHostApplicationServices.d.ts +96 -0
- package/lib/base/AcDbHostApplicationServices.d.ts.map +1 -0
- package/lib/base/AcDbHostApplicationServices.js +118 -0
- package/lib/base/AcDbHostApplicationServices.js.map +1 -0
- package/lib/base/AcDbObject.d.ts +205 -0
- package/lib/base/AcDbObject.d.ts.map +1 -0
- package/lib/base/AcDbObject.js +236 -0
- package/lib/base/AcDbObject.js.map +1 -0
- package/lib/base/index.d.ts +3 -0
- package/lib/base/index.d.ts.map +1 -0
- package/lib/base/index.js +3 -0
- package/lib/base/index.js.map +1 -0
- package/lib/converter/AcDbBatchProcessing.d.ts +146 -0
- package/lib/converter/AcDbBatchProcessing.d.ts.map +1 -0
- package/lib/converter/AcDbBatchProcessing.js +272 -0
- package/lib/converter/AcDbBatchProcessing.js.map +1 -0
- package/lib/converter/AcDbDxfConverter.d.ts +272 -0
- package/lib/converter/AcDbDxfConverter.d.ts.map +1 -0
- package/lib/converter/AcDbDxfConverter.js +874 -0
- package/lib/converter/AcDbDxfConverter.js.map +1 -0
- package/lib/converter/AcDbDxfParser.d.ts +23 -0
- package/lib/converter/AcDbDxfParser.d.ts.map +1 -0
- package/lib/converter/AcDbDxfParser.js +85 -0
- package/lib/converter/AcDbDxfParser.js.map +1 -0
- package/lib/converter/AcDbEntitiyConverter.d.ts +159 -0
- package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -0
- package/lib/converter/AcDbEntitiyConverter.js +659 -0
- package/lib/converter/AcDbEntitiyConverter.js.map +1 -0
- package/lib/converter/AcDbObjectConverter.d.ts +61 -0
- package/lib/converter/AcDbObjectConverter.d.ts.map +1 -0
- package/lib/converter/AcDbObjectConverter.js +91 -0
- package/lib/converter/AcDbObjectConverter.js.map +1 -0
- package/lib/converter/AcDbRegenerator.d.ts +101 -0
- package/lib/converter/AcDbRegenerator.d.ts.map +1 -0
- package/lib/converter/AcDbRegenerator.js +334 -0
- package/lib/converter/AcDbRegenerator.js.map +1 -0
- package/lib/converter/index.d.ts +5 -0
- package/lib/converter/index.d.ts.map +1 -0
- package/lib/converter/index.js +5 -0
- package/lib/converter/index.js.map +1 -0
- package/lib/converter/worker/AcDbBaseWorker.d.ts +36 -0
- package/lib/converter/worker/AcDbBaseWorker.d.ts.map +1 -0
- package/lib/converter/worker/AcDbBaseWorker.js +93 -0
- package/lib/converter/worker/AcDbBaseWorker.js.map +1 -0
- package/lib/converter/worker/AcDbDxfParserWorker.d.ts +11 -0
- package/lib/converter/worker/AcDbDxfParserWorker.d.ts.map +1 -0
- package/lib/converter/worker/AcDbDxfParserWorker.js +75 -0
- package/lib/converter/worker/AcDbDxfParserWorker.js.map +1 -0
- package/lib/converter/worker/AcDbWorkerManager.d.ts +107 -0
- package/lib/converter/worker/AcDbWorkerManager.d.ts.map +1 -0
- package/lib/converter/worker/AcDbWorkerManager.js +360 -0
- package/lib/converter/worker/AcDbWorkerManager.js.map +1 -0
- package/lib/converter/worker/index.d.ts +3 -0
- package/lib/converter/worker/index.d.ts.map +1 -0
- package/lib/converter/worker/index.js +3 -0
- package/lib/converter/worker/index.js.map +1 -0
- package/lib/database/AcDbBlockTable.d.ts +56 -0
- package/lib/database/AcDbBlockTable.d.ts.map +1 -0
- package/lib/database/AcDbBlockTable.js +98 -0
- package/lib/database/AcDbBlockTable.js.map +1 -0
- package/lib/database/AcDbBlockTableRecord.d.ts +185 -0
- package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbBlockTableRecord.js +261 -0
- package/lib/database/AcDbBlockTableRecord.js.map +1 -0
- package/lib/database/AcDbDatabase.d.ts +563 -0
- package/lib/database/AcDbDatabase.d.ts.map +1 -0
- package/lib/database/AcDbDatabase.js +842 -0
- package/lib/database/AcDbDatabase.js.map +1 -0
- package/lib/database/AcDbDatabaseConverter.d.ts +292 -0
- package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -0
- package/lib/database/AcDbDatabaseConverter.js +448 -0
- package/lib/database/AcDbDatabaseConverter.js.map +1 -0
- package/lib/database/AcDbDatabaseConverterManager.d.ts +141 -0
- package/lib/database/AcDbDatabaseConverterManager.d.ts.map +1 -0
- package/lib/database/AcDbDatabaseConverterManager.js +173 -0
- package/lib/database/AcDbDatabaseConverterManager.js.map +1 -0
- package/lib/database/AcDbDimStyleTable.d.ts +31 -0
- package/lib/database/AcDbDimStyleTable.d.ts.map +1 -0
- package/lib/database/AcDbDimStyleTable.js +49 -0
- package/lib/database/AcDbDimStyleTable.js.map +1 -0
- package/lib/database/AcDbDimStyleTableRecord.d.ts +797 -0
- package/lib/database/AcDbDimStyleTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbDimStyleTableRecord.js +1294 -0
- package/lib/database/AcDbDimStyleTableRecord.js.map +1 -0
- package/lib/database/AcDbDwgVersion.d.ts +32 -0
- package/lib/database/AcDbDwgVersion.d.ts.map +1 -0
- package/lib/database/AcDbDwgVersion.js +126 -0
- package/lib/database/AcDbDwgVersion.js.map +1 -0
- package/lib/database/AcDbLayerTable.d.ts +51 -0
- package/lib/database/AcDbLayerTable.d.ts.map +1 -0
- package/lib/database/AcDbLayerTable.js +92 -0
- package/lib/database/AcDbLayerTable.js.map +1 -0
- package/lib/database/AcDbLayerTableRecord.d.ts +278 -0
- package/lib/database/AcDbLayerTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbLayerTableRecord.js +397 -0
- package/lib/database/AcDbLayerTableRecord.js.map +1 -0
- package/lib/database/AcDbLinetypeTable.d.ts +30 -0
- package/lib/database/AcDbLinetypeTable.d.ts.map +1 -0
- package/lib/database/AcDbLinetypeTable.js +48 -0
- package/lib/database/AcDbLinetypeTable.js.map +1 -0
- package/lib/database/AcDbLinetypeTableRecord.d.ts +79 -0
- package/lib/database/AcDbLinetypeTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbLinetypeTableRecord.js +129 -0
- package/lib/database/AcDbLinetypeTableRecord.js.map +1 -0
- package/lib/database/AcDbSymbolTable.d.ts +199 -0
- package/lib/database/AcDbSymbolTable.d.ts.map +1 -0
- package/lib/database/AcDbSymbolTable.js +264 -0
- package/lib/database/AcDbSymbolTable.js.map +1 -0
- package/lib/database/AcDbSymbolTableRecord.d.ts +61 -0
- package/lib/database/AcDbSymbolTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbSymbolTableRecord.js +82 -0
- package/lib/database/AcDbSymbolTableRecord.js.map +1 -0
- package/lib/database/AcDbTextStyleTable.d.ts +48 -0
- package/lib/database/AcDbTextStyleTable.d.ts.map +1 -0
- package/lib/database/AcDbTextStyleTable.js +112 -0
- package/lib/database/AcDbTextStyleTable.js.map +1 -0
- package/lib/database/AcDbTextStyleTableRecord.d.ts +179 -0
- package/lib/database/AcDbTextStyleTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbTextStyleTableRecord.js +276 -0
- package/lib/database/AcDbTextStyleTableRecord.js.map +1 -0
- package/lib/database/AcDbViewportTable.d.ts +31 -0
- package/lib/database/AcDbViewportTable.d.ts.map +1 -0
- package/lib/database/AcDbViewportTable.js +49 -0
- package/lib/database/AcDbViewportTable.js.map +1 -0
- package/lib/database/AcDbViewportTableRecord.d.ts +154 -0
- package/lib/database/AcDbViewportTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbViewportTableRecord.js +318 -0
- package/lib/database/AcDbViewportTableRecord.js.map +1 -0
- package/lib/database/index.d.ts +19 -0
- package/lib/database/index.d.ts.map +1 -0
- package/lib/database/index.js +19 -0
- package/lib/database/index.js.map +1 -0
- package/lib/entity/AcDbArc.d.ts +254 -0
- package/lib/entity/AcDbArc.d.ts.map +1 -0
- package/lib/entity/AcDbArc.js +340 -0
- package/lib/entity/AcDbArc.js.map +1 -0
- package/lib/entity/AcDbBlockReference.d.ts +190 -0
- package/lib/entity/AcDbBlockReference.d.ts.map +1 -0
- package/lib/entity/AcDbBlockReference.js +302 -0
- package/lib/entity/AcDbBlockReference.js.map +1 -0
- package/lib/entity/AcDbCircle.d.ts +186 -0
- package/lib/entity/AcDbCircle.d.ts.map +1 -0
- package/lib/entity/AcDbCircle.js +249 -0
- package/lib/entity/AcDbCircle.js.map +1 -0
- package/lib/entity/AcDbCurve.d.ts +42 -0
- package/lib/entity/AcDbCurve.d.ts.map +1 -0
- package/lib/entity/AcDbCurve.js +44 -0
- package/lib/entity/AcDbCurve.js.map +1 -0
- package/lib/entity/AcDbEllipse.d.ts +207 -0
- package/lib/entity/AcDbEllipse.d.ts.map +1 -0
- package/lib/entity/AcDbEllipse.js +272 -0
- package/lib/entity/AcDbEllipse.js.map +1 -0
- package/lib/entity/AcDbEntity.d.ts +385 -0
- package/lib/entity/AcDbEntity.d.ts.map +1 -0
- package/lib/entity/AcDbEntity.js +561 -0
- package/lib/entity/AcDbEntity.js.map +1 -0
- package/lib/entity/AcDbFace.d.ts +151 -0
- package/lib/entity/AcDbFace.d.ts.map +1 -0
- package/lib/entity/AcDbFace.js +224 -0
- package/lib/entity/AcDbFace.js.map +1 -0
- package/lib/entity/AcDbHatch.d.ts +174 -0
- package/lib/entity/AcDbHatch.d.ts.map +1 -0
- package/lib/entity/AcDbHatch.js +250 -0
- package/lib/entity/AcDbHatch.js.map +1 -0
- package/lib/entity/AcDbLeader.d.ts +243 -0
- package/lib/entity/AcDbLeader.d.ts.map +1 -0
- package/lib/entity/AcDbLeader.js +358 -0
- package/lib/entity/AcDbLeader.js.map +1 -0
- package/lib/entity/AcDbLine.d.ts +198 -0
- package/lib/entity/AcDbLine.d.ts.map +1 -0
- package/lib/entity/AcDbLine.js +300 -0
- package/lib/entity/AcDbLine.js.map +1 -0
- package/lib/entity/AcDbMText.d.ts +248 -0
- package/lib/entity/AcDbMText.d.ts.map +1 -0
- package/lib/entity/AcDbMText.js +414 -0
- package/lib/entity/AcDbMText.js.map +1 -0
- package/lib/entity/AcDbPoint.d.ts +113 -0
- package/lib/entity/AcDbPoint.d.ts.map +1 -0
- package/lib/entity/AcDbPoint.js +155 -0
- package/lib/entity/AcDbPoint.js.map +1 -0
- package/lib/entity/AcDbPolyline.d.ts +221 -0
- package/lib/entity/AcDbPolyline.d.ts.map +1 -0
- package/lib/entity/AcDbPolyline.js +301 -0
- package/lib/entity/AcDbPolyline.js.map +1 -0
- package/lib/entity/AcDbRasterImage.d.ts +216 -0
- package/lib/entity/AcDbRasterImage.d.ts.map +1 -0
- package/lib/entity/AcDbRasterImage.js +451 -0
- package/lib/entity/AcDbRasterImage.js.map +1 -0
- package/lib/entity/AcDbRay.d.ts +150 -0
- package/lib/entity/AcDbRay.d.ts.map +1 -0
- package/lib/entity/AcDbRay.js +208 -0
- package/lib/entity/AcDbRay.js.map +1 -0
- package/lib/entity/AcDbSpline.d.ts +135 -0
- package/lib/entity/AcDbSpline.d.ts.map +1 -0
- package/lib/entity/AcDbSpline.js +142 -0
- package/lib/entity/AcDbSpline.js.map +1 -0
- package/lib/entity/AcDbTable.d.ts +260 -0
- package/lib/entity/AcDbTable.d.ts.map +1 -0
- package/lib/entity/AcDbTable.js +452 -0
- package/lib/entity/AcDbTable.js.map +1 -0
- package/lib/entity/AcDbText.d.ts +388 -0
- package/lib/entity/AcDbText.d.ts.map +1 -0
- package/lib/entity/AcDbText.js +523 -0
- package/lib/entity/AcDbText.js.map +1 -0
- package/lib/entity/AcDbTrace.d.ts +193 -0
- package/lib/entity/AcDbTrace.d.ts.map +1 -0
- package/lib/entity/AcDbTrace.js +271 -0
- package/lib/entity/AcDbTrace.js.map +1 -0
- package/lib/entity/AcDbViewport.d.ts +173 -0
- package/lib/entity/AcDbViewport.d.ts.map +1 -0
- package/lib/entity/AcDbViewport.js +295 -0
- package/lib/entity/AcDbViewport.js.map +1 -0
- package/lib/entity/AcDbWipeout.d.ts +39 -0
- package/lib/entity/AcDbWipeout.d.ts.map +1 -0
- package/lib/entity/AcDbWipeout.js +70 -0
- package/lib/entity/AcDbWipeout.js.map +1 -0
- package/lib/entity/AcDbXline.d.ts +151 -0
- package/lib/entity/AcDbXline.d.ts.map +1 -0
- package/lib/entity/AcDbXline.js +209 -0
- package/lib/entity/AcDbXline.js.map +1 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts +92 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.js +157 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbAlignedDimension.d.ts +220 -0
- package/lib/entity/dimension/AcDbAlignedDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbAlignedDimension.js +341 -0
- package/lib/entity/dimension/AcDbAlignedDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbArcDimension.d.ts +94 -0
- package/lib/entity/dimension/AcDbArcDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbArcDimension.js +159 -0
- package/lib/entity/dimension/AcDbArcDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts +145 -0
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbDiametricDimension.js +275 -0
- package/lib/entity/dimension/AcDbDiametricDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbDimension.d.ts +257 -0
- package/lib/entity/dimension/AcDbDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbDimension.js +466 -0
- package/lib/entity/dimension/AcDbDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.d.ts +78 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.js +133 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbRadialDimension.d.ts +214 -0
- package/lib/entity/dimension/AcDbRadialDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbRadialDimension.js +288 -0
- package/lib/entity/dimension/AcDbRadialDimension.js.map +1 -0
- package/lib/entity/dimension/index.d.ts +8 -0
- package/lib/entity/dimension/index.d.ts.map +1 -0
- package/lib/entity/dimension/index.js +8 -0
- package/lib/entity/dimension/index.js.map +1 -0
- package/lib/entity/index.d.ts +24 -0
- package/lib/entity/index.d.ts.map +1 -0
- package/lib/entity/index.js +24 -0
- package/lib/entity/index.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/misc/AcDbAngleUnits.d.ts +20 -0
- package/lib/misc/AcDbAngleUnits.d.ts.map +1 -0
- package/lib/misc/AcDbAngleUnits.js +21 -0
- package/lib/misc/AcDbAngleUnits.js.map +1 -0
- package/lib/misc/AcDbCodePage.d.ts +50 -0
- package/lib/misc/AcDbCodePage.d.ts.map +1 -0
- package/lib/misc/AcDbCodePage.js +100 -0
- package/lib/misc/AcDbCodePage.js.map +1 -0
- package/lib/misc/AcDbConstants.d.ts +24 -0
- package/lib/misc/AcDbConstants.d.ts.map +1 -0
- package/lib/misc/AcDbConstants.js +24 -0
- package/lib/misc/AcDbConstants.js.map +1 -0
- package/lib/misc/AcDbDimArrowType.d.ts +89 -0
- package/lib/misc/AcDbDimArrowType.d.ts.map +1 -0
- package/lib/misc/AcDbDimArrowType.js +90 -0
- package/lib/misc/AcDbDimArrowType.js.map +1 -0
- package/lib/misc/AcDbObjectIterator.d.ts +64 -0
- package/lib/misc/AcDbObjectIterator.d.ts.map +1 -0
- package/lib/misc/AcDbObjectIterator.js +84 -0
- package/lib/misc/AcDbObjectIterator.js.map +1 -0
- package/lib/misc/AcDbOsnapMode.d.ts +51 -0
- package/lib/misc/AcDbOsnapMode.d.ts.map +1 -0
- package/lib/misc/AcDbOsnapMode.js +52 -0
- package/lib/misc/AcDbOsnapMode.js.map +1 -0
- package/lib/misc/AcDbRenderingCache.d.ts +141 -0
- package/lib/misc/AcDbRenderingCache.d.ts.map +1 -0
- package/lib/misc/AcDbRenderingCache.js +239 -0
- package/lib/misc/AcDbRenderingCache.js.map +1 -0
- package/lib/misc/AcDbUnitsValue.d.ts +101 -0
- package/lib/misc/AcDbUnitsValue.d.ts.map +1 -0
- package/lib/misc/AcDbUnitsValue.js +121 -0
- package/lib/misc/AcDbUnitsValue.js.map +1 -0
- package/lib/misc/index.d.ts +9 -0
- package/lib/misc/index.d.ts.map +1 -0
- package/lib/misc/index.js +9 -0
- package/lib/misc/index.js.map +1 -0
- package/lib/object/AcDbDictionary.d.ts +178 -0
- package/lib/object/AcDbDictionary.d.ts.map +1 -0
- package/lib/object/AcDbDictionary.js +264 -0
- package/lib/object/AcDbDictionary.js.map +1 -0
- package/lib/object/AcDbRasterImageDef.d.ts +54 -0
- package/lib/object/AcDbRasterImageDef.d.ts.map +1 -0
- package/lib/object/AcDbRasterImageDef.js +82 -0
- package/lib/object/AcDbRasterImageDef.js.map +1 -0
- package/lib/object/index.d.ts +4 -0
- package/lib/object/index.d.ts.map +1 -0
- package/lib/object/index.js +4 -0
- package/lib/object/index.js.map +1 -0
- package/lib/object/layout/AcDbLayout.d.ts +190 -0
- package/lib/object/layout/AcDbLayout.d.ts.map +1 -0
- package/lib/object/layout/AcDbLayout.js +253 -0
- package/lib/object/layout/AcDbLayout.js.map +1 -0
- package/lib/object/layout/AcDbLayoutDictionary.d.ts +47 -0
- package/lib/object/layout/AcDbLayoutDictionary.d.ts.map +1 -0
- package/lib/object/layout/AcDbLayoutDictionary.js +122 -0
- package/lib/object/layout/AcDbLayoutDictionary.js.map +1 -0
- package/lib/object/layout/AcDbLayoutManager.d.ts +188 -0
- package/lib/object/layout/AcDbLayoutManager.d.ts.map +1 -0
- package/lib/object/layout/AcDbLayoutManager.js +245 -0
- package/lib/object/layout/AcDbLayoutManager.js.map +1 -0
- package/lib/object/layout/index.d.ts +4 -0
- package/lib/object/layout/index.d.ts.map +1 -0
- package/lib/object/layout/index.js +4 -0
- package/lib/object/layout/index.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterator used for iterating over database objects.
|
|
3
|
+
*
|
|
4
|
+
* This class provides an iterator interface for traversing collections
|
|
5
|
+
* of database objects. It implements both IterableIterator and provides
|
|
6
|
+
* additional methods for checking if more items are available.
|
|
7
|
+
*
|
|
8
|
+
* @template ResultType - The type of objects being iterated over
|
|
9
|
+
*/
|
|
10
|
+
var AcDbObjectIterator = /** @class */ (function () {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new AcDbObjectIterator instance.
|
|
13
|
+
*
|
|
14
|
+
* @param records - Array of objects to iterate over
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const entities = [entity1, entity2, entity3];
|
|
19
|
+
* const iterator = new AcDbObjectIterator(entities);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function AcDbObjectIterator(records) {
|
|
23
|
+
/** Current index in the iteration */
|
|
24
|
+
this.i = 0;
|
|
25
|
+
this._records = records;
|
|
26
|
+
this._keys = Array.from(records.keys());
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(AcDbObjectIterator.prototype, "count", {
|
|
29
|
+
/**
|
|
30
|
+
* The number of items
|
|
31
|
+
*/
|
|
32
|
+
get: function () {
|
|
33
|
+
return this._records.size;
|
|
34
|
+
},
|
|
35
|
+
enumerable: false,
|
|
36
|
+
configurable: true
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Converts values in the current iterator to one array
|
|
40
|
+
* @returns An array of values in the current iterator
|
|
41
|
+
*/
|
|
42
|
+
AcDbObjectIterator.prototype.toArray = function () {
|
|
43
|
+
return Array.from(this._records.values());
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Returns the iterator itself, allowing it to be used in for...of loops.
|
|
47
|
+
*
|
|
48
|
+
* @returns This iterator instance
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* for (const entity of iterator) {
|
|
53
|
+
* console.log('Entity:', entity);
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
AcDbObjectIterator.prototype[Symbol.iterator] = function () {
|
|
58
|
+
return this;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Increments the iterator to the next entry.
|
|
62
|
+
*
|
|
63
|
+
* @returns Iterator result containing the next value or null if done
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const result = iterator.next();
|
|
68
|
+
* if (!result.done) {
|
|
69
|
+
* console.log('Next item:', result.value);
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
AcDbObjectIterator.prototype.next = function () {
|
|
74
|
+
while (this.i < this._keys.length) {
|
|
75
|
+
var value = this._records.get(this._keys[this.i]);
|
|
76
|
+
this.i += 1;
|
|
77
|
+
return { value: value, done: false };
|
|
78
|
+
}
|
|
79
|
+
return { value: null, done: true };
|
|
80
|
+
};
|
|
81
|
+
return AcDbObjectIterator;
|
|
82
|
+
}());
|
|
83
|
+
export { AcDbObjectIterator };
|
|
84
|
+
//# sourceMappingURL=AcDbObjectIterator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcDbObjectIterator.js","sourceRoot":"","sources":["../../src/misc/AcDbObjectIterator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH;IAQE;;;;;;;;;;OAUG;IACH,4BAAY,OAAgC;QAhB5C,qCAAqC;QAC7B,MAAC,GAAG,CAAC,CAAA;QAgBX,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IACzC,CAAC;IAKD,sBAAI,qCAAK;QAHT;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA;QAC3B,CAAC;;;OAAA;IAED;;;OAGG;IACH,oCAAO,GAAP;QACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED;;;;;;;;;;;OAWG;IACH,6BAAC,MAAM,CAAC,QAAQ,CAAC,GAAjB;QACE,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,iCAAI,GAAJ;QACE,OAAO,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClC,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAe,CAAA;YACjE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAA;YACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACtC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IACpC,CAAC;IACH,yBAAC;AAAD,CAAC,AA5ED,IA4EC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumeration of object snap modes used in AutoCAD.
|
|
3
|
+
*
|
|
4
|
+
* Object snap modes define the types of geometric points that can be
|
|
5
|
+
* snapped to when drawing or editing entities. These modes help ensure
|
|
6
|
+
* precise positioning and alignment of objects.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum AcDbOsnapMode {
|
|
9
|
+
/**
|
|
10
|
+
* End point - snaps to the endpoint of a line, arc, or other entity
|
|
11
|
+
*/
|
|
12
|
+
EndPoint = 1,
|
|
13
|
+
/**
|
|
14
|
+
* Middle point - snaps to the midpoint of a line or arc
|
|
15
|
+
*/
|
|
16
|
+
MidPoint = 2,
|
|
17
|
+
/**
|
|
18
|
+
* Center - snaps to the center point of a circle, arc, or ellipse
|
|
19
|
+
*/
|
|
20
|
+
Center = 3,
|
|
21
|
+
/**
|
|
22
|
+
* Node - snaps to a point entity
|
|
23
|
+
*/
|
|
24
|
+
Node = 4,
|
|
25
|
+
/**
|
|
26
|
+
* Quadrant - snaps to the quadrant points of a circle or ellipse
|
|
27
|
+
* (0°, 90°, 180°, 270°)
|
|
28
|
+
*/
|
|
29
|
+
Quadrant = 5,
|
|
30
|
+
/**
|
|
31
|
+
* Insertion - snaps to the insertion point of text, blocks, or other objects
|
|
32
|
+
*/
|
|
33
|
+
Insertion = 7,
|
|
34
|
+
/**
|
|
35
|
+
* Perpendicular - snaps to a point perpendicular to a line or arc
|
|
36
|
+
*/
|
|
37
|
+
Perpendicular = 8,
|
|
38
|
+
/**
|
|
39
|
+
* Tangent - snaps to a point tangent to a circle or arc
|
|
40
|
+
*/
|
|
41
|
+
Tangent = 9,
|
|
42
|
+
/**
|
|
43
|
+
* Nearest - snaps to the nearest point on an entity
|
|
44
|
+
*/
|
|
45
|
+
Nearest = 10,
|
|
46
|
+
/**
|
|
47
|
+
* Center of the object - snaps to the centroid or center of mass of an object
|
|
48
|
+
*/
|
|
49
|
+
Centroid = 11
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=AcDbOsnapMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcDbOsnapMode.d.ts","sourceRoot":"","sources":["../../src/misc/AcDbOsnapMode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,aAAa;IACvB;;OAEG;IACH,QAAQ,IAAI;IACZ;;OAEG;IACH,QAAQ,IAAI;IACZ;;OAEG;IACH,MAAM,IAAI;IACV;;OAEG;IACH,IAAI,IAAI;IACR;;;OAGG;IACH,QAAQ,IAAI;IACZ;;OAEG;IACH,SAAS,IAAI;IACb;;OAEG;IACH,aAAa,IAAI;IACjB;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,OAAO,KAAK;IACZ;;OAEG;IACH,QAAQ,KAAK;CACd"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumeration of object snap modes used in AutoCAD.
|
|
3
|
+
*
|
|
4
|
+
* Object snap modes define the types of geometric points that can be
|
|
5
|
+
* snapped to when drawing or editing entities. These modes help ensure
|
|
6
|
+
* precise positioning and alignment of objects.
|
|
7
|
+
*/
|
|
8
|
+
export var AcDbOsnapMode;
|
|
9
|
+
(function (AcDbOsnapMode) {
|
|
10
|
+
/**
|
|
11
|
+
* End point - snaps to the endpoint of a line, arc, or other entity
|
|
12
|
+
*/
|
|
13
|
+
AcDbOsnapMode[AcDbOsnapMode["EndPoint"] = 1] = "EndPoint";
|
|
14
|
+
/**
|
|
15
|
+
* Middle point - snaps to the midpoint of a line or arc
|
|
16
|
+
*/
|
|
17
|
+
AcDbOsnapMode[AcDbOsnapMode["MidPoint"] = 2] = "MidPoint";
|
|
18
|
+
/**
|
|
19
|
+
* Center - snaps to the center point of a circle, arc, or ellipse
|
|
20
|
+
*/
|
|
21
|
+
AcDbOsnapMode[AcDbOsnapMode["Center"] = 3] = "Center";
|
|
22
|
+
/**
|
|
23
|
+
* Node - snaps to a point entity
|
|
24
|
+
*/
|
|
25
|
+
AcDbOsnapMode[AcDbOsnapMode["Node"] = 4] = "Node";
|
|
26
|
+
/**
|
|
27
|
+
* Quadrant - snaps to the quadrant points of a circle or ellipse
|
|
28
|
+
* (0°, 90°, 180°, 270°)
|
|
29
|
+
*/
|
|
30
|
+
AcDbOsnapMode[AcDbOsnapMode["Quadrant"] = 5] = "Quadrant";
|
|
31
|
+
/**
|
|
32
|
+
* Insertion - snaps to the insertion point of text, blocks, or other objects
|
|
33
|
+
*/
|
|
34
|
+
AcDbOsnapMode[AcDbOsnapMode["Insertion"] = 7] = "Insertion";
|
|
35
|
+
/**
|
|
36
|
+
* Perpendicular - snaps to a point perpendicular to a line or arc
|
|
37
|
+
*/
|
|
38
|
+
AcDbOsnapMode[AcDbOsnapMode["Perpendicular"] = 8] = "Perpendicular";
|
|
39
|
+
/**
|
|
40
|
+
* Tangent - snaps to a point tangent to a circle or arc
|
|
41
|
+
*/
|
|
42
|
+
AcDbOsnapMode[AcDbOsnapMode["Tangent"] = 9] = "Tangent";
|
|
43
|
+
/**
|
|
44
|
+
* Nearest - snaps to the nearest point on an entity
|
|
45
|
+
*/
|
|
46
|
+
AcDbOsnapMode[AcDbOsnapMode["Nearest"] = 10] = "Nearest";
|
|
47
|
+
/**
|
|
48
|
+
* Center of the object - snaps to the centroid or center of mass of an object
|
|
49
|
+
*/
|
|
50
|
+
AcDbOsnapMode[AcDbOsnapMode["Centroid"] = 11] = "Centroid";
|
|
51
|
+
})(AcDbOsnapMode || (AcDbOsnapMode = {}));
|
|
52
|
+
//# sourceMappingURL=AcDbOsnapMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcDbOsnapMode.js","sourceRoot":"","sources":["../../src/misc/AcDbOsnapMode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,aA0CX;AA1CD,WAAY,aAAa;IACvB;;OAEG;IACH,yDAAY,CAAA;IACZ;;OAEG;IACH,yDAAY,CAAA;IACZ;;OAEG;IACH,qDAAU,CAAA;IACV;;OAEG;IACH,iDAAQ,CAAA;IACR;;;OAGG;IACH,yDAAY,CAAA;IACZ;;OAEG;IACH,2DAAa,CAAA;IACb;;OAEG;IACH,mEAAiB,CAAA;IACjB;;OAEG;IACH,uDAAW,CAAA;IACX;;OAEG;IACH,wDAAY,CAAA;IACZ;;OAEG;IACH,0DAAa,CAAA;AACf,CAAC,EA1CW,aAAa,KAAb,aAAa,QA0CxB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { AcGeMatrix3d, AcGeVector3d } from '@mlightcad/geometry-engine';
|
|
2
|
+
import { AcGiEntity, AcGiRenderer } from '@mlightcad/graphic-interface';
|
|
3
|
+
import { AcDbBlockTableRecord } from '../database';
|
|
4
|
+
/**
|
|
5
|
+
* Internal class used to cache rendered results to avoid duplicated rendering.
|
|
6
|
+
*
|
|
7
|
+
* This class can be used to improve performance when rendering block references.
|
|
8
|
+
* Because different colors will result in different materials, the block name and
|
|
9
|
+
* color are used together to create the cache key.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const cache = AcDbRenderingCache.instance;
|
|
16
|
+
* const key = cache.createKey('MyBlock', 0xFF0000);
|
|
17
|
+
* const renderedEntity = cache.draw(renderer, blockRecord, 0xFF0000);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class AcDbRenderingCache {
|
|
21
|
+
/** Map of cached rendering results indexed by key */
|
|
22
|
+
private _blocks;
|
|
23
|
+
/** Singleton instance of the cache */
|
|
24
|
+
private static _instance?;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the singleton instance of the rendering cache.
|
|
27
|
+
*
|
|
28
|
+
* @returns The singleton instance of AcDbRenderingCache
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const cache = AcDbRenderingCache.instance;
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
static get instance(): AcDbRenderingCache;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new AcDbRenderingCache instance.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const cache = new AcDbRenderingCache();
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
constructor();
|
|
45
|
+
/**
|
|
46
|
+
* Creates a cache key by combining the block name and color.
|
|
47
|
+
*
|
|
48
|
+
* @param name - The block name
|
|
49
|
+
* @param color - The color value
|
|
50
|
+
* @returns A unique key for the cache entry
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const key = cache.createKey('MyBlock', 0xFF0000);
|
|
55
|
+
* // Returns: "MyBlock_16711680"
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
createKey(name: string, color: number): string;
|
|
59
|
+
/**
|
|
60
|
+
* Stores rendering results of a block in the cache.
|
|
61
|
+
*
|
|
62
|
+
* @param key - The key for the rendering results
|
|
63
|
+
* @param group - The rendering results to store
|
|
64
|
+
* @returns The stored rendering results (deep cloned)
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const renderedEntity = cache.set(key, entity);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
set(key: string, group: AcGiEntity): AcGiEntity;
|
|
72
|
+
/**
|
|
73
|
+
* Gets rendering results with the specified key.
|
|
74
|
+
*
|
|
75
|
+
* @param name - The key of the rendering results
|
|
76
|
+
* @returns The rendering results with the specified key, or undefined if not found
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const cachedEntity = cache.get('MyBlock_16711680');
|
|
81
|
+
* if (cachedEntity) {
|
|
82
|
+
* // Use cached entity
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
get(name: string): AcGiEntity | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Checks if rendering results with the specified key exist in the cache.
|
|
89
|
+
*
|
|
90
|
+
* @param name - The key to check
|
|
91
|
+
* @returns True if the key exists in the cache, false otherwise
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* if (cache.has('MyBlock_16711680')) {
|
|
96
|
+
* console.log('Cached result found');
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
has(name: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Clears all cached rendering results.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* cache.clear();
|
|
107
|
+
* console.log('Cache cleared');
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
clear(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Draws a block table record and optionally caches the result.
|
|
113
|
+
*
|
|
114
|
+
* This method renders the block table record using the specified renderer
|
|
115
|
+
* and color, and optionally stores the result in the cache for future use.
|
|
116
|
+
*
|
|
117
|
+
* @param renderer - The renderer to use for drawing
|
|
118
|
+
* @param blockTableRecord - The block table record to draw
|
|
119
|
+
* @param color - The color to use for rendering
|
|
120
|
+
* @param cache - Whether to cache the rendering result (default: true)
|
|
121
|
+
* @param transform - Optional transformation matrix to apply
|
|
122
|
+
* @param normal - Optional normal vector
|
|
123
|
+
* @returns The rendered entity
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const renderedEntity = cache.draw(
|
|
128
|
+
* renderer,
|
|
129
|
+
* blockRecord,
|
|
130
|
+
* 0xFF0000,
|
|
131
|
+
* true,
|
|
132
|
+
* transform,
|
|
133
|
+
* normal
|
|
134
|
+
* );
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
draw(renderer: AcGiRenderer, blockTableRecord: AcDbBlockTableRecord, color: number, cache?: boolean, transform?: AcGeMatrix3d, normal?: AcGeVector3d): AcGiEntity | undefined;
|
|
138
|
+
private addEntity;
|
|
139
|
+
private attachEntityInfo;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=AcDbRenderingCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcDbRenderingCache.d.ts","sourceRoot":"","sources":["../../src/misc/AcDbRenderingCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAGvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,kBAAkB;IAC7B,qDAAqD;IACrD,OAAO,CAAC,OAAO,CAAyB;IACxC,sCAAsC;IACtC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAoB;IAE7C;;;;;;;;;OASG;IACH,MAAM,KAAK,QAAQ,uBAKlB;IAED;;;;;;;OAOG;;IAKH;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIrC;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU;IAMlC;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM;IAQhB;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM;IAIhB;;;;;;;;OAQG;IACH,KAAK;IAIL;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,CACF,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,oBAAoB,EACtC,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,OAAc,EACrB,SAAS,CAAC,EAAE,YAAY,EACxB,MAAM,CAAC,EAAE,YAAY;IAwCvB,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,gBAAgB;CAMzB"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
import { AcCmColor } from '@mlightcad/common';
|
|
13
|
+
/**
|
|
14
|
+
* Internal class used to cache rendered results to avoid duplicated rendering.
|
|
15
|
+
*
|
|
16
|
+
* This class can be used to improve performance when rendering block references.
|
|
17
|
+
* Because different colors will result in different materials, the block name and
|
|
18
|
+
* color are used together to create the cache key.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const cache = AcDbRenderingCache.instance;
|
|
25
|
+
* const key = cache.createKey('MyBlock', 0xFF0000);
|
|
26
|
+
* const renderedEntity = cache.draw(renderer, blockRecord, 0xFF0000);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
var AcDbRenderingCache = /** @class */ (function () {
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new AcDbRenderingCache instance.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const cache = new AcDbRenderingCache();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function AcDbRenderingCache() {
|
|
39
|
+
this._blocks = new Map();
|
|
40
|
+
}
|
|
41
|
+
Object.defineProperty(AcDbRenderingCache, "instance", {
|
|
42
|
+
/**
|
|
43
|
+
* Gets the singleton instance of the rendering cache.
|
|
44
|
+
*
|
|
45
|
+
* @returns The singleton instance of AcDbRenderingCache
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const cache = AcDbRenderingCache.instance;
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
get: function () {
|
|
53
|
+
if (!this._instance) {
|
|
54
|
+
this._instance = new AcDbRenderingCache();
|
|
55
|
+
}
|
|
56
|
+
return this._instance;
|
|
57
|
+
},
|
|
58
|
+
enumerable: false,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Creates a cache key by combining the block name and color.
|
|
63
|
+
*
|
|
64
|
+
* @param name - The block name
|
|
65
|
+
* @param color - The color value
|
|
66
|
+
* @returns A unique key for the cache entry
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const key = cache.createKey('MyBlock', 0xFF0000);
|
|
71
|
+
* // Returns: "MyBlock_16711680"
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
AcDbRenderingCache.prototype.createKey = function (name, color) {
|
|
75
|
+
return "".concat(name, "_").concat(color);
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Stores rendering results of a block in the cache.
|
|
79
|
+
*
|
|
80
|
+
* @param key - The key for the rendering results
|
|
81
|
+
* @param group - The rendering results to store
|
|
82
|
+
* @returns The stored rendering results (deep cloned)
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const renderedEntity = cache.set(key, entity);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
AcDbRenderingCache.prototype.set = function (key, group) {
|
|
90
|
+
group = group.fastDeepClone();
|
|
91
|
+
this._blocks.set(key, group);
|
|
92
|
+
return group;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Gets rendering results with the specified key.
|
|
96
|
+
*
|
|
97
|
+
* @param name - The key of the rendering results
|
|
98
|
+
* @returns The rendering results with the specified key, or undefined if not found
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const cachedEntity = cache.get('MyBlock_16711680');
|
|
103
|
+
* if (cachedEntity) {
|
|
104
|
+
* // Use cached entity
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
AcDbRenderingCache.prototype.get = function (name) {
|
|
109
|
+
var block = this._blocks.get(name);
|
|
110
|
+
if (block) {
|
|
111
|
+
block = block.fastDeepClone();
|
|
112
|
+
}
|
|
113
|
+
return block;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Checks if rendering results with the specified key exist in the cache.
|
|
117
|
+
*
|
|
118
|
+
* @param name - The key to check
|
|
119
|
+
* @returns True if the key exists in the cache, false otherwise
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* if (cache.has('MyBlock_16711680')) {
|
|
124
|
+
* console.log('Cached result found');
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
AcDbRenderingCache.prototype.has = function (name) {
|
|
129
|
+
return this._blocks.has(name);
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Clears all cached rendering results.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* cache.clear();
|
|
137
|
+
* console.log('Cache cleared');
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
AcDbRenderingCache.prototype.clear = function () {
|
|
141
|
+
this._blocks.clear();
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Draws a block table record and optionally caches the result.
|
|
145
|
+
*
|
|
146
|
+
* This method renders the block table record using the specified renderer
|
|
147
|
+
* and color, and optionally stores the result in the cache for future use.
|
|
148
|
+
*
|
|
149
|
+
* @param renderer - The renderer to use for drawing
|
|
150
|
+
* @param blockTableRecord - The block table record to draw
|
|
151
|
+
* @param color - The color to use for rendering
|
|
152
|
+
* @param cache - Whether to cache the rendering result (default: true)
|
|
153
|
+
* @param transform - Optional transformation matrix to apply
|
|
154
|
+
* @param normal - Optional normal vector
|
|
155
|
+
* @returns The rendered entity
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const renderedEntity = cache.draw(
|
|
160
|
+
* renderer,
|
|
161
|
+
* blockRecord,
|
|
162
|
+
* 0xFF0000,
|
|
163
|
+
* true,
|
|
164
|
+
* transform,
|
|
165
|
+
* normal
|
|
166
|
+
* );
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
AcDbRenderingCache.prototype.draw = function (renderer, blockTableRecord, color, cache, transform, normal) {
|
|
170
|
+
var e_1, _a;
|
|
171
|
+
if (cache === void 0) { cache = true; }
|
|
172
|
+
var results = [];
|
|
173
|
+
if (blockTableRecord != null) {
|
|
174
|
+
var key = this.createKey(blockTableRecord.name, color);
|
|
175
|
+
var block = void 0;
|
|
176
|
+
if (this.has(key)) {
|
|
177
|
+
block = this.get(key);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
var entities = blockTableRecord.newIterator();
|
|
181
|
+
try {
|
|
182
|
+
for (var entities_1 = __values(entities), entities_1_1 = entities_1.next(); !entities_1_1.done; entities_1_1 = entities_1.next()) {
|
|
183
|
+
var entity = entities_1_1.value;
|
|
184
|
+
// If the color of this entity is 'byBlock', then store the original color of this entity color
|
|
185
|
+
// and set the color of this entity to block's color. After renderering this entity, restore
|
|
186
|
+
// its original color
|
|
187
|
+
if (entity.color.isByBlock && color) {
|
|
188
|
+
_tmpColor.copy(entity.color);
|
|
189
|
+
entity.color.color = color;
|
|
190
|
+
this.addEntity(entity, results, renderer);
|
|
191
|
+
entity.color.copy(_tmpColor);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.addEntity(entity, results, renderer);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
199
|
+
finally {
|
|
200
|
+
try {
|
|
201
|
+
if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
|
|
202
|
+
}
|
|
203
|
+
finally { if (e_1) throw e_1.error; }
|
|
204
|
+
}
|
|
205
|
+
block = renderer.group(results);
|
|
206
|
+
if (block && cache)
|
|
207
|
+
this.set(key, block);
|
|
208
|
+
}
|
|
209
|
+
if (block && transform) {
|
|
210
|
+
block.applyMatrix(transform);
|
|
211
|
+
if (normal && (normal.x != 0 || normal.y != 0 || normal.z != 1)) {
|
|
212
|
+
transform.setFromExtrusionDirection(normal);
|
|
213
|
+
block.applyMatrix(transform);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return block;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
return renderer.group(results);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
AcDbRenderingCache.prototype.addEntity = function (entity, results, renderer) {
|
|
223
|
+
var object = entity.draw(renderer);
|
|
224
|
+
if (object) {
|
|
225
|
+
this.attachEntityInfo(object, entity);
|
|
226
|
+
results.push(object);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
AcDbRenderingCache.prototype.attachEntityInfo = function (target, source) {
|
|
230
|
+
target.objectId = source.objectId;
|
|
231
|
+
target.ownerId = source.ownerId;
|
|
232
|
+
target.layerName = source.layer;
|
|
233
|
+
target.visible = source.visibility;
|
|
234
|
+
};
|
|
235
|
+
return AcDbRenderingCache;
|
|
236
|
+
}());
|
|
237
|
+
export { AcDbRenderingCache };
|
|
238
|
+
var _tmpColor = /*@__PURE__*/ new AcCmColor();
|
|
239
|
+
//# sourceMappingURL=AcDbRenderingCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcDbRenderingCache.js","sourceRoot":"","sources":["../../src/misc/AcDbRenderingCache.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAO7C;;;;;;;;;;;;;;;GAeG;AACH;IAuBE;;;;;;;OAOG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1B,CAAC;IAjBD,sBAAW,8BAAQ;QAVnB;;;;;;;;;WASG;aACH;YACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,IAAI,CAAC,SAAS,GAAG,IAAI,kBAAkB,EAAE,CAAA;YAC3C,CAAC;YACD,OAAO,IAAI,CAA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