import { Http } from "../Http";
import { ExportAsync } from "./ExportAsync";
import { Geometry } from "../models/Geometry";
import { AstHelper } from "@gvol-org/geovis-brain-core";
import { Image } from "../models/Image";
/**
* @class Export.map
* @since Export
*/
export class map extends ExportAsync {
// /**
// * @hideconstructor
// * @returns Export.map
// */
constructor(...param: any[]) {
super();
if (!(this instanceof map)) {
return new map(param);
}
}
/**
* 导出影像为map tile
* @param {Object} args 批处理对象
* @tutorial Export.map
*/
static toDrive(args: {
image: Image;
description?: string;
minZoom?: number;
maxZoom?: number;
scale?: number;
region?: Geometry;
palette?: any;
tileType?: string
}) {
if(args.scale){
Http.scale = args.scale.toString();
}
let newObj = JSON.parse(JSON.stringify(args));
let {newChain, newOrder} = AstHelper.objectParamChain(newObj);
newChain.push({
"functionName": "Export.map.toDrive",
"arguments": {
"args": newObj
},
"order": newOrder
})
let exportObj = new ExportAsync();
exportObj.execute(async () => {
let data = await Http.getRequest(newChain);
Http.responseSubject$.next(data);
if (data && data.data.status == "success") {
exportObj.param = data;
// console.log("subjecttttt", this.exportSubject$);
this.exportSubject$.next(data.data.detail);
} else {
// console.log("应当删除export")
}
});
return exportObj;
}
}