diff --git a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html
index d155aeff..ba25f7d3 100644
--- a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html
+++ b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.html
@@ -218,6 +218,7 @@
Borehole Analytics
{{status.timeStamp}} |
{{status.status}} |
+
|
diff --git a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts
index 80c84c90..bfcea0b6 100644
--- a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts
+++ b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.component.ts
@@ -1,15 +1,11 @@
import { saveAs } from 'file-saver';
import { LayerModel } from '@auscope/portal-core-ui';
import { NVCLBoreholeAnalyticService } from './nvcl.boreholeanalytic.service';
-import {
- Component,
- Input,
- AfterViewInit,
- OnInit,
- ViewChild
-} from '@angular/core';
+import { Component, Input, AfterViewInit, OnInit, ViewChild} from '@angular/core';
+import { UserStateService } from 'app/services/user/user-state.service';
import { LayerAnalyticInterface } from '../layer.analytic.interface';
import { NgForm } from '@angular/forms';
+import { environment } from 'environments/environment';
@Component({
@@ -48,9 +44,7 @@ export class NVCLBoreholeAnalyticComponent
checkprocess: false
};
- constructor(
- public nvclBoreholeAnalyticService: NVCLBoreholeAnalyticService
- ) {
+ constructor( public nvclBoreholeAnalyticService: NVCLBoreholeAnalyticService, private userStateService: UserStateService ) {
this.nvclform = {};
}
@@ -192,13 +186,19 @@ export class NVCLBoreholeAnalyticComponent
// console.log('jobid=' + jobid + ' publishStatus=' + response);
});
}
-
+ public viewOnMap(jobid: string) {
+ const me = this;
+ this.nvclBoreholeAnalyticService.getNVCLGeoJson(jobid).subscribe(results => {
+ const jsonData = results;
+ me.nvclBoreholeAnalyticService.addGeoJsonLayer(jobid,jsonData);
+ });
+ }
public nvclDownload(jobid: string) {
this.nvclBoreholeAnalyticService
.downloadNVCLJobResult(jobid)
.subscribe(response => {
- const blob = new Blob([response], { type: 'application/zip' });
- saveAs(blob, 'nvclAnalytical-jobresult-' + jobid + '.zip');
+ const blob = new Blob([response], { type: 'text/csv' });
+ saveAs(blob, 'nvclAnalytical-jobresult-' + jobid + '.csv');
this.nvclBoreholeAnalyticService.setUserEmail(this.nvclform.email);
});
}
diff --git a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.service.ts b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.service.ts
index f439a326..68cbc649 100644
--- a/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.service.ts
+++ b/src/app/modalwindow/layeranalytic/nvcl/nvcl.boreholeanalytic.service.ts
@@ -2,7 +2,7 @@
import {throwError as observableThrowError, Observable } from 'rxjs';
import {catchError, map} from 'rxjs/operators';
-import { LayerModel } from '@auscope/portal-core-ui';
+import { LayerModel, RenderStatusService } from '@auscope/portal-core-ui';
import { LayerHandlerService } from '@auscope/portal-core-ui';
import { Injectable, Inject } from '@angular/core';
import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
@@ -10,14 +10,54 @@ import { environment } from '../../../../environments/environment';
import {config} from '../../../../environments/config';
import { LOCAL_STORAGE, StorageService } from 'ngx-webstorage-service';
+import { LayerManagerService } from 'app/services/ui/layer-manager.service';
+import { UILayerModelService } from 'app/services/ui/uilayer-model.service';
+import { UILayerModel } from 'app/menupanel/common/model/ui/uilayer.model';
@Injectable()
export class NVCLBoreholeAnalyticService {
- constructor(private http: HttpClient, private layerHandlerService: LayerHandlerService, @Inject(LOCAL_STORAGE) private storage: StorageService) {
+ constructor(private http: HttpClient,
+ private layerHandlerService: LayerHandlerService,
+ private layerManagerService: LayerManagerService,
+ private renderStatusService: RenderStatusService,
+ private uiLayerModelService: UILayerModelService,
+ @Inject(LOCAL_STORAGE) private storage: StorageService) {
}
+ public addGeoJsonLayer(name: string, jsonData: any) {
+ const me = this;
+ const proxyUrl = "";
+ let layerRec: LayerModel= null;
+ // Make a layer model object
+ layerRec = me.layerHandlerService.makeCustomGEOJSONLayerRecord(name, proxyUrl, jsonData);
+ layerRec.group = 'geojson-layer';
+ // Configure layers so it can be added to map
+ const uiLayerModel = new UILayerModel(layerRec.id, 100, me.renderStatusService.getStatusBSubject(layerRec));
+ me.uiLayerModelService.setUILayerModel(layerRec.id, uiLayerModel);
+ me.layerManagerService.addLayer(layerRec, [], null, null);
+ }
+
+ public getNVCLGeoJson(jobId:string): Observable {
+ let httpParams = new HttpParams();
+ httpParams = httpParams.append('jobid', jobId);
+ httpParams = httpParams.append('format', 'json');
+ return this.http.get(environment.nVCLAnalyticalUrl + 'downloadNVCLJobResult.do', {
+ params: httpParams
+ }).pipe(map(response => {
+ if (response) {
+ return JSON.stringify(response);
+ } else {
+ return observableThrowError('error');
+ }
+ }), catchError(
+ (error: HttpResponse) => {
+ return observableThrowError(error);
+ }
+ ), );
+ }
+
public getNVCLAlgorithms(): Observable {
let httpParams = new HttpParams();