@regionerne/gis-komponent 0.0.112 → 0.0.114

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.
@@ -3196,6 +3196,11 @@ class ToolboxComponent {
3196
3196
  selectedDocumentSearchMode = 'document-search-by-point';
3197
3197
  activateShowInputWKT() {
3198
3198
  this._clearAllInteractions();
3199
+ if (this.activeMode === 'wkt-input') {
3200
+ this.activeMode = null;
3201
+ this.showInputWKT = false;
3202
+ return;
3203
+ }
3199
3204
  this.showInputWKT = true;
3200
3205
  this.activeMode = 'wkt-input';
3201
3206
  this._active = 'No';
@@ -3744,6 +3749,10 @@ class ToolboxComponent {
3744
3749
  _actionSource = new VectorSource();
3745
3750
  clipHole() {
3746
3751
  this._clearAllInteractions();
3752
+ if (this.activeMode === 'clip-hole') {
3753
+ this.activeMode = null;
3754
+ return;
3755
+ }
3747
3756
  this.activeMode = 'clip-hole';
3748
3757
  const clipHoleDraw = new Draw({
3749
3758
  source: this._actionSource,
@@ -3827,6 +3836,10 @@ class ToolboxComponent {
3827
3836
  }
3828
3837
  split() {
3829
3838
  this._clearAllInteractions();
3839
+ if (this.activeMode === 'split') {
3840
+ this.activeMode = null;
3841
+ return;
3842
+ }
3830
3843
  this.activeMode = 'split';
3831
3844
  const splitInteraction = new Draw({
3832
3845
  type: 'LineString',
@@ -3908,6 +3921,11 @@ class ToolboxComponent {
3908
3921
  return this._deleteSelect;
3909
3922
  }
3910
3923
  startDelete() {
3924
+ if (this.activeMode === 'delete') {
3925
+ this.activeMode = null;
3926
+ this._clearAllInteractions();
3927
+ return;
3928
+ }
3911
3929
  this._clearAllInteractions();
3912
3930
  this.activeMode = 'delete';
3913
3931
  this.map.addInteraction(this.deleteSelect);
@@ -4323,10 +4341,14 @@ class ToolboxComponent {
4323
4341
  // In order to add the distance to each segment of the distance measure feature, we need some extra handling like this.
4324
4342
  this._distanceMeasureDraw.on('drawstart', (evt) => {
4325
4343
  const sketch = evt.feature;
4344
+ this._featureHelper.setId(sketch);
4345
+ console.log("🚀 ~ ToolboxComponent ~ constructor ~ sketch:", sketch);
4326
4346
  sketch.getGeometry().on('change', (geomEvt) => {
4327
4347
  const geom = geomEvt.target;
4328
4348
  const coords = geom.getCoordinates();
4329
- this._distanceLabelSource.clear(); // Clear existing labels for each change
4349
+ // Cleanup the labels for current item for each change.
4350
+ const featuresToRemove = this._distanceLabelSource.getFeatures().filter(f => f.get('_lineFeatureId') == sketch.getId());
4351
+ this._distanceLabelSource.removeFeatures(featuresToRemove);
4330
4352
  let totalLength = 0;
4331
4353
  for (let i = 0; i < coords.length - 1; i++) {
4332
4354
  const c1 = coords[i];
@@ -4340,6 +4362,7 @@ class ToolboxComponent {
4340
4362
  geometry: new Point$1(mid),
4341
4363
  label: formatted
4342
4364
  });
4365
+ labelFeature.set('_lineFeatureId', sketch.getId());
4343
4366
  this._distanceLabelSource.addFeature(labelFeature);
4344
4367
  }
4345
4368
  // Add total length at the last point
@@ -4350,6 +4373,7 @@ class ToolboxComponent {
4350
4373
  geometry: new Point$1(positionPoint),
4351
4374
  label: `Total: ${formattedTotal}`
4352
4375
  });
4376
+ totalFeature.set('_lineFeatureId', sketch.getId());
4353
4377
  this._distanceLabelSource.addFeature(totalFeature);
4354
4378
  }
4355
4379
  });
@@ -4378,7 +4402,7 @@ class ToolboxComponent {
4378
4402
  ngOnInit() {
4379
4403
  this._originalMapHeight = this.map.getSize()[1];
4380
4404
  this._originalMapWidth = this.map.getSize()[0];
4381
- this.bufferInMeters = this.settings.defaultBufferInMeters ?? 0.2;
4405
+ this.bufferInMeters = this.settings.defaultBufferInMeters ?? -0.2;
4382
4406
  this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
4383
4407
  this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this._POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.toolboxHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.toolboxWidth);
4384
4408
  });
@@ -4578,6 +4602,10 @@ class ToolboxComponent {
4578
4602
  }
4579
4603
  startMergeFeatures() {
4580
4604
  this._clearAllInteractions();
4605
+ if (this.activeMode === 'merge-features') {
4606
+ this.activeMode = null;
4607
+ return;
4608
+ }
4581
4609
  this.activeMode = 'merge-features';
4582
4610
  this._mergeService.startMerge(this.selectedDrawItem.typeId, () => { this.activeMode = null; });
4583
4611
  }
@@ -4985,7 +5013,9 @@ class ActiveObjectsComponent {
4985
5013
  feature: f,
4986
5014
  id: f.getId()
4987
5015
  }));
4988
- this.runConflictAnalysis();
5016
+ if (this._current.gisKomponentSettings.containsCheck?.enabled) {
5017
+ this._runConflictAnalysis();
5018
+ }
4989
5019
  }
4990
5020
  });
4991
5021
  this._featuresForHighlight$.subscribe({
@@ -5030,7 +5060,7 @@ class ActiveObjectsComponent {
5030
5060
  endSession() {
5031
5061
  this.sessionDone.emit();
5032
5062
  }
5033
- runConflictAnalysis() {
5063
+ _runConflictAnalysis() {
5034
5064
  const unlockedFeatures = this.activeFeatures.filter(f => !f.locked);
5035
5065
  const conflictSearches$ = unlockedFeatures.map(f => this._conflictService.search(f.feature.getGeometry(), 1));
5036
5066
  combineLatest(conflictSearches$).subscribe({