Skip to content

Commit

Permalink
Tile outline visualization fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
josephbirkner committed Nov 5, 2024
1 parent a243647 commit dfc450f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion erdblick_app/app/rightclickmenu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class RightClickMenuService {
lastInspectedTileSourceDataOption: BehaviorSubject<{tileId: number, mapId: string, layerId: string} | null> =
new BehaviorSubject<{tileId: number, mapId: string, layerId: string} | null>(null);
tileIdsForSourceData: Subject<SourceDataDropdownOption[]> = new Subject<SourceDataDropdownOption[]>();
tileOutiline: Subject<object | null> = new Subject<object | null>();
tileOutline: Subject<object | null> = new Subject<object | null>();
customTileAndMapId: Subject<[string, string]> = new Subject<[string, string]>();

constructor(private inspectionService: InspectionService) {
Expand Down
15 changes: 8 additions & 7 deletions erdblick_app/app/sourcedataselection.dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class SourceDataLayerSelectionDialogComponent {
this.mapIds = [];
this.sourceDataLayers = [];
this.loading = false;
this.menuService.tileOutiline.next(null);
this.menuService.tileOutline.next(null);

// Special case: There is a custom tile ID.
if (customTileId) {
Expand All @@ -126,7 +126,7 @@ export class SourceDataLayerSelectionDialogComponent {

// Pre-select the tile ID.
let tileIdSelection = this.tileIds.find(element =>
!element.disabled && [...this.mapService.tileLayersForTileId(element.id as bigint)]
!element.disabled && [...this.mapService.tileLayersForTileId(element.id as bigint)].length
);
if (tileIdSelection) {
this.setCurrentTileId(tileIdSelection);
Expand Down Expand Up @@ -204,19 +204,19 @@ export class SourceDataLayerSelectionDialogComponent {
}

outlineTheTileBox(tileId: bigint, color: Color) {
this.menuService.tileOutiline.next(null);
this.menuService.tileOutline.next(null);
const tileBox = coreLib.getTileBox(tileId);
const entity = {
rectangle: {
coordinates: Rectangle.fromDegrees(...tileBox),
height: HeightReference.CLAMP_TO_GROUND,
material: Color.TRANSPARENT,
outlineWidth: 2,
material: color.withAlpha(0.2),
outline: true,
outlineColor: color.withAlpha(0.5)
outlineWidth: 3.,
outlineColor: color
}
}
this.menuService.tileOutiline.next(entity);
this.menuService.tileOutline.next(entity);
}

findLayersForMapId(mapId: string) {
Expand Down Expand Up @@ -285,6 +285,7 @@ export class SourceDataLayerSelectionDialogComponent {
this.sourceDataLayers = [];
this.showCustomTileIdInput = false;
this.customTileId = "";
this.menuService.tileOutline.next(null);
}

close() {
Expand Down
14 changes: 11 additions & 3 deletions erdblick_app/app/view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare let window: DebugWindow;
selector: 'erdblick-view',
template: `
<div #viewer id="mapViewContainer" class="mapviewer-renderlayer" style="z-index: 0"></div>
<p-contextMenu [target]="viewer" [model]="menuItems" />
<p-contextMenu [target]="viewer" [model]="menuItems" (onHide)="onContextMenuHide()" />
<sourcedatadialog></sourcedatadialog>
`,
styles: [`
Expand Down Expand Up @@ -178,7 +178,7 @@ export class ErdblickViewComponent implements AfterViewInit {
}
if (!defined(feature)) {
this.inspectionService.isInspectionPanelVisible = false;
this.menuService.tileOutiline.next(null);
this.menuService.tileOutline.next(null);
}
this.mapService.highlightFeatures(
Array.isArray(feature?.id) ? feature.id : [feature?.id],
Expand Down Expand Up @@ -312,11 +312,13 @@ export class ErdblickViewComponent implements AfterViewInit {
spinner.style.display = 'none';
}

this.menuService.tileOutiline.subscribe(entity => {
this.menuService.tileOutline.subscribe(entity => {
if (entity) {
this.tileOutlineEntity = this.viewer.entities.add(entity);
this.viewer.scene.requestRender();
} else if (this.tileOutlineEntity) {
this.viewer.entities.remove(this.tileOutlineEntity);
this.viewer.scene.requestRender();
}
});
}
Expand Down Expand Up @@ -481,4 +483,10 @@ export class ErdblickViewComponent implements AfterViewInit {
roll: 0.0
});
}

onContextMenuHide() {
if (!this.menuService.tileSourceDataDialogVisible) {
this.menuService.tileOutline.next(null)
}
}
}

0 comments on commit dfc450f

Please sign in to comment.