add dynamic loading of point clouds
name and visible changes are also passed to potree
This commit is contained in:
@@ -14,7 +14,7 @@ namespace PointCloudWeb.Server.Controllers
|
||||
|
||||
public PointCloudInfoController(PointCloudService pointCloudService)
|
||||
{
|
||||
this._pointCloudService = pointCloudService;
|
||||
_pointCloudService = pointCloudService;
|
||||
}
|
||||
|
||||
private PointCloudInfoDto ConvertPointCloudToDto(PointCloud pc) => new PointCloudInfoDto(pc.Id, pc.Name);
|
||||
@@ -47,7 +47,8 @@ namespace PointCloudWeb.Server.Controllers
|
||||
return new NotFoundResult();
|
||||
|
||||
_pointCloudService.RemoveById(id);
|
||||
return new OkResult();
|
||||
//Json Result, becaus OkResult throws in Firefox an XML-Root element not found error.
|
||||
return new JsonResult("OK");
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PointCloudWeb.Server
|
||||
static Globals()
|
||||
{
|
||||
var basePath = Directory.GetCurrentDirectory() + "/../..";
|
||||
PotreeDataPath = basePath + "/PointCloudWeb.Web/public/Potree/pointclouds";
|
||||
PotreeDataPath = basePath + "/PointCloudWeb.Web/public/Potree/pointclouds/generated";
|
||||
PotreeConverterExe = basePath + "/PointCloudWeb.Server/Tools/PotreeConverter/PotreeConverter.exe";
|
||||
TempPath = basePath + "/temp";
|
||||
CloudCompareExe = "C:/Program Files/CloudCompare/CloudCompare.exe";
|
||||
|
||||
@@ -21,23 +21,19 @@ namespace PointCloudWeb.Server.Services
|
||||
|
||||
private void GeneratePotreeData(Guid id)
|
||||
{
|
||||
var pathTarget = Globals.PotreeDataPath;
|
||||
var converter = Globals.PotreeConverterExe;
|
||||
|
||||
var pathTarget = Globals.PotreeDataPath + $"/{id.ToString()}";
|
||||
var tempFile = Globals.TempPath + $"/{id}.las";
|
||||
|
||||
Directory.CreateDirectory(Globals.TempPath);
|
||||
|
||||
|
||||
var pc = _pointClouds.GetById(id);
|
||||
|
||||
pc.WriteToLas(tempFile);
|
||||
|
||||
|
||||
|
||||
var potreeConverter = new Process();
|
||||
potreeConverter.StartInfo.FileName = Globals.PotreeConverterExe;
|
||||
potreeConverter.StartInfo.Arguments = $"\"{tempFile}\" -o \"{Globals.TempPath}/{id.ToString()}\"";
|
||||
potreeConverter.Start();
|
||||
potreeConverter.WaitForExit();
|
||||
|
||||
Directory.Move(Globals.TempPath + "/" + id, pathTarget);
|
||||
}
|
||||
|
||||
private void InitSampleData()
|
||||
@@ -70,7 +66,7 @@ namespace PointCloudWeb.Server.Services
|
||||
|
||||
public IEnumerable<PointCloud> GetAll() => _pointClouds;
|
||||
|
||||
public PointCloud GetById(Guid id) => _pointClouds.GetById(id);
|
||||
public PointCloud GetById(Guid id) => _pointClouds.GetById(id);
|
||||
|
||||
public void RegisterPointCloud(Guid id)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,13 @@ namespace PointCloudWeb.Server
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
Directory.Delete(Globals.TempPath, true);
|
||||
|
||||
if (Directory.Exists(Globals.TempPath))
|
||||
Directory.Delete(Globals.TempPath, true);
|
||||
if (Directory.Exists(Globals.PotreeDataPath))
|
||||
Directory.Delete(Globals.PotreeDataPath, true);
|
||||
Directory.CreateDirectory(Globals.TempPath);
|
||||
Directory.CreateDirectory(Globals.PotreeDataPath);
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
@@ -36,10 +42,7 @@ namespace PointCloudWeb.Server
|
||||
|
||||
//app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
|
||||
Reference in New Issue
Block a user