Skip to content

Commit

Permalink
Refactor feature iteration to allow jump to feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Waguramu committed Sep 10, 2024
1 parent b5e381b commit 0ff9530
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions erdblick_app/app/inspection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ export class InspectionService {
this.selectedFeatureGeoJsonTexts = [];
this.selectedFeatures = selectedFeatures;

selectedFeatures.forEach(selectedFeature => {
selectedFeature.peek((feature: Feature) => {
// Currently only takes the first element for Jump to Feature functionality.
// TODO: Allow to use the whole set for Jump to Feature.
if (selectedFeatures.length) {
selectedFeatures[0].peek((feature: Feature) => {
this.selectedFeatureInspectionModel.push(...feature.inspectionModel());
this.selectedFeatureGeoJsonTexts.push(feature.geojson() as string);
this.isInspectionPanelVisible = true;
Expand All @@ -106,7 +108,16 @@ export class InspectionService {
this.selectedFeatureBoundingRadius = Cartesian3.distance(this.selectedFeatureOrigin, radiusPoint);
this.selectedFeatureGeometryType = feature.getGeometryType() as any;this.isInspectionPanelVisible = true;
});
});
}
if (selectedFeatures.length > 1) {
selectedFeatures.slice(1).forEach(selectedFeature => {
selectedFeature.peek((feature: Feature) => {
this.selectedFeatureInspectionModel.push(...feature.inspectionModel());
this.selectedFeatureGeoJsonTexts.push(feature.geojson() as string);
this.isInspectionPanelVisible = true;
});
});
}
this.loadFeatureData();

this.parametersService.setSelectedFeatures(this.selectedFeatures.map(f => f.key()));
Expand Down Expand Up @@ -205,7 +216,7 @@ export class InspectionService {
}

zoomToFeature() {
if (!this.selectedFeature) {
if (!this.selectedFeatures) {
this.infoMessageService.showError("Could not zoom to feature: no feature is selected!");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions erdblick_app/app/view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export class ErdblickViewComponent implements AfterViewInit {
if (feature.primitive.id) {
const featureInfo = this.featureSearchService.searchResults[feature.primitive.id.index];
if (featureInfo.mapId && featureInfo.featureId) {
this.jumpService.highlightFeature(featureInfo.mapId, featureInfo.featureId).then(() => {
if (this.inspectionService.selectedFeature) {
this.jumpService.highlightByJumpTargetFilter(featureInfo.mapId, featureInfo.featureId).then(() => {
if (this.inspectionService.selectedFeatures) {
this.inspectionService.zoomToFeature();
}
});
Expand Down

0 comments on commit 0ff9530

Please sign in to comment.