Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integration with AWS; Add Custom band #110

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion data-cube-manager/src/app/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { BucketsModal } from './pages/create-cube/steps/definition/buckets/bucke
import { MapFieldComponent } from './components/map-field/map-field.component';
import { UpdateCubeDialog } from './components/update-cube-dialog/update-cube-dialog.component';
import { UpdateBandDialogComponent } from './components/update-band-dialog/update-band-dialog.component';
import { CustomBandDialogComponent } from './pages/create-cube/steps/definition/custom-band-dialog/custom-band-dialog.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -105,7 +106,8 @@ import { UpdateBandDialogComponent } from './components/update-band-dialog/updat
UpdateBandDialogComponent,
BucketsModal,
MapFieldComponent,
UpdateBandDialogComponent
UpdateBandDialogComponent,
CustomBandDialogComponent
],
providers: [
AdminGuardService
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div mat-dialog-content>
<p>Type the index band name</p>
<mat-form-field appearance="fill">
<mat-label>Band name</mat-label>
<input matInput [(ngModel)]="data.band">
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onClose()" cdkFocusInitial>Ok</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
selector: 'app-custom-band-dialog',
templateUrl: './custom-band-dialog.component.html',
styleUrls: ['./custom-band-dialog.component.css']
})
export class CustomBandDialogComponent {

constructor(
public dialogRef: MatDialogRef<CustomBandDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
) { }

onClose() {
this.dialogRef.close(this.data.band ? this.data.band.toUpperCase() : this.data.band)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,15 @@ <h3 style="display: flex; align-items: center;">
<mat-form-field appearance="outline">
<mat-label>Indexes</mat-label>
<mat-select multiple formControlName="indexes" (selectionChange)="onChangeBandIndex($event)">
<mat-option *ngFor="let index of indexesAvailable" [value]="index">
{{ index }}
</mat-option>
<div class="band-index-panel">
<mat-option *ngFor="let index of indexesAvailable" [value]="index">
{{ index }}
</mat-option>
</div>

<footer>
<button mat-raised-button (click)="addCustomIndex()">Add custom band</button>
</footer>
</mat-select>
<mat-error>
<form-field-error [errors]="formCreateCube.get('indexes').errors"></form-field-error>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
.mat-form-field {
width: 100% !important;
}

.btn_suffix {
margin-left: 5px;
width: 40px;
Expand All @@ -27,7 +27,7 @@
padding: 0 5px;
}
.content {
display: flex;
display: flex;
justify-content: space-between;
margin-top: -15px;
}
Expand All @@ -43,4 +43,20 @@
padding: 10px 20px;
}
}
}

footer{
border-top:2px solid rgba(0,0,0,0.09);
height: 57px;
padding-top: 10px;
text-align:right;

button {
margin-right: 10px;
}
}

.band-index-panel {
max-height: 200px;
overflow: auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { EstimateCostModal } from './estimate-cost/estimate-cost.component'
import { FormGroup, FormBuilder, Validators } from '@angular/forms'
import { setDefinition } from 'app/admin/admin.action'
import { BucketsModal } from './buckets/buckets.component'
import { CustomBandDialogComponent } from './custom-band-dialog/custom-band-dialog.component'

@Component({
selector: 'app-create-cube-definition',
Expand All @@ -34,7 +35,8 @@ export class CreateCubeDefinitionComponent implements OnInit {

public wellKnownIndexes = {
'NDVI': '10000. * ((NIR_BAND_HERE - RED_BAND_HERE) / (NIR_BAND_HERE + RED_BAND_HERE))',
'EVI': '10000. * 2.5 * (NIR_BAND_HERE - RED_BAND_HERE) / (NIR_BAND_HERE + 6. * RED_BAND_HERE - 7.5 * BLUE_BAND_HERE + 10000)'
'EVI': '10000. * 2.5 * (NIR_BAND_HERE - RED_BAND_HERE) / (NIR_BAND_HERE + 6. * RED_BAND_HERE - 7.5 * BLUE_BAND_HERE + 10000)',
'CUSTOM': 'B1 / B2'
}

public environmentVersion = window['__env'].environmentVersion
Expand Down Expand Up @@ -104,6 +106,10 @@ export class CreateCubeDefinitionComponent implements OnInit {
for(let indexValue of value) {
let expression = this.wellKnownIndexes[indexValue];

if (expression === undefined) {
continue
}

let redBand = '';
let nirBand = '';
let blueBand = '';
Expand Down Expand Up @@ -137,6 +143,23 @@ export class CreateCubeDefinitionComponent implements OnInit {
}
}

addCustomIndex() {
const dialogRef = this.dialog.open(CustomBandDialogComponent, {
width: '250px',
data: {},
});

dialogRef.afterClosed().subscribe(result => {
if (!!result) {
if (!this.indexesAvailable.includes(result)) {
this.indexesAvailable.push(result);
this.wellKnownIndexes[result] = 'B1 / B2'
}
}

});
}

ngOnInit() {
this.definitonCompleted = false
this.getCompositeFunctions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,18 @@ export class CreateCubePreviewComponent implements OnInit {
}

getCubeName(func) {
return func !== 'IDT' ?
`${this.definition.name}_${this.getComplementCubeName(this.definition.temporal)}_${func}` :
`${this.definition.name}_${this.definition.resolution}`
let cubeName = this.definition.name
let complement = '';

if (func !== 'IDT') {
complement = `_${this.getComplementCubeName(this.definition.temporal)}`;

if (this.environmentVersion === 'cloud') {
complement = `-${complement.split('_')[2]}`
}
}

return `${cubeName}${complement}`
}

getComplementCubeName(temporalSchema) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<a [routerLink]="['/details-cube', getCubeFullName(cube)]">
<div class="card card-chart">
<div [ngClass]="['card-header', getCubeClass(cube)]">
<h4 class="card-title text-center">{{ cube.name }}</h4>
<h4 class="card-title text-center">{{ cube.name }}-{{ cube.version }}</h4>
</div>
<div class="card-body">
<p class="card-category text-justify">
Expand Down