using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp.ShpGeo;
using OpenAuth.App.ServiceApp.ShpGeo.Request;
using OpenAuth.App.ServiceApp.ShpGeo.Response;
using OpenAuth.App.Shape.Request;
using OpenAuth.Repository.Domain;
namespace OpenAuth.WebApi.Controllers.ServiceControllers;
[Route("api/[controller]/[action]")]
[ApiController]
public class GeoTiffManagerController : ControllerBase
{
private readonly GeoTiffManagerApp _app;
public GeoTiffManagerController(GeoTiffManagerApp geoTiffManagerApp)
{
_app = geoTiffManagerApp;
}
///
/// 更新tiff影像
///
///
[HttpPost]
public async Task>> UpdateGeoTiff()
{
return await _app.UpdateGeoTiff();
}
///
/// 列表
///
///
///
[HttpGet]
public async Task>>> LoadPage([FromQuery] GeoTiffManagerReq req)
{
return await _app.LoadPage(req);
}
///
/// 影像详情
///
///
///
[HttpGet]
public Response Get(string id)
{
var result = new Response();
try
{
result.Result = _app.Get(id);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
[AllowAnonymous]
[HttpPost]
public Response Test(string storeName, string layerName)
{
var result = _app.Test(storeName, layerName);
return new Response { Result = result };
}
///
/// 返回相交影像信息
///
///
///
[HttpGet]
[AllowAnonymous]
public async Task>>> GetIntersects([FromQuery] GeoTiffManagerReq req)
{
return new Response>>
{
Result = await _app.GetIntersects(req)
};
}
[HttpPost]
[AllowAnonymous]
public async Task> GroupGeoTiff(string type)
{
return await _app.GroupGeoTiff(type);
}
///
/// 删除图层存储,级联删除图层
///
///
///
[HttpPost]
public async Task> DeleteTifStore(string stores)
{
return await _app.DeleteTifStore(stores);
}
///
/// 生成图层组缩略图
///
///
///
///
///
///
///
[HttpPost]
public async Task> UpdateLayerGroupThumb(string layerGroups, string bbox, int num, int height = 768,
int width = 330)
{
return await _app.UpdateLayerGroupThumb(layerGroups, bbox, num, height, width);
}
[HttpGet]
[AllowAnonymous]
public dynamic GetTifCrs(string filePath)
{
return _app.GetTifCrs(filePath);
}
}