diff --git a/PointCloudWeb.Server/PointCloudWeb.Server.ScanConverter/Program.cs b/PointCloudWeb.Server/PointCloudWeb.Server.ScanConverter/Program.cs
index b5f92ee..dbfa9df 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server.ScanConverter/Program.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server.ScanConverter/Program.cs
@@ -10,7 +10,7 @@ namespace PointCloudWeb.Server.ScanConverter
{
internal class Program
{
- private static void Main(string[] args)
+ private static void Main()
{
var scanPoints = File.ReadAllLines("C:\\Users\\timwu\\Desktop\\Scans\\0yGrad-edited-scan.csv")
.Select(v => ScanDataPointFromCsv(v))
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server.sln.DotSettings.user b/PointCloudWeb.Server/PointCloudWeb.Server.sln.DotSettings.user
new file mode 100644
index 0000000..1ac451f
--- /dev/null
+++ b/PointCloudWeb.Server/PointCloudWeb.Server.sln.DotSettings.user
@@ -0,0 +1,3 @@
+
+
+ ShowAndRun
\ No newline at end of file
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudController.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudController.cs
index a267025..1af0905 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudController.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudController.cs
@@ -3,7 +3,6 @@ using PointCloudWeb.Server.Models;
using PointCloudWeb.Server.Services;
using System;
using System.Collections.Generic;
-using System.Linq;
namespace PointCloudWeb.Server.Controllers
{
@@ -11,11 +10,11 @@ namespace PointCloudWeb.Server.Controllers
[Route("[controller]")]
public class PointCloudController
{
- private readonly PointCloudService pointCloudService;
+ private readonly PointCloudService _pointCloudService;
public PointCloudController(PointCloudService pointCloudService)
{
- this.pointCloudService = pointCloudService;
+ this._pointCloudService = pointCloudService;
}
private PointCloudDto ConvertPointCloudToDto(PointCloud pc) => new PointCloudDto(pc.Id, pc.TransformedPoints);
@@ -24,7 +23,7 @@ namespace PointCloudWeb.Server.Controllers
public IList GetAll()
{
var result = new List();
- foreach (var pc in pointCloudService.GetAll())
+ foreach (var pc in _pointCloudService.GetAll())
result.Add(ConvertPointCloudToDto(pc));
return result;
@@ -33,7 +32,7 @@ namespace PointCloudWeb.Server.Controllers
[HttpGet]
public PointCloudDto GetById(Guid id)
{
- var pc = pointCloudService.GetById(id) ?? throw new KeyNotFoundException();
+ var pc = _pointCloudService.GetById(id) ?? throw new KeyNotFoundException();
return ConvertPointCloudToDto(pc);
}
}
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudInfoController.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudInfoController.cs
index 6bd9204..552c98a 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudInfoController.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/PointCloudInfoController.cs
@@ -3,7 +3,6 @@ using PointCloudWeb.Server.Models;
using PointCloudWeb.Server.Services;
using System;
using System.Collections.Generic;
-using System.Linq;
namespace PointCloudWeb.Server.Controllers
{
@@ -11,11 +10,11 @@ namespace PointCloudWeb.Server.Controllers
[Route("[controller]")]
public class PointCloudInfoController
{
- private readonly PointCloudService pointCloudService;
+ private readonly PointCloudService _pointCloudService;
public PointCloudInfoController(PointCloudService pointCloudService)
{
- this.pointCloudService = pointCloudService;
+ this._pointCloudService = pointCloudService;
}
private PointCloudInfoDto ConvertPointCloudToDto(PointCloud pc) => new PointCloudInfoDto(pc.Id, pc.Name);
@@ -24,7 +23,7 @@ namespace PointCloudWeb.Server.Controllers
public IList GetAll()
{
var result = new List();
- foreach (var pc in pointCloudService.GetAll())
+ foreach (var pc in _pointCloudService.GetAll())
result.Add(ConvertPointCloudToDto(pc));
return result;
@@ -34,7 +33,7 @@ namespace PointCloudWeb.Server.Controllers
[Route("{id:Guid}")]
public ActionResult GetById(Guid id)
{
- var pc = pointCloudService.GetById(id);
+ var pc = _pointCloudService.GetById(id);
if (pc == null)
return new NotFoundResult();
return ConvertPointCloudToDto(pc);
@@ -44,17 +43,17 @@ namespace PointCloudWeb.Server.Controllers
[Route("{id:Guid}")]
public ActionResult RemoveById(Guid id)
{
- if (pointCloudService.GetById(id) == null)
+ if (_pointCloudService.GetById(id) == null)
return new NotFoundResult();
- pointCloudService.RemoveById(id);
+ _pointCloudService.RemoveById(id);
return new OkResult();
}
[HttpPut]
public ActionResult UpdatePointCloud([FromBody] PointCloudInfoDto newPc)
{
- var pc = pointCloudService.GetById(newPc.Id);
+ var pc = _pointCloudService.GetById(newPc.Id);
if (pc == null)
return new NotFoundResult();
pc.Name = newPc.Name;
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/ScanDataController.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/ScanDataController.cs
index 735cab4..b2538c9 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/ScanDataController.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/ScanDataController.cs
@@ -9,23 +9,23 @@ namespace PointCloudWeb.Server.Controllers
[Route("[controller]")]
public class DataController : ControllerBase
{
- private readonly ScanDataService scanDataService;
+ private readonly ScanDataService _scanDataService;
public DataController(ScanDataService scanDataService)
{
- this.scanDataService = scanDataService;
+ this._scanDataService = scanDataService;
}
[HttpPost]
public void PostScanData([FromBody] ScanDataList data)
{
- scanDataService.AddScan(data);
+ _scanDataService.AddScan(data);
}
[HttpPut]
public void ScanFinished(Guid id)
{
- scanDataService.ScanFinished(id);
+ _scanDataService.ScanFinished(id);
}
}
}
\ No newline at end of file
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/WeatherForecastController.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/WeatherForecastController.cs
deleted file mode 100644
index 8685dd1..0000000
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Controllers/WeatherForecastController.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace PointCloudWeb.Server.Controllers
-{
- [ApiController]
- [Route("[controller]")]
- public class WeatherForecastController : ControllerBase
- {
- private static readonly string[] Summaries = new[]
- {
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
-
- private readonly ILogger logger;
-
- public WeatherForecastController(ILogger logger)
- {
- this.logger = logger;
- }
-
- [HttpGet]
- public IEnumerable Get()
- {
- var rng = new Random();
- return Enumerable.Range(1, 5).Select(index => new WeatherForecast
- {
- Date = DateTime.Now.AddDays(index),
- TemperatureC = rng.Next(-20, 55),
- Summary = Summaries[rng.Next(Summaries.Length)]
- })
- .ToArray();
- }
- }
-}
\ No newline at end of file
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloud.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloud.cs
index ecd766c..fd3f139 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloud.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloud.cs
@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
-using System.Linq;
+using System.Diagnostics.CodeAnalysis;
using System.Numerics;
namespace PointCloudWeb.Server.Models
@@ -27,29 +27,27 @@ namespace PointCloudWeb.Server.Models
public override bool Equals(object obj)
{
- if ((obj == null) || !GetType().Equals(obj.GetType()))
+ if (obj == null || GetType() != obj.GetType())
return false;
- else
- {
- Point p = (Point)obj;
- return (X == p.X) && (Y == p.Y) && (Z == p.Z);
- }
+ var p = (Point) obj;
+ return X == p.X && Y == p.Y && Z == p.Z;
}
+ [SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")]
public override int GetHashCode() => HashCode.Combine(X, Y, Z);
- public override string ToString() => X.ToString() + " " + Y.ToString() + " " + Z.ToString();
+ public override string ToString() => X + " " + Y + " " + Z;
}
public class PointCloud
{
- private ObservableCollection points;
- private Matrix4x4 transformation;
+ private readonly ObservableCollection _points;
+ private Matrix4x4 _transformation;
public PointCloud(Guid id, string name)
{
- points = new ObservableCollection();
- points.CollectionChanged += PointsCollectionChanged;
+ _points = new ObservableCollection();
+ _points.CollectionChanged += PointsCollectionChanged;
TransformedPoints = new List();
Id = id;
Name = name;
@@ -59,15 +57,18 @@ namespace PointCloudWeb.Server.Models
public string Name { get; set; }
- public IList Points { get => points; }
+ public IList Points
+ {
+ get => _points;
+ }
public Matrix4x4 Transformation
{
- get => transformation;
+ get => _transformation;
set
{
TransformationChanged();
- transformation = value;
+ _transformation = value;
}
}
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloudDto.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloudDto.cs
index 816626e..81356a2 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloudDto.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Models/PointCloudDto.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace PointCloudWeb.Server.Models
{
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Models/ScanData.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Models/ScanData.cs
index 77e047b..05af5c2 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Models/ScanData.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Models/ScanData.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Linq;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
namespace PointCloudWeb.Server.Models
{
@@ -10,6 +11,7 @@ namespace PointCloudWeb.Server.Models
public IList ScanPoints { get; set; }
}
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
public class ScanDataPoint
{
public ScanDataPoint()
@@ -27,15 +29,17 @@ namespace PointCloudWeb.Server.Models
}
public float DistanceMM { get; set; }
-
//RotationAngle on {X, Y} Axis
public double RAX { get; set; }
-
public double RAY { get; set; }
public override string ToString()
{
- return String.Join(", ", new string[] { RAY.ToString(), RAX.ToString(), DistanceMM.ToString() });
+ return string.Join(
+ ", ",
+ RAY.ToString(CultureInfo.InvariantCulture),
+ RAX.ToString(CultureInfo.InvariantCulture),
+ DistanceMM.ToString(CultureInfo.InvariantCulture));
}
}
}
\ No newline at end of file
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Models/WeatherForecast.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Models/WeatherForecast.cs
deleted file mode 100644
index 67d28bf..0000000
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Models/WeatherForecast.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-
-namespace PointCloudWeb.Server
-{
- public class WeatherForecast
- {
- public DateTime Date { get; set; }
-
- public string Summary { get; set; }
- public int TemperatureC { get; set; }
-
- public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
- }
-}
\ No newline at end of file
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Program.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Program.cs
index 821f4ef..0191a78 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Program.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Program.cs
@@ -1,11 +1,5 @@
using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace PointCloudWeb.Server
{
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Services/PointCloudService.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Services/PointCloudService.cs
index 078333f..6a1685a 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Services/PointCloudService.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Services/PointCloudService.cs
@@ -7,40 +7,40 @@ namespace PointCloudWeb.Server.Services
public class PointCloudService
{
//private readonly IPointCloudRegistationService pointCloudRegistation;
- private readonly PointCloudCollection pointClouds;
+ private readonly PointCloudCollection _pointClouds;
public PointCloudService(/*IPointCloudRegistationService pointCloudRegistation*/)
{
- pointClouds = new PointCloudCollection();
+ _pointClouds = new PointCloudCollection();
//this.pointCloudRegistation = pointCloudRegistation;
InitSampleData();
}
private void InitSampleData()
{
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 1"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 2"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 3"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 4"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 5"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 6"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 7"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 8"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 9"));
- pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 10"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 1"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 2"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 3"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 4"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 5"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 6"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 7"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 8"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 9"));
+ _pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 10"));
}
private void RaiseIfNotExists(Guid id)
{
- if (!pointClouds.Contains(id))
- throw new ArgumentOutOfRangeException("The Id {0} was not found!", id.ToString());
+ if (!_pointClouds.Contains(id))
+ throw new ArgumentOutOfRangeException($"The Id {id.ToString()} was not found!");
}
public void AddPoints(Guid id, IList points)
{
RaiseIfNotExists(id);
- var pc = pointClouds.GetById(id);
+ var pc = _pointClouds.GetById(id);
foreach (var point in points)
pc.Points.Add(point);
@@ -48,22 +48,22 @@ namespace PointCloudWeb.Server.Services
public IList GetAll()
{
- return pointClouds;
+ return _pointClouds;
}
public PointCloud GetById(Guid id)
{
- return pointClouds.GetById(id);
+ return _pointClouds.GetById(id);
}
public void RegisterPointCloud(Guid id)
{
RaiseIfNotExists(id);
- var pointCloud = pointClouds.GetById(id);
-
- //the first can't be registered
- if (pointClouds.IndexOf(pointCloud) == 0)
- return;
+ // var pointCloud = _pointClouds.GetById(id);
+ //
+ // //the first can't be registered
+ // if (_pointClouds.IndexOf(pointCloud) == 0)
+ // return;
//var transformation = pointCloudRegistation.RegisterPointCloud(pointCloud, pointClouds[0]);
//pointCloud.Transformation = transformation;
@@ -71,13 +71,13 @@ namespace PointCloudWeb.Server.Services
public void RegisterPointClouds()
{
- foreach (var pointCloud in pointClouds)
+ foreach (var pointCloud in _pointClouds)
RegisterPointCloud(pointCloud.Id);
}
public void RemoveById(Guid id)
{
- pointClouds.RemoveById(id);
+ _pointClouds.RemoveById(id);
}
}
}
\ No newline at end of file
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanConverterService.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanConverterService.cs
index a756118..33cee2c 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanConverterService.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanConverterService.cs
@@ -11,8 +11,8 @@ namespace PointCloudWeb.Server.Services
if (scan.RAX >= 180 || scan.RAY >= 180)
return new Point(0, 0, 0);
- var degreeXA = scan.RAX;
- var degreeYA = scan.RAY;
+ var degreeXa = scan.RAX;
+ var degreeYa = scan.RAY;
//if (degreeXA > 270 && degreeYA > 270)
//{
@@ -21,23 +21,23 @@ namespace PointCloudWeb.Server.Services
// factorZ = -1;
//}
- var degreeXB = 180 - 90 - degreeXA;
- var degreeYB = 180 - 90 - degreeYA;
+ var degreeXb = 180 - 90 - degreeXa;
+ var degreeYb = 180 - 90 - degreeYa;
- var radXA = degreeXA * Math.PI / 180;
- var radXB = degreeXB * Math.PI / 180;
- var radYA = degreeYA * Math.PI / 180;
- var radYB = degreeYB * Math.PI / 180;
+ var radXa = degreeXa * Math.PI / 180;
+ var radXb = degreeXb * Math.PI / 180;
+ var radYa = degreeYa * Math.PI / 180;
+ var radYb = degreeYb * Math.PI / 180;
- double sinXA = Math.Sin(radXA);
- double sinXB = Math.Sin(radXB);
- double sinYA = Math.Sin(radYA);
- double sinYB = Math.Sin(radYB);
+ var sinXa = Math.Sin(radXa);
+ var sinXb = Math.Sin(radXb);
+ var sinYa = Math.Sin(radYa);
+ var sinYb = Math.Sin(radYb);
var z = Math.Sqrt(
Math.Pow(
- Math.Pow(sinXB, 2) / Math.Pow(sinXA, 2)
- + Math.Pow(sinYB, 2) / Math.Pow(sinYA, 2)
+ Math.Pow(sinXb, 2) / Math.Pow(sinXa, 2)
+ + Math.Pow(sinYb, 2) / Math.Pow(sinYa, 2)
+ 1
, -1)
* Math.Pow(scan.DistanceMM, 2)
@@ -45,8 +45,8 @@ namespace PointCloudWeb.Server.Services
var p = new Point()
{
- X = NumericUtils.Round(z * sinYB / sinYA),
- Y = NumericUtils.Round(z * sinXB / sinXA),
+ X = NumericUtils.Round(z * sinYb / sinYa),
+ Y = NumericUtils.Round(z * sinXb / sinXa),
Z = NumericUtils.Round(z)
};
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanDataService.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanDataService.cs
index ed04f7e..2f143c6 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanDataService.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Services/ScanDataService.cs
@@ -6,13 +6,13 @@ namespace PointCloudWeb.Server.Services
{
public class ScanDataService
{
- private readonly PointCloudService pointCloudService;
- private readonly ScanConverterService scanConverterService;
+ private readonly PointCloudService _pointCloudService;
+ private readonly ScanConverterService _scanConverterService;
public ScanDataService(PointCloudService pointCloudService, ScanConverterService scanConverterService)
{
- this.pointCloudService = pointCloudService;
- this.scanConverterService = scanConverterService;
+ _pointCloudService = pointCloudService;
+ _scanConverterService = scanConverterService;
}
private IList ConvertToPoints(ScanDataList scanData)
@@ -21,7 +21,7 @@ namespace PointCloudWeb.Server.Services
foreach (var scan in scanData.ScanPoints)
{
- list.Add(scanConverterService.Transform(scan));
+ list.Add(_scanConverterService.Transform(scan));
}
return list;
@@ -29,12 +29,12 @@ namespace PointCloudWeb.Server.Services
public void AddScan(ScanDataList scanData)
{
- pointCloudService.AddPoints(scanData.Id, ConvertToPoints(scanData));
+ _pointCloudService.AddPoints(scanData.Id, ConvertToPoints(scanData));
}
public void ScanFinished(Guid id)
{
- pointCloudService.RegisterPointCloud(id);
+ _pointCloudService.RegisterPointCloud(id);
}
}
}
\ No newline at end of file
diff --git a/PointCloudWeb.Server/PointCloudWeb.Server/Startup.cs b/PointCloudWeb.Server/PointCloudWeb.Server/Startup.cs
index 82379f4..03e76fc 100644
--- a/PointCloudWeb.Server/PointCloudWeb.Server/Startup.cs
+++ b/PointCloudWeb.Server/PointCloudWeb.Server/Startup.cs
@@ -1,16 +1,9 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
using PointCloudWeb.Server.Services;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace PointCloudWeb.Server
{