@smarterplan/ngx-smarterplan-locations 0.2.44 → 0.2.45

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.
Files changed (152) hide show
  1. package/esm2020/lib/components/carousel/carousel.component.mjs +28 -0
  2. package/esm2020/lib/components/chevron/chevron.component.mjs +18 -0
  3. package/esm2020/lib/components/detail-location/detail-location.component.mjs +168 -0
  4. package/esm2020/lib/components/form-location/form-location.component.mjs +237 -0
  5. package/esm2020/lib/components/images/images.component.mjs +107 -0
  6. package/esm2020/lib/components/locations/locations.component.mjs +145 -0
  7. package/esm2020/lib/components/locations/map/map-popup/map-popup.component.mjs +66 -0
  8. package/esm2020/lib/components/locations/map/map.component.mjs +91 -0
  9. package/esm2020/lib/components/plan-legend/plan-legend.component.mjs +47 -0
  10. package/esm2020/lib/components/plans/calibration/calibration.component.mjs +468 -0
  11. package/esm2020/lib/components/plans/edit-plan/edit-plan.component.mjs +324 -0
  12. package/esm2020/lib/components/plans/plans.component.mjs +225 -0
  13. package/esm2020/lib/components/tab-navigation/tab-navigation.component.mjs +41 -0
  14. package/esm2020/lib/components/visits/visits.component.mjs +283 -0
  15. package/esm2020/lib/components/zones/add-audio-zone/add-audio-zone.component.mjs +230 -0
  16. package/esm2020/lib/components/zones/add-zone/add-zone.component.mjs +315 -0
  17. package/esm2020/lib/components/zones/add-zone/selection/selection.component.mjs +77 -0
  18. package/esm2020/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.mjs +502 -0
  19. package/esm2020/lib/components/zones/zones.component.mjs +268 -0
  20. package/esm2020/lib/helper.service.mjs +134 -0
  21. package/esm2020/lib/ngx-smarterplan-location-routing.module.mjs +49 -0
  22. package/esm2020/lib/ngx-smarterplan-locations.module.mjs +125 -0
  23. package/esm2020/lib/ngx-smarterplan-locations.service.mjs +14 -0
  24. package/esm2020/lib/pipes/count-audio-sweeps.pipe.mjs +27 -0
  25. package/esm2020/lib/radio-button/radio-button.component.mjs +26 -0
  26. package/esm2020/public-api.mjs +9 -0
  27. package/esm2020/smarterplan-ngx-smarterplan-locations.mjs +5 -0
  28. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs +3991 -0
  29. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
  30. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs +3828 -0
  31. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
  32. package/lib/components/carousel/carousel.component.d.ts +12 -0
  33. package/lib/components/chevron/chevron.component.d.ts +9 -0
  34. package/lib/components/detail-location/detail-location.component.d.ts +55 -0
  35. package/lib/components/form-location/form-location.component.d.ts +45 -0
  36. package/lib/components/images/images.component.d.ts +33 -0
  37. package/lib/components/locations/locations.component.d.ts +51 -0
  38. package/lib/components/locations/map/map-popup/map-popup.component.d.ts +22 -0
  39. package/lib/components/locations/map/map.component.d.ts +22 -0
  40. package/lib/components/plan-legend/plan-legend.component.d.ts +14 -0
  41. package/lib/components/plans/calibration/calibration.component.d.ts +140 -0
  42. package/lib/components/plans/edit-plan/edit-plan.component.d.ts +55 -0
  43. package/lib/components/plans/plans.component.d.ts +63 -0
  44. package/lib/components/tab-navigation/tab-navigation.component.d.ts +13 -0
  45. package/lib/components/visits/visits.component.d.ts +62 -0
  46. package/lib/components/zones/add-audio-zone/add-audio-zone.component.d.ts +63 -0
  47. package/lib/components/zones/add-zone/add-zone.component.d.ts +69 -0
  48. package/lib/components/zones/add-zone/selection/selection.component.d.ts +44 -0
  49. package/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.d.ts +107 -0
  50. package/lib/components/zones/zones.component.d.ts +73 -0
  51. package/lib/helper.service.d.ts +53 -0
  52. package/lib/ngx-smarterplan-location-routing.module.d.ts +7 -0
  53. package/lib/ngx-smarterplan-locations.module.d.ts +36 -0
  54. package/lib/ngx-smarterplan-locations.service.d.ts +6 -0
  55. package/lib/pipes/count-audio-sweeps.pipe.d.ts +10 -0
  56. package/lib/radio-button/radio-button.component.d.ts +12 -0
  57. package/package.json +22 -5
  58. package/{src/public-api.ts → public-api.d.ts} +4 -11
  59. package/smarterplan-ngx-smarterplan-locations.d.ts +5 -0
  60. package/.browserslistrc +0 -16
  61. package/karma.conf.js +0 -44
  62. package/ng-package.json +0 -7
  63. package/src/lib/components/carousel/carousel.component.html +0 -13
  64. package/src/lib/components/carousel/carousel.component.scss +0 -0
  65. package/src/lib/components/carousel/carousel.component.spec.ts +0 -25
  66. package/src/lib/components/carousel/carousel.component.ts +0 -31
  67. package/src/lib/components/chevron/chevron.component.html +0 -5
  68. package/src/lib/components/chevron/chevron.component.scss +0 -16
  69. package/src/lib/components/chevron/chevron.component.spec.ts +0 -25
  70. package/src/lib/components/chevron/chevron.component.ts +0 -17
  71. package/src/lib/components/detail-location/detail-location.component.html +0 -108
  72. package/src/lib/components/detail-location/detail-location.component.scss +0 -0
  73. package/src/lib/components/detail-location/detail-location.component.spec.ts +0 -25
  74. package/src/lib/components/detail-location/detail-location.component.ts +0 -215
  75. package/src/lib/components/form-location/form-location.component.html +0 -160
  76. package/src/lib/components/form-location/form-location.component.scss +0 -62
  77. package/src/lib/components/form-location/form-location.component.spec.ts +0 -25
  78. package/src/lib/components/form-location/form-location.component.ts +0 -274
  79. package/src/lib/components/images/images.component.html +0 -27
  80. package/src/lib/components/images/images.component.scss +0 -0
  81. package/src/lib/components/images/images.component.spec.ts +0 -25
  82. package/src/lib/components/images/images.component.ts +0 -133
  83. package/src/lib/components/locations/locations.component.html +0 -63
  84. package/src/lib/components/locations/locations.component.scss +0 -121
  85. package/src/lib/components/locations/locations.component.spec.ts +0 -25
  86. package/src/lib/components/locations/locations.component.ts +0 -186
  87. package/src/lib/components/locations/map/map-popup/map-popup.component.html +0 -11
  88. package/src/lib/components/locations/map/map-popup/map-popup.component.scss +0 -51
  89. package/src/lib/components/locations/map/map-popup/map-popup.component.spec.ts +0 -25
  90. package/src/lib/components/locations/map/map-popup/map-popup.component.ts +0 -79
  91. package/src/lib/components/locations/map/map.component.html +0 -2
  92. package/src/lib/components/locations/map/map.component.scss +0 -0
  93. package/src/lib/components/locations/map/map.component.spec.ts +0 -25
  94. package/src/lib/components/locations/map/map.component.ts +0 -111
  95. package/src/lib/components/plan-legend/plan-legend.component.html +0 -9
  96. package/src/lib/components/plan-legend/plan-legend.component.scss +0 -38
  97. package/src/lib/components/plan-legend/plan-legend.component.spec.ts +0 -25
  98. package/src/lib/components/plan-legend/plan-legend.component.ts +0 -50
  99. package/src/lib/components/plans/calibration/calibration.component.html +0 -98
  100. package/src/lib/components/plans/calibration/calibration.component.scss +0 -136
  101. package/src/lib/components/plans/calibration/calibration.component.spec.ts +0 -25
  102. package/src/lib/components/plans/calibration/calibration.component.ts +0 -603
  103. package/src/lib/components/plans/edit-plan/edit-plan.component.html +0 -77
  104. package/src/lib/components/plans/edit-plan/edit-plan.component.scss +0 -9
  105. package/src/lib/components/plans/edit-plan/edit-plan.component.spec.ts +0 -25
  106. package/src/lib/components/plans/edit-plan/edit-plan.component.ts +0 -421
  107. package/src/lib/components/plans/plans.component.html +0 -102
  108. package/src/lib/components/plans/plans.component.scss +0 -24
  109. package/src/lib/components/plans/plans.component.spec.ts +0 -25
  110. package/src/lib/components/plans/plans.component.ts +0 -305
  111. package/src/lib/components/tab-navigation/tab-navigation.component.html +0 -7
  112. package/src/lib/components/tab-navigation/tab-navigation.component.scss +0 -27
  113. package/src/lib/components/tab-navigation/tab-navigation.component.spec.ts +0 -25
  114. package/src/lib/components/tab-navigation/tab-navigation.component.ts +0 -35
  115. package/src/lib/components/visits/visits.component.html +0 -134
  116. package/src/lib/components/visits/visits.component.scss +0 -24
  117. package/src/lib/components/visits/visits.component.spec.ts +0 -25
  118. package/src/lib/components/visits/visits.component.ts +0 -357
  119. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.html +0 -73
  120. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.scss +0 -14
  121. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.spec.ts +0 -25
  122. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.ts +0 -269
  123. package/src/lib/components/zones/add-zone/add-zone.component.html +0 -153
  124. package/src/lib/components/zones/add-zone/add-zone.component.scss +0 -44
  125. package/src/lib/components/zones/add-zone/add-zone.component.spec.ts +0 -25
  126. package/src/lib/components/zones/add-zone/add-zone.component.ts +0 -377
  127. package/src/lib/components/zones/add-zone/selection/selection.component.html +0 -3
  128. package/src/lib/components/zones/add-zone/selection/selection.component.scss +0 -16
  129. package/src/lib/components/zones/add-zone/selection/selection.component.spec.ts +0 -25
  130. package/src/lib/components/zones/add-zone/selection/selection.component.ts +0 -95
  131. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.html +0 -73
  132. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.scss +0 -23
  133. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.spec.ts +0 -25
  134. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.ts +0 -595
  135. package/src/lib/components/zones/zones.component.html +0 -181
  136. package/src/lib/components/zones/zones.component.scss +0 -36
  137. package/src/lib/components/zones/zones.component.spec.ts +0 -25
  138. package/src/lib/components/zones/zones.component.ts +0 -339
  139. package/src/lib/helper.service.ts +0 -161
  140. package/src/lib/ngx-smarterplan-location-routing.module.ts +0 -41
  141. package/src/lib/ngx-smarterplan-locations.module.ts +0 -74
  142. package/src/lib/ngx-smarterplan-locations.service.spec.ts +0 -16
  143. package/src/lib/ngx-smarterplan-locations.service.ts +0 -9
  144. package/src/lib/pipes/count-audio-sweeps.pipe.ts +0 -21
  145. package/src/lib/radio-button/radio-button.component.html +0 -9
  146. package/src/lib/radio-button/radio-button.component.scss +0 -152
  147. package/src/lib/radio-button/radio-button.component.spec.ts +0 -25
  148. package/src/lib/radio-button/radio-button.component.ts +0 -26
  149. package/src/test.ts +0 -27
  150. package/tsconfig.lib.json +0 -15
  151. package/tsconfig.lib.prod.json +0 -10
  152. package/tsconfig.spec.json +0 -17
