Skip to content

Commit

Permalink
Update to the way Edges are handled and duplication of code
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjamesnugent committed Jun 28, 2023
1 parent f7e182c commit ba19c29
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions Lusas_Adapter/CRUD/Create/Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ private bool CreateCollection(IEnumerable<Edge> edges)
{
if (edges != null)
{
List<Point> allPoints = new List<Point>();

//Check List<Curve> is not null and Curve is not invalid (i.e. not a Line)
List<Edge> validEdges = edges.Where(x => CheckPropertyError(x, y => y.Curve))
.Where(x => !Engine.Adapters.Lusas.Query.InvalidEdge(x)).ToList();
Expand All @@ -355,19 +353,10 @@ private bool CreateCollection(IEnumerable<Edge> edges)
distinctEdges.Add(edge);
}

distinctEdges = Engine.Adapters.Lusas.Query.GetDistinctEdges(distinctEdges);

foreach (Edge edge in distinctEdges)
{
allPoints.Add(edge.Curve.IStartPoint());
allPoints.Add(edge.Curve.IEndPoint());
}

List<Point> distinctPoints = Engine.Adapters.Lusas.Query.GetDistinctPoints(allPoints);
List<Point> distinctPoints = distinctEdges.Select(x => x.Curve.IStartPoint()).Union(edges.Select(x => x.Curve.IEndPoint())).ToList();

List<Point> existingPoints = ReadPoints();
List<Point> pointsToPush = distinctPoints.Except(
existingPoints, new PointDistanceComparer()).ToList();
List<Point> pointsToPush = distinctPoints.Except(existingPoints, new PointDistanceComparer()).ToList();

ReduceRuntime(true);

Expand All @@ -378,13 +367,9 @@ private bool CreateCollection(IEnumerable<Edge> edges)

ReduceRuntime(false);

List<IFPoint> lusasPoints = ReadLusasPoints();
List<Point> points = new List<Point>();
List<Point> points = ReadPoints();

foreach (IFPoint point in lusasPoints)
{
points.Add(Adapters.Lusas.Convert.ToPoint(point));
}
List<IFPoint> lusasPoints = ReadLusasPoints();

CreateTags(distinctEdges);

Expand Down

0 comments on commit ba19c29

Please sign in to comment.