@itwin/core-orbitgt 5.0.0-dev.4 → 5.0.0-dev.40
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/CHANGELOG.md +26 -1
- package/lib/cjs/pointcloud/format/opc/BlockRecord.js +2 -2
- package/lib/cjs/pointcloud/format/opc/BlockRecord.js.map +1 -1
- package/lib/cjs/pointcloud/format/opc/ContainerFile.js +2 -2
- package/lib/cjs/pointcloud/format/opc/ContainerFile.js.map +1 -1
- package/lib/cjs/pointcloud/format/opc/FileReader.js +2 -2
- package/lib/cjs/pointcloud/format/opc/FileReader.js.map +1 -1
- package/lib/cjs/pointcloud/format/opc/GeometryReader.js +6 -6
- package/lib/cjs/pointcloud/format/opc/GeometryReader.js.map +1 -1
- package/lib/cjs/pointcloud/format/opc/TileRecord.js +2 -2
- package/lib/cjs/pointcloud/format/opc/TileRecord.js.map +1 -1
- package/lib/cjs/pointcloud/model/AttributeTypes.js +16 -16
- package/lib/cjs/pointcloud/model/AttributeTypes.js.map +1 -1
- package/lib/cjs/pointcloud/model/AttributeValue.js +4 -4
- package/lib/cjs/pointcloud/model/AttributeValue.js.map +1 -1
- package/lib/cjs/pointcloud/model/CloudPoint.js +2 -2
- package/lib/cjs/pointcloud/model/CloudPoint.js.map +1 -1
- package/lib/cjs/pointcloud/model/PointDataRaw.js +2 -2
- package/lib/cjs/pointcloud/model/PointDataRaw.js.map +1 -1
- package/lib/cjs/pointcloud/model/ReadRequest.js +6 -6
- package/lib/cjs/pointcloud/model/ReadRequest.js.map +1 -1
- package/lib/cjs/pointcloud/model/StandardAttributes.js +21 -21
- package/lib/cjs/pointcloud/model/StandardAttributes.js.map +1 -1
- package/lib/cjs/pointcloud/render/DataManager.js +6 -6
- package/lib/cjs/pointcloud/render/DataManager.js.map +1 -1
- package/lib/cjs/pointcloud/render/TileLoadSorter.js +2 -2
- package/lib/cjs/pointcloud/render/TileLoadSorter.js.map +1 -1
- package/lib/cjs/pointcloud/render/ViewTree.js +4 -4
- package/lib/cjs/pointcloud/render/ViewTree.js.map +1 -1
- package/lib/cjs/spatial/crs/CRSManager.js +2 -2
- package/lib/cjs/spatial/crs/CRSManager.js.map +1 -1
- package/lib/cjs/spatial/ecrs/CRS.js +34 -34
- package/lib/cjs/spatial/ecrs/CRS.js.map +1 -1
- package/lib/cjs/spatial/ecrs/CoordinateSystem.js +2 -2
- package/lib/cjs/spatial/ecrs/CoordinateSystem.js.map +1 -1
- package/lib/cjs/spatial/ecrs/DataFileUnit.js +1 -1
- package/lib/cjs/spatial/ecrs/DataFileUnit.js.map +1 -1
- package/lib/cjs/spatial/ecrs/Datum.js +4 -4
- package/lib/cjs/spatial/ecrs/Datum.js.map +1 -1
- package/lib/cjs/spatial/ecrs/OnlineRegistry.js +2 -2
- package/lib/cjs/spatial/ecrs/OnlineRegistry.js.map +1 -1
- package/lib/cjs/spatial/ecrs/Operation.js +6 -6
- package/lib/cjs/spatial/ecrs/Operation.js.map +1 -1
- package/lib/cjs/spatial/ecrs/Registry.js +17 -17
- package/lib/cjs/spatial/ecrs/Registry.js.map +1 -1
- package/lib/cjs/spatial/ecrs/Transform.js +11 -11
- package/lib/cjs/spatial/ecrs/Transform.js.map +1 -1
- package/lib/cjs/spatial/ecrs/Unit.js +24 -24
- package/lib/cjs/spatial/ecrs/Unit.js.map +1 -1
- package/lib/cjs/spatial/ecrs/WellKnownText.js +8 -8
- package/lib/cjs/spatial/ecrs/WellKnownText.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/HotineObliqueMercator.js +2 -2
- package/lib/cjs/spatial/ecrs/projection/HotineObliqueMercator.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/KrovakObliqueConformalConic.js +2 -2
- package/lib/cjs/spatial/ecrs/projection/KrovakObliqueConformalConic.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/KrovakObliqueConformalConicEN.js +2 -2
- package/lib/cjs/spatial/ecrs/projection/KrovakObliqueConformalConicEN.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/LambertConical1SP.js +2 -2
- package/lib/cjs/spatial/ecrs/projection/LambertConical1SP.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/LambertConical2SP.js +6 -6
- package/lib/cjs/spatial/ecrs/projection/LambertConical2SP.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/Mercator1SP.js +4 -4
- package/lib/cjs/spatial/ecrs/projection/Mercator1SP.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/ObliqueMercator.js +4 -4
- package/lib/cjs/spatial/ecrs/projection/ObliqueMercator.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/ObliqueStereographic.js +4 -4
- package/lib/cjs/spatial/ecrs/projection/ObliqueStereographic.js.map +1 -1
- package/lib/cjs/spatial/ecrs/projection/TransverseMercator.js +4 -4
- package/lib/cjs/spatial/ecrs/projection/TransverseMercator.js.map +1 -1
- package/lib/cjs/spatial/ecrs/transformation/PositionVector.js +2 -2
- package/lib/cjs/spatial/ecrs/transformation/PositionVector.js.map +1 -1
- package/lib/cjs/system/buffer/Float32Buffer.js +2 -2
- package/lib/cjs/system/buffer/Float32Buffer.js.map +1 -1
- package/lib/cjs/system/buffer/Uint16Buffer.js +2 -2
- package/lib/cjs/system/buffer/Uint16Buffer.js.map +1 -1
- package/lib/cjs/system/buffer/Uint8Buffer.js +2 -2
- package/lib/cjs/system/buffer/Uint8Buffer.js.map +1 -1
- package/lib/cjs/system/runtime/ALong.js +26 -26
- package/lib/cjs/system/runtime/ALong.js.map +1 -1
- package/lib/cjs/system/runtime/ASystem.js +1 -1
- package/lib/cjs/system/runtime/ASystem.js.map +1 -1
- package/lib/cjs/system/runtime/Downloader.js +2 -2
- package/lib/cjs/system/runtime/Downloader.js.map +1 -1
- package/lib/cjs/system/runtime/Message.js +2 -2
- package/lib/cjs/system/runtime/Message.js.map +1 -1
- package/lib/cjs/system/runtime/Numbers.js +6 -6
- package/lib/cjs/system/runtime/Numbers.js.map +1 -1
- package/lib/cjs/system/runtime/Strings.js +14 -14
- package/lib/cjs/system/runtime/Strings.js.map +1 -1
- package/lib/cjs/system/storage/ContentLoader.js +2 -2
- package/lib/cjs/system/storage/ContentLoader.js.map +1 -1
- package/lib/esm/pointcloud/format/opc/BlockRecord.js +2 -2
- package/lib/esm/pointcloud/format/opc/BlockRecord.js.map +1 -1
- package/lib/esm/pointcloud/format/opc/ContainerFile.js +2 -2
- package/lib/esm/pointcloud/format/opc/ContainerFile.js.map +1 -1
- package/lib/esm/pointcloud/format/opc/FileReader.js +2 -2
- package/lib/esm/pointcloud/format/opc/FileReader.js.map +1 -1
- package/lib/esm/pointcloud/format/opc/GeometryReader.js +6 -6
- package/lib/esm/pointcloud/format/opc/GeometryReader.js.map +1 -1
- package/lib/esm/pointcloud/format/opc/TileRecord.js +2 -2
- package/lib/esm/pointcloud/format/opc/TileRecord.js.map +1 -1
- package/lib/esm/pointcloud/model/AttributeTypes.js +16 -16
- package/lib/esm/pointcloud/model/AttributeTypes.js.map +1 -1
- package/lib/esm/pointcloud/model/AttributeValue.js +4 -4
- package/lib/esm/pointcloud/model/AttributeValue.js.map +1 -1
- package/lib/esm/pointcloud/model/CloudPoint.js +2 -2
- package/lib/esm/pointcloud/model/CloudPoint.js.map +1 -1
- package/lib/esm/pointcloud/model/PointDataRaw.js +2 -2
- package/lib/esm/pointcloud/model/PointDataRaw.js.map +1 -1
- package/lib/esm/pointcloud/model/ReadRequest.js +6 -6
- package/lib/esm/pointcloud/model/ReadRequest.js.map +1 -1
- package/lib/esm/pointcloud/model/StandardAttributes.js +21 -21
- package/lib/esm/pointcloud/model/StandardAttributes.js.map +1 -1
- package/lib/esm/pointcloud/render/DataManager.js +6 -6
- package/lib/esm/pointcloud/render/DataManager.js.map +1 -1
- package/lib/esm/pointcloud/render/TileLoadSorter.js +2 -2
- package/lib/esm/pointcloud/render/TileLoadSorter.js.map +1 -1
- package/lib/esm/pointcloud/render/ViewTree.js +4 -4
- package/lib/esm/pointcloud/render/ViewTree.js.map +1 -1
- package/lib/esm/spatial/crs/CRSManager.js +2 -2
- package/lib/esm/spatial/crs/CRSManager.js.map +1 -1
- package/lib/esm/spatial/ecrs/CRS.js +34 -34
- package/lib/esm/spatial/ecrs/CRS.js.map +1 -1
- package/lib/esm/spatial/ecrs/CoordinateSystem.js +2 -2
- package/lib/esm/spatial/ecrs/CoordinateSystem.js.map +1 -1
- package/lib/esm/spatial/ecrs/DataFileUnit.js +1 -1
- package/lib/esm/spatial/ecrs/DataFileUnit.js.map +1 -1
- package/lib/esm/spatial/ecrs/Datum.js +4 -4
- package/lib/esm/spatial/ecrs/Datum.js.map +1 -1
- package/lib/esm/spatial/ecrs/OnlineRegistry.js +2 -2
- package/lib/esm/spatial/ecrs/OnlineRegistry.js.map +1 -1
- package/lib/esm/spatial/ecrs/Operation.js +6 -6
- package/lib/esm/spatial/ecrs/Operation.js.map +1 -1
- package/lib/esm/spatial/ecrs/Registry.js +17 -17
- package/lib/esm/spatial/ecrs/Registry.js.map +1 -1
- package/lib/esm/spatial/ecrs/Transform.js +11 -11
- package/lib/esm/spatial/ecrs/Transform.js.map +1 -1
- package/lib/esm/spatial/ecrs/Unit.js +24 -24
- package/lib/esm/spatial/ecrs/Unit.js.map +1 -1
- package/lib/esm/spatial/ecrs/WellKnownText.js +8 -8
- package/lib/esm/spatial/ecrs/WellKnownText.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/HotineObliqueMercator.js +2 -2
- package/lib/esm/spatial/ecrs/projection/HotineObliqueMercator.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/KrovakObliqueConformalConic.js +2 -2
- package/lib/esm/spatial/ecrs/projection/KrovakObliqueConformalConic.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/KrovakObliqueConformalConicEN.js +2 -2
- package/lib/esm/spatial/ecrs/projection/KrovakObliqueConformalConicEN.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/LambertConical1SP.js +2 -2
- package/lib/esm/spatial/ecrs/projection/LambertConical1SP.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/LambertConical2SP.js +6 -6
- package/lib/esm/spatial/ecrs/projection/LambertConical2SP.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/Mercator1SP.js +4 -4
- package/lib/esm/spatial/ecrs/projection/Mercator1SP.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/ObliqueMercator.js +4 -4
- package/lib/esm/spatial/ecrs/projection/ObliqueMercator.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/ObliqueStereographic.js +4 -4
- package/lib/esm/spatial/ecrs/projection/ObliqueStereographic.js.map +1 -1
- package/lib/esm/spatial/ecrs/projection/TransverseMercator.js +4 -4
- package/lib/esm/spatial/ecrs/projection/TransverseMercator.js.map +1 -1
- package/lib/esm/spatial/ecrs/transformation/PositionVector.js +2 -2
- package/lib/esm/spatial/ecrs/transformation/PositionVector.js.map +1 -1
- package/lib/esm/system/buffer/Float32Buffer.js +2 -2
- package/lib/esm/system/buffer/Float32Buffer.js.map +1 -1
- package/lib/esm/system/buffer/Uint16Buffer.js +2 -2
- package/lib/esm/system/buffer/Uint16Buffer.js.map +1 -1
- package/lib/esm/system/buffer/Uint8Buffer.js +2 -2
- package/lib/esm/system/buffer/Uint8Buffer.js.map +1 -1
- package/lib/esm/system/runtime/ALong.js +26 -26
- package/lib/esm/system/runtime/ALong.js.map +1 -1
- package/lib/esm/system/runtime/ASystem.js +1 -1
- package/lib/esm/system/runtime/ASystem.js.map +1 -1
- package/lib/esm/system/runtime/Downloader.js +2 -2
- package/lib/esm/system/runtime/Downloader.js.map +1 -1
- package/lib/esm/system/runtime/Message.js +2 -2
- package/lib/esm/system/runtime/Message.js.map +1 -1
- package/lib/esm/system/runtime/Numbers.js +6 -6
- package/lib/esm/system/runtime/Numbers.js.map +1 -1
- package/lib/esm/system/runtime/Strings.js +14 -14
- package/lib/esm/system/runtime/Strings.js.map +1 -1
- package/lib/esm/system/storage/ContentLoader.js +2 -2
- package/lib/esm/system/storage/ContentLoader.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnlineRegistry.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/OnlineRegistry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAUH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,OAAO,cAAc;
|
|
1
|
+
{"version":3,"file":"OnlineRegistry.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/OnlineRegistry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAUH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,OAAO,cAAc;IACvB,8BAA8B;aACN,WAAM,GAAW,gBAAgB,CAAC;IAO1D;;;OAGG;IACI,MAAM,CAAC,WAAW;QACrB,OAAO,IAAI,cAAc,CAAC,0EAA0E,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACtI,CAAC;IAED;;;;OAIG;IACH,YAAoB,WAAmB,EAAE,OAAe;QACpD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,OA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CAAC;QAC/B,YAAY;QACZ,OAAO,GAAG,CAAC;IACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { Downloader } from \"../../system/runtime/Downloader\";\nimport { Message } from \"../../system/runtime/Message\";\nimport { Strings } from \"../../system/runtime/Strings\";\nimport { CRS } from \"./CRS\";\nimport { Registry } from \"./Registry\";\nimport { WellKnownText } from \"./WellKnownText\";\n\n/**\n * Class OnlineRegistry downloads the CRS definitions from an online server.\n *\n * @version 1.0 March 2020\n */\n/** @internal */\nexport class OnlineRegistry {\n /** The name of this module */\n private static readonly MODULE: string = \"OnlineRegistry\";\n\n /** The template URL */\n private _urlTemplate: string;\n /** The dialect of WKT to parse */\n private _dialect: string;\n\n /**\n * Open the OrbitGT online registry, see https://spatialreference.org/.\n * @return the registry.\n */\n public static openOrbitGT(): OnlineRegistry {\n return new OnlineRegistry(\"https://ogtcrsregistry.blob.core.windows.net/registry/crs/[epsgCode].prj\", WellKnownText.TYPE_GENERIC);\n }\n\n /**\n * Create a new online registry.\n * @param urlTemplate the template URL in which [epsgCode] will be replaced by the EPSG CRS code.\n * @param dialect the dialect of WKT to parse.\n */\n private constructor(urlTemplate: string, dialect: string) {\n this._urlTemplate = urlTemplate;\n this._dialect = dialect;\n }\n\n /**\n * Get a CRS.\n * @param epsgCode the EPSG code of the CRS to get.\n * @return the CRS.\n */\n public async getCRS(epsgCode: int32): Promise<CRS> {\n /* Invalid code? */\n if (epsgCode == 0) return null;\n /* Already downloaded? */\n let crs: CRS = Registry.getCRS(epsgCode);\n if (crs != null) return crs;\n /* Download the declaration */\n Message.print(OnlineRegistry.MODULE, \"Requesting online crs '\" + epsgCode + \"'\");\n let downloadURL: string = Strings.replace(this._urlTemplate, \"[epsgCode]\", \"\" + epsgCode);\n let wkt: string = await Downloader.INSTANCE.downloadText2(downloadURL);\n if (wkt == null) { Message.print(OnlineRegistry.MODULE, \"No WKT response\"); return null; }\n /* Try to parse the WKT */\n crs = WellKnownText.parseSpatialReferenceSystem(epsgCode, wkt, this._dialect);\n if (crs == null) { Message.print(OnlineRegistry.MODULE, \"The WKT could not be parsed\"); return null; }\n crs.setTextForm(wkt);\n /* Keep in memory */\n Message.print(OnlineRegistry.MODULE, \"Created online CRS \" + crs);\n Registry.setCRS(epsgCode, crs);\n /* Return */\n return crs;\n }\n}\n"]}
|
|
@@ -21,6 +21,12 @@ import { Registry } from "./Registry";
|
|
|
21
21
|
*/
|
|
22
22
|
/** @internal */
|
|
23
23
|
export class Operation {
|
|
24
|
+
/** The type of a concatenated operation */
|
|
25
|
+
static { this.CONCATENATED = 1; }
|
|
26
|
+
/** The type of a conversion operation (projected to geographic) */
|
|
27
|
+
static { this.CONVERSION = 2; }
|
|
28
|
+
/** The type of a transformation operation (geocentric to geocentric) */
|
|
29
|
+
static { this.TRANSFORMATION = 3; }
|
|
24
30
|
/**
|
|
25
31
|
* Create a new coordinate operation.
|
|
26
32
|
* @param code the code.
|
|
@@ -333,10 +339,4 @@ export class Operation {
|
|
|
333
339
|
return transformations.get(bestIndex);
|
|
334
340
|
}
|
|
335
341
|
}
|
|
336
|
-
/** The type of a concatenated operation */
|
|
337
|
-
Operation.CONCATENATED = 1;
|
|
338
|
-
/** The type of a conversion operation (projected to geographic) */
|
|
339
|
-
Operation.CONVERSION = 2;
|
|
340
|
-
/** The type of a transformation operation (geocentric to geocentric) */
|
|
341
|
-
Operation.TRANSFORMATION = 3;
|
|
342
342
|
//# sourceMappingURL=Operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/Operation.ts"],"names":[],"mappings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,wBAAwB,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACtG,+BAA+B;QAC/B,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,WAAW;YACX,IAAI,OAAO,GAAU,SAAS,CAAC,wBAAwB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1F,IAAI,OAAO,GAAG,WAAW,EAAE,CAAC;gBACxB,uBAAuB;gBACvB,SAAS,GAAG,CAAC,CAAC;gBACd,WAAW,GAAG,OAAO,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,+BAA+B;QAC/B,OAAO,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;;AAnVD,2CAA2C;AACpB,sBAAY,GAAU,CAAC,CAAC;AAC/C,mEAAmE;AAC5C,oBAAU,GAAU,CAAC,CAAC;AAC7C,wEAAwE;AACjD,wBAAc,GAAU,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { AList } from \"../../system/collection/AList\";\nimport { Numbers } from \"../../system/runtime/Numbers\";\nimport { Strings } from \"../../system/runtime/Strings\";\nimport { Coordinate } from \"../geom/Coordinate\";\nimport { CRS } from \"./CRS\";\nimport { OperationMethod } from \"./OperationMethod\";\nimport { Registry } from \"./Registry\";\n\n/**\n * Class Operation defines an coordinate operation. The operation defines a specific method,\n * together with specific values for the parameters of the method, and a specific source and\n * destination coordinate reference system.\n *\n * 'Conversions' are operations that convert from projected systems to and from geographic systems (same datum).\n * 'Transformations' are Operations that convert from one geocentric system to another (different datum).\n *\n * @version 1.0 July 2005\n */\n/** @internal */\nexport class Operation {\n /** The type of a concatenated operation */\n public static readonly CONCATENATED: int32 = 1;\n /** The type of a conversion operation (projected to geographic) */\n public static readonly CONVERSION: int32 = 2;\n /** The type of a transformation operation (geocentric to geocentric) */\n public static readonly TRANSFORMATION: int32 = 3;\n\n /** The code */\n private _code: int32;\n /** The name */\n private _name: string;\n /** The type */\n private _type: int32;\n /** The code of the source CRS */\n private _sourceCRScode: int32;\n /** The code of the target CRS */\n private _targetCRScode: int32;\n /** The area on which the operation has been defined (0 if unknown) */\n private _areaOfUse: int32;\n /** The method */\n private _method: OperationMethod;\n\n /** Have we been initialised ? */\n private _initialised: boolean;\n /** The source coordinate reference system */\n private _sourceCRS: CRS;\n /** The target coordinate reference system */\n private _targetCRS: CRS;\n /** The concatenated operations */\n private _concatenatedOperations: AList<Operation>;\n\n /**\n * Create a new coordinate operation.\n * @param code the code.\n * @param name the name.\n * @param type the type (CONCATENATED, CONVERSION or TRANSFORMATION).\n * @param sourceCRScode the code of the source CRS.\n * @param targetCRScode the code of the target CRS.\n * @param areaOfUse the area on which the operation has been defined (0 if unknown).\n * @param method the method (null for concatenated operations).\n */\n public constructor(code: int32, name: string, type: int32, sourceCRScode: int32, targetCRScode: int32, areaOfUse: int32, method: OperationMethod) {\n /* Store the parameters */\n this._code = code;\n this._name = name;\n this._type = type;\n this._sourceCRScode = sourceCRScode;\n this._targetCRScode = targetCRScode;\n this._areaOfUse = areaOfUse;\n this._method = method;\n /* Clear */\n this._initialised = false;\n this._sourceCRS = null;\n this._targetCRS = null;\n this._concatenatedOperations = null;\n }\n\n /**\n * Get the code.\n * @return the code.\n */\n public getCode(): int32 {\n return this._code;\n }\n\n /**\n * Get the name.\n * @return the name.\n */\n public getName(): string {\n return this._name;\n }\n\n /**\n * Get the type (CONCATENATED, CONVERSION or TRANSFORMATION).\n * @return the type.\n */\n public getType(): int32 {\n return this._type;\n }\n\n /**\n * Get the code of the source CRS.\n * @return the code of the source CRS.\n */\n public getSourceCRScode(): int32 {\n return this._sourceCRScode;\n }\n\n /**\n * Get the code of the target CRS.\n * @return the code of the target CRS.\n */\n public getTargetCRScode(): int32 {\n return this._targetCRScode;\n }\n\n /**\n * Get the area on which the operation has been defined.\n * @return the area on which the operation has been defined (0 if unknown).\n */\n public getAreaOfUse(): int32 {\n return this._areaOfUse;\n }\n\n /**\n * Get the method (null for concatenated operations).\n * @return the method.\n */\n public getMethod(): OperationMethod {\n return this._method;\n }\n\n /**\n * Set the method.\n * @param method the new method (null for concatenated operations).\n */\n public setMethod(method: OperationMethod): void {\n this._method = method;\n }\n\n /**\n * Get the concatenated operations.\n * @return the concatenated operations (null for a method).\n */\n public getConcatenatedOperations(): AList<Operation> {\n return this._concatenatedOperations;\n }\n\n /**\n * Set the concatenated operations.\n * @param concatenatedOperations the concatenated operations (null for a method).\n */\n public setConcatenatedOperations(concatenatedOperations: AList<Operation>): void {\n this._concatenatedOperations = concatenatedOperations;\n }\n\n /**\n * Initialise the operation.\n */\n public initialise(): void {\n /* Initialize the systems */\n if (this._sourceCRS == null) this._sourceCRS = Registry.getCRS(this._sourceCRScode);\n if (this._targetCRS == null) this._targetCRS = Registry.getCRS(this._targetCRScode);\n /* Already done ? */\n if (this._initialised) return;\n this._initialised = true;\n /* Concatenated operations ? */\n if (this._type == Operation.CONCATENATED) {\n /* Create the list of operations */\n this._concatenatedOperations = new AList<Operation>(); //Registry.readConcatenatedOperations(this.code);\n }\n else {\n /* Initialise the method ? */\n this._method.initialize(this);\n }\n }\n\n /**\n * Get the source CRS.\n * @return the source CRS.\n */\n public getSourceCRS(): CRS {\n if (this._sourceCRS == null) this.initialise();\n return this._sourceCRS;\n }\n\n /**\n * Set the source CRS.\n * @param sourceCRS the source CRS.\n */\n public setSourceCRS(sourceCRS: CRS): void {\n this._sourceCRS = sourceCRS;\n }\n\n /**\n * Get the target CRS.\n * @return the target CRS.\n */\n public getTargetCRS(): CRS {\n if (this._targetCRS == null) this.initialise();\n return this._targetCRS;\n }\n\n /**\n * Set the target CRS.\n * @param targetCRS the target CRS.\n */\n public setTargetCRS(targetCRS: CRS): void {\n this._targetCRS = targetCRS;\n }\n\n /**\n * Convert a source coordinate to a target coordinate.\n * @param source the coordinates in the source CRS.\n * @param target the coordinates in the target CRS (this is the result object).\n */\n public forward(source: Coordinate, target: Coordinate): void {\n this.initialise();\n /* Concatenated operations ? */\n if (this._type == Operation.CONCATENATED) {\n /* Run all operations */\n for (let i: number = 0; i < this._concatenatedOperations.size(); i++) {\n this._concatenatedOperations.get(i).forward(source, target);\n source = target;\n }\n }\n else {\n /* Let the method do it */\n this._method.forward(this._sourceCRS, source, this._targetCRS, target);\n }\n }\n\n /**\n * Convert a target coordinate to a source coordinate.\n * @param source the coordinates in the source CRS (this is the result object).\n * @param target the coordinates in the target CRS.\n */\n public reverse(source: Coordinate, target: Coordinate): void {\n this.initialise();\n /* Concatenated operations ? */\n if (this._type == Operation.CONCATENATED) {\n /* Run all operations */\n for (let i: number = 0; i < this._concatenatedOperations.size(); i++) {\n this._concatenatedOperations.get(this._concatenatedOperations.size() - 1 - i).reverse(source, target);\n target = source;\n }\n }\n else {\n /* Let the method do it */\n this._method.reverse(this._sourceCRS, source, this._targetCRS, target);\n }\n }\n\n /**\n * Check if another operation is compatible with this one.\n * @param other the other operation.\n * @return true if compatible.\n */\n public isCompatible(other: Operation): boolean {\n if (other._code == this._code) return true; // all operations should have unique identifiers\n if (other._type != this._type) return false;\n if (other._sourceCRScode != this._sourceCRScode) return false;\n if (other._targetCRScode != this._targetCRScode) return false;\n if (other._method.isCompatible(this._method) == false) return false;\n if (Operation.areCompatibleOperations(other._concatenatedOperations, this._concatenatedOperations) == false) return false;\n return true;\n }\n\n /**\n * Check if two operations are compatible.\n * @param operation1 the first operation.\n * @param operation2 the second operation.\n * @return true if compatible.\n */\n public static isCompatibleOperation(operation1: Operation, operation2: Operation): boolean {\n if (operation1 == null) return (operation2 == null);\n if (operation2 == null) return false;\n return (operation1.isCompatible(operation2));\n }\n\n /**\n * Check if a list of operations is compatible with another one.\n * @param list1 the first list.\n * @param list2 the second list.\n * @return true if compatible.\n */\n private static areCompatibleOperations(list1: AList<Operation>, list2: AList<Operation>): boolean {\n if (list1 == null) return (list2 == null);\n if (list2 == null) return false;\n if (list2.size() != list1.size()) return false;\n for (let i: number = 0; i < list2.size(); i++) if (list2.get(i).isCompatible(list1.get(i)) == false) return false;\n return true;\n }\n\n /**\n * The standard toString method.\n * @see Object#toString\n */\n public toString(): string {\n return \"[Operation:code=\" + this._code + \",name='\" + this._name + \"',type=\" + this._type + \",sourceCRS=\" + this._sourceCRScode + \",targetCRS=\" + this._targetCRScode + \",area=\" + this._areaOfUse + \",method=\" + this._method + \"]\";\n }\n\n /**\n * Find an operation by name.\n * @param operations the list of operations.\n * @param name the name of the operation.\n * @return the index of the operation.\n */\n public static findByName(operations: Array<Operation>, name: string): int32 {\n /* No list ? */\n if (operations == null) return -1;\n /* Check */\n for (let i: number = 0; i < operations.length; i++) if (Strings.equalsIgnoreCase(operations[i].getName(), name)) return i;\n /* Not found */\n return -1;\n }\n\n /**\n * Get the version of a transformation.\n * @param transformationName the name of the transformation.\n * @return the version (0 if not found).\n */\n private static getTransformationVersion(transformationName: string): int32 {\n /* Find the (...) sequence */\n let index0: int32 = Strings.lastIndexOf(transformationName, \"(\");\n if (index0 < 0) return 0;\n let index1: int32 = Strings.lastIndexOf(transformationName, \")\");\n if ((index1 < 0) || (index1 < index0)) return 0;\n /* Parse the version */\n let version: string = Strings.substring(transformationName, index0 + 1, index1);\n return Numbers.getInteger(version, 0);\n }\n\n /**\n * Get the latest transform from a set of transformations.\n * @param transformations the set of transformations.\n * @return the latest transform.\n */\n public static getLatestTransformation(transformations: AList<Operation>): Operation {\n /* We need at least two transforms */\n if (transformations == null) return null;\n if (transformations.size() == 0) return null;\n if (transformations.size() == 1) return transformations.get(0);\n /* Start with the first transform */\n let bestIndex: int32 = 0;\n let bestVersion: int32 = Operation.getTransformationVersion(transformations.get(bestIndex).getName());\n /* Check for better versions */\n for (let i: number = 1; i < transformations.size(); i++) {\n /* Check */\n let version: int32 = Operation.getTransformationVersion(transformations.get(i).getName());\n if (version > bestVersion) {\n /* This one is later */\n bestIndex = i;\n bestVersion = version;\n }\n }\n /* Return the best transform */\n return transformations.get(bestIndex);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/Operation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAUH,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAIvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;GASG;AACH,gBAAgB;AAChB,MAAM,OAAO,SAAS;IAClB,2CAA2C;aACpB,iBAAY,GAAU,CAAC,CAAC;IAC/C,mEAAmE;aAC5C,eAAU,GAAU,CAAC,CAAC;IAC7C,wEAAwE;aACjD,mBAAc,GAAU,CAAC,CAAC;IA0BjD;;;;;;;;;OASG;IACH,YAAmB,IAAW,EAAE,IAAY,EAAE,IAAW,EAAE,aAAoB,EAAE,aAAoB,EAAE,SAAgB,EAAE,MAAuB;QAC5I,0BAA0B;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CA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EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QAChF,OAAO,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,uBAAuB,CAAC,eAAiC;QACnE,qCAAqC;QACrC,IAAI,eAAe,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QACzC,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAC7C,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/D,oCAAoC;QACpC,IAAI,SAAS,GAAU,CAAC,CAAC;QACzB,IAAI,WAAW,GAAU,SAAS,CAAC,wBAAwB,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACtG,+BAA+B;QAC/B,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,WAAW;YACX,IAAI,OAAO,GAAU,SAAS,CAAC,wBAAwB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1F,IAAI,OAAO,GAAG,WAAW,EAAE,CAAC;gBACxB,uBAAuB;gBACvB,SAAS,GAAG,CAAC,CAAC;gBACd,WAAW,GAAG,OAAO,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,+BAA+B;QAC/B,OAAO,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { AList } from \"../../system/collection/AList\";\nimport { Numbers } from \"../../system/runtime/Numbers\";\nimport { Strings } from \"../../system/runtime/Strings\";\nimport { Coordinate } from \"../geom/Coordinate\";\nimport { CRS } from \"./CRS\";\nimport { OperationMethod } from \"./OperationMethod\";\nimport { Registry } from \"./Registry\";\n\n/**\n * Class Operation defines an coordinate operation. The operation defines a specific method,\n * together with specific values for the parameters of the method, and a specific source and\n * destination coordinate reference system.\n *\n * 'Conversions' are operations that convert from projected systems to and from geographic systems (same datum).\n * 'Transformations' are Operations that convert from one geocentric system to another (different datum).\n *\n * @version 1.0 July 2005\n */\n/** @internal */\nexport class Operation {\n /** The type of a concatenated operation */\n public static readonly CONCATENATED: int32 = 1;\n /** The type of a conversion operation (projected to geographic) */\n public static readonly CONVERSION: int32 = 2;\n /** The type of a transformation operation (geocentric to geocentric) */\n public static readonly TRANSFORMATION: int32 = 3;\n\n /** The code */\n private _code: int32;\n /** The name */\n private _name: string;\n /** The type */\n private _type: int32;\n /** The code of the source CRS */\n private _sourceCRScode: int32;\n /** The code of the target CRS */\n private _targetCRScode: int32;\n /** The area on which the operation has been defined (0 if unknown) */\n private _areaOfUse: int32;\n /** The method */\n private _method: OperationMethod;\n\n /** Have we been initialised ? */\n private _initialised: boolean;\n /** The source coordinate reference system */\n private _sourceCRS: CRS;\n /** The target coordinate reference system */\n private _targetCRS: CRS;\n /** The concatenated operations */\n private _concatenatedOperations: AList<Operation>;\n\n /**\n * Create a new coordinate operation.\n * @param code the code.\n * @param name the name.\n * @param type the type (CONCATENATED, CONVERSION or TRANSFORMATION).\n * @param sourceCRScode the code of the source CRS.\n * @param targetCRScode the code of the target CRS.\n * @param areaOfUse the area on which the operation has been defined (0 if unknown).\n * @param method the method (null for concatenated operations).\n */\n public constructor(code: int32, name: string, type: int32, sourceCRScode: int32, targetCRScode: int32, areaOfUse: int32, method: OperationMethod) {\n /* Store the parameters */\n this._code = code;\n this._name = name;\n this._type = type;\n this._sourceCRScode = sourceCRScode;\n this._targetCRScode = targetCRScode;\n this._areaOfUse = areaOfUse;\n this._method = method;\n /* Clear */\n this._initialised = false;\n this._sourceCRS = null;\n this._targetCRS = null;\n this._concatenatedOperations = null;\n }\n\n /**\n * Get the code.\n * @return the code.\n */\n public getCode(): int32 {\n return this._code;\n }\n\n /**\n * Get the name.\n * @return the name.\n */\n public getName(): string {\n return this._name;\n }\n\n /**\n * Get the type (CONCATENATED, CONVERSION or TRANSFORMATION).\n * @return the type.\n */\n public getType(): int32 {\n return this._type;\n }\n\n /**\n * Get the code of the source CRS.\n * @return the code of the source CRS.\n */\n public getSourceCRScode(): int32 {\n return this._sourceCRScode;\n }\n\n /**\n * Get the code of the target CRS.\n * @return the code of the target CRS.\n */\n public getTargetCRScode(): int32 {\n return this._targetCRScode;\n }\n\n /**\n * Get the area on which the operation has been defined.\n * @return the area on which the operation has been defined (0 if unknown).\n */\n public getAreaOfUse(): int32 {\n return this._areaOfUse;\n }\n\n /**\n * Get the method (null for concatenated operations).\n * @return the method.\n */\n public getMethod(): OperationMethod {\n return this._method;\n }\n\n /**\n * Set the method.\n * @param method the new method (null for concatenated operations).\n */\n public setMethod(method: OperationMethod): void {\n this._method = method;\n }\n\n /**\n * Get the concatenated operations.\n * @return the concatenated operations (null for a method).\n */\n public getConcatenatedOperations(): AList<Operation> {\n return this._concatenatedOperations;\n }\n\n /**\n * Set the concatenated operations.\n * @param concatenatedOperations the concatenated operations (null for a method).\n */\n public setConcatenatedOperations(concatenatedOperations: AList<Operation>): void {\n this._concatenatedOperations = concatenatedOperations;\n }\n\n /**\n * Initialise the operation.\n */\n public initialise(): void {\n /* Initialize the systems */\n if (this._sourceCRS == null) this._sourceCRS = Registry.getCRS(this._sourceCRScode);\n if (this._targetCRS == null) this._targetCRS = Registry.getCRS(this._targetCRScode);\n /* Already done ? */\n if (this._initialised) return;\n this._initialised = true;\n /* Concatenated operations ? */\n if (this._type == Operation.CONCATENATED) {\n /* Create the list of operations */\n this._concatenatedOperations = new AList<Operation>(); //Registry.readConcatenatedOperations(this.code);\n }\n else {\n /* Initialise the method ? */\n this._method.initialize(this);\n }\n }\n\n /**\n * Get the source CRS.\n * @return the source CRS.\n */\n public getSourceCRS(): CRS {\n if (this._sourceCRS == null) this.initialise();\n return this._sourceCRS;\n }\n\n /**\n * Set the source CRS.\n * @param sourceCRS the source CRS.\n */\n public setSourceCRS(sourceCRS: CRS): void {\n this._sourceCRS = sourceCRS;\n }\n\n /**\n * Get the target CRS.\n * @return the target CRS.\n */\n public getTargetCRS(): CRS {\n if (this._targetCRS == null) this.initialise();\n return this._targetCRS;\n }\n\n /**\n * Set the target CRS.\n * @param targetCRS the target CRS.\n */\n public setTargetCRS(targetCRS: CRS): void {\n this._targetCRS = targetCRS;\n }\n\n /**\n * Convert a source coordinate to a target coordinate.\n * @param source the coordinates in the source CRS.\n * @param target the coordinates in the target CRS (this is the result object).\n */\n public forward(source: Coordinate, target: Coordinate): void {\n this.initialise();\n /* Concatenated operations ? */\n if (this._type == Operation.CONCATENATED) {\n /* Run all operations */\n for (let i: number = 0; i < this._concatenatedOperations.size(); i++) {\n this._concatenatedOperations.get(i).forward(source, target);\n source = target;\n }\n }\n else {\n /* Let the method do it */\n this._method.forward(this._sourceCRS, source, this._targetCRS, target);\n }\n }\n\n /**\n * Convert a target coordinate to a source coordinate.\n * @param source the coordinates in the source CRS (this is the result object).\n * @param target the coordinates in the target CRS.\n */\n public reverse(source: Coordinate, target: Coordinate): void {\n this.initialise();\n /* Concatenated operations ? */\n if (this._type == Operation.CONCATENATED) {\n /* Run all operations */\n for (let i: number = 0; i < this._concatenatedOperations.size(); i++) {\n this._concatenatedOperations.get(this._concatenatedOperations.size() - 1 - i).reverse(source, target);\n target = source;\n }\n }\n else {\n /* Let the method do it */\n this._method.reverse(this._sourceCRS, source, this._targetCRS, target);\n }\n }\n\n /**\n * Check if another operation is compatible with this one.\n * @param other the other operation.\n * @return true if compatible.\n */\n public isCompatible(other: Operation): boolean {\n if (other._code == this._code) return true; // all operations should have unique identifiers\n if (other._type != this._type) return false;\n if (other._sourceCRScode != this._sourceCRScode) return false;\n if (other._targetCRScode != this._targetCRScode) return false;\n if (other._method.isCompatible(this._method) == false) return false;\n if (Operation.areCompatibleOperations(other._concatenatedOperations, this._concatenatedOperations) == false) return false;\n return true;\n }\n\n /**\n * Check if two operations are compatible.\n * @param operation1 the first operation.\n * @param operation2 the second operation.\n * @return true if compatible.\n */\n public static isCompatibleOperation(operation1: Operation, operation2: Operation): boolean {\n if (operation1 == null) return (operation2 == null);\n if (operation2 == null) return false;\n return (operation1.isCompatible(operation2));\n }\n\n /**\n * Check if a list of operations is compatible with another one.\n * @param list1 the first list.\n * @param list2 the second list.\n * @return true if compatible.\n */\n private static areCompatibleOperations(list1: AList<Operation>, list2: AList<Operation>): boolean {\n if (list1 == null) return (list2 == null);\n if (list2 == null) return false;\n if (list2.size() != list1.size()) return false;\n for (let i: number = 0; i < list2.size(); i++) if (list2.get(i).isCompatible(list1.get(i)) == false) return false;\n return true;\n }\n\n /**\n * The standard toString method.\n * @see Object#toString\n */\n public toString(): string {\n return \"[Operation:code=\" + this._code + \",name='\" + this._name + \"',type=\" + this._type + \",sourceCRS=\" + this._sourceCRScode + \",targetCRS=\" + this._targetCRScode + \",area=\" + this._areaOfUse + \",method=\" + this._method + \"]\";\n }\n\n /**\n * Find an operation by name.\n * @param operations the list of operations.\n * @param name the name of the operation.\n * @return the index of the operation.\n */\n public static findByName(operations: Array<Operation>, name: string): int32 {\n /* No list ? */\n if (operations == null) return -1;\n /* Check */\n for (let i: number = 0; i < operations.length; i++) if (Strings.equalsIgnoreCase(operations[i].getName(), name)) return i;\n /* Not found */\n return -1;\n }\n\n /**\n * Get the version of a transformation.\n * @param transformationName the name of the transformation.\n * @return the version (0 if not found).\n */\n private static getTransformationVersion(transformationName: string): int32 {\n /* Find the (...) sequence */\n let index0: int32 = Strings.lastIndexOf(transformationName, \"(\");\n if (index0 < 0) return 0;\n let index1: int32 = Strings.lastIndexOf(transformationName, \")\");\n if ((index1 < 0) || (index1 < index0)) return 0;\n /* Parse the version */\n let version: string = Strings.substring(transformationName, index0 + 1, index1);\n return Numbers.getInteger(version, 0);\n }\n\n /**\n * Get the latest transform from a set of transformations.\n * @param transformations the set of transformations.\n * @return the latest transform.\n */\n public static getLatestTransformation(transformations: AList<Operation>): Operation {\n /* We need at least two transforms */\n if (transformations == null) return null;\n if (transformations.size() == 0) return null;\n if (transformations.size() == 1) return transformations.get(0);\n /* Start with the first transform */\n let bestIndex: int32 = 0;\n let bestVersion: int32 = Operation.getTransformationVersion(transformations.get(bestIndex).getName());\n /* Check for better versions */\n for (let i: number = 1; i < transformations.size(); i++) {\n /* Check */\n let version: int32 = Operation.getTransformationVersion(transformations.get(i).getName());\n if (version > bestVersion) {\n /* This one is later */\n bestIndex = i;\n bestVersion = version;\n }\n }\n /* Return the best transform */\n return transformations.get(bestIndex);\n }\n}\n"]}
|
|
@@ -19,6 +19,23 @@ import { Unit } from "./Unit";
|
|
|
19
19
|
*/
|
|
20
20
|
/** @internal */
|
|
21
21
|
export class Registry {
|
|
22
|
+
/** The name of the unit table */
|
|
23
|
+
static { this._TABLE_UNIT = "unit"; }
|
|
24
|
+
// Unit columns: UOM_CODE UNIT_OF_MEAS_NAME UNIT_OF_MEAS_TYPE TARGET_UOM_CODE FACTOR_B FACTOR_C ABBREVIATION
|
|
25
|
+
static { this._COL_COUNT_UNIT = 7; }
|
|
26
|
+
static { this._COL_UNIT_CODE = 0; }
|
|
27
|
+
static { this._COL_UNIT_NAME = 1; }
|
|
28
|
+
static { this._COL_UNIT_TYPE = 2; }
|
|
29
|
+
static { this._COL_UNIT_TARGET_CODE = 3; }
|
|
30
|
+
static { this._COL_UNIT_FACTOR_B = 4; }
|
|
31
|
+
static { this._COL_UNIT_FACTOR_C = 5; }
|
|
32
|
+
static { this._COL_UNIT_ABBREVIATION = 6; }
|
|
33
|
+
/** The map for preferred transformation between CRSs */
|
|
34
|
+
static { this._PREFERRED_TRANSFORMATIONS = new StringMap(); }
|
|
35
|
+
/** Define the list of all units */
|
|
36
|
+
static { this._UNIT_LIST = null; }
|
|
37
|
+
/** Define the map of CRS instances that have been read */
|
|
38
|
+
static { this._CRS_MAP = new StringMap(); }
|
|
22
39
|
/**
|
|
23
40
|
* No instances.
|
|
24
41
|
*/
|
|
@@ -184,21 +201,4 @@ export class Registry {
|
|
|
184
201
|
Registry.setCRS(baseCRS.getCode(), baseCRS);
|
|
185
202
|
}
|
|
186
203
|
}
|
|
187
|
-
/** The name of the unit table */
|
|
188
|
-
Registry._TABLE_UNIT = "unit";
|
|
189
|
-
// Unit columns: UOM_CODE UNIT_OF_MEAS_NAME UNIT_OF_MEAS_TYPE TARGET_UOM_CODE FACTOR_B FACTOR_C ABBREVIATION
|
|
190
|
-
Registry._COL_COUNT_UNIT = 7;
|
|
191
|
-
Registry._COL_UNIT_CODE = 0;
|
|
192
|
-
Registry._COL_UNIT_NAME = 1;
|
|
193
|
-
Registry._COL_UNIT_TYPE = 2;
|
|
194
|
-
Registry._COL_UNIT_TARGET_CODE = 3;
|
|
195
|
-
Registry._COL_UNIT_FACTOR_B = 4;
|
|
196
|
-
Registry._COL_UNIT_FACTOR_C = 5;
|
|
197
|
-
Registry._COL_UNIT_ABBREVIATION = 6;
|
|
198
|
-
/** The map for preferred transformation between CRSs */
|
|
199
|
-
Registry._PREFERRED_TRANSFORMATIONS = new StringMap();
|
|
200
|
-
/** Define the list of all units */
|
|
201
|
-
Registry._UNIT_LIST = null;
|
|
202
|
-
/** Define the map of CRS instances that have been read */
|
|
203
|
-
Registry._CRS_MAP = new StringMap();
|
|
204
204
|
//# sourceMappingURL=Registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/Registry.ts"],"names":[],"mappings":"AAAA;;;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,GAAQ;QACzC,sBAAsB;QACtB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,CAAC,CAAC;QACzC,mCAAmC;QACnC,IAAI,OAAO,GAAQ,GAAG,CAAC,UAAU,EAAE,CAAC;QACpC,IAAI,OAAO,IAAI,IAAI;YAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;;AAlLD,iCAAiC;AACT,oBAAW,GAAW,MAAM,CAAC;AAErD,4GAA4G;AACpF,wBAAe,GAAU,CAAC,CAAC;AAC3B,uBAAc,GAAU,CAAC,CAAC;AAC1B,uBAAc,GAAU,CAAC,CAAC;AAC1B,uBAAc,GAAU,CAAC,CAAC;AAC1B,8BAAqB,GAAU,CAAC,CAAC;AACjC,2BAAkB,GAAU,CAAC,CAAC;AAC9B,2BAAkB,GAAU,CAAC,CAAC;AAC9B,+BAAsB,GAAU,CAAC,CAAC;AAE1D,wDAAwD;AACzC,mCAA0B,GAAyB,IAAI,SAAS,EAAa,CAAC;AAC7F,mCAAmC;AACpB,mBAAU,GAAgB,IAAI,CAAC;AAC9C,0DAA0D;AAC3C,iBAAQ,GAAmB,IAAI,SAAS,EAAO,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { AList } from \"../../system/collection/AList\";\nimport { StringMap } from \"../../system/collection/StringMap\";\nimport { ASystem } from \"../../system/runtime/ASystem\";\nimport { Numbers } from \"../../system/runtime/Numbers\";\nimport { Strings } from \"../../system/runtime/Strings\";\nimport { CRS } from \"./CRS\";\nimport { DataFileUnit } from \"./DataFileUnit\";\nimport { Operation } from \"./Operation\";\nimport { Unit } from \"./Unit\";\n\n/**\n * Class Registry defines the EPSG registry of coordinate reference systems (CRS).\n *\n * @version 1.0 December 2019\n */\n/** @internal */\nexport class Registry {\n /** The name of the unit table */\n private static readonly _TABLE_UNIT: string = \"unit\";\n\n // Unit columns: UOM_CODE\tUNIT_OF_MEAS_NAME\tUNIT_OF_MEAS_TYPE\tTARGET_UOM_CODE\tFACTOR_B\tFACTOR_C\tABBREVIATION\n private static readonly _COL_COUNT_UNIT: int32 = 7;\n private static readonly _COL_UNIT_CODE: int32 = 0;\n private static readonly _COL_UNIT_NAME: int32 = 1;\n private static readonly _COL_UNIT_TYPE: int32 = 2;\n private static readonly _COL_UNIT_TARGET_CODE: int32 = 3;\n private static readonly _COL_UNIT_FACTOR_B: int32 = 4;\n private static readonly _COL_UNIT_FACTOR_C: int32 = 5;\n private static readonly _COL_UNIT_ABBREVIATION: int32 = 6;\n\n /** The map for preferred transformation between CRSs */\n private static _PREFERRED_TRANSFORMATIONS: StringMap<Operation> = new StringMap<Operation>();\n /** Define the list of all units */\n private static _UNIT_LIST: AList<Unit> = null;\n /** Define the map of CRS instances that have been read */\n private static _CRS_MAP: StringMap<CRS> = new StringMap<CRS>();\n\n /**\n * No instances.\n */\n private constructor() { }\n\n /**\n * Get the UTM CRS code at a certain location.\n * @param lon the WGS84 (CRS 4326) longitude (degrees).\n * @param lat the WGS84 (CRS 4326) latitude (degrees).\n * @return the CRS code.\n */\n public static getUTMCRSCodeAt(lon: float64, lat: float64): int32 {\n /* Normalize longitude */\n while (lon < -180.0) lon += 360.0;\n while (lon > 180.0) lon -= 360.0;\n /* Get the zone identifier */\n let zoneId: int32 = Math.round((lon + 183.0) / 6.0);\n if (zoneId < 1) zoneId = 1;\n if (zoneId > 60) zoneId = 60;\n /* Get the CRS code */\n return (lat >= 0.0) ? (32600 + zoneId) : (32700 + zoneId);\n }\n\n /**\n * Get a preferred transformation (to WGS84).\n * @param crs the crs.\n * @return the preferred transformation (can be null).\n */\n public static getPreferredTransformation(crs: string): Operation {\n return Registry._PREFERRED_TRANSFORMATIONS.get(crs);\n }\n\n /**\n * Set a preferred transformation (to WGS84).\n * @param crs the crs.\n * @param transformation the preferred transformation (can be null).\n */\n public static setPreferredTransformation(crs: string, transformation: Operation): void {\n Registry._PREFERRED_TRANSFORMATIONS.put(crs, transformation);\n }\n\n /**\n * Open a table.\n * @param tableName the name of the table.\n * @return the table.\n */\n private static openTable(tableName: string): AList<string> {\n if (Strings.equals(tableName, Registry._TABLE_UNIT)) return DataFileUnit.getDataLines();\n return new AList<string>();\n }\n\n /**\n * Read all units.\n * @return all units.\n */\n private static readAllUnits(): AList<Unit> {\n /* Make the list */\n let units: AList<Unit> = new AList<Unit>();\n /* Open the table */\n let tableReader: AList<string> = Registry.openTable(Registry._TABLE_UNIT);\n let headerLine: string = tableReader.get(0);\n /* Process the table */\n for (let i: number = 1; i < tableReader.size(); i++) {\n /* Read the next line */\n let line: string = tableReader.get(i);\n /* Get the columns */\n let parts: AList<string> = Strings.splitAsList(line, Strings.TAB);\n if (parts.size() != Registry._COL_COUNT_UNIT) continue;\n /* Get the parameters */\n let code: int32 = Numbers.getInteger(parts.get(Registry._COL_UNIT_CODE), 0);\n let name: string = parts.get(Registry._COL_UNIT_NAME);\n let type: string = parts.get(Registry._COL_UNIT_TYPE);\n let targetUnitCode: int32 = Numbers.getInteger(parts.get(Registry._COL_UNIT_TARGET_CODE), 0);\n let b: float64 = Numbers.getDouble(parts.get(Registry._COL_UNIT_FACTOR_B), 0.0);\n let c: float64 = Numbers.getDouble(parts.get(Registry._COL_UNIT_FACTOR_C), 0.0);\n let abbreviation: string = parts.get(Registry._COL_UNIT_ABBREVIATION);\n /* Add a new unit */\n let unit: Unit = new Unit(code, name, abbreviation, type, targetUnitCode, b, c);\n units.add(unit);\n }\n /* Return the units */\n return units;\n }\n\n /**\n * List all units.\n * @return all units.\n */\n public static listUnits(): AList<Unit> {\n if (Registry._UNIT_LIST == null) Registry._UNIT_LIST = Registry.readAllUnits();\n return Registry._UNIT_LIST;\n }\n\n /**\n * Find a unit.\n * @param unitCode the identification code of the unit.\n * @return a unit (null if not found).\n */\n public static findUnit(unitCode: int32): Unit {\n let unitList: AList<Unit> = Registry.listUnits();\n for (let unit of unitList) if (unit.getCode() == unitCode) return unit;\n return null;\n }\n\n /**\n * Get a unit.\n * @param unitCode the identification code of the unit.\n * @return a unit (not null).\n */\n public static getUnit(unitCode: int32): Unit {\n let unit: Unit = Registry.findUnit(unitCode);\n ASystem.assertNot(unit == null, \"Unit '\" + unitCode + \"' not found\");\n return unit;\n }\n\n /**\n * Find a unit by name.\n * @param unitName the name (or abbreviation or code) of the unit.\n * @return a unit (null if not found).\n */\n public static findUnitName(unitName: string): Unit {\n if (unitName == null) return null;\n let unitList: AList<Unit> = Registry.listUnits();\n for (let unit of unitList) if (Strings.equalsIgnoreCase(unitName, unit.getName())) return unit;\n for (let unit of unitList) if (Strings.equalsIgnoreCase(unitName, unit.getAbbreviation())) return unit;\n for (let unit of unitList) if (Strings.equals(unitName, \"\" + unit.getCode())) return unit;\n return null;\n }\n\n /**\n * Get a CRS.\n * @param crsCode the identification code of the CRS.\n * @return the CRS (null if not found).\n */\n public static getCRS(crsCode: int32): CRS {\n return Registry._CRS_MAP.get(\"\" + crsCode);\n }\n\n /**\n * Get a CRS.\n * @param crsCode the identification code of the CRS.\n * @return the CRS (null if not found).\n */\n public static getCRS2(crsCode: string): CRS {\n return Registry._CRS_MAP.get(crsCode);\n }\n\n /**\n * Set a CRS.\n * @param crsCode the identification code of the CRS.\n * @param the CRS.\n */\n public static setCRS(crsCode: int32, crs: CRS): void {\n /* Register the CRS */\n Registry._CRS_MAP.set(\"\" + crsCode, crs);\n /* Register the base CRS as well */\n let baseCRS: CRS = crs.getBaseCRS();\n if (baseCRS != null) Registry.setCRS(baseCRS.getCode(), baseCRS);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Registry.js","sourceR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AC;gBAAE,OAAO,IAAI,CAAC;QACvG,KAAK,IAAI,IAAI,IAAI,QAAQ;YAAE,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBAAE,OAAO,IAAI,CAAC;QAC1F,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,OAAc;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,OAAe;QACjC,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,OAAc,EAAE,GAAQ;QACzC,sBAAsB;QACtB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,CAAC,CAAC;QACzC,mCAAmC;QACnC,IAAI,OAAO,GAAQ,GAAG,CAAC,UAAU,EAAE,CAAC;QACpC,IAAI,OAAO,IAAI,IAAI;YAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { AList } from \"../../system/collection/AList\";\nimport { StringMap } from \"../../system/collection/StringMap\";\nimport { ASystem } from \"../../system/runtime/ASystem\";\nimport { Numbers } from \"../../system/runtime/Numbers\";\nimport { Strings } from \"../../system/runtime/Strings\";\nimport { CRS } from \"./CRS\";\nimport { DataFileUnit } from \"./DataFileUnit\";\nimport { Operation } from \"./Operation\";\nimport { Unit } from \"./Unit\";\n\n/**\n * Class Registry defines the EPSG registry of coordinate reference systems (CRS).\n *\n * @version 1.0 December 2019\n */\n/** @internal */\nexport class Registry {\n /** The name of the unit table */\n private static readonly _TABLE_UNIT: string = \"unit\";\n\n // Unit columns: UOM_CODE\tUNIT_OF_MEAS_NAME\tUNIT_OF_MEAS_TYPE\tTARGET_UOM_CODE\tFACTOR_B\tFACTOR_C\tABBREVIATION\n private static readonly _COL_COUNT_UNIT: int32 = 7;\n private static readonly _COL_UNIT_CODE: int32 = 0;\n private static readonly _COL_UNIT_NAME: int32 = 1;\n private static readonly _COL_UNIT_TYPE: int32 = 2;\n private static readonly _COL_UNIT_TARGET_CODE: int32 = 3;\n private static readonly _COL_UNIT_FACTOR_B: int32 = 4;\n private static readonly _COL_UNIT_FACTOR_C: int32 = 5;\n private static readonly _COL_UNIT_ABBREVIATION: int32 = 6;\n\n /** The map for preferred transformation between CRSs */\n private static _PREFERRED_TRANSFORMATIONS: StringMap<Operation> = new StringMap<Operation>();\n /** Define the list of all units */\n private static _UNIT_LIST: AList<Unit> = null;\n /** Define the map of CRS instances that have been read */\n private static _CRS_MAP: StringMap<CRS> = new StringMap<CRS>();\n\n /**\n * No instances.\n */\n private constructor() { }\n\n /**\n * Get the UTM CRS code at a certain location.\n * @param lon the WGS84 (CRS 4326) longitude (degrees).\n * @param lat the WGS84 (CRS 4326) latitude (degrees).\n * @return the CRS code.\n */\n public static getUTMCRSCodeAt(lon: float64, lat: float64): int32 {\n /* Normalize longitude */\n while (lon < -180.0) lon += 360.0;\n while (lon > 180.0) lon -= 360.0;\n /* Get the zone identifier */\n let zoneId: int32 = Math.round((lon + 183.0) / 6.0);\n if (zoneId < 1) zoneId = 1;\n if (zoneId > 60) zoneId = 60;\n /* Get the CRS code */\n return (lat >= 0.0) ? (32600 + zoneId) : (32700 + zoneId);\n }\n\n /**\n * Get a preferred transformation (to WGS84).\n * @param crs the crs.\n * @return the preferred transformation (can be null).\n */\n public static getPreferredTransformation(crs: string): Operation {\n return Registry._PREFERRED_TRANSFORMATIONS.get(crs);\n }\n\n /**\n * Set a preferred transformation (to WGS84).\n * @param crs the crs.\n * @param transformation the preferred transformation (can be null).\n */\n public static setPreferredTransformation(crs: string, transformation: Operation): void {\n Registry._PREFERRED_TRANSFORMATIONS.put(crs, transformation);\n }\n\n /**\n * Open a table.\n * @param tableName the name of the table.\n * @return the table.\n */\n private static openTable(tableName: string): AList<string> {\n if (Strings.equals(tableName, Registry._TABLE_UNIT)) return DataFileUnit.getDataLines();\n return new AList<string>();\n }\n\n /**\n * Read all units.\n * @return all units.\n */\n private static readAllUnits(): AList<Unit> {\n /* Make the list */\n let units: AList<Unit> = new AList<Unit>();\n /* Open the table */\n let tableReader: AList<string> = Registry.openTable(Registry._TABLE_UNIT);\n let headerLine: string = tableReader.get(0);\n /* Process the table */\n for (let i: number = 1; i < tableReader.size(); i++) {\n /* Read the next line */\n let line: string = tableReader.get(i);\n /* Get the columns */\n let parts: AList<string> = Strings.splitAsList(line, Strings.TAB);\n if (parts.size() != Registry._COL_COUNT_UNIT) continue;\n /* Get the parameters */\n let code: int32 = Numbers.getInteger(parts.get(Registry._COL_UNIT_CODE), 0);\n let name: string = parts.get(Registry._COL_UNIT_NAME);\n let type: string = parts.get(Registry._COL_UNIT_TYPE);\n let targetUnitCode: int32 = Numbers.getInteger(parts.get(Registry._COL_UNIT_TARGET_CODE), 0);\n let b: float64 = Numbers.getDouble(parts.get(Registry._COL_UNIT_FACTOR_B), 0.0);\n let c: float64 = Numbers.getDouble(parts.get(Registry._COL_UNIT_FACTOR_C), 0.0);\n let abbreviation: string = parts.get(Registry._COL_UNIT_ABBREVIATION);\n /* Add a new unit */\n let unit: Unit = new Unit(code, name, abbreviation, type, targetUnitCode, b, c);\n units.add(unit);\n }\n /* Return the units */\n return units;\n }\n\n /**\n * List all units.\n * @return all units.\n */\n public static listUnits(): AList<Unit> {\n if (Registry._UNIT_LIST == null) Registry._UNIT_LIST = Registry.readAllUnits();\n return Registry._UNIT_LIST;\n }\n\n /**\n * Find a unit.\n * @param unitCode the identification code of the unit.\n * @return a unit (null if not found).\n */\n public static findUnit(unitCode: int32): Unit {\n let unitList: AList<Unit> = Registry.listUnits();\n for (let unit of unitList) if (unit.getCode() == unitCode) return unit;\n return null;\n }\n\n /**\n * Get a unit.\n * @param unitCode the identification code of the unit.\n * @return a unit (not null).\n */\n public static getUnit(unitCode: int32): Unit {\n let unit: Unit = Registry.findUnit(unitCode);\n ASystem.assertNot(unit == null, \"Unit '\" + unitCode + \"' not found\");\n return unit;\n }\n\n /**\n * Find a unit by name.\n * @param unitName the name (or abbreviation or code) of the unit.\n * @return a unit (null if not found).\n */\n public static findUnitName(unitName: string): Unit {\n if (unitName == null) return null;\n let unitList: AList<Unit> = Registry.listUnits();\n for (let unit of unitList) if (Strings.equalsIgnoreCase(unitName, unit.getName())) return unit;\n for (let unit of unitList) if (Strings.equalsIgnoreCase(unitName, unit.getAbbreviation())) return unit;\n for (let unit of unitList) if (Strings.equals(unitName, \"\" + unit.getCode())) return unit;\n return null;\n }\n\n /**\n * Get a CRS.\n * @param crsCode the identification code of the CRS.\n * @return the CRS (null if not found).\n */\n public static getCRS(crsCode: int32): CRS {\n return Registry._CRS_MAP.get(\"\" + crsCode);\n }\n\n /**\n * Get a CRS.\n * @param crsCode the identification code of the CRS.\n * @return the CRS (null if not found).\n */\n public static getCRS2(crsCode: string): CRS {\n return Registry._CRS_MAP.get(crsCode);\n }\n\n /**\n * Set a CRS.\n * @param crsCode the identification code of the CRS.\n * @param the CRS.\n */\n public static setCRS(crsCode: int32, crs: CRS): void {\n /* Register the CRS */\n Registry._CRS_MAP.set(\"\" + crsCode, crs);\n /* Register the base CRS as well */\n let baseCRS: CRS = crs.getBaseCRS();\n if (baseCRS != null) Registry.setCRS(baseCRS.getCode(), baseCRS);\n }\n}\n"]}
|
|
@@ -17,6 +17,17 @@ import { Registry } from "./Registry";
|
|
|
17
17
|
*/
|
|
18
18
|
/** @internal */
|
|
19
19
|
export class Transform {
|
|
20
|
+
/** The name of this module */
|
|
21
|
+
static { this.MODULE = "Transform"; }
|
|
22
|
+
/** Define the different paths a CRS transformation can take */
|
|
23
|
+
static { this._SAME_CRS = 1; }
|
|
24
|
+
static { this._FORWARD_PROJECTION = 2; }
|
|
25
|
+
static { this._INVERSE_PROJECTION = 3; }
|
|
26
|
+
static { this._TWO_PROJECTIONS = 4; }
|
|
27
|
+
static { this._TO_WGS = 6; }
|
|
28
|
+
static { this._FROM_WGS = 7; }
|
|
29
|
+
static { this._FULL_TRANSFORM = 8; }
|
|
30
|
+
static { this._VERTICAL = 9; }
|
|
20
31
|
/**
|
|
21
32
|
* Prevent instantiation.
|
|
22
33
|
*/
|
|
@@ -379,15 +390,4 @@ export class Transform {
|
|
|
379
390
|
Transform.transformCRS(source, from, target, to);
|
|
380
391
|
}
|
|
381
392
|
}
|
|
382
|
-
/** The name of this module */
|
|
383
|
-
Transform.MODULE = "Transform";
|
|
384
|
-
/** Define the different paths a CRS transformation can take */
|
|
385
|
-
Transform._SAME_CRS = 1;
|
|
386
|
-
Transform._FORWARD_PROJECTION = 2;
|
|
387
|
-
Transform._INVERSE_PROJECTION = 3;
|
|
388
|
-
Transform._TWO_PROJECTIONS = 4;
|
|
389
|
-
Transform._TO_WGS = 6;
|
|
390
|
-
Transform._FROM_WGS = 7;
|
|
391
|
-
Transform._FULL_TRANSFORM = 8;
|
|
392
|
-
Transform._VERTICAL = 9;
|
|
393
393
|
//# sourceMappingURL=Transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/Transform.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAUH,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACv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IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;;AAzWD,8BAA8B;AACN,gBAAM,GAAW,WAAW,CAAC;AAErD,+DAA+D;AACvC,mBAAS,GAAU,CAAC,CAAC;AACrB,6BAAmB,GAAU,CAAC,CAAC;AAC/B,6BAAmB,GAAU,CAAC,CAAC;AAC/B,0BAAgB,GAAU,CAAC,CAAC;AAC5B,iBAAO,GAAU,CAAC,CAAC;AACnB,mBAAS,GAAU,CAAC,CAAC;AACrB,yBAAe,GAAU,CAAC,CAAC;AAC3B,mBAAS,GAAU,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { Message } from \"../../system/runtime/Message\";\nimport { Strings } from \"../../system/runtime/Strings\";\nimport { Coordinate } from \"../geom/Coordinate\";\nimport { CRS } from \"./CRS\";\nimport { Registry } from \"./Registry\";\nimport { VerticalModel } from \"./VerticalModel\";\n\n/**\n * Class Transform transforms coordinates between coordinate reference systems.\n *\n * @version 1.0 September 2005\n */\n/** @internal */\nexport class Transform {\n /** The name of this module */\n private static readonly MODULE: string = \"Transform\";\n\n /** Define the different paths a CRS transformation can take */\n private static readonly _SAME_CRS: int32 = 1;\n private static readonly _FORWARD_PROJECTION: int32 = 2;\n private static readonly _INVERSE_PROJECTION: int32 = 3;\n private static readonly _TWO_PROJECTIONS: int32 = 4;\n private static readonly _TO_WGS: int32 = 6;\n private static readonly _FROM_WGS: int32 = 7;\n private static readonly _FULL_TRANSFORM: int32 = 8;\n private static readonly _VERTICAL: int32 = 9;\n\n /**\n * Prevent instantiation.\n */\n private constructor() { }\n\n /**\n * Is a conversion between two coordinate systems possible/needed?\n * @param sourceCRS the name/code of the source reference system.\n * @param targetCRS the name/code of the target reference system.\n * @return true if a conversion is possible/needed.\n */\n public static canTransform(sourceCRS: string, targetCRS: string): boolean {\n /* We need two CRSs */\n if (sourceCRS == null || Strings.getLength(sourceCRS) == 0) return false;\n if (targetCRS == null || Strings.getLength(targetCRS) == 0) return false;\n /* Same CRS ? */\n if (Strings.equalsIgnoreCase(targetCRS, sourceCRS)) return true;\n /* Get the two CRSs */\n let source: CRS = Registry.getCRS2(sourceCRS);\n let target: CRS = Registry.getCRS2(targetCRS);\n /* We need two CRSs */\n if (source == null) return false;\n if (target == null) return false;\n /* Vertical transform ? */\n if (source.hasVerticalComponent() || target.hasVerticalComponent()) {\n /* Get the horizontal components */\n let sourceHor: CRS = (source.hasVerticalComponent()) ? source.getHorizontalComponent() : source;\n let targetHor: CRS = (target.hasVerticalComponent()) ? target.getHorizontalComponent() : target;\n /* Check transform in the horizontal CRS */\n return Transform.canTransform(\"\" + sourceHor.getCode(), \"\" + targetHor.getCode());\n }\n /* Same datum ? */\n if (source.getDatum().isCompatible(target.getDatum())) return true;\n /* Chained transform ? */\n if ((source.getCode() != CRS.WGS84_2D_CRS_CODE) && (target.getCode() != CRS.WGS84_2D_CRS_CODE)) {\n /* Use WGS as in-between */\n if (source.isWGSCompatible() == false) return false;\n if (target.isWGSCompatible() == false) return false;\n /* Possible */\n return true;\n }\n /* To WGS ? */\n if (target.getCode() == CRS.WGS84_2D_CRS_CODE) {\n /* Use WGS */\n if (source.isWGSCompatible() == false) return false;\n /* Possible */\n return true;\n }\n /* From WGS ? */\n if (source.getCode() == CRS.WGS84_2D_CRS_CODE) {\n /* Use WGS */\n if (target.isWGSCompatible() == false) return false;\n /* Possible */\n return true;\n }\n /* Not possible */\n return false;\n }\n\n /**\n * Do a vertical transform.\n * @param horizontalCRS the horizontal CRS.\n * @param fromVerticalCRS the vertical CRS to convert from.\n * @param from the coordinate to convert from.\n * @param toVerticalCRS the vertical CRS to convert to.\n * @param to the coordinate to convert to.\n */\n public static transformVertical(horizontalCRS: CRS, fromVerticalCRS: CRS, from: Coordinate, toVerticalCRS: CRS, to: Coordinate): void {\n /* 1: From 'ellipsoid' to 'ellipsoid' height ? */\n if ((fromVerticalCRS == null) && (toVerticalCRS == null)) {\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n //Message.print(MODULE,\"_VERTICAL: ellipsoid->ellipsoid: \"+from.getZ());\n }\n /* 2: From 'ellipsoid' to 'local' height ? */\n else if ((fromVerticalCRS == null) && (toVerticalCRS != null)) {\n /* Get the geoid separation */\n let geoidModel: VerticalModel = toVerticalCRS.getVerticalModel();\n let toZ: float64 = from.getZ();\n if (geoidModel != null) toZ = geoidModel.toLocalHeight(horizontalCRS, from);\n else Message.printWarning(Transform.MODULE, \"Target vertical CRS \" + toVerticalCRS + \" does not have a height model\");\n //Message.print(MODULE,\"_VERTICAL: ellipsoid->local: \"+from.getZ()+\"->\"+toZ);\n /* Substract the separation */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(toZ);\n }\n /* 3: From 'local' to 'ellipsoid' height ? */\n else if ((fromVerticalCRS != null) && (toVerticalCRS == null)) {\n /* Get the geoid separation */\n let geoidModel: VerticalModel = fromVerticalCRS.getVerticalModel();\n let toZ: float64 = from.getZ();\n if (geoidModel != null) toZ = geoidModel.toEllipsoidHeight(horizontalCRS, from);\n else Message.printWarning(Transform.MODULE, \"Source vertical CRS \" + fromVerticalCRS + \" does not have a height model\");\n //Message.print(MODULE,\"_VERTICAL: local->ellipsoid: \"+from.getZ()+\"->\"+toZ);\n /* Add the separation */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(toZ);\n }\n /* 4: From 'local1' to 'local2' */\n else {\n /* Same ? */\n if (fromVerticalCRS.getCode() == toVerticalCRS.getCode()) {\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n //Message.print(MODULE,\"_VERTICAL: local->local same: \"+from.getZ());\n }\n else {\n /* Get the 'from' ellipsoid height */\n let fromGeoidModel: VerticalModel = fromVerticalCRS.getVerticalModel();\n let fromZ: float64 = from.getZ();\n if (fromGeoidModel != null) fromZ = fromGeoidModel.toEllipsoidHeight(horizontalCRS, from);\n else Message.printWarning(Transform.MODULE, \"Source vertical CRS \" + fromVerticalCRS + \" does not have a height model\");\n /* Copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(fromZ);\n /* Get the 'to' local height */\n let toGeoidModel: VerticalModel = toVerticalCRS.getVerticalModel();\n let toZ: float64 = to.getZ();\n if (toGeoidModel != null) toZ = toGeoidModel.toLocalHeight(horizontalCRS, to);\n else Message.printWarning(Transform.MODULE, \"Target vertical CRS \" + toVerticalCRS + \" does not have a height model\");\n //Message.print(MODULE,\"_VERTICAL: local->local: \"+from.getZ()+\"->\"+fromZ+\"->\"+toZ);\n /* Copy */\n to.setZ(toZ);\n }\n }\n }\n\n /**\n * Get the transformation path from one CRS to another CRS.\n * @param sourceCRS the source reference system.\n * @param targetCRS the target reference system.\n * @return the transformation path.\n */\n public static getTransformPath(sourceCRS: CRS, targetCRS: CRS): int32 {\n /* Same CRS ? */\n if (targetCRS.getCode() == sourceCRS.getCode()) {\n return Transform._SAME_CRS;\n }\n /* Compatible CRS ? */\n if (targetCRS.isCompatible(sourceCRS)) {\n return Transform._SAME_CRS;\n }\n /* Vertical transform ? */\n if (sourceCRS.hasVerticalComponent() || targetCRS.hasVerticalComponent()) {\n return Transform._VERTICAL;\n }\n /* Same datum/ellipsoid ? (added on 24/11/2011) */\n if (sourceCRS.getDatum().isCompatible(targetCRS.getDatum())) {\n /* Is the target a projection of the source ? (added on 05/12/2011) */\n if (targetCRS.isProjectionOf(sourceCRS)) {\n return Transform._FORWARD_PROJECTION;\n }\n /* Is the source a projection of the target ? (added on 05/12/2011) */\n if (sourceCRS.isProjectionOf(targetCRS)) {\n return Transform._INVERSE_PROJECTION;\n }\n /* Two projections of the same base? */\n if (sourceCRS.isProjected() && targetCRS.isProjected() && (targetCRS.getBaseCRS().isCompatible(sourceCRS.getBaseCRS()))) {\n return Transform._TWO_PROJECTIONS;\n }\n }\n /* To WGS ? */\n if (targetCRS.getCode() == CRS.WGS84_2D_CRS_CODE) {\n return Transform._TO_WGS;\n }\n /* From WGS ? */\n if (sourceCRS.getCode() == CRS.WGS84_2D_CRS_CODE) {\n return Transform._FROM_WGS;\n }\n /* Use WGS as in-between (slowest path) */\n return Transform._FULL_TRANSFORM;\n }\n\n /**\n * Convert between two coordinate reference systems.\n * @param sourceCRS the source reference system.\n * @param from the coordinate to convert from.\n * @param targetCRS the target reference system.\n * @param to the coordinate to convert to.\n */\n public static transformWithPath(path: int32, sourceCRS: CRS, from: Coordinate, targetCRS: CRS, to: Coordinate): void {\n //Message.print(MODULE,\"---------->>>\");\n //Message.print(MODULE,\"TRANSFORM: sourceCRS = \"+sourceCRS.getCode());\n //Message.print(MODULE,\"TRANSFORM: targetCRS = \"+targetCRS.getCode());\n //Message.print(MODULE,\"TRANSFORM: from = \"+from);\n //Message.print(MODULE,\"TRANSFORM: path = \"+path);\n /* Same CRS ? */\n if (path == Transform._SAME_CRS) {\n //Message.print(MODULE,\"TRANSFORM: _SAME_CRS\");\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Is the target a projection of the source ? (added on 05/12/2011) */\n if (path == Transform._FORWARD_PROJECTION) {\n //Message.print(MODULE,\"TRANSFORM: _FORWARD_PROJECTION\");\n /* Apply the projection */\n targetCRS.toProjected(from, to);\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Is the source a projection of the target ? (added on 05/12/2011) */\n if (path == Transform._INVERSE_PROJECTION) {\n //Message.print(MODULE,\"TRANSFORM: _INVERSE_PROJECTION\");\n /* Reverse the projection */\n sourceCRS.fromProjected(from, to);\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Two projections of the same base? */\n if (path == Transform._TWO_PROJECTIONS) {\n //Message.print(MODULE,\"TRANSFORM: _TWO_PROJECTIONS\");\n /* Reverse the projection */\n sourceCRS.fromProjected(from, to);\n /* Apply the projection */\n targetCRS.toProjected(to, to);\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* To WGS ? */\n if (path == Transform._TO_WGS) {\n //Message.print(MODULE,\"TRANSFORM: _TO_WGS\");\n /* Use WGS */\n let toWGS: Coordinate = sourceCRS.toWGS(from);\n /* Set the target */\n to.setX(toWGS.getX());\n to.setY(toWGS.getY());\n to.setZ(toWGS.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* From WGS ? */\n if (path == Transform._FROM_WGS) {\n //Message.print(MODULE,\"TRANSFORM: _FROM_WGS\");\n /* Use WGS */\n let fromWGS: Coordinate = targetCRS.fromWGS(from);\n /* Set the target */\n to.setX(fromWGS.getX());\n to.setY(fromWGS.getY());\n to.setZ(fromWGS.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Full transform ? */\n if (path == Transform._FULL_TRANSFORM) {\n //Message.print(MODULE,\"TRANSFORM: _FULL_TRANSFORM\");\n /* Use WGS as in-between */\n let toWGS: Coordinate = sourceCRS.toWGS(from);\n let fromWGS: Coordinate = targetCRS.fromWGS(toWGS);\n /* Set the target */\n to.setX(fromWGS.getX());\n to.setY(fromWGS.getY());\n to.setZ(fromWGS.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Vertical transform ? */\n if (path == Transform._VERTICAL) {\n //Message.print(MODULE,\"TRANSFORM: _VERTICAL\");\n /* Get the horizontal components */\n let sourceHorCRS: CRS = (sourceCRS.hasVerticalComponent()) ? sourceCRS.getHorizontalComponent() : sourceCRS;\n let targetHorCRS: CRS = (targetCRS.hasVerticalComponent()) ? targetCRS.getHorizontalComponent() : targetCRS;\n /* Get the vertical components */\n let sourceVerCRS: CRS = (sourceCRS.hasVerticalComponent()) ? sourceCRS.getVerticalComponent() : null;\n let targetVerCRS: CRS = (targetCRS.hasVerticalComponent()) ? targetCRS.getVerticalComponent() : null;\n /* Put the source coordinate in the ellipsoid height */\n if (sourceVerCRS != null) {\n /* Move to the default 'ellipsoid' height */\n //Message.print(MODULE,\"TRANSFORM: source to ellipsoidZ\");\n Transform.transformVertical(sourceHorCRS, sourceVerCRS, from, null, to);\n from = to;\n //Message.print(MODULE,\"TRANSFORM: source ellipsoidZ = \"+to);\n }\n /* Get the ellipsoid height */\n let ellipsoidZ: float64 = from.getZ();\n if (sourceHorCRS.isGeoCentric()) {\n /* Calculate the ellipsoid height */\n let geographic: Coordinate = new Coordinate(0.0, 0.0, 0.0);\n sourceHorCRS.getEllipsoid().toGeoGraphic(from, geographic);\n ellipsoidZ = geographic.getZ();\n }\n /* Transform in the horizontal CRS (keep the WGS Z (and not the Bessel Z) for transform from WGS to RD-NAP) */\n //Message.print(MODULE,\"TRANSFORM: ellipsoidZ = \"+ellipsoidZ);\n //Message.print(MODULE,\"TRANSFORM: horizontal \"+sourceHorCRS.getCode()+\" -> \"+targetHorCRS.getCode());\n Transform.transformCRS(sourceHorCRS, from, targetHorCRS, to);\n /* Is the target CRS horizontal? */\n if (targetHorCRS.isGeoCentric() == false) {\n /* Keep the ellipsoid height after the horizontal transform */\n to.setZ(ellipsoidZ);\n }\n from = to;\n //Message.print(MODULE,\"TRANSFORM: intermediate = \"+from);\n /* Put the target coordinate in the vertical CRS */\n if (targetVerCRS != null) {\n /* Move from the default 'ellipsoid' height */\n Transform.transformVertical(targetHorCRS, null, from, targetVerCRS, to);\n from = to;\n //Message.print(MODULE,\"TRANSFORM: target vtransf = \"+to);\n }\n /* Done */\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n //Message.print(MODULE,\"TRANSFORMED: UNKNOWN!\");\n }\n\n /**\n * Convert between two coordinate reference systems.\n * @param sourceCRS the source reference system.\n * @param from the coordinate to convert from.\n * @param targetCRS the target reference system.\n * @param to the coordinate to convert to.\n */\n public static transformCRS(sourceCRS: CRS, from: Coordinate, targetCRS: CRS, to: Coordinate): void {\n Transform.transformWithPath(Transform.getTransformPath(sourceCRS, targetCRS), sourceCRS, from, targetCRS, to);\n }\n\n /**\n * Convert between two coordinate reference systems.\n * @param sourceCRS the name/code of the source reference system.\n * @param from the coordinate to convert from.\n * @param targetCRS the name/code of the target reference system.\n * @param to the coordinate to convert to.\n */\n public static transform(sourceCRS: string, from: Coordinate, targetCRS: string, to: Coordinate): void {\n /* Same CRS ? */\n if (Strings.equalsIgnoreCase(targetCRS, sourceCRS)) {\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n return;\n }\n /* Get the two CRSs */\n let source: CRS = Registry.getCRS2(sourceCRS);\n let target: CRS = Registry.getCRS2(targetCRS);\n /* Transform */\n Transform.transformCRS(source, from, target, to);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/Transform.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAUH,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,OAAO,SAAS;IAClB,8BAA8B;aACN,WAAM,GAAW,WAAW,CAAC;IAErD,+DAA+D;aACvC,cAAS,GAAU,CAAC,CAAC;aACrB,wBAAmB,GAAU,CAAC,CAAC;aAC/B,wBAAmB,GAAU,CAAC,CAAC;aAC/B,qBAAgB,GAAU,CAAC,CAAC;aAC5B,YA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AC9C,SAAS,CAAC,iBAAiB,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;gBACxE,IAAI,GAAG,EAAE,CAAC;gBACV,0DAA0D;YAC9D,CAAC;YACD,UAAU;YACV,gDAAgD;YAChD,OAAO;QACX,CAAC;QACD,gDAAgD;IACpD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,YAAY,CAAC,SAAc,EAAE,IAAgB,EAAE,SAAc,EAAE,EAAc;QACvF,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAClH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,SAAS,CAAC,SAAiB,EAAE,IAAgB,EAAE,SAAiB,EAAE,EAAc;QAC1F,gBAAgB;QAChB,IAAI,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;YACjD,mBAAmB;YACnB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACrB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACrB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACrB,OAAO;QACX,CAAC;QACD,sBAAsB;QACtB,IAAI,MAAM,GAAQ,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,MAAM,GAAQ,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9C,eAAe;QACf,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { Message } from \"../../system/runtime/Message\";\nimport { Strings } from \"../../system/runtime/Strings\";\nimport { Coordinate } from \"../geom/Coordinate\";\nimport { CRS } from \"./CRS\";\nimport { Registry } from \"./Registry\";\nimport { VerticalModel } from \"./VerticalModel\";\n\n/**\n * Class Transform transforms coordinates between coordinate reference systems.\n *\n * @version 1.0 September 2005\n */\n/** @internal */\nexport class Transform {\n /** The name of this module */\n private static readonly MODULE: string = \"Transform\";\n\n /** Define the different paths a CRS transformation can take */\n private static readonly _SAME_CRS: int32 = 1;\n private static readonly _FORWARD_PROJECTION: int32 = 2;\n private static readonly _INVERSE_PROJECTION: int32 = 3;\n private static readonly _TWO_PROJECTIONS: int32 = 4;\n private static readonly _TO_WGS: int32 = 6;\n private static readonly _FROM_WGS: int32 = 7;\n private static readonly _FULL_TRANSFORM: int32 = 8;\n private static readonly _VERTICAL: int32 = 9;\n\n /**\n * Prevent instantiation.\n */\n private constructor() { }\n\n /**\n * Is a conversion between two coordinate systems possible/needed?\n * @param sourceCRS the name/code of the source reference system.\n * @param targetCRS the name/code of the target reference system.\n * @return true if a conversion is possible/needed.\n */\n public static canTransform(sourceCRS: string, targetCRS: string): boolean {\n /* We need two CRSs */\n if (sourceCRS == null || Strings.getLength(sourceCRS) == 0) return false;\n if (targetCRS == null || Strings.getLength(targetCRS) == 0) return false;\n /* Same CRS ? */\n if (Strings.equalsIgnoreCase(targetCRS, sourceCRS)) return true;\n /* Get the two CRSs */\n let source: CRS = Registry.getCRS2(sourceCRS);\n let target: CRS = Registry.getCRS2(targetCRS);\n /* We need two CRSs */\n if (source == null) return false;\n if (target == null) return false;\n /* Vertical transform ? */\n if (source.hasVerticalComponent() || target.hasVerticalComponent()) {\n /* Get the horizontal components */\n let sourceHor: CRS = (source.hasVerticalComponent()) ? source.getHorizontalComponent() : source;\n let targetHor: CRS = (target.hasVerticalComponent()) ? target.getHorizontalComponent() : target;\n /* Check transform in the horizontal CRS */\n return Transform.canTransform(\"\" + sourceHor.getCode(), \"\" + targetHor.getCode());\n }\n /* Same datum ? */\n if (source.getDatum().isCompatible(target.getDatum())) return true;\n /* Chained transform ? */\n if ((source.getCode() != CRS.WGS84_2D_CRS_CODE) && (target.getCode() != CRS.WGS84_2D_CRS_CODE)) {\n /* Use WGS as in-between */\n if (source.isWGSCompatible() == false) return false;\n if (target.isWGSCompatible() == false) return false;\n /* Possible */\n return true;\n }\n /* To WGS ? */\n if (target.getCode() == CRS.WGS84_2D_CRS_CODE) {\n /* Use WGS */\n if (source.isWGSCompatible() == false) return false;\n /* Possible */\n return true;\n }\n /* From WGS ? */\n if (source.getCode() == CRS.WGS84_2D_CRS_CODE) {\n /* Use WGS */\n if (target.isWGSCompatible() == false) return false;\n /* Possible */\n return true;\n }\n /* Not possible */\n return false;\n }\n\n /**\n * Do a vertical transform.\n * @param horizontalCRS the horizontal CRS.\n * @param fromVerticalCRS the vertical CRS to convert from.\n * @param from the coordinate to convert from.\n * @param toVerticalCRS the vertical CRS to convert to.\n * @param to the coordinate to convert to.\n */\n public static transformVertical(horizontalCRS: CRS, fromVerticalCRS: CRS, from: Coordinate, toVerticalCRS: CRS, to: Coordinate): void {\n /* 1: From 'ellipsoid' to 'ellipsoid' height ? */\n if ((fromVerticalCRS == null) && (toVerticalCRS == null)) {\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n //Message.print(MODULE,\"_VERTICAL: ellipsoid->ellipsoid: \"+from.getZ());\n }\n /* 2: From 'ellipsoid' to 'local' height ? */\n else if ((fromVerticalCRS == null) && (toVerticalCRS != null)) {\n /* Get the geoid separation */\n let geoidModel: VerticalModel = toVerticalCRS.getVerticalModel();\n let toZ: float64 = from.getZ();\n if (geoidModel != null) toZ = geoidModel.toLocalHeight(horizontalCRS, from);\n else Message.printWarning(Transform.MODULE, \"Target vertical CRS \" + toVerticalCRS + \" does not have a height model\");\n //Message.print(MODULE,\"_VERTICAL: ellipsoid->local: \"+from.getZ()+\"->\"+toZ);\n /* Substract the separation */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(toZ);\n }\n /* 3: From 'local' to 'ellipsoid' height ? */\n else if ((fromVerticalCRS != null) && (toVerticalCRS == null)) {\n /* Get the geoid separation */\n let geoidModel: VerticalModel = fromVerticalCRS.getVerticalModel();\n let toZ: float64 = from.getZ();\n if (geoidModel != null) toZ = geoidModel.toEllipsoidHeight(horizontalCRS, from);\n else Message.printWarning(Transform.MODULE, \"Source vertical CRS \" + fromVerticalCRS + \" does not have a height model\");\n //Message.print(MODULE,\"_VERTICAL: local->ellipsoid: \"+from.getZ()+\"->\"+toZ);\n /* Add the separation */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(toZ);\n }\n /* 4: From 'local1' to 'local2' */\n else {\n /* Same ? */\n if (fromVerticalCRS.getCode() == toVerticalCRS.getCode()) {\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n //Message.print(MODULE,\"_VERTICAL: local->local same: \"+from.getZ());\n }\n else {\n /* Get the 'from' ellipsoid height */\n let fromGeoidModel: VerticalModel = fromVerticalCRS.getVerticalModel();\n let fromZ: float64 = from.getZ();\n if (fromGeoidModel != null) fromZ = fromGeoidModel.toEllipsoidHeight(horizontalCRS, from);\n else Message.printWarning(Transform.MODULE, \"Source vertical CRS \" + fromVerticalCRS + \" does not have a height model\");\n /* Copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(fromZ);\n /* Get the 'to' local height */\n let toGeoidModel: VerticalModel = toVerticalCRS.getVerticalModel();\n let toZ: float64 = to.getZ();\n if (toGeoidModel != null) toZ = toGeoidModel.toLocalHeight(horizontalCRS, to);\n else Message.printWarning(Transform.MODULE, \"Target vertical CRS \" + toVerticalCRS + \" does not have a height model\");\n //Message.print(MODULE,\"_VERTICAL: local->local: \"+from.getZ()+\"->\"+fromZ+\"->\"+toZ);\n /* Copy */\n to.setZ(toZ);\n }\n }\n }\n\n /**\n * Get the transformation path from one CRS to another CRS.\n * @param sourceCRS the source reference system.\n * @param targetCRS the target reference system.\n * @return the transformation path.\n */\n public static getTransformPath(sourceCRS: CRS, targetCRS: CRS): int32 {\n /* Same CRS ? */\n if (targetCRS.getCode() == sourceCRS.getCode()) {\n return Transform._SAME_CRS;\n }\n /* Compatible CRS ? */\n if (targetCRS.isCompatible(sourceCRS)) {\n return Transform._SAME_CRS;\n }\n /* Vertical transform ? */\n if (sourceCRS.hasVerticalComponent() || targetCRS.hasVerticalComponent()) {\n return Transform._VERTICAL;\n }\n /* Same datum/ellipsoid ? (added on 24/11/2011) */\n if (sourceCRS.getDatum().isCompatible(targetCRS.getDatum())) {\n /* Is the target a projection of the source ? (added on 05/12/2011) */\n if (targetCRS.isProjectionOf(sourceCRS)) {\n return Transform._FORWARD_PROJECTION;\n }\n /* Is the source a projection of the target ? (added on 05/12/2011) */\n if (sourceCRS.isProjectionOf(targetCRS)) {\n return Transform._INVERSE_PROJECTION;\n }\n /* Two projections of the same base? */\n if (sourceCRS.isProjected() && targetCRS.isProjected() && (targetCRS.getBaseCRS().isCompatible(sourceCRS.getBaseCRS()))) {\n return Transform._TWO_PROJECTIONS;\n }\n }\n /* To WGS ? */\n if (targetCRS.getCode() == CRS.WGS84_2D_CRS_CODE) {\n return Transform._TO_WGS;\n }\n /* From WGS ? */\n if (sourceCRS.getCode() == CRS.WGS84_2D_CRS_CODE) {\n return Transform._FROM_WGS;\n }\n /* Use WGS as in-between (slowest path) */\n return Transform._FULL_TRANSFORM;\n }\n\n /**\n * Convert between two coordinate reference systems.\n * @param sourceCRS the source reference system.\n * @param from the coordinate to convert from.\n * @param targetCRS the target reference system.\n * @param to the coordinate to convert to.\n */\n public static transformWithPath(path: int32, sourceCRS: CRS, from: Coordinate, targetCRS: CRS, to: Coordinate): void {\n //Message.print(MODULE,\"---------->>>\");\n //Message.print(MODULE,\"TRANSFORM: sourceCRS = \"+sourceCRS.getCode());\n //Message.print(MODULE,\"TRANSFORM: targetCRS = \"+targetCRS.getCode());\n //Message.print(MODULE,\"TRANSFORM: from = \"+from);\n //Message.print(MODULE,\"TRANSFORM: path = \"+path);\n /* Same CRS ? */\n if (path == Transform._SAME_CRS) {\n //Message.print(MODULE,\"TRANSFORM: _SAME_CRS\");\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Is the target a projection of the source ? (added on 05/12/2011) */\n if (path == Transform._FORWARD_PROJECTION) {\n //Message.print(MODULE,\"TRANSFORM: _FORWARD_PROJECTION\");\n /* Apply the projection */\n targetCRS.toProjected(from, to);\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Is the source a projection of the target ? (added on 05/12/2011) */\n if (path == Transform._INVERSE_PROJECTION) {\n //Message.print(MODULE,\"TRANSFORM: _INVERSE_PROJECTION\");\n /* Reverse the projection */\n sourceCRS.fromProjected(from, to);\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Two projections of the same base? */\n if (path == Transform._TWO_PROJECTIONS) {\n //Message.print(MODULE,\"TRANSFORM: _TWO_PROJECTIONS\");\n /* Reverse the projection */\n sourceCRS.fromProjected(from, to);\n /* Apply the projection */\n targetCRS.toProjected(to, to);\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* To WGS ? */\n if (path == Transform._TO_WGS) {\n //Message.print(MODULE,\"TRANSFORM: _TO_WGS\");\n /* Use WGS */\n let toWGS: Coordinate = sourceCRS.toWGS(from);\n /* Set the target */\n to.setX(toWGS.getX());\n to.setY(toWGS.getY());\n to.setZ(toWGS.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* From WGS ? */\n if (path == Transform._FROM_WGS) {\n //Message.print(MODULE,\"TRANSFORM: _FROM_WGS\");\n /* Use WGS */\n let fromWGS: Coordinate = targetCRS.fromWGS(from);\n /* Set the target */\n to.setX(fromWGS.getX());\n to.setY(fromWGS.getY());\n to.setZ(fromWGS.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Full transform ? */\n if (path == Transform._FULL_TRANSFORM) {\n //Message.print(MODULE,\"TRANSFORM: _FULL_TRANSFORM\");\n /* Use WGS as in-between */\n let toWGS: Coordinate = sourceCRS.toWGS(from);\n let fromWGS: Coordinate = targetCRS.fromWGS(toWGS);\n /* Set the target */\n to.setX(fromWGS.getX());\n to.setY(fromWGS.getY());\n to.setZ(fromWGS.getZ());\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n /* Vertical transform ? */\n if (path == Transform._VERTICAL) {\n //Message.print(MODULE,\"TRANSFORM: _VERTICAL\");\n /* Get the horizontal components */\n let sourceHorCRS: CRS = (sourceCRS.hasVerticalComponent()) ? sourceCRS.getHorizontalComponent() : sourceCRS;\n let targetHorCRS: CRS = (targetCRS.hasVerticalComponent()) ? targetCRS.getHorizontalComponent() : targetCRS;\n /* Get the vertical components */\n let sourceVerCRS: CRS = (sourceCRS.hasVerticalComponent()) ? sourceCRS.getVerticalComponent() : null;\n let targetVerCRS: CRS = (targetCRS.hasVerticalComponent()) ? targetCRS.getVerticalComponent() : null;\n /* Put the source coordinate in the ellipsoid height */\n if (sourceVerCRS != null) {\n /* Move to the default 'ellipsoid' height */\n //Message.print(MODULE,\"TRANSFORM: source to ellipsoidZ\");\n Transform.transformVertical(sourceHorCRS, sourceVerCRS, from, null, to);\n from = to;\n //Message.print(MODULE,\"TRANSFORM: source ellipsoidZ = \"+to);\n }\n /* Get the ellipsoid height */\n let ellipsoidZ: float64 = from.getZ();\n if (sourceHorCRS.isGeoCentric()) {\n /* Calculate the ellipsoid height */\n let geographic: Coordinate = new Coordinate(0.0, 0.0, 0.0);\n sourceHorCRS.getEllipsoid().toGeoGraphic(from, geographic);\n ellipsoidZ = geographic.getZ();\n }\n /* Transform in the horizontal CRS (keep the WGS Z (and not the Bessel Z) for transform from WGS to RD-NAP) */\n //Message.print(MODULE,\"TRANSFORM: ellipsoidZ = \"+ellipsoidZ);\n //Message.print(MODULE,\"TRANSFORM: horizontal \"+sourceHorCRS.getCode()+\" -> \"+targetHorCRS.getCode());\n Transform.transformCRS(sourceHorCRS, from, targetHorCRS, to);\n /* Is the target CRS horizontal? */\n if (targetHorCRS.isGeoCentric() == false) {\n /* Keep the ellipsoid height after the horizontal transform */\n to.setZ(ellipsoidZ);\n }\n from = to;\n //Message.print(MODULE,\"TRANSFORM: intermediate = \"+from);\n /* Put the target coordinate in the vertical CRS */\n if (targetVerCRS != null) {\n /* Move from the default 'ellipsoid' height */\n Transform.transformVertical(targetHorCRS, null, from, targetVerCRS, to);\n from = to;\n //Message.print(MODULE,\"TRANSFORM: target vtransf = \"+to);\n }\n /* Done */\n //Message.print(MODULE,\"TRANSFORMED: to = \"+to);\n return;\n }\n //Message.print(MODULE,\"TRANSFORMED: UNKNOWN!\");\n }\n\n /**\n * Convert between two coordinate reference systems.\n * @param sourceCRS the source reference system.\n * @param from the coordinate to convert from.\n * @param targetCRS the target reference system.\n * @param to the coordinate to convert to.\n */\n public static transformCRS(sourceCRS: CRS, from: Coordinate, targetCRS: CRS, to: Coordinate): void {\n Transform.transformWithPath(Transform.getTransformPath(sourceCRS, targetCRS), sourceCRS, from, targetCRS, to);\n }\n\n /**\n * Convert between two coordinate reference systems.\n * @param sourceCRS the name/code of the source reference system.\n * @param from the coordinate to convert from.\n * @param targetCRS the name/code of the target reference system.\n * @param to the coordinate to convert to.\n */\n public static transform(sourceCRS: string, from: Coordinate, targetCRS: string, to: Coordinate): void {\n /* Same CRS ? */\n if (Strings.equalsIgnoreCase(targetCRS, sourceCRS)) {\n /* Straight copy */\n to.setX(from.getX());\n to.setY(from.getY());\n to.setZ(from.getZ());\n return;\n }\n /* Get the two CRSs */\n let source: CRS = Registry.getCRS2(sourceCRS);\n let target: CRS = Registry.getCRS2(targetCRS);\n /* Transform */\n Transform.transformCRS(source, from, target, to);\n }\n}\n"]}
|
|
@@ -15,6 +15,30 @@ import { Registry } from "./Registry";
|
|
|
15
15
|
*/
|
|
16
16
|
/** @internal */
|
|
17
17
|
export class Unit {
|
|
18
|
+
/** The "meter" unit code (length) */
|
|
19
|
+
static { this.METER = 9001; }
|
|
20
|
+
/** The "foot" unit code (length) */
|
|
21
|
+
static { this.FOOT = 9002; }
|
|
22
|
+
/** The "footUS" unit code (length) */
|
|
23
|
+
static { this.FOOT_US = 9003; }
|
|
24
|
+
/** The "radian" unit code (angle) */
|
|
25
|
+
static { this.RADIAN = 9101; }
|
|
26
|
+
/** The "degree" unit code (angle) */
|
|
27
|
+
static { this.DEGREE = 9102; }
|
|
28
|
+
/** The "unity" unit code (scale) */
|
|
29
|
+
static { this.UNITY = 9201; }
|
|
30
|
+
/** Define the custom unit 'sexagesimal DMS' (9110) */
|
|
31
|
+
static { this._UNIT_DMS = 9110; }
|
|
32
|
+
/** Define the custom unit 'sexagesimal DM' (9111) */
|
|
33
|
+
static { this._UNIT_DM = 9111; }
|
|
34
|
+
/** The type of units for angles */
|
|
35
|
+
static { this._TYPE_ANGLE = "angle"; }
|
|
36
|
+
/** The type of units for length */
|
|
37
|
+
static { this._TYPE_LENGTH = "length"; }
|
|
38
|
+
/** The type of units for time */
|
|
39
|
+
static { this._TYPE_TIME = "time"; }
|
|
40
|
+
/** The type of units for scale */
|
|
41
|
+
static { this._TYPE_SCALE = "scale"; }
|
|
18
42
|
/**
|
|
19
43
|
* Create a new unit.
|
|
20
44
|
* @param code the code.
|
|
@@ -306,28 +330,4 @@ export class Unit {
|
|
|
306
330
|
return dms;
|
|
307
331
|
}
|
|
308
332
|
}
|
|
309
|
-
/** The "meter" unit code (length) */
|
|
310
|
-
Unit.METER = 9001;
|
|
311
|
-
/** The "foot" unit code (length) */
|
|
312
|
-
Unit.FOOT = 9002;
|
|
313
|
-
/** The "footUS" unit code (length) */
|
|
314
|
-
Unit.FOOT_US = 9003;
|
|
315
|
-
/** The "radian" unit code (angle) */
|
|
316
|
-
Unit.RADIAN = 9101;
|
|
317
|
-
/** The "degree" unit code (angle) */
|
|
318
|
-
Unit.DEGREE = 9102;
|
|
319
|
-
/** The "unity" unit code (scale) */
|
|
320
|
-
Unit.UNITY = 9201;
|
|
321
|
-
/** Define the custom unit 'sexagesimal DMS' (9110) */
|
|
322
|
-
Unit._UNIT_DMS = 9110;
|
|
323
|
-
/** Define the custom unit 'sexagesimal DM' (9111) */
|
|
324
|
-
Unit._UNIT_DM = 9111;
|
|
325
|
-
/** The type of units for angles */
|
|
326
|
-
Unit._TYPE_ANGLE = "angle";
|
|
327
|
-
/** The type of units for length */
|
|
328
|
-
Unit._TYPE_LENGTH = "length";
|
|
329
|
-
/** The type of units for time */
|
|
330
|
-
Unit._TYPE_TIME = "time";
|
|
331
|
-
/** The type of units for scale */
|
|
332
|
-
Unit._TYPE_SCALE = "scale";
|
|
333
333
|
//# sourceMappingURL=Unit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unit.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/Unit.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAUH,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,OAAO,IAAI;IA8Cb;;;;;;;;;OASG;IACH,YAAmB,IAAW,EAAE,IAAY,EAAE,YAAoB,EAAE,IAAY,EAAE,cAAqB,EAAE,CAAU,EAAE,CAAU;QAC3H,0BAA0B;QAC1B,IAAI,CAAC,KAAK,GAAG,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AG,GAAY,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG;YAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,6BAA6B;QAC7B,IAAI,IAAI,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,GAAG,IAAI,IAAI,CAAC;QACZ,qBAAqB;QACrB,GAAG,IAAI,IAAI,CAAC;QACZ,IAAI,GAAG,GAAY,GAAG,CAAC;QACvB,oBAAoB;QACpB,IAAI,GAAG,GAAY,IAAI,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;QACxC,IAAI,GAAG;YAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,oBAAoB;QACpB,OAAO,GAAG,CAAC;IACf,CAAC;;AArUD,qCAAqC;AACd,UAAK,GAAU,IAAI,CAAC;AAC3C,oCAAoC;AACb,SAAI,GAAU,IAAI,CAAC;AAC1C,sCAAsC;AACf,YAAO,GAAU,IAAI,CAAC;AAC7C,qCAAqC;AACd,WAAM,GAAU,IAAI,CAAC;AAC5C,qCAAqC;AACd,WAAM,GAAU,IAAI,CAAC;AAC5C,oCAAoC;AACb,UAAK,GAAU,IAAI,CAAC;AAE3C,sDAAsD;AAC9B,cAAS,GAAU,IAAI,CAAC;AAChD,qDAAqD;AAC7B,aAAQ,GAAU,IAAI,CAAC;AAE/C,mCAAmC;AACX,gBAAW,GAAW,OAAO,CAAC;AACtD,mCAAmC;AACX,iBAAY,GAAW,QAAQ,CAAC;AACxD,iCAAiC;AACT,eAAU,GAAW,MAAM,CAAC;AACpD,kCAAkC;AACV,gBAAW,GAAW,OAAO,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { ASystem } from \"../../system/runtime/ASystem\";\nimport { Numbers } from \"../../system/runtime/Numbers\";\nimport { Registry } from \"./Registry\";\n\n/**\n * Class Unit defines a unit of measure.\n *\n * @version 1.0 July 2005\n */\n/** @internal */\nexport class Unit {\n /** The \"meter\" unit code (length) */\n public static readonly METER: int32 = 9001;\n /** The \"foot\" unit code (length) */\n public static readonly FOOT: int32 = 9002;\n /** The \"footUS\" unit code (length) */\n public static readonly FOOT_US: int32 = 9003;\n /** The \"radian\" unit code (angle) */\n public static readonly RADIAN: int32 = 9101;\n /** The \"degree\" unit code (angle) */\n public static readonly DEGREE: int32 = 9102;\n /** The \"unity\" unit code (scale) */\n public static readonly UNITY: int32 = 9201;\n\n /** Define the custom unit 'sexagesimal DMS' (9110) */\n private static readonly _UNIT_DMS: int32 = 9110;\n /** Define the custom unit 'sexagesimal DM' (9111) */\n private static readonly _UNIT_DM: int32 = 9111;\n\n /** The type of units for angles */\n private static readonly _TYPE_ANGLE: string = \"angle\";\n /** The type of units for length */\n private static readonly _TYPE_LENGTH: string = \"length\";\n /** The type of units for time */\n private static readonly _TYPE_TIME: string = \"time\";\n /** The type of units for scale */\n private static readonly _TYPE_SCALE: string = \"scale\";\n\n /** The code */\n private _code: int32;\n /** The name */\n private _name: string;\n /** The abbreviation */\n private _abbreviation: string;\n /** The type */\n private _type: string;\n /** The target unit code */\n private _targetUnitCode: int32;\n /** The B factor */\n private _b: float64;\n /** The C factor */\n private _c: float64;\n\n /** The target unit */\n private _target: Unit;\n\n /**\n * Create a new unit.\n * @param code the code.\n * @param name the name.\n * @param abbreviation the abbreviation.\n * @param type the type (LENGTH, ANGLE or SCALE).\n * @param targetUnitCode the target unit code.\n * @param b the B factor.\n * @param c the C factor.\n */\n public constructor(code: int32, name: string, abbreviation: string, type: string, targetUnitCode: int32, b: float64, c: float64) {\n /* Store the parameters */\n this._code = code;\n this._name = name;\n this._abbreviation = abbreviation;\n this._type = type;\n this._targetUnitCode = targetUnitCode;\n this._b = b;\n this._c = c;\n /* Clear */\n this._target = null;\n }\n\n /**\n * Get the code.\n * @return the code.\n */\n public getCode(): int32 {\n return this._code;\n }\n\n /**\n * Get the name.\n * @return the name.\n */\n public getName(): string {\n return this._name;\n }\n\n /**\n * Get the abbreviation.\n * @return the abbreviation.\n */\n public getAbbreviation(): string {\n return this._abbreviation;\n }\n\n /**\n * Get the type (LENGTH, ANGLE or SCALE).\n * @return the type.\n */\n public getType(): string {\n return this._type;\n }\n\n /**\n * Check is this is an angle type.\n * @return true for an angle type.\n */\n public isTypeAngle(): boolean {\n return (this._type === Unit._TYPE_ANGLE);\n }\n\n /**\n * Check is this is a length type.\n * @return true for a length type.\n */\n public isTypeLength(): boolean {\n return (this._type === Unit._TYPE_LENGTH);\n }\n\n /**\n * Get the target unit code.\n * @return the target unit code.\n */\n public getTargetUnitCode(): int32 {\n return this._targetUnitCode;\n }\n\n /**\n * Get the B factor.\n * @return the B factor.\n */\n public getB(): float64 {\n return this._b;\n }\n\n /**\n * Get the C factor.\n * @return the C factor.\n */\n public getC(): float64 {\n return this._c;\n }\n\n /**\n * Check if another unit is compatible with this one.\n * @param other the other unit.\n * @return true if compatible.\n */\n public isCompatible(other: Unit): boolean {\n if (other._code == this._code) return true;\n if (other._targetUnitCode != this._targetUnitCode) return false;\n if (other._b != this._b) return false;\n if (other._c != this._c) return false;\n return true;\n }\n\n /**\n * Convert to the standard unit.\n * @param value the value.\n * @return the standard value.\n */\n public toStandard(value: float64): float64 {\n /* Get the target unit */\n if (this._target == null) this._target = Registry.getUnit(this._targetUnitCode);\n /* Already standard ? */\n if (this._code == this._targetUnitCode) return value;\n /* Check for a custom unit */\n else if (this._code == Unit._UNIT_DMS) return this._target.toStandard(Unit.dmsToDeg(value));\n else if (this._code == Unit._UNIT_DM) return this._target.toStandard(Unit.dmToDeg(value));\n /* Default to scale */\n else return this._target.toStandard(value * this._b / this._c);\n }\n\n /**\n * Convert to the standard unit.\n * @param value the value.\n * @return the standard value.\n */\n public to(value: float64): float64 {\n return this.toStandard(value);\n }\n\n /**\n * Convert from the standard unit.\n * @param value the standard value.\n * @return the value.\n */\n public fromStandard(value: float64): float64 {\n /* Get the target unit */\n if (this._target == null) this._target = Registry.getUnit(this._targetUnitCode);\n /* Already standard ? */\n if (this._code == this._targetUnitCode) return value;\n /* Check for a custom unit */\n else if (this._code == Unit._UNIT_DMS) return Unit.degToDms(this._target.fromStandard(value));\n else if (this._code == Unit._UNIT_DM) return Unit.degToDm(this._target.fromStandard(value));\n /* Default to scale */\n else return this._target.fromStandard(value) * this._c / this._b;\n }\n\n /**\n * Convert from the standard unit.\n * @param value the standard value.\n * @return the value.\n */\n public from(value: float64): float64 {\n return this.fromStandard(value);\n }\n\n /**\n * Convert a sexagesimal DMS value to fractional degrees.\n * @param dms the sexagesimal DMS value.\n * @return the fractional degrees.\n */\n public static dmsToDeg(dms: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (dms < 0.0);\n if (neg) dms *= -1.0;\n /* Get the seconds */\n let seconds: float64 = (10000.0 * dms);\n let iseconds: int32 = Math.floor(seconds);\n let fraction: float64 = (seconds - iseconds);\n /* Catch rounding errors (like 6.1000 to 6.099999999999999) */\n if (Math.abs(fraction - 1.0) < 1.0e-4) { iseconds++; fraction = 0.0; }\n /* Get the degrees */\n let deg: int32 = Numbers.divInt(iseconds, 10000);\n ASystem.assertNot((deg < -360) || (deg > 360), \"Invalid deg (\" + deg + \") in DMS \" + dms);\n iseconds -= (deg * 10000);\n /* Get the minutes */\n let min: int32 = Numbers.divInt(iseconds, 100);\n ASystem.assertNot((min < 0) || (min > 59), \"Invalid min (\" + min + \") in DMS \" + dms);\n iseconds -= (min * 100);\n /* Get the seconds */\n let sec: int32 = (iseconds);\n ASystem.assertNot((sec < 0) || (sec > 59), \"Invalid sec (\" + sec + \") in DMS \" + dms);\n /* Check the fraction */\n ASystem.assertNot((fraction < 0.0) || (fraction >= 1.0), \"Invalid fraction (\" + fraction + \") in DMS \" + dms);\n /* Convert to fractional degrees */\n let fdeg: float64 = deg + (min / 60.0) + (sec / 3600.0) + (fraction / 3600.0);\n if (neg) fdeg *= -1.0;\n /* Return the degrees */\n return fdeg;\n }\n\n /**\n * Convert a sexagesimal DMS value to fractional radians.\n * @param dms the sexagesimal DMS value.\n * @return the fractional radians.\n */\n public static dmsToRad(dms: float64): float64 {\n return Unit.dmsToDeg(dms) * Math.PI / 180.0;\n }\n\n /**\n * Convert fractional degrees to a sexagesimal DMS value.\n * @param deg the fractional degrees.\n * @return the sexagesimal DMS value.\n */\n public static degToDms(deg: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (deg < 0.0);\n if (neg) deg *= -1.0;\n /* Get the integer degrees */\n let ideg: float64 = Math.floor(deg);\n deg -= ideg;\n /* Get the minutes */\n deg *= 60.0;\n let min: float64 = Math.floor(deg);\n deg -= min;\n /* Get the seconds */\n deg *= 60.0;\n let sec: float64 = deg;\n /* Convert to DMS */\n let dms: float64 = ideg + (min / 100.0) + (sec / 10000.0);\n if (neg) dms *= -1.0;\n /* Return the DMS */\n return dms;\n }\n\n /**\n * Convert a sexagesimal DM value to fractional degrees.\n * @param dm the sexagesimal DM value.\n * @return the fractional degrees.\n */\n public static dmToDeg(dm: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (dm < 0.0);\n if (neg) dm *= -1.0;\n /* Get the seconds */\n let minutes: float64 = (100.0 * dm);\n let iminutes: int32 = Math.floor(minutes);\n let fraction: float64 = (minutes - iminutes);\n /* Catch rounding errors (like 6.1000 to 6.099999999999999) */\n if (Math.abs(fraction - 1.0) < 1.0e-4) { iminutes++; fraction = 0.0; }\n /* Get the degrees */\n let deg: int32 = Numbers.divInt(iminutes, 100);\n ASystem.assertNot((deg < -180) || (deg > 180), \"Invalid deg (\" + deg + \") in DM \" + dm);\n /* Get the minutes */\n let min: int32 = (iminutes) % 100;\n ASystem.assertNot((min < 0) || (min > 59), \"Invalid min (\" + min + \") in DM \" + dm);\n /* Check the fraction */\n ASystem.assertNot((fraction < 0.0) || (fraction >= 1.0), \"Invalid fraction (\" + fraction + \") in DM \" + dm);\n /* Convert to fractional degrees */\n let fdeg: float64 = deg + (min / 60.0) + (fraction / 60.0);\n if (neg) fdeg *= -1.0;\n /* Return the degrees */\n return fdeg;\n }\n\n /**\n * Convert fractional degrees to a sexagesimal DM value.\n * @param deg the fractional degrees.\n * @return the sexagesimal DM value.\n */\n public static degToDm(deg: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (deg < 0.0);\n if (neg) deg *= -1.0;\n /* Get the integer degrees */\n let ideg: float64 = Math.floor(deg);\n deg -= ideg;\n /* Get the minutes */\n deg *= 60.0;\n let min: float64 = deg;\n /* Convert to DMS */\n let dms: float64 = ideg + (min / 100.0);\n if (neg) dms *= -1.0;\n /* Return the DMS */\n return dms;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Unit.js","sourceRoot":"","sources":["../../../../src/spatial/ecrs/Unit.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAUH,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,OAAO,IAAI;IACb,qCAAqC;aACd,UAAK,GAAU,IAAI,CAAC;IAC3C,oCAAoC;aACb,SAAI,GAAU,IAAI,CAAC;IAC1C,sCAAsC;aACf,YAAO,GAAU,IAAI,CAAC;IAC7C,qCAAqC;aACd,WAAM,GAAU,IAAI,CAAC;IAC5C,qCAAqC;aACd,WAAM,GAAU,IAAI,CAAC;IAC5C,oCAAoC;aACb,UAAK,GAAU,IAAI,CAAC;IAE3C,sDAAsD;aAC9B,cAAS,GAAU,IAAI,CAAC;IAChD,qDAAqD;aAC7B,aAAQ,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AAG,QAAQ,GAAG,UAAU,GAAG,EAAE,CAAC,CAAC;QAC5G,mCAAmC;QACnC,IAAI,IAAI,GAAY,GAAG,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;QAC3D,IAAI,GAAG;YAAE,IAAI,IAAI,CAAC,GAAG,CAAC;QACtB,wBAAwB;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,GAAY;QAC9B,8CAA8C;QAC9C,IAAI,GAAG,GAAY,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG;YAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,6BAA6B;QAC7B,IAAI,IAAI,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,GAAG,IAAI,IAAI,CAAC;QACZ,qBAAqB;QACrB,GAAG,IAAI,IAAI,CAAC;QACZ,IAAI,GAAG,GAAY,GAAG,CAAC;QACvB,oBAAoB;QACpB,IAAI,GAAG,GAAY,IAAI,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;QACxC,IAAI,GAAG;YAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,oBAAoB;QACpB,OAAO,GAAG,CAAC;IACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module OrbitGT\n */\n\n//package orbitgt.spatial.ecrs;\n\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\ntype float32 = number;\ntype float64 = number;\n\nimport { ASystem } from \"../../system/runtime/ASystem\";\nimport { Numbers } from \"../../system/runtime/Numbers\";\nimport { Registry } from \"./Registry\";\n\n/**\n * Class Unit defines a unit of measure.\n *\n * @version 1.0 July 2005\n */\n/** @internal */\nexport class Unit {\n /** The \"meter\" unit code (length) */\n public static readonly METER: int32 = 9001;\n /** The \"foot\" unit code (length) */\n public static readonly FOOT: int32 = 9002;\n /** The \"footUS\" unit code (length) */\n public static readonly FOOT_US: int32 = 9003;\n /** The \"radian\" unit code (angle) */\n public static readonly RADIAN: int32 = 9101;\n /** The \"degree\" unit code (angle) */\n public static readonly DEGREE: int32 = 9102;\n /** The \"unity\" unit code (scale) */\n public static readonly UNITY: int32 = 9201;\n\n /** Define the custom unit 'sexagesimal DMS' (9110) */\n private static readonly _UNIT_DMS: int32 = 9110;\n /** Define the custom unit 'sexagesimal DM' (9111) */\n private static readonly _UNIT_DM: int32 = 9111;\n\n /** The type of units for angles */\n private static readonly _TYPE_ANGLE: string = \"angle\";\n /** The type of units for length */\n private static readonly _TYPE_LENGTH: string = \"length\";\n /** The type of units for time */\n private static readonly _TYPE_TIME: string = \"time\";\n /** The type of units for scale */\n private static readonly _TYPE_SCALE: string = \"scale\";\n\n /** The code */\n private _code: int32;\n /** The name */\n private _name: string;\n /** The abbreviation */\n private _abbreviation: string;\n /** The type */\n private _type: string;\n /** The target unit code */\n private _targetUnitCode: int32;\n /** The B factor */\n private _b: float64;\n /** The C factor */\n private _c: float64;\n\n /** The target unit */\n private _target: Unit;\n\n /**\n * Create a new unit.\n * @param code the code.\n * @param name the name.\n * @param abbreviation the abbreviation.\n * @param type the type (LENGTH, ANGLE or SCALE).\n * @param targetUnitCode the target unit code.\n * @param b the B factor.\n * @param c the C factor.\n */\n public constructor(code: int32, name: string, abbreviation: string, type: string, targetUnitCode: int32, b: float64, c: float64) {\n /* Store the parameters */\n this._code = code;\n this._name = name;\n this._abbreviation = abbreviation;\n this._type = type;\n this._targetUnitCode = targetUnitCode;\n this._b = b;\n this._c = c;\n /* Clear */\n this._target = null;\n }\n\n /**\n * Get the code.\n * @return the code.\n */\n public getCode(): int32 {\n return this._code;\n }\n\n /**\n * Get the name.\n * @return the name.\n */\n public getName(): string {\n return this._name;\n }\n\n /**\n * Get the abbreviation.\n * @return the abbreviation.\n */\n public getAbbreviation(): string {\n return this._abbreviation;\n }\n\n /**\n * Get the type (LENGTH, ANGLE or SCALE).\n * @return the type.\n */\n public getType(): string {\n return this._type;\n }\n\n /**\n * Check is this is an angle type.\n * @return true for an angle type.\n */\n public isTypeAngle(): boolean {\n return (this._type === Unit._TYPE_ANGLE);\n }\n\n /**\n * Check is this is a length type.\n * @return true for a length type.\n */\n public isTypeLength(): boolean {\n return (this._type === Unit._TYPE_LENGTH);\n }\n\n /**\n * Get the target unit code.\n * @return the target unit code.\n */\n public getTargetUnitCode(): int32 {\n return this._targetUnitCode;\n }\n\n /**\n * Get the B factor.\n * @return the B factor.\n */\n public getB(): float64 {\n return this._b;\n }\n\n /**\n * Get the C factor.\n * @return the C factor.\n */\n public getC(): float64 {\n return this._c;\n }\n\n /**\n * Check if another unit is compatible with this one.\n * @param other the other unit.\n * @return true if compatible.\n */\n public isCompatible(other: Unit): boolean {\n if (other._code == this._code) return true;\n if (other._targetUnitCode != this._targetUnitCode) return false;\n if (other._b != this._b) return false;\n if (other._c != this._c) return false;\n return true;\n }\n\n /**\n * Convert to the standard unit.\n * @param value the value.\n * @return the standard value.\n */\n public toStandard(value: float64): float64 {\n /* Get the target unit */\n if (this._target == null) this._target = Registry.getUnit(this._targetUnitCode);\n /* Already standard ? */\n if (this._code == this._targetUnitCode) return value;\n /* Check for a custom unit */\n else if (this._code == Unit._UNIT_DMS) return this._target.toStandard(Unit.dmsToDeg(value));\n else if (this._code == Unit._UNIT_DM) return this._target.toStandard(Unit.dmToDeg(value));\n /* Default to scale */\n else return this._target.toStandard(value * this._b / this._c);\n }\n\n /**\n * Convert to the standard unit.\n * @param value the value.\n * @return the standard value.\n */\n public to(value: float64): float64 {\n return this.toStandard(value);\n }\n\n /**\n * Convert from the standard unit.\n * @param value the standard value.\n * @return the value.\n */\n public fromStandard(value: float64): float64 {\n /* Get the target unit */\n if (this._target == null) this._target = Registry.getUnit(this._targetUnitCode);\n /* Already standard ? */\n if (this._code == this._targetUnitCode) return value;\n /* Check for a custom unit */\n else if (this._code == Unit._UNIT_DMS) return Unit.degToDms(this._target.fromStandard(value));\n else if (this._code == Unit._UNIT_DM) return Unit.degToDm(this._target.fromStandard(value));\n /* Default to scale */\n else return this._target.fromStandard(value) * this._c / this._b;\n }\n\n /**\n * Convert from the standard unit.\n * @param value the standard value.\n * @return the value.\n */\n public from(value: float64): float64 {\n return this.fromStandard(value);\n }\n\n /**\n * Convert a sexagesimal DMS value to fractional degrees.\n * @param dms the sexagesimal DMS value.\n * @return the fractional degrees.\n */\n public static dmsToDeg(dms: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (dms < 0.0);\n if (neg) dms *= -1.0;\n /* Get the seconds */\n let seconds: float64 = (10000.0 * dms);\n let iseconds: int32 = Math.floor(seconds);\n let fraction: float64 = (seconds - iseconds);\n /* Catch rounding errors (like 6.1000 to 6.099999999999999) */\n if (Math.abs(fraction - 1.0) < 1.0e-4) { iseconds++; fraction = 0.0; }\n /* Get the degrees */\n let deg: int32 = Numbers.divInt(iseconds, 10000);\n ASystem.assertNot((deg < -360) || (deg > 360), \"Invalid deg (\" + deg + \") in DMS \" + dms);\n iseconds -= (deg * 10000);\n /* Get the minutes */\n let min: int32 = Numbers.divInt(iseconds, 100);\n ASystem.assertNot((min < 0) || (min > 59), \"Invalid min (\" + min + \") in DMS \" + dms);\n iseconds -= (min * 100);\n /* Get the seconds */\n let sec: int32 = (iseconds);\n ASystem.assertNot((sec < 0) || (sec > 59), \"Invalid sec (\" + sec + \") in DMS \" + dms);\n /* Check the fraction */\n ASystem.assertNot((fraction < 0.0) || (fraction >= 1.0), \"Invalid fraction (\" + fraction + \") in DMS \" + dms);\n /* Convert to fractional degrees */\n let fdeg: float64 = deg + (min / 60.0) + (sec / 3600.0) + (fraction / 3600.0);\n if (neg) fdeg *= -1.0;\n /* Return the degrees */\n return fdeg;\n }\n\n /**\n * Convert a sexagesimal DMS value to fractional radians.\n * @param dms the sexagesimal DMS value.\n * @return the fractional radians.\n */\n public static dmsToRad(dms: float64): float64 {\n return Unit.dmsToDeg(dms) * Math.PI / 180.0;\n }\n\n /**\n * Convert fractional degrees to a sexagesimal DMS value.\n * @param deg the fractional degrees.\n * @return the sexagesimal DMS value.\n */\n public static degToDms(deg: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (deg < 0.0);\n if (neg) deg *= -1.0;\n /* Get the integer degrees */\n let ideg: float64 = Math.floor(deg);\n deg -= ideg;\n /* Get the minutes */\n deg *= 60.0;\n let min: float64 = Math.floor(deg);\n deg -= min;\n /* Get the seconds */\n deg *= 60.0;\n let sec: float64 = deg;\n /* Convert to DMS */\n let dms: float64 = ideg + (min / 100.0) + (sec / 10000.0);\n if (neg) dms *= -1.0;\n /* Return the DMS */\n return dms;\n }\n\n /**\n * Convert a sexagesimal DM value to fractional degrees.\n * @param dm the sexagesimal DM value.\n * @return the fractional degrees.\n */\n public static dmToDeg(dm: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (dm < 0.0);\n if (neg) dm *= -1.0;\n /* Get the seconds */\n let minutes: float64 = (100.0 * dm);\n let iminutes: int32 = Math.floor(minutes);\n let fraction: float64 = (minutes - iminutes);\n /* Catch rounding errors (like 6.1000 to 6.099999999999999) */\n if (Math.abs(fraction - 1.0) < 1.0e-4) { iminutes++; fraction = 0.0; }\n /* Get the degrees */\n let deg: int32 = Numbers.divInt(iminutes, 100);\n ASystem.assertNot((deg < -180) || (deg > 180), \"Invalid deg (\" + deg + \") in DM \" + dm);\n /* Get the minutes */\n let min: int32 = (iminutes) % 100;\n ASystem.assertNot((min < 0) || (min > 59), \"Invalid min (\" + min + \") in DM \" + dm);\n /* Check the fraction */\n ASystem.assertNot((fraction < 0.0) || (fraction >= 1.0), \"Invalid fraction (\" + fraction + \") in DM \" + dm);\n /* Convert to fractional degrees */\n let fdeg: float64 = deg + (min / 60.0) + (fraction / 60.0);\n if (neg) fdeg *= -1.0;\n /* Return the degrees */\n return fdeg;\n }\n\n /**\n * Convert fractional degrees to a sexagesimal DM value.\n * @param deg the fractional degrees.\n * @return the sexagesimal DM value.\n */\n public static degToDm(deg: float64): float64 {\n /* Make sure we have an non-negative number */\n let neg: boolean = (deg < 0.0);\n if (neg) deg *= -1.0;\n /* Get the integer degrees */\n let ideg: float64 = Math.floor(deg);\n deg -= ideg;\n /* Get the minutes */\n deg *= 60.0;\n let min: float64 = deg;\n /* Convert to DMS */\n let dms: float64 = ideg + (min / 100.0);\n if (neg) dms *= -1.0;\n /* Return the DMS */\n return dms;\n }\n}\n"]}
|