|
|
|
|
@@ -1,80 +1,80 @@
|
|
|
|
|
<mat-card class="algo-container">
|
|
|
|
|
<mat-card-header>
|
|
|
|
|
<mat-card-title>{{ 'PATHFINDING.TITLE' | translate }}</mat-card-title>
|
|
|
|
|
</mat-card-header>
|
|
|
|
|
<mat-card-content>
|
|
|
|
|
<app-information [algorithmInformation]="algoInformation"/>
|
|
|
|
|
<mat-card class="algo-container">
|
|
|
|
|
<mat-card-header>
|
|
|
|
|
<mat-card-title>{{ 'PATHFINDING.TITLE' | translate }}</mat-card-title>
|
|
|
|
|
</mat-card-header>
|
|
|
|
|
<mat-card-content>
|
|
|
|
|
<app-information [algorithmInformation]="algoInformation"/>
|
|
|
|
|
|
|
|
|
|
<div class="controls-container">
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<button matButton="filled" (click)="visualize('dijkstra')">{{ 'PATHFINDING.DIJKSTRA' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="visualize('astar')">{{ 'PATHFINDING.ASTAR' | translate }}</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: true, scenario: 'normal'})">{{ 'PATHFINDING.NORMAL_CASE' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: true, scenario: 'random'})">{{ 'PATHFINDING.RANDOM_CASE' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: true, scenario: 'edge'})">{{ 'PATHFINDING.EDGE_CASE' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: false, scenario: 'normal'})">{{ 'PATHFINDING.CLEAR_BOARD' | translate }}</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls-container">
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<button matButton="filled" (click)="visualize('dijkstra')">{{ 'PATHFINDING.DIJKSTRA' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="visualize('astar')">{{ 'PATHFINDING.ASTAR' | translate }}</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: true, scenario: 'normal'})">{{ 'PATHFINDING.NORMAL_CASE' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: true, scenario: 'random'})">{{ 'PATHFINDING.RANDOM_CASE' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: true, scenario: 'edge'})">{{ 'PATHFINDING.EDGE_CASE' | translate }}</button>
|
|
|
|
|
<button matButton="filled" (click)="createCase({withWalls: false, scenario: 'normal'})">{{ 'PATHFINDING.CLEAR_BOARD' | translate }}</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<mat-button-toggle-group [(ngModel)]="selectedNodeType" aria-label="Node Type Selection">
|
|
|
|
|
<mat-button-toggle [value]="NodeType.Start">{{ 'PATHFINDING.START_NODE' | translate }}</mat-button-toggle>
|
|
|
|
|
<mat-button-toggle [value]="NodeType.End">{{ 'PATHFINDING.END_NODE' | translate }}</mat-button-toggle>
|
|
|
|
|
<mat-button-toggle [value]="NodeType.Wall">{{ 'PATHFINDING.WALL' | translate }}</mat-button-toggle>
|
|
|
|
|
<mat-button-toggle [value]="NodeType.None">{{ 'PATHFINDING.CLEAR_NODE' | translate }}</mat-button-toggle>
|
|
|
|
|
</mat-button-toggle-group>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<div class="input-container">
|
|
|
|
|
<mat-form-field appearance="outline" class="input-field">
|
|
|
|
|
<mat-label>{{ 'ALGORITHM.GRID_HEIGHT' | translate }}</mat-label>
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="number"
|
|
|
|
|
[min]="MIN_GRID_SIZE"
|
|
|
|
|
[max]="MAX_GRID_SIZE"
|
|
|
|
|
[(ngModel)]="gridRows"
|
|
|
|
|
(ngModelChange)="genericGridComponent.gridRows = gridRows; genericGridComponent.applyGridSize()"
|
|
|
|
|
/> </mat-form-field>
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<mat-button-toggle-group [(ngModel)]="selectedNodeType" aria-label="Node Type Selection">
|
|
|
|
|
<mat-button-toggle [value]="NodeType.Start">{{ 'PATHFINDING.START_NODE' | translate }}</mat-button-toggle>
|
|
|
|
|
<mat-button-toggle [value]="NodeType.End">{{ 'PATHFINDING.END_NODE' | translate }}</mat-button-toggle>
|
|
|
|
|
<mat-button-toggle [value]="NodeType.Wall">{{ 'PATHFINDING.WALL' | translate }}</mat-button-toggle>
|
|
|
|
|
<mat-button-toggle [value]="NodeType.None">{{ 'PATHFINDING.CLEAR_NODE' | translate }}</mat-button-toggle>
|
|
|
|
|
</mat-button-toggle-group>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<div class="input-container">
|
|
|
|
|
<mat-form-field appearance="outline" class="input-field">
|
|
|
|
|
<mat-label>{{ 'ALGORITHM.GRID_HEIGHT' | translate }}</mat-label>
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="number"
|
|
|
|
|
[min]="MIN_GRID_SIZE"
|
|
|
|
|
[max]="MAX_GRID_SIZE"
|
|
|
|
|
[(ngModel)]="gridRows"
|
|
|
|
|
(ngModelChange)="genericGridComponent.gridRows = gridRows; genericGridComponent.applyGridSize()"
|
|
|
|
|
/> </mat-form-field>
|
|
|
|
|
|
|
|
|
|
<mat-form-field appearance="outline" class="input-field">
|
|
|
|
|
<mat-label>{{ 'ALGORITHM.GRID_WIDTH' | translate }}</mat-label>
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="number"
|
|
|
|
|
[min]="MIN_GRID_SIZE"
|
|
|
|
|
[max]="MAX_GRID_SIZE"
|
|
|
|
|
[(ngModel)]="gridCols"
|
|
|
|
|
(ngModelChange)="genericGridComponent.gridCols = gridCols; genericGridComponent.applyGridSize()"
|
|
|
|
|
/> </mat-form-field>
|
|
|
|
|
<mat-form-field appearance="outline" class="input-field">
|
|
|
|
|
<mat-label>{{ 'ALGORITHM.GRID_WIDTH' | translate }}</mat-label>
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="number"
|
|
|
|
|
[min]="MIN_GRID_SIZE"
|
|
|
|
|
[max]="MAX_GRID_SIZE"
|
|
|
|
|
[(ngModel)]="gridCols"
|
|
|
|
|
(ngModelChange)="genericGridComponent.gridCols = gridCols; genericGridComponent.applyGridSize()"
|
|
|
|
|
/> </mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="legend">
|
|
|
|
|
<span><span class="legend-color start"></span> {{ 'PATHFINDING.START_NODE' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color end"></span> {{ 'PATHFINDING.END_NODE' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color wall"></span> {{ 'PATHFINDING.WALL' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color visited"></span> {{ 'PATHFINDING.VISITED' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color path"></span> {{ 'PATHFINDING.PATH' | translate }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<p>{{ 'PATHFINDING.PATH_LENGTH' | translate }}: {{ pathLength }}</p>
|
|
|
|
|
<p>{{ 'PATHFINDING.EXECUTION_TIME' | translate }}: {{ executionTime | number:'1.2-2' }} ms</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="legend">
|
|
|
|
|
<span><span class="legend-color start"></span> {{ 'PATHFINDING.START_NODE' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color end"></span> {{ 'PATHFINDING.END_NODE' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color wall"></span> {{ 'PATHFINDING.WALL' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color visited"></span> {{ 'PATHFINDING.VISITED' | translate }}</span>
|
|
|
|
|
<span><span class="legend-color path"></span> {{ 'PATHFINDING.PATH' | translate }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls-panel">
|
|
|
|
|
<p>{{ 'PATHFINDING.PATH_LENGTH' | translate }}: {{ pathLength }}</p>
|
|
|
|
|
<p>{{ 'PATHFINDING.EXECUTION_TIME' | translate }}: {{ executionTime | number:'1.2-2' }} ms</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<app-generic-grid
|
|
|
|
|
[gridRows]="gridRows"
|
|
|
|
|
[gridCols]="gridCols"
|
|
|
|
|
[minGridSize]="MIN_GRID_SIZE"
|
|
|
|
|
[maxGridSize]="MAX_GRID_SIZE"
|
|
|
|
|
[maxGridPx]="MAX_GRID_PX"
|
|
|
|
|
[createNodeFn]="createPathfindingNode"
|
|
|
|
|
[getNodeColorFn]="getPathfindingNodeColor"
|
|
|
|
|
[applySelectionFn]="applyPathfindingSelection"
|
|
|
|
|
[backgroundColor]="'lightgray'"
|
|
|
|
|
(gridChange)="grid = $event"
|
|
|
|
|
></app-generic-grid>
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</mat-card>
|
|
|
|
|
<app-generic-grid
|
|
|
|
|
[gridRows]="gridRows"
|
|
|
|
|
[gridCols]="gridCols"
|
|
|
|
|
[minGridSize]="MIN_GRID_SIZE"
|
|
|
|
|
[maxGridSize]="MAX_GRID_SIZE"
|
|
|
|
|
[maxGridPx]="MAX_GRID_PX"
|
|
|
|
|
[createNodeFn]="createPathfindingNode"
|
|
|
|
|
[getNodeColorFn]="getPathfindingNodeColor"
|
|
|
|
|
[applySelectionFn]="applyPathfindingSelection"
|
|
|
|
|
[backgroundColor]="'lightgray'"
|
|
|
|
|
(gridChange)="grid = $event"
|
|
|
|
|
></app-generic-grid>
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</mat-card>
|
|
|
|
|
|