@smarterplan/ngx-smarterplan-core 1.4.30 → 1.4.31
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/esm2022/lib/services/filter.service.mjs +16 -1
- package/esm2022/lib/services/matterport-tag-copy.service.mjs +1 -1
- package/esm2022/lib/services/models/equipment.service.mjs +46 -3
- package/esm2022/lib/services/models/feature.service.mjs +47 -5
- package/esm2022/lib/services/models/measurement.service.mjs +3 -1
- package/esm2022/lib/services/models/object3D.service.mjs +23 -6
- package/esm2022/lib/services/models/poi.service.mjs +41 -4
- package/esm2022/lib/services/models/ticket.service.mjs +43 -3
- package/esm2022/lib/services/user.service.mjs +18 -1
- package/esm2022/lib/services/utils/matterport-transform.util.mjs +1 -1
- package/esm2022/lib/services/utils/object3d-model.util.mjs +1 -1
- package/esm2022/lib/tokens/object3d-model-upload.token.mjs +1 -1
- package/esm2022/public-api.mjs +1 -1
- package/fesm2022/smarterplan-ngx-smarterplan-core.mjs +226 -14
- package/fesm2022/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/lib/services/filter.service.d.ts +9 -0
- package/lib/services/models/equipment.service.d.ts +4 -0
- package/lib/services/models/feature.service.d.ts +4 -0
- package/lib/services/models/object3D.service.d.ts +5 -1
- package/lib/services/models/poi.service.d.ts +23 -0
- package/lib/services/models/ticket.service.d.ts +4 -0
- package/lib/services/user.service.d.ts +7 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import * as i1$2 from '@ng-bootstrap/ng-bootstrap';
|
|
|
8
8
|
import { NgbDate, NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
|
9
9
|
import * as i1 from '@angular/router';
|
|
10
10
|
import { RouterModule } from '@angular/router';
|
|
11
|
-
import { Subject, BehaviorSubject, takeUntil, Observable } from 'rxjs';
|
|
11
|
+
import { Subject, BehaviorSubject, filter, takeUntil, Observable } from 'rxjs';
|
|
12
12
|
import * as THREE from 'three';
|
|
13
13
|
import { Matrix4, Vector3, Color, Object3D, Euler, PerspectiveCamera, CylinderBufferGeometry, BoxGeometry, MeshBasicMaterial, NormalBlending, BackSide, Mesh, EdgesGeometry, AdditiveBlending, ShaderMaterial, AnimationMixer, VectorKeyframeTrack, InterpolateSmooth, AnimationClip, LoopOnce, Group, PlaneBufferGeometry, CanvasTexture, Texture, LinearFilter, Box3, MathUtils, Quaternion } from 'three';
|
|
14
14
|
import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js';
|
|
@@ -1964,6 +1964,23 @@ class BaseUserService {
|
|
|
1964
1964
|
const highestLevel = getHighestLevelForMissions(this.currentMissions);
|
|
1965
1965
|
return levels.filter((level) => getLevelsBelow(highestLevel).includes(level));
|
|
1966
1966
|
}
|
|
1967
|
+
/**
|
|
1968
|
+
* The access levels the user sees in every one of the spaces, by the rule the lists are
|
|
1969
|
+
* filtered with: those of their highest mission in a space, and all of them where they have no
|
|
1970
|
+
* mission, as nothing is filtered there. A form offering a level beyond these would make an
|
|
1971
|
+
* object its own author cannot see.
|
|
1972
|
+
*/
|
|
1973
|
+
getAvailableLevelsForSpaces(spaceIDs) {
|
|
1974
|
+
const levels = enumToArray(LevelStatus);
|
|
1975
|
+
return spaceIDs.reduce((visible, spaceID) => {
|
|
1976
|
+
const spaceMissions = (this.currentMissions ?? []).filter((mission) => mission.spaceID === spaceID);
|
|
1977
|
+
if (spaceMissions.length === 0) {
|
|
1978
|
+
return visible;
|
|
1979
|
+
}
|
|
1980
|
+
const below = getLevelsBelow(getHighestLevelForMissions(spaceMissions));
|
|
1981
|
+
return visible.filter((level) => below.includes(level));
|
|
1982
|
+
}, levels);
|
|
1983
|
+
}
|
|
1967
1984
|
getAvailableRolesForCurrentUser() {
|
|
1968
1985
|
if (!this.currentMissions) {
|
|
1969
1986
|
return [RoleStatus.VISITOR];
|
|
@@ -2148,6 +2165,13 @@ class PoiService {
|
|
|
2148
2165
|
destroy$ = new Subject();
|
|
2149
2166
|
/** Elements whose POI was written in this session: a copy loaded earlier with the element is outdated. */
|
|
2150
2167
|
changedElementIDs = new Set();
|
|
2168
|
+
/**
|
|
2169
|
+
* Every POI this service has just created, updated or deleted. The lists sorted by zone read the
|
|
2170
|
+
* zone off the POI, so they have to be sorted again when it moves.
|
|
2171
|
+
*/
|
|
2172
|
+
poiWritten = new Subject();
|
|
2173
|
+
/** The last POI written for each element in this session, by element ID. */
|
|
2174
|
+
lastWrites = new Map();
|
|
2151
2175
|
constructor(apiInjected, awsKinesisAnalyticsInjected, userService, zoneChangeService // inject ZoneChangeService instead of NavigatorService to fix circular dependancy
|
|
2152
2176
|
) {
|
|
2153
2177
|
this.userService = userService;
|
|
@@ -2227,17 +2251,47 @@ class PoiService {
|
|
|
2227
2251
|
}, 'AWSKinesis');
|
|
2228
2252
|
}
|
|
2229
2253
|
this.markChanged(poi);
|
|
2230
|
-
return this.API.CreatePOI(poi);
|
|
2254
|
+
return this.written(await this.API.CreatePOI(poi), false);
|
|
2231
2255
|
}
|
|
2232
2256
|
poiIsVirtual(poi) {
|
|
2233
2257
|
const { coordinate } = poi;
|
|
2234
2258
|
return !coordinate;
|
|
2235
2259
|
}
|
|
2236
2260
|
async updatePoi(poi) {
|
|
2237
|
-
return this.markChanged(await this.API.UpdatePOI(poi));
|
|
2261
|
+
return this.written(this.markChanged(await this.API.UpdatePOI(poi)), false);
|
|
2238
2262
|
}
|
|
2239
2263
|
async deletePoi(poiID) {
|
|
2240
|
-
return this.markChanged(await this.API.DeletePOI({ id: poiID }));
|
|
2264
|
+
return this.written(this.markChanged(await this.API.DeletePOI({ id: poiID })), true);
|
|
2265
|
+
}
|
|
2266
|
+
written(poi, deleted) {
|
|
2267
|
+
if (poi?.elementID) {
|
|
2268
|
+
const write = { poi, deleted };
|
|
2269
|
+
this.lastWrites.set(poi.elementID, write);
|
|
2270
|
+
this.poiWritten.next(write);
|
|
2271
|
+
}
|
|
2272
|
+
return poi;
|
|
2273
|
+
}
|
|
2274
|
+
/**
|
|
2275
|
+
* Puts in the objects the POI this session last wrote for them, where it is more recent than the
|
|
2276
|
+
* one they were loaded with. The lists are read from indexes that may not show a write made a
|
|
2277
|
+
* moment ago, and a zone read off the old POI would be the wrong one.
|
|
2278
|
+
*/
|
|
2279
|
+
withLatestPois(objects) {
|
|
2280
|
+
for (const object of objects ?? []) {
|
|
2281
|
+
const write = object?.id ? this.lastWrites.get(object.id) : undefined;
|
|
2282
|
+
if (!write) {
|
|
2283
|
+
continue;
|
|
2284
|
+
}
|
|
2285
|
+
// updatedAt is returned with every POI, though the POI type does not declare it.
|
|
2286
|
+
const loaded = object.pois?.items?.[0];
|
|
2287
|
+
const written = write.poi;
|
|
2288
|
+
// Written by someone else since: that one is the current POI.
|
|
2289
|
+
if (loaded && (loaded.updatedAt ?? '') > (written.updatedAt ?? '')) {
|
|
2290
|
+
continue;
|
|
2291
|
+
}
|
|
2292
|
+
object.pois = { ...object.pois, items: write.deleted ? [] : [write.poi] };
|
|
2293
|
+
}
|
|
2294
|
+
return objects;
|
|
2241
2295
|
}
|
|
2242
2296
|
async getPoisByMatterportSweepByType(sweep, type) {
|
|
2243
2297
|
return this.API.ListPOIS({ matterportSweepID: { eq: sweep } }, 300)
|
|
@@ -12517,6 +12571,21 @@ class FilterService {
|
|
|
12517
12571
|
}));
|
|
12518
12572
|
return filteredObjects;
|
|
12519
12573
|
}
|
|
12574
|
+
/** Whether an object belongs to the zone, by the same rule as filterObjectsForZone; true without a zone. */
|
|
12575
|
+
async isInZone(object, zoneID = null, zone = null) {
|
|
12576
|
+
if (!zoneID) {
|
|
12577
|
+
return true;
|
|
12578
|
+
}
|
|
12579
|
+
return (await this.filterObjectsForZone([object], zoneID, zone)).length > 0;
|
|
12580
|
+
}
|
|
12581
|
+
/**
|
|
12582
|
+
* A zone's list once one object's POI has changed: the objects of the space that were in it, in
|
|
12583
|
+
* the space's order, with that object in it or not as `inZone` says.
|
|
12584
|
+
*/
|
|
12585
|
+
zoneListAfterMove(space, zone, objectID, inZone) {
|
|
12586
|
+
const inZoneIDs = new Set((zone ?? []).map((object) => object.id));
|
|
12587
|
+
return (space ?? []).filter((object) => object.id === objectID ? inZone : inZoneIDs.has(object.id));
|
|
12588
|
+
}
|
|
12520
12589
|
filterEquipmentsByDomainList(equipments, domainIDList) {
|
|
12521
12590
|
let filtered = [];
|
|
12522
12591
|
const filteredByDomain = equipments.filter((equip) => domainIDList.includes(equip.domainID));
|
|
@@ -15141,6 +15210,8 @@ class TicketsService extends BaseObjectService {
|
|
|
15141
15210
|
floorsPerSpace = null;
|
|
15142
15211
|
selectedFloor = null;
|
|
15143
15212
|
destroy$ = new Subject();
|
|
15213
|
+
/** Counts the calls to initTickets, so that only the latest one publishes its lists. */
|
|
15214
|
+
initTicketsRun = 0;
|
|
15144
15215
|
constructor(awsKinesisAnalyticsInjected, apiInjected, operationService, eventService, affectationService, poiService, userService, navigatorService, filterService, interventionService, navigationService, visitService, viewerService, zoneChangeService, modalService) {
|
|
15145
15216
|
super(poiService, navigationService, visitService);
|
|
15146
15217
|
this.operationService = operationService;
|
|
@@ -15175,11 +15246,39 @@ class TicketsService extends BaseObjectService {
|
|
|
15175
15246
|
this.selectedFloor = floor;
|
|
15176
15247
|
}
|
|
15177
15248
|
});
|
|
15249
|
+
// A ticket belongs to the zone of its POI's sweep. The POI is written after the ticket - when it
|
|
15250
|
+
// is created, the refresh that addTicket triggers reads the ticket without it - and again
|
|
15251
|
+
// whenever its tag is moved: sort the ticket again with the POI the API returned.
|
|
15252
|
+
this.poiService.poiWritten
|
|
15253
|
+
.pipe(filter(({ poi }) => poi.type === PoiType.TICKET))
|
|
15254
|
+
.subscribe(({ poi }) => this.sortAgainIntoZone(poi.elementID).catch((e) => console.log(e.message)));
|
|
15255
|
+
}
|
|
15256
|
+
/** Moves a loaded ticket into or out of the current zone's list, as its last written POI says. */
|
|
15257
|
+
async sortAgainIntoZone(ticketID) {
|
|
15258
|
+
const ticket = this.currentTickets.space?.find((t) => t.id === ticketID);
|
|
15259
|
+
if (!ticket) {
|
|
15260
|
+
// Not loaded, or being loaded: the load puts the POI in through withLatestPois.
|
|
15261
|
+
return;
|
|
15262
|
+
}
|
|
15263
|
+
const zoneID = this.zoneIDFilter;
|
|
15264
|
+
this.poiService.withLatestPois([ticket]);
|
|
15265
|
+
const inZone = await this.filterService.isInZone(ticket, zoneID);
|
|
15266
|
+
// Another zone, or other lists, since: their load has sorted the ticket already.
|
|
15267
|
+
if (zoneID !== this.zoneIDFilter || !this.currentTickets.space?.includes(ticket)) {
|
|
15268
|
+
return;
|
|
15269
|
+
}
|
|
15270
|
+
this.currentTickets.zone = this.filterService.zoneListAfterMove(this.currentTickets.space, this.currentTickets.zone, ticketID, inZone);
|
|
15271
|
+
this.ticketTags.next(this.currentTickets.zone);
|
|
15272
|
+
this.ticketsUpdated.next(this.currentTickets);
|
|
15178
15273
|
}
|
|
15179
15274
|
async initTickets() {
|
|
15180
15275
|
if (this.userService.getSpModule() === SpModule.MUSEUM) {
|
|
15181
15276
|
return;
|
|
15182
15277
|
}
|
|
15278
|
+
const run = ++this.initTicketsRun;
|
|
15279
|
+
// Calls overlap - one per change - and their requests can resolve in any order: a call that
|
|
15280
|
+
// started earlier would publish the tickets as they were before the change.
|
|
15281
|
+
const hasNewerCall = () => run !== this.initTicketsRun;
|
|
15183
15282
|
let ticketsFiltered = [];
|
|
15184
15283
|
if (this.currentSpaceID) {
|
|
15185
15284
|
this.updating.next(true);
|
|
@@ -15190,6 +15289,10 @@ class TicketsService extends BaseObjectService {
|
|
|
15190
15289
|
});
|
|
15191
15290
|
ticketsFiltered =
|
|
15192
15291
|
await this.filterService.filterTicketsForCurrentUserInSpace(ticketsFiltered, this.currentSpaceID);
|
|
15292
|
+
if (hasNewerCall()) {
|
|
15293
|
+
return;
|
|
15294
|
+
}
|
|
15295
|
+
this.poiService.withLatestPois(ticketsFiltered);
|
|
15193
15296
|
// @ts-ignore
|
|
15194
15297
|
if (this.dateFilter && this.dateFilter[0] != "Invalid Date" && this.dateFilter[1] != "Invalid Date") {
|
|
15195
15298
|
ticketsFiltered = this.filterService.filterObjectsForDateRange(ticketsFiltered, this.dateFilter);
|
|
@@ -15198,10 +15301,14 @@ class TicketsService extends BaseObjectService {
|
|
|
15198
15301
|
if (this.ticketTypeFilter) {
|
|
15199
15302
|
ticketsFiltered = ticketsFiltered.filter((ticket) => this.ticketTypeFilter.includes(ticket.type));
|
|
15200
15303
|
}
|
|
15201
|
-
|
|
15304
|
+
const ticketsSpace = ticketsFiltered;
|
|
15202
15305
|
if (this.zoneIDFilter) {
|
|
15203
15306
|
ticketsFiltered = await this.filterService.filterObjectsForZone(ticketsFiltered, this.zoneIDFilter);
|
|
15204
15307
|
}
|
|
15308
|
+
if (hasNewerCall()) {
|
|
15309
|
+
return;
|
|
15310
|
+
}
|
|
15311
|
+
this.currentTickets.space = ticketsSpace;
|
|
15205
15312
|
this.currentTickets.zone = ticketsFiltered;
|
|
15206
15313
|
this.ticketTags.next(ticketsFiltered);
|
|
15207
15314
|
this.ticketsUpdated.next(this.currentTickets);
|
|
@@ -15209,6 +15316,8 @@ class TicketsService extends BaseObjectService {
|
|
|
15209
15316
|
}
|
|
15210
15317
|
else {
|
|
15211
15318
|
this.ticketTags.next(null);
|
|
15319
|
+
// An earlier call may have started loading, and it now leaves the result to this one.
|
|
15320
|
+
this.updating.next(false);
|
|
15212
15321
|
}
|
|
15213
15322
|
}
|
|
15214
15323
|
async adaptTicket(ticket) {
|
|
@@ -15687,6 +15796,8 @@ class EquipmentService extends BaseObjectService {
|
|
|
15687
15796
|
awsKinesisAnalytics; //AWS
|
|
15688
15797
|
isMuseumUser = false;
|
|
15689
15798
|
destroy$ = new Subject();
|
|
15799
|
+
/** Counts the calls to initEquips, so that only the latest one publishes its lists. */
|
|
15800
|
+
initEquipsRun = 0;
|
|
15690
15801
|
constructor(apiInjected, awsKinesisAnalyticsInjected, poiService, navigationService, visitService, operationService, ticketsService, navigatorService, filterService, userService, viewerService, modalService, zoneChangeService) {
|
|
15691
15802
|
super(poiService, navigationService, visitService);
|
|
15692
15803
|
this.operationService = operationService;
|
|
@@ -15715,6 +15826,32 @@ class EquipmentService extends BaseObjectService {
|
|
|
15715
15826
|
this.selectedFloor = floor;
|
|
15716
15827
|
}
|
|
15717
15828
|
});
|
|
15829
|
+
// An equipment belongs to the zone of its POI's sweep: when its tag moves, sort it again with
|
|
15830
|
+
// the POI the API returned.
|
|
15831
|
+
this.poiService.poiWritten
|
|
15832
|
+
.pipe(filter(({ poi }) => poi.type === PoiType.EQUIPMENT))
|
|
15833
|
+
.subscribe(({ poi }) => this.sortAgainIntoZone(poi.elementID).catch((e) => console.log(e.message)));
|
|
15834
|
+
}
|
|
15835
|
+
/** Moves a loaded equipment into or out of the current zone's list, as its last written POI says. */
|
|
15836
|
+
async sortAgainIntoZone(equipmentID) {
|
|
15837
|
+
const equipment = this.currentEquipments.space?.find((e) => e.id === equipmentID);
|
|
15838
|
+
if (!equipment) {
|
|
15839
|
+
// Not loaded, or being loaded: the load puts the POI in through withLatestPois.
|
|
15840
|
+
return;
|
|
15841
|
+
}
|
|
15842
|
+
const zoneID = this.zoneIDFilter;
|
|
15843
|
+
this.poiService.withLatestPois([equipment]);
|
|
15844
|
+
const inZone = await this.filterService.isInZone(equipment, zoneID, this.currentZone);
|
|
15845
|
+
// Another zone, or other lists, since: their load has sorted the equipment already.
|
|
15846
|
+
if (zoneID !== this.zoneIDFilter || !this.currentEquipments.space?.includes(equipment)) {
|
|
15847
|
+
return;
|
|
15848
|
+
}
|
|
15849
|
+
const zone = this.filterService.zoneListAfterMove(this.currentEquipments.space, this.currentEquipments.zonesMap.get(zoneID), equipmentID, inZone);
|
|
15850
|
+
// The lists kept for the other zones may hold it or miss it now: they are sorted again from
|
|
15851
|
+
// the space's list when the user goes back to them.
|
|
15852
|
+
this.currentEquipments.zonesMap = new Map([[zoneID, zone]]);
|
|
15853
|
+
this.equipmentsTags.next(zone);
|
|
15854
|
+
this.equipmentsUpdated.next({ space: this.currentEquipments.space, zone });
|
|
15718
15855
|
}
|
|
15719
15856
|
async readEquipment(id) {
|
|
15720
15857
|
return this.API.__proto__.GetEquipment(id).then(async (receivedEquip) => {
|
|
@@ -16047,10 +16184,18 @@ class EquipmentService extends BaseObjectService {
|
|
|
16047
16184
|
if (!this.currentSpaceID || this.userService.getSpModule() === SpModule.MUSEUM) {
|
|
16048
16185
|
return;
|
|
16049
16186
|
}
|
|
16187
|
+
const run = ++this.initEquipsRun;
|
|
16188
|
+
// Calls overlap - one per change - and their requests can resolve in any order: a call that
|
|
16189
|
+
// started earlier would publish the equipments as they were before the change.
|
|
16190
|
+
const hasNewerCall = () => run !== this.initEquipsRun;
|
|
16050
16191
|
this.updating.next(true);
|
|
16051
16192
|
this.currentlyUpdating = true;
|
|
16052
16193
|
let eqList = await this.getEquipmentsForSpace(this.currentSpaceID);
|
|
16053
16194
|
eqList = await this.filterService.filterEquipmentsForCurrentUserInSpace(this.currentSpaceID, eqList);
|
|
16195
|
+
if (hasNewerCall()) {
|
|
16196
|
+
return;
|
|
16197
|
+
}
|
|
16198
|
+
this.poiService.withLatestPois(eqList);
|
|
16054
16199
|
// console.log(eqList);
|
|
16055
16200
|
if (eqList.length > 0) {
|
|
16056
16201
|
let filteredEquips = eqList.filter((equipment) => !this.isArchived(equipment));
|
|
@@ -16058,14 +16203,21 @@ class EquipmentService extends BaseObjectService {
|
|
|
16058
16203
|
equip.documentationImageUrlSigned =
|
|
16059
16204
|
await getSignedImageUrlForEquipment(equip);
|
|
16060
16205
|
}));
|
|
16206
|
+
if (hasNewerCall()) {
|
|
16207
|
+
return;
|
|
16208
|
+
}
|
|
16061
16209
|
this.equipmentsUnfiltered.next(filteredEquips);
|
|
16062
16210
|
if (this.equipmentDomainFilter) {
|
|
16063
16211
|
filteredEquips = this.filterService.filterEquipmentsByDomainList(filteredEquips, this.equipmentDomainFilter);
|
|
16064
16212
|
}
|
|
16065
|
-
|
|
16213
|
+
const equipsSpace = filteredEquips;
|
|
16066
16214
|
if (this.zoneIDFilter) {
|
|
16067
16215
|
filteredEquips = (await this.filterService.filterObjectsForZone(filteredEquips, this.zoneIDFilter, this.currentZone));
|
|
16068
16216
|
}
|
|
16217
|
+
if (hasNewerCall()) {
|
|
16218
|
+
return;
|
|
16219
|
+
}
|
|
16220
|
+
this.currentEquipments.space = equipsSpace;
|
|
16069
16221
|
this.currentEquipments.zonesMap.set(this.zoneIDFilter, filteredEquips);
|
|
16070
16222
|
this.equipmentsTags.next(filteredEquips); // adding tags only for the current zone
|
|
16071
16223
|
this.equipmentsUpdated.next({
|
|
@@ -17298,6 +17450,8 @@ class FeatureService extends BaseObjectService {
|
|
|
17298
17450
|
currentHashtags = [];
|
|
17299
17451
|
createObservable = new Subject();
|
|
17300
17452
|
deleteObservable = new Subject();
|
|
17453
|
+
/** Counts the calls to initFeatures, so that only the latest one publishes its lists. */
|
|
17454
|
+
initFeaturesRun = 0;
|
|
17301
17455
|
constructor(apiInjected, navigatorService, filterService, poiService, commentService, userService, navigationService, visitService, hashtagService, zoneChangeService) {
|
|
17302
17456
|
super(poiService, navigationService, visitService);
|
|
17303
17457
|
this.navigatorService = navigatorService;
|
|
@@ -17352,6 +17506,33 @@ class FeatureService extends BaseObjectService {
|
|
|
17352
17506
|
this.updateDueToCreate(feature);
|
|
17353
17507
|
}
|
|
17354
17508
|
});
|
|
17509
|
+
// An info point or a desk belongs to the zone of its POI's sweep: when its tag moves, sort it
|
|
17510
|
+
// again with the POI the API returned.
|
|
17511
|
+
this.poiService.poiWritten
|
|
17512
|
+
.pipe(filter(({ poi }) => poi.type === PoiType.DATA || poi.type === PoiType.DESK))
|
|
17513
|
+
.subscribe(({ poi }) => {
|
|
17514
|
+
if (this.currentSpaceID && !this.userService.isMuseumUser(this.currentSpaceID)) {
|
|
17515
|
+
this.sortAgainIntoZone(poi.elementID).catch((e) => console.log(e.message));
|
|
17516
|
+
}
|
|
17517
|
+
});
|
|
17518
|
+
}
|
|
17519
|
+
/** Moves a loaded info point or desk into or out of the current zone's list, as its last written POI says. */
|
|
17520
|
+
async sortAgainIntoZone(featureID) {
|
|
17521
|
+
const feature = this.currentFeatures.space?.find((f) => f.id === featureID);
|
|
17522
|
+
if (!feature) {
|
|
17523
|
+
// Not loaded, or being loaded: the load puts the POI in through withLatestPois.
|
|
17524
|
+
return;
|
|
17525
|
+
}
|
|
17526
|
+
const zoneID = this.zoneIDFilter;
|
|
17527
|
+
this.poiService.withLatestPois([feature]);
|
|
17528
|
+
const inZone = await this.filterService.isInZone(feature, zoneID);
|
|
17529
|
+
// Another zone, or other lists, since: their load has sorted the feature already.
|
|
17530
|
+
if (zoneID !== this.zoneIDFilter || !this.currentFeatures.space?.includes(feature)) {
|
|
17531
|
+
return;
|
|
17532
|
+
}
|
|
17533
|
+
const zone = this.filterService.zoneListAfterMove(this.currentFeatures.space, this.currentFeatures.zone, featureID, inZone);
|
|
17534
|
+
this.featureTags.next(zone);
|
|
17535
|
+
this.featureUpdated.next({ space: this.currentFeatures.space, zone });
|
|
17355
17536
|
}
|
|
17356
17537
|
/*
|
|
17357
17538
|
* CRUD
|
|
@@ -17394,10 +17575,19 @@ class FeatureService extends BaseObjectService {
|
|
|
17394
17575
|
if (!this.currentSpaceID) {
|
|
17395
17576
|
return;
|
|
17396
17577
|
}
|
|
17578
|
+
const run = ++this.initFeaturesRun;
|
|
17579
|
+
// Calls overlap - one per change - and their requests can resolve in any order: a call that
|
|
17580
|
+
// started earlier would publish the info points and desks as they were before the change.
|
|
17581
|
+
const hasNewerCall = () => run !== this.initFeaturesRun;
|
|
17397
17582
|
this.updating.next(true);
|
|
17398
17583
|
this.isUpdating = true;
|
|
17399
17584
|
const featureList = await this.getFeaturesForSpace(this.currentSpaceID);
|
|
17400
|
-
|
|
17585
|
+
const hashtags = await this.hashtagService.getHashtagsForSpace(this.currentSpaceID);
|
|
17586
|
+
if (hasNewerCall()) {
|
|
17587
|
+
return;
|
|
17588
|
+
}
|
|
17589
|
+
this.poiService.withLatestPois(featureList);
|
|
17590
|
+
this.currentHashtags = hashtags;
|
|
17401
17591
|
// console.log(this.currentHashtags);
|
|
17402
17592
|
this.featuresUnfiltered.next(featureList);
|
|
17403
17593
|
if (featureList.length > 0) {
|
|
@@ -17411,12 +17601,16 @@ class FeatureService extends BaseObjectService {
|
|
|
17411
17601
|
filteredDesks = filteredDesks.filter((feature) => this.deskDomainFilter.find((domain) => feature.domain && domain === feature.domain.id));
|
|
17412
17602
|
}
|
|
17413
17603
|
filteredFeatures = [...filteredPointInterest, ...filteredDesks];
|
|
17414
|
-
|
|
17415
|
-
// emit on tags should be after setting current.space !!
|
|
17604
|
+
const featuresSpace = filteredFeatures.sort((a, b) => a.index - b.index);
|
|
17416
17605
|
if (this.zoneIDFilter) {
|
|
17417
17606
|
filteredFeatures =
|
|
17418
17607
|
(await this.filterService.filterObjectsForZone(filteredFeatures, this.zoneIDFilter));
|
|
17419
17608
|
}
|
|
17609
|
+
if (hasNewerCall()) {
|
|
17610
|
+
return;
|
|
17611
|
+
}
|
|
17612
|
+
// emit on tags should be after setting current.space !!
|
|
17613
|
+
this.currentFeatures.space = featuresSpace;
|
|
17420
17614
|
this.featureTags.next(filteredFeatures); // for this zone
|
|
17421
17615
|
this.currentFeatures.zone = filteredFeatures.sort((a, b) => a.index - b.index);
|
|
17422
17616
|
// console.log(this.currentFeatures);
|
|
@@ -17768,6 +17962,8 @@ class MeasurementService {
|
|
|
17768
17962
|
if (this.currentSpaceID) {
|
|
17769
17963
|
this.updating.next(true);
|
|
17770
17964
|
let measurements = await this.getMeasurementsForSpaceForUser(this.currentSpaceID);
|
|
17965
|
+
// The list may be read before it shows the POI of a measurement just taken.
|
|
17966
|
+
this.poiService.withLatestPois(measurements.map((measure) => measure.comment));
|
|
17771
17967
|
if (measurements.length > 0) {
|
|
17772
17968
|
if (this.dateFilter) {
|
|
17773
17969
|
measurements = this.filterService.filterMeasurementsForDateRange(measurements, this.dateFilter);
|
|
@@ -22191,6 +22387,7 @@ class Object3DService {
|
|
|
22191
22387
|
navigatorService;
|
|
22192
22388
|
zoneChangeService;
|
|
22193
22389
|
filterService;
|
|
22390
|
+
poiService;
|
|
22194
22391
|
API; //AWS APIService
|
|
22195
22392
|
objects3DUpdated = new Subject();
|
|
22196
22393
|
currentObjects3D = {
|
|
@@ -22219,12 +22416,15 @@ class Object3DService {
|
|
|
22219
22416
|
isMuseumUser = false;
|
|
22220
22417
|
isUpdating = false;
|
|
22221
22418
|
destroy$ = new Subject();
|
|
22419
|
+
/** Counts the calls to initObjects3D, so that only the latest one publishes its lists. */
|
|
22420
|
+
initObjects3DRun = 0;
|
|
22222
22421
|
selectedObject3D; // selected from sprite carrousel viewer (lib of objects3D)
|
|
22223
|
-
constructor(apiInjected, userService, navigatorService, zoneChangeService, filterService) {
|
|
22422
|
+
constructor(apiInjected, userService, navigatorService, zoneChangeService, filterService, poiService) {
|
|
22224
22423
|
this.userService = userService;
|
|
22225
22424
|
this.navigatorService = navigatorService;
|
|
22226
22425
|
this.zoneChangeService = zoneChangeService;
|
|
22227
22426
|
this.filterService = filterService;
|
|
22427
|
+
this.poiService = poiService;
|
|
22228
22428
|
this.API = apiInjected;
|
|
22229
22429
|
// this.isMuseumUser = this.userService.hasOnlyMuseumRole(); // Not used yet!
|
|
22230
22430
|
this.objects3DUpdated.subscribe((list) => {
|
|
@@ -22267,18 +22467,30 @@ class Object3DService {
|
|
|
22267
22467
|
if (!this.currentSpaceID) {
|
|
22268
22468
|
return;
|
|
22269
22469
|
}
|
|
22470
|
+
const run = ++this.initObjects3DRun;
|
|
22471
|
+
// Moving an object reloads the list twice - once for the object, once its POI has followed it -
|
|
22472
|
+
// and the first call, which read the POI before it moved, may answer last: it is ignored then.
|
|
22473
|
+
const hasNewerCall = () => run !== this.initObjects3DRun;
|
|
22270
22474
|
this.updating.next(true);
|
|
22271
22475
|
this.isUpdating = true;
|
|
22272
22476
|
const object3DList = await this.getObjects3DBySpace(this.currentSpaceID);
|
|
22477
|
+
if (hasNewerCall()) {
|
|
22478
|
+
return;
|
|
22479
|
+
}
|
|
22480
|
+
// The list may be read before it shows the POI just moved with its object.
|
|
22481
|
+
this.poiService.withLatestPois(object3DList);
|
|
22273
22482
|
if (object3DList.length > 0) {
|
|
22274
22483
|
let filteredObjects3D = [...object3DList];
|
|
22275
|
-
this.currentObjects3D.zone = filteredObjects3D; // not sorted!
|
|
22276
22484
|
filteredObjects3D =
|
|
22277
22485
|
await this.filterService.filterObjectsForCurrentUserInSpace(filteredObjects3D, this.currentSpaceID);
|
|
22278
|
-
|
|
22486
|
+
const objects3DSpace = filteredObjects3D;
|
|
22279
22487
|
if (this.zoneIDFilter) {
|
|
22280
22488
|
filteredObjects3D = await this.filterService.filterObjectsForZone(filteredObjects3D, this.zoneIDFilter);
|
|
22281
22489
|
}
|
|
22490
|
+
if (hasNewerCall()) {
|
|
22491
|
+
return;
|
|
22492
|
+
}
|
|
22493
|
+
this.currentObjects3D.space = objects3DSpace;
|
|
22282
22494
|
this.currentObjects3D.zone = filteredObjects3D;
|
|
22283
22495
|
this.objects3DUpdated.next(this.currentObjects3D);
|
|
22284
22496
|
}
|
|
@@ -22538,7 +22750,7 @@ class Object3DService {
|
|
|
22538
22750
|
}
|
|
22539
22751
|
return receivedObject3D;
|
|
22540
22752
|
}
|
|
22541
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Object3DService, deps: [{ token: 'currentAPIService' }, { token: BaseUserService }, { token: NavigatorService }, { token: ZoneChangeService }, { token: FilterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
22753
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Object3DService, deps: [{ token: 'currentAPIService' }, { token: BaseUserService }, { token: NavigatorService }, { token: ZoneChangeService }, { token: FilterService }, { token: PoiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
22542
22754
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Object3DService, providedIn: "root" });
|
|
22543
22755
|
}
|
|
22544
22756
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Object3DService, decorators: [{
|
|
@@ -22549,7 +22761,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
22549
22761
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
22550
22762
|
type: Inject,
|
|
22551
22763
|
args: ['currentAPIService']
|
|
22552
|
-
}] }, { type: BaseUserService }, { type: NavigatorService }, { type: ZoneChangeService }, { type: FilterService }] });
|
|
22764
|
+
}] }, { type: BaseUserService }, { type: NavigatorService }, { type: ZoneChangeService }, { type: FilterService }, { type: PoiService }] });
|
|
22553
22765
|
|
|
22554
22766
|
class DomainService {
|
|
22555
22767
|
API; //AWS
|