@@ -1,377 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import {
3
- FormGroup,
4
- FormBuilder,
5
- Validators,
6
- AbstractControl,
7
- ValidatorFn,
8
- ValidationErrors,
9
- } from '@angular/forms';
10
- import {
11
- Zone,
12
- Plan,
13
- Layer,
14
- ZoneService,
15
- LayerService,
16
- BaseUserService,
17
- NavigationService,
18
- } from '@smarterplan/ngx-smarterplan-core';
19
- @Component({
20
- selector: 'lib-add-zone',
21
- templateUrl: './add-zone.component.html',
22
- styleUrls: ['./add-zone.component.scss'],
23
- })
24
- export class AddZoneComponent implements OnInit {
25
- @Input() zoneEdit: Zone;
26
-
27
- @Input() spaceID: string;
28
-
29
- @Input() images360: { path: string; filename: string }[];
30
-
31
- @Input() navigationIDs: string[];
32
-
33
- @Input() zones: Zone[];
34
-
35
- @Input() newZoneDataFromEditor: any;
36
-
37
- @Output() updatedZone = new EventEmitter<any>();
38
-
39
- @Input() chosenPlan: Plan;
40
-
41
- @Input() isMuseumVisit: boolean = false;
42
-
43
- @Input() defaultZone: Zone;
44
-
45
- parentZones: Zone[] = [];
46
-
47
- carouselIsVisible = false;
48
-
49
- zoneForm: FormGroup;
50
-
51
- isSubmitted = false;
52
-
53
- currentScanShowing: number;
54
-
55
- chosenScans: number[] = [];
56
-
57
- layers: Layer[];
58
-
59
- fromPlan: boolean = false;
60
-
61
- chosenScansOnPlan: string[] = [];
62
-
63
- currentOrgId: string;
64
-
65
- zoneInitialNavCount = 0;
66
-
67
- zoneIsMatterportFloor = false;
68
-
69
- multipleFloors = false;
70
-
71
- constructor(
72
- private fb: FormBuilder,
73
- private zoneService: ZoneService,
74
- private layerService: LayerService,
75
- private userService: BaseUserService,
76
- private navigationService: NavigationService
77
- ) {}
78
-
79
- async ngOnInit() {
80
- this.parentZones = this.zones.filter(
81
- (zone) => zone.layer && zone.layer.name === 'FLOOR'
82
- );
83
- if (!this.defaultZone) {
84
- this.defaultZone = this.getDefaultZone();
85
- }
86
- this.parentZones.unshift(this.defaultZone);
87
- await this.updateLayers();
88
- this.initZoneForm();
89
- }
90
-
91
- async updateLayers() {
92
- this.currentOrgId = this.userService.currentOrganisation(this.spaceID).id;
93
- const layers = await this.layerService.getLayerForOrganisation(
94
- this.currentOrgId
95
- );
96
- // filter out layers created by the system
97
- this.layers = layers.filter(
98
- (l) => l.name !== 'BUILDING' && l.name !== 'FLOOR'
99
- );
100
- }
101
-
102
- async initZoneForm() {
103
- if (this.zoneEdit) {
104
- if (this.zoneEdit.metadata) {
105
- const metadata = JSON.parse(this.zoneEdit.metadata);
106
- this.zoneIsMatterportFloor = metadata.hasOwnProperty(
107
- 'matterportFloorSequence'
108
- );
109
- }
110
- const isVirtual = this.zoneService.zoneIsVirtual(this.zoneEdit);
111
- if (!isVirtual) {
112
- await this.loadNavigations();
113
- }
114
- this.isMuseumVisit = this.zoneEdit.isMuseumVisitZone === true;
115
- this.multipleFloors = this.zoneEdit.isMultipleFloorZone === true;
116
- this.zoneForm = this.fb.group({
117
- id: this.zoneEdit.id,
118
- name: [this.zoneEdit.name, [Validators.required]],
119
- code_ref: this.zoneEdit.code_ref ? this.zoneEdit.code_ref : null,
120
- layerID: this.zoneEdit.layer ? this.zoneEdit.layer.id : null,
121
- surface: this.zoneEdit.surface ? this.zoneEdit.surface : 0,
122
- parentID: this.zoneEdit.parentID,
123
- parent: { value: this.zoneEdit.parent.name, disabled: true },
124
- newLayer: [null, [this.layerNameValidator()]],
125
- isMuseumVisitZone: this.isMuseumVisit,
126
- startSweepID: this.zoneEdit.startSweepID,
127
- });
128
- this.onChangeMultipleFloors();
129
- } else {
130
- this.zoneForm = this.fb.group({
131
- name: [
132
- this.newZoneDataFromEditor ? this.newZoneDataFromEditor.name : '',
133
- [Validators.required],
134
- ],
135
- code_ref: null,
136
- layerID: null,
137
- surface: 0,
138
- parentID: this.defaultZone.id,
139
- newLayer: [null, [this.layerNameValidator()]],
140
- isMuseumVisitZone: this.isMuseumVisit,
141
- startSweepID: null,
142
- });
143
- }
144
- }
145
-
146
- async onSubmitZone() {
147
- this.isSubmitted = true;
148
- if (!this.zoneForm.valid) {
149
- return;
150
- }
151
- const formValue = this.zoneForm.getRawValue(); //because we need values of disables controls as well
152
- if (formValue.newLayer) {
153
- await this.createLayer(formValue.newLayer).then((layer) => {
154
- formValue.layerID = layer.id;
155
- });
156
- }
157
-
158
- const zoneInput = {
159
- name: formValue.name,
160
- surface: Math.round(formValue.surface * 100) / 100,
161
- spaceID: this.spaceID,
162
- layerID: formValue.layerID,
163
- parentID: formValue.parentID,
164
- isMuseumVisitZone: this.isMuseumVisit,
165
- isMultipleFloorZone: this.multipleFloors,
166
- sweepIDs: [],
167
- startSweepID: formValue.startSweepID,
168
- } as Zone;
169
-
170
- if (formValue.code_ref) {
171
- zoneInput.code_ref = formValue.code_ref;
172
- }
173
-
174
- try {
175
- this.zoneForm = null;
176
- this.isSubmitted = false;
177
- if (this.zoneEdit) {
178
- const zoneUpdate = zoneInput;
179
- zoneUpdate.sweepIDs = this.zoneEdit.sweepIDs;
180
- zoneUpdate.id = formValue.id;
181
- await this.setSweepsAndNodeForZoneInput(zoneUpdate);
182
- await this.zoneService.updateZone(zoneUpdate);
183
- this.zoneEdit = null;
184
- this.updatedZone.emit(zoneUpdate.id);
185
- } else {
186
- await this.setSweepsAndNodeForZoneInput(zoneInput);
187
- if (!zoneInput.parentID) {
188
- // set building as parent
189
- zoneInput.parentID = this.defaultZone.id;
190
- }
191
- await this.zoneService.create(zoneInput).then((zoneCreated) => {
192
- this.updatedZone.emit(zoneCreated.id);
193
- });
194
- }
195
- } catch (error) {
196
- console.error(error);
197
- }
198
- }
199
-
200
- onCancel() {
201
- this.isSubmitted = false;
202
- this.zoneForm = null;
203
- this.chosenScansOnPlan = [];
204
- this.chosenScans = [];
205
- this.updatedZone.emit(false);
206
- }
207
-
208
- get name(): AbstractControl {
209
- return this.zoneForm.get('name');
210
- }
211
-
212
- get newLayer(): AbstractControl {
213
- return this.zoneForm.get('newLayer');
214
- }
215
-
216
- toggleCarousel() {
217
- this.carouselIsVisible = true;
218
- this.chosenScansOnPlan = [];
219
- }
220
-
221
- togglePlan() {
222
- this.fromPlan = true;
223
- this.chosenScans = [];
224
- }
225
-
226
- onAddScan() {
227
- if (!this.chosenScans.includes(this.currentScanShowing)) {
228
- // console.log("adding scan", this.currentScanShowing);
229
- this.chosenScans.push(this.currentScanShowing);
230
- } else {
231
- alert('Scan already added!');
232
- }
233
- }
234
-
235
- onRemoveScanImage(scan: any) {
236
- const index = this.chosenScans.indexOf(scan);
237
- this.chosenScans.splice(index, 1);
238
- }
239
-
240
- onRemoveScanPlan(scan: any) {
241
- const index = this.chosenScansOnPlan.indexOf(scan);
242
- this.chosenScansOnPlan.splice(index, 1);
243
- }
244
-
245
- async setSweepsAndNodeForZoneInput(zoneInput: Zone) {
246
- if (
247
- this.chosenScans.length > 0 &&
248
- this.chosenScans.length !== this.zoneInitialNavCount &&
249
- !this.fromPlan
250
- ) {
251
- // if we chose scans from the carousel
252
- const sweepIDs: string[] = [];
253
- this.chosenScans.map(async (scan) => {
254
- const imageUuid = this.images360[scan].filename.split('_')[0];
255
- const sweepID = this.navigationIDs.find((nav) => {
256
- return nav.includes(imageUuid);
257
- });
258
- if (sweepID) {
259
- sweepIDs.push(sweepID);
260
- }
261
- });
262
- zoneInput.sweepIDs = sweepIDs;
263
- } else {
264
- // we are not coming from gallery choice
265
- if (this.chosenScansOnPlan.length > 0) {
266
- zoneInput.sweepIDs = this.chosenScansOnPlan;
267
- }
268
- }
269
-
270
- if (zoneInput.sweepIDs && zoneInput.sweepIDs.length > 0) {
271
- const navForSweep =
272
- await this.navigationService.getNavigationsForMatterportIDForSpace(
273
- zoneInput.sweepIDs[0],
274
- this.spaceID
275
- );
276
- zoneInput.nodeIDs = [navForSweep[0].nodeID];
277
- }
278
- }
279
-
280
- async createLayer(name: string): Promise<Layer> {
281
- return this.layerService.createLayerForOrganisation(
282
- name,
283
- this.currentOrgId
284
- );
285
- }
286
-
287
- async loadNavigations(): Promise<any> {
288
- if (this.zoneEdit.sweepIDs.length > 0) {
289
- this.zoneInitialNavCount = this.zoneEdit.sweepIDs.length;
290
- const navList: number[] = [];
291
- const scansZoneEdit: string[] = [];
292
- await Promise.all(
293
- this.zoneEdit.sweepIDs.map(async (sweepID: string) => {
294
- scansZoneEdit.push(sweepID);
295
- const index = this.images360.findIndex((im) => {
296
- return im.filename.includes(sweepID.slice(0, 8));
297
- });
298
- if (index !== -1) {
299
- navList.push(index);
300
- }
301
- })
302
- );
303
- this.chosenScans = navList;
304
- this.chosenScansOnPlan = scansZoneEdit;
305
- return Promise.resolve();
306
- }
307
- return Promise.resolve();
308
- }
309
-
310
- // iniPlanForDraw() {
311
- // this.togglePlan();
312
- // setTimeout(() => {
313
- // this.onPlanClick();
314
- // }, 500);
315
- // }
316
-
317
- /**
318
- * Adds all sweeps of the space
319
- */
320
- onAddAll() {
321
- const defaultZone = this.getDefaultZone();
322
- if (defaultZone) {
323
- this.chosenScansOnPlan = defaultZone.sweepIDs;
324
- this.zoneForm.get('parentID').setValue(defaultZone.id);
325
- this.zoneForm.get('parentID').disable();
326
- this.multipleFloors = true;
327
- }
328
- }
329
-
330
- getDefaultZone(): Zone {
331
- return this.zones.find(
332
- (zone) =>
333
- zone.layer &&
334
- zone.layer.name === 'BUILDING' &&
335
- zone.sweepIDs &&
336
- zone.sweepIDs.length > 0
337
- );
338
- }
339
- /**
340
- * Multiple floors
341
- */
342
- onChangeMultipleFloors() {
343
- if (this.multipleFloors) {
344
- const defaultZone = this.getDefaultZone();
345
- if (defaultZone) {
346
- this.zoneForm.get('parentID').setValue(defaultZone.id);
347
- this.zoneForm.get('parentID').disable();
348
- }
349
- } else {
350
- this.zoneForm.get('parentID').enable();
351
- }
352
- }
353
-
354
- onSelectedSweepsFromPlan(result: { sweeps: string[]; startSweepID: string }) {
355
- if (result) {
356
- if (result.sweeps) {
357
- this.chosenScansOnPlan = result.sweeps;
358
- }
359
- if (result.startSweepID) {
360
- this.zoneForm.controls.startSweepID.setValue(result.startSweepID);
361
- }
362
- }
363
- this.fromPlan = false;
364
- }
365
-
366
- layerNameValidator(): ValidatorFn {
367
- return (control: AbstractControl): ValidationErrors | null => {
368
- if (!control.value) {
369
- return null;
370
- }
371
- const forbidden = this.layers
372
- .map((l) => l.name.toLowerCase())
373
- .includes(control.value.toLowerCase());
374
- return forbidden ? { forbiddenName: { value: control.value } } : null;
375
- };
376
- }
377
- }
@@ -1,3 +0,0 @@
1
- <ng-content></ng-content>
2
-
3
- <div id="selection"></div>
@@ -1,16 +0,0 @@
1
- #selection{
2
- will-change: top, left, width, height;
3
- top: 0px;
4
- left: 0px;
5
- position: fixed;
6
- display: block;
7
- margin-top: 0px;
8
- margin-left: 0px;
9
- width: 0px;
10
- height: 0px;
11
-
12
- background: rgb(83 182 187 / 0.3);
13
- border-radius: 0.15em;
14
- border: 0.15em solid rgb(83 182 187 / 0.8);
15
- pointer-events: none;
16
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { SelectionComponent } from './selection.component';
4
-
5
- describe('SelectionComponent', () => {
6
- let component: SelectionComponent;
7
- let fixture: ComponentFixture<SelectionComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ SelectionComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(SelectionComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,95 +0,0 @@
1
- import { Component, EventEmitter, OnInit, Output } from '@angular/core';
2
- import { Rectangle } from '../../../../helper.service';
3
-
4
- @Component({
5
- selector: 'lib-selection',
6
- templateUrl: './selection.component.html',
7
- styleUrls: ['./selection.component.scss']
8
- })
9
- export class SelectionComponent implements OnInit {
10
- constructor(){}
11
-
12
- /**Emit a new selection */
13
- @Output() onSelectionChanged = new EventEmitter<Rectangle>();
14
-
15
- /**Zone wich you can use a selection inside, must have the class ".selectZone" */
16
- selectionableZone : HTMLElement;
17
-
18
- /**HtmlElement use to display the selected zone (blue) */
19
- selectionElement : HTMLElement;
20
-
21
- isMousedown : boolean = false;
22
-
23
- selection = {startX: 0, startY: 0, endX: 0, endY: 0};
24
-
25
- selectionRectangle : Rectangle = {top : 0, left: 0, width: 0, height: 0};
26
-
27
- ngOnInit(): void {
28
- this.selectionableZone = document.querySelector(".selectZone");
29
-
30
- this.selectionElement = document.querySelector("#selection");
31
-
32
- this.selectionableZone.addEventListener("mousedown",this.mousedown.bind(this));
33
-
34
- this.selectionableZone.addEventListener("mousemove",this.mousemove.bind(this));
35
-
36
- this.selectionableZone.addEventListener("mouseup",this.mouseup.bind(this));
37
- }
38
-
39
- /**
40
- * Update the current selection
41
- * Will update the selectionRectangle and Selection HTML element
42
- * @param shouldEmit if true an event will be emitted through onSelectionChanged (true by default)
43
- */
44
- updateSelectionElement(shouldEmit=true){
45
- this.selectionRectangle.width = Math.abs(this.selection.endX - this.selection.startX);
46
- this.selectionRectangle.height = Math.abs(this.selection.endY - this.selection.startY);
47
- this.selectionRectangle.top = Math.min(this.selection.endY, this.selection.startY);
48
- this.selectionRectangle.left = Math.min(this.selection.endX, this.selection.startX);
49
-
50
- this.selectionElement.style.top = `${this.selectionRectangle.top}px`;
51
- this.selectionElement.style.left = `${this.selectionRectangle.left}px`;
52
- this.selectionElement.style.width = `${this.selectionRectangle.width}px`;
53
- this.selectionElement.style.height = `${this.selectionRectangle.height}px`;
54
-
55
- if(shouldEmit){
56
- this.onSelectionChanged.emit(this.selectionRectangle);
57
- }
58
- }
59
-
60
- /**
61
- * Trigger when mouse is press down on selectionableZone
62
- * @param event
63
- */
64
- mousedown(event : MouseEvent){
65
- if(event.button !== 2){ /**Selection with the right click, so ignore all other event */
66
- return;
67
- }
68
- this.isMousedown = true;
69
- this.selection = {startY : event.clientY, startX : event.clientX, endX:event.clientX, endY:event.clientY};
70
- this.updateSelectionElement();
71
- }
72
-
73
- /**
74
- * Trigger when mouse is release on selectionableZone
75
- * @param event
76
- */
77
- mouseup(event : MouseEvent){
78
- this.isMousedown = false;
79
- this.selection = {startX :0, startY : 0, endX:0, endY:0};
80
- this.updateSelectionElement(false);
81
- }
82
-
83
- /**
84
- * Trigger when mouse is moving on selectionableZone
85
- * @param event
86
- */
87
- mousemove(event : MouseEvent){
88
- if(this.isMousedown){
89
- this.selection.endX = event.clientX;
90
- this.selection.endY = event.clientY;
91
- this.updateSelectionElement();
92
- }
93
- }
94
-
95
- }
@@ -1,73 +0,0 @@
1
- <div ngbDropdown class="sp-row d-inline-block">
2
- <div class="col-sm-3" *ngIf="plans">
3
- <button type="button" class="btn btn-label-file rounded-pill" id="dropdownBasic1"
4
- ngbDropdownToggle>{{chosenPlan ?
5
- chosenPlan.name : ('Choose Plan' | translate) }}</button>
6
- <div ngbDropdownMenu aria-labelledby="dropdownBasic1">
7
- <button type="button" ngbDropdownItem *ngFor="let plan of plans" (click)="onPlanClick(plan)"
8
- [disabled]="!plan.calibration">{{ plan.name }}
9
- </button>
10
- </div>
11
- </div>
12
- </div>
13
- <div class="sp-row">
14
- <lib-selection class="col-md-8" (onSelectionChanged)="onSelectionChanged($event)">
15
- <lib-plan-legend [isAudioZone]="editingAudioZone" *ngIf="buttonElements.length > 0"></lib-plan-legend>
16
- <div class="selectZone" oncontextmenu="return false;">
17
- <div class="sp-row">
18
- <div style="overflow: hidden;width:100%;">
19
- <div style="height: 400px; width: 100%;" id="planDiv">
20
- </div>
21
- </div>
22
- </div>
23
- </div>
24
- </lib-selection>
25
-
26
- <div class="col-md-4 scanTool" *ngIf="buttonElements.length > 0">
27
- <div class="sp-row d-inline-block">
28
- <h2>{{'selectTool.title' | translate}}</h2>
29
- <div class="protip">{{'selectTool.tip' | translate}}.</div>
30
- </div>
31
-
32
- <div class="sp-row">
33
- <div class="col-3" style="padding:0px">
34
- <label class="tool-label" for="scanSize">{{'selectTool.size' | translate}}</label>
35
- </div>
36
- <div class="col-9">
37
- <input type="range" class="form-range" min="0.001" max="5" step="0.01" value="1"
38
- id="scanSize" (input)="onChangeScanSize($event)">
39
- </div>
40
- </div>
41
-
42
- <div class="sp-row">
43
- <button class="btn btn-primary rounded-pill" (click)="onSelectAll()">{{'selectTool.selectAll' | translate}}</button>
44
- </div>
45
-
46
- <div *ngIf="buttonsInSelection.length > 0" class="edit-selected">
47
- <span class="tool-label">{{'selectTool.edit' | translate}} : </span>
48
- <div class="sp-row">
49
- <button class="btn rounded-pill btn-primary ms-3 me-2" (click)="onSelectionAdd()">{{'selectTool.add' | translate}}</button>
50
- <button class="btn btn-primary rounded-pill" (click)="onSelectionRemove()">{{'selectTool.undo' | translate}}</button>
51
- </div>
52
- </div>
53
-
54
- <div class="sp-row">
55
- <div *ngIf="multipleFloors">
56
- {{ chosenSweepsPerFloor.get(chosenPlan.zoneID) ? chosenSweepsPerFloor.get(chosenPlan.zoneID).length : "0"}} {{'scan points selected on this floor' | translate}}
57
- <button class="btn btn-primary rounded-pill" (click)="onValidateForFloor()" [disabled]="!selectionChanged">{{'Update selection for this floor' | translate}}</button>
58
- </div>
59
- <div *ngIf="!multipleFloors">
60
- {{ chosenScansOnPlan.length }} {{'scan points chosen' | translate}}
61
- </div>
62
- </div>
63
- <div *ngIf="!editingAudioZone" class="sp-row">
64
- <lib-radio-button label="{{ 'selectTool.chooseStartPoint' | translate }}" (isCheckedEvent)="isSettingStartSweep=!isSettingStartSweep"></lib-radio-button>
65
- </div>
66
- <div class="sp-row">
67
- <button class="btn btn-primary rounded-pill" (click)="onSaveSelection()">{{'selectTool.saveSelection' | translate}}</button>
68
- <button class="btn btn-outline-primary rounded-pill" (click)="onCancel()">{{'selectTool.cancelSelection' | translate}}</button>
69
- </div>
70
- </div>
71
-
72
- </div>
73
-
@@ -1,23 +0,0 @@
1
- .sp-row{
2
- display: flex;
3
- margin-bottom: 1rem;
4
- }
5
- .selectZone {
6
- border-radius: 6px;
7
- overflow: hidden;
8
- background-color: var(--smarterplan-secondary);
9
- }
10
-
11
- .scanTool {
12
- margin: 0px 1rem;
13
- }
14
-
15
- .protip {
16
- color: gray;
17
- padding: 0px;
18
- }
19
-
20
-
21
- .tool-label {
22
- font-size: 1rem;
23
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { SweepPlanSelectionComponent } from './sweep-plan-selection.component';
4
-
5
- describe('SweepPlanSelectionComponent', () => {
6
- let component: SweepPlanSelectionComponent;
7
- let fixture: ComponentFixture<SweepPlanSelectionComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ SweepPlanSelectionComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(SweepPlanSelectionComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });