bruce-models 4.7.8 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-models.es5.js +126 -67
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +122 -66
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +3 -1
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/environment.js +6 -0
- package/dist/lib/environment.js.map +1 -1
- package/dist/lib/import/import-assembly.js +53 -0
- package/dist/lib/import/import-assembly.js.map +1 -0
- package/dist/lib/import/import-cad.js +1 -0
- package/dist/lib/import/import-cad.js.map +1 -1
- package/dist/lib/import/import-csv.js +1 -1
- package/dist/lib/import/import-csv.js.map +1 -1
- package/dist/lib/import/import-geojson.js +28 -0
- package/dist/lib/import/import-geojson.js.map +1 -0
- package/dist/lib/import/import-json.js +1 -1
- package/dist/lib/import/import-json.js.map +1 -1
- package/dist/lib/import/import-kml.js +1 -1
- package/dist/lib/import/import-kml.js.map +1 -1
- package/dist/types/bruce-models.d.ts +3 -1
- package/dist/types/entity/entity-type.d.ts +7 -6
- package/dist/types/environment.d.ts +2 -0
- package/dist/types/import/import-assembly.d.ts +73 -0
- package/dist/types/import/import-cad.d.ts +1 -0
- package/dist/types/import/import-csv.d.ts +10 -15
- package/dist/types/import/import-geojson.d.ts +23 -0
- package/dist/types/import/import-json.d.ts +9 -12
- package/dist/types/import/import-kml.d.ts +16 -5
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1585,6 +1585,68 @@
|
|
|
1585
1585
|
}
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
|
+
/**
|
|
1589
|
+
* Simple event utility.
|
|
1590
|
+
* Instantiate the model, then subscribe and trigger events.
|
|
1591
|
+
*/
|
|
1592
|
+
class BruceEvent {
|
|
1593
|
+
constructor() {
|
|
1594
|
+
// Counter to help differentiate subscriptions.
|
|
1595
|
+
this._counter = 0;
|
|
1596
|
+
// Record of all callback subscriptions for this event.
|
|
1597
|
+
this.callbacks = [];
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Subscribes to this event.
|
|
1601
|
+
* The provided callback will be called when the event is triggered.
|
|
1602
|
+
* @param callback
|
|
1603
|
+
* @returns A function that can be called to unsubscribe from this event.
|
|
1604
|
+
*/
|
|
1605
|
+
Subscribe(callback) {
|
|
1606
|
+
let id = this._counter++;
|
|
1607
|
+
let newBruceEventCallback = {
|
|
1608
|
+
_id: id,
|
|
1609
|
+
removeCallback: () => {
|
|
1610
|
+
this.Unsubscribe(id);
|
|
1611
|
+
},
|
|
1612
|
+
callback: callback
|
|
1613
|
+
};
|
|
1614
|
+
this.callbacks.push(newBruceEventCallback);
|
|
1615
|
+
return newBruceEventCallback.removeCallback;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Unsubscribes from this event.
|
|
1619
|
+
* @param id specific subscription entry to remove.
|
|
1620
|
+
* @warning please use the returned function from Subscribe() instead of this function.
|
|
1621
|
+
*/
|
|
1622
|
+
Unsubscribe(id) {
|
|
1623
|
+
let index = this.callbacks.findIndex(x => x._id == id);
|
|
1624
|
+
if (index > -1) {
|
|
1625
|
+
this.callbacks.splice(index, 1);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Triggers this event with optional data.
|
|
1630
|
+
* This will call all subscribed callbacks.
|
|
1631
|
+
* @param data
|
|
1632
|
+
*/
|
|
1633
|
+
Trigger(data) {
|
|
1634
|
+
let callbacks = this.callbacks;
|
|
1635
|
+
for (let i = 0; i < callbacks.length; i++) {
|
|
1636
|
+
let callback = callbacks[i];
|
|
1637
|
+
if (callback.callback) {
|
|
1638
|
+
callback.callback(data);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Clears all subscriptions.
|
|
1644
|
+
*/
|
|
1645
|
+
Clear() {
|
|
1646
|
+
this.callbacks = [];
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1588
1650
|
// Global instance for smaller use-cases where you don't want to manage the getters yourself.
|
|
1589
1651
|
let _getters;
|
|
1590
1652
|
(function (ENVIRONMENT) {
|
|
@@ -1599,6 +1661,9 @@
|
|
|
1599
1661
|
// Default session ID.
|
|
1600
1662
|
sessionId: ""
|
|
1601
1663
|
};
|
|
1664
|
+
// Subscribe to get notified when someone calls Reset.
|
|
1665
|
+
// If you are manually updating params, call OnParamsChange.Trigger() to notify others.
|
|
1666
|
+
ENVIRONMENT.OnParamsChange = new BruceEvent();
|
|
1602
1667
|
/**
|
|
1603
1668
|
* Returns the ApiGetters instance.
|
|
1604
1669
|
* This is used to communicate with any Nextspace API instance.
|
|
@@ -1623,6 +1688,7 @@
|
|
|
1623
1688
|
* @param params
|
|
1624
1689
|
*/
|
|
1625
1690
|
function Reset(params) {
|
|
1691
|
+
var _a;
|
|
1626
1692
|
if (ENVIRONMENT.IS_SELF_MANAGED) {
|
|
1627
1693
|
throw ("Self managed mode ON. You are getting this error because you didn't pass an Api instance to a function.");
|
|
1628
1694
|
}
|
|
@@ -1639,6 +1705,7 @@
|
|
|
1639
1705
|
}
|
|
1640
1706
|
}
|
|
1641
1707
|
ENVIRONMENT.PARAMS = Object.assign(Object.assign({}, ENVIRONMENT.PARAMS), params);
|
|
1708
|
+
(_a = ENVIRONMENT.OnParamsChange) === null || _a === void 0 ? void 0 : _a.Trigger();
|
|
1642
1709
|
}
|
|
1643
1710
|
ENVIRONMENT.Reset = Reset;
|
|
1644
1711
|
})(exports.ENVIRONMENT || (exports.ENVIRONMENT = {}));
|
|
@@ -4948,68 +5015,6 @@
|
|
|
4948
5015
|
Bounds.FromEntity = FromEntity;
|
|
4949
5016
|
})(exports.Bounds || (exports.Bounds = {}));
|
|
4950
5017
|
|
|
4951
|
-
/**
|
|
4952
|
-
* Simple event utility.
|
|
4953
|
-
* Instantiate the model, then subscribe and trigger events.
|
|
4954
|
-
*/
|
|
4955
|
-
class BruceEvent {
|
|
4956
|
-
constructor() {
|
|
4957
|
-
// Counter to help differentiate subscriptions.
|
|
4958
|
-
this._counter = 0;
|
|
4959
|
-
// Record of all callback subscriptions for this event.
|
|
4960
|
-
this.callbacks = [];
|
|
4961
|
-
}
|
|
4962
|
-
/**
|
|
4963
|
-
* Subscribes to this event.
|
|
4964
|
-
* The provided callback will be called when the event is triggered.
|
|
4965
|
-
* @param callback
|
|
4966
|
-
* @returns A function that can be called to unsubscribe from this event.
|
|
4967
|
-
*/
|
|
4968
|
-
Subscribe(callback) {
|
|
4969
|
-
let id = this._counter++;
|
|
4970
|
-
let newBruceEventCallback = {
|
|
4971
|
-
_id: id,
|
|
4972
|
-
removeCallback: () => {
|
|
4973
|
-
this.Unsubscribe(id);
|
|
4974
|
-
},
|
|
4975
|
-
callback: callback
|
|
4976
|
-
};
|
|
4977
|
-
this.callbacks.push(newBruceEventCallback);
|
|
4978
|
-
return newBruceEventCallback.removeCallback;
|
|
4979
|
-
}
|
|
4980
|
-
/**
|
|
4981
|
-
* Unsubscribes from this event.
|
|
4982
|
-
* @param id specific subscription entry to remove.
|
|
4983
|
-
* @warning please use the returned function from Subscribe() instead of this function.
|
|
4984
|
-
*/
|
|
4985
|
-
Unsubscribe(id) {
|
|
4986
|
-
let index = this.callbacks.findIndex(x => x._id == id);
|
|
4987
|
-
if (index > -1) {
|
|
4988
|
-
this.callbacks.splice(index, 1);
|
|
4989
|
-
}
|
|
4990
|
-
}
|
|
4991
|
-
/**
|
|
4992
|
-
* Triggers this event with optional data.
|
|
4993
|
-
* This will call all subscribed callbacks.
|
|
4994
|
-
* @param data
|
|
4995
|
-
*/
|
|
4996
|
-
Trigger(data) {
|
|
4997
|
-
let callbacks = this.callbacks;
|
|
4998
|
-
for (let i = 0; i < callbacks.length; i++) {
|
|
4999
|
-
let callback = callbacks[i];
|
|
5000
|
-
if (callback.callback) {
|
|
5001
|
-
callback.callback(data);
|
|
5002
|
-
}
|
|
5003
|
-
}
|
|
5004
|
-
}
|
|
5005
|
-
/**
|
|
5006
|
-
* Clears all subscriptions.
|
|
5007
|
-
*/
|
|
5008
|
-
Clear() {
|
|
5009
|
-
this.callbacks = [];
|
|
5010
|
-
}
|
|
5011
|
-
}
|
|
5012
|
-
|
|
5013
5018
|
(function (Camera) {
|
|
5014
5019
|
let EFrustum;
|
|
5015
5020
|
(function (EFrustum) {
|
|
@@ -12935,6 +12940,44 @@
|
|
|
12935
12940
|
DataLab.Run = Run;
|
|
12936
12941
|
})(exports.DataLab || (exports.DataLab = {}));
|
|
12937
12942
|
|
|
12943
|
+
(function (ImportAssembly) {
|
|
12944
|
+
function Analyze(params) {
|
|
12945
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12946
|
+
let { api, fileAnalyze, req: reqParams } = params;
|
|
12947
|
+
if (!api) {
|
|
12948
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
12949
|
+
}
|
|
12950
|
+
return api.POST("import/analyze/assembly", fileAnalyze, exports.Api.PrepReqParams(reqParams));
|
|
12951
|
+
});
|
|
12952
|
+
}
|
|
12953
|
+
ImportAssembly.Analyze = Analyze;
|
|
12954
|
+
function ImportEntities(params) {
|
|
12955
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12956
|
+
let { api, fileImport, req: reqParams } = params;
|
|
12957
|
+
if (!api) {
|
|
12958
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
12959
|
+
}
|
|
12960
|
+
return api.POST("import/assembly", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
12961
|
+
});
|
|
12962
|
+
}
|
|
12963
|
+
ImportAssembly.ImportEntities = ImportEntities;
|
|
12964
|
+
/**
|
|
12965
|
+
* Parses the completed pending action result from running "ImportEntities".
|
|
12966
|
+
* This will return the root entity's id if any is present.
|
|
12967
|
+
* @param paResult
|
|
12968
|
+
*/
|
|
12969
|
+
function ParseAnalysisResult(paResult) {
|
|
12970
|
+
try {
|
|
12971
|
+
return typeof paResult == "string" ? JSON.parse(paResult) : paResult;
|
|
12972
|
+
}
|
|
12973
|
+
catch (_a) {
|
|
12974
|
+
// Failed to parse json.
|
|
12975
|
+
}
|
|
12976
|
+
return null;
|
|
12977
|
+
}
|
|
12978
|
+
ImportAssembly.ParseAnalysisResult = ParseAnalysisResult;
|
|
12979
|
+
})(exports.ImportAssembly || (exports.ImportAssembly = {}));
|
|
12980
|
+
|
|
12938
12981
|
(function (ImportCad) {
|
|
12939
12982
|
function Analyze(params) {
|
|
12940
12983
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -12984,7 +13027,7 @@
|
|
|
12984
13027
|
if (!api) {
|
|
12985
13028
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
12986
13029
|
}
|
|
12987
|
-
return api.POST("
|
|
13030
|
+
return api.POST("import/csv", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
12988
13031
|
});
|
|
12989
13032
|
}
|
|
12990
13033
|
ImportCsv.ImportEntities = ImportEntities;
|
|
@@ -12997,12 +13040,25 @@
|
|
|
12997
13040
|
if (!api) {
|
|
12998
13041
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
12999
13042
|
}
|
|
13000
|
-
return api.POST("
|
|
13043
|
+
return api.POST("import/json", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
13001
13044
|
});
|
|
13002
13045
|
}
|
|
13003
13046
|
ImportJson.ImportEntities = ImportEntities;
|
|
13004
13047
|
})(exports.ImportJson || (exports.ImportJson = {}));
|
|
13005
13048
|
|
|
13049
|
+
(function (ImportGeoJson) {
|
|
13050
|
+
function ImportEntities(params) {
|
|
13051
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13052
|
+
let { api, fileImport, req: reqParams } = params;
|
|
13053
|
+
if (!api) {
|
|
13054
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
13055
|
+
}
|
|
13056
|
+
return api.POST("import/geojson", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
13057
|
+
});
|
|
13058
|
+
}
|
|
13059
|
+
ImportGeoJson.ImportEntities = ImportEntities;
|
|
13060
|
+
})(exports.ImportGeoJson || (exports.ImportGeoJson = {}));
|
|
13061
|
+
|
|
13006
13062
|
(function (ImportKml) {
|
|
13007
13063
|
function ImportEntities(params) {
|
|
13008
13064
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -13010,7 +13066,7 @@
|
|
|
13010
13066
|
if (!api) {
|
|
13011
13067
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
13012
13068
|
}
|
|
13013
|
-
return api.POST("
|
|
13069
|
+
return api.POST("import/kml", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
13014
13070
|
});
|
|
13015
13071
|
}
|
|
13016
13072
|
ImportKml.ImportEntities = ImportEntities;
|
|
@@ -13860,7 +13916,7 @@
|
|
|
13860
13916
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13861
13917
|
|
|
13862
13918
|
// This is updated with the package.json version on build.
|
|
13863
|
-
const VERSION = "4.
|
|
13919
|
+
const VERSION = "4.8.0";
|
|
13864
13920
|
|
|
13865
13921
|
exports.VERSION = VERSION;
|
|
13866
13922
|
exports.AbstractApi = AbstractApi;
|