public List <BodyElement> getBodyLinesFromPoints() { if (this.shapeBuilding != null) { //APpliquer un algo de reduction de points List <Point> pointsReduced = this.DouglasPeuckerReduction(shapeBuilding, 3); //Convertir la liste de points en CPoints2D CPoint2D[] points2D = getCPoint2D(pointsReduced); //Creer un calculate reduction CalculateReduction cr = new CalculateReduction(points2D); CPoint2D[] pointsRet = cr.getPointReduce(); if (pointsRet != null) { List <Point> listPoints = convertCPoint2DToPoint(pointsRet); //Creer les bodyelements List <BodyElement> elements = new List <BodyElement>(); for (int i = 0; i < listPoints.Count - 1; i++) { Point p1 = listPoints[i]; Point p2 = listPoints[i + 1]; List <Point> pointsLine = new List <Point>(); pointsLine.Add(p1); pointsLine.Add(p2); BodyElement elem = new BodyElement(elements.Count, "Line" + elements.Count, 0, 0, 0, pointsLine); elements.Add(elem); if (listPoints.Count % 2 == 1) { if (i == listPoints.Count - 2) { Point p3 = listPoints[i + 1]; List <Point> pointsLine2 = new List <Point>(); pointsLine2.Add(p2); pointsLine2.Add(p3); BodyElement elem2 = new BodyElement(elements.Count, "Line" + elements.Count, 0, 0, 0, pointsLine2); elements.Add(elem2); } } } return(elements); } } return(null); }
public List<BodyElement> getBodyLinesFromPoints() { if (this.shapeBuilding != null) { //APpliquer un algo de reduction de points List<Point> pointsReduced = this.DouglasPeuckerReduction(shapeBuilding,3); //Convertir la liste de points en CPoints2D CPoint2D[] points2D = getCPoint2D(pointsReduced); //Creer un calculate reduction CalculateReduction cr = new CalculateReduction(points2D); CPoint2D[] pointsRet = cr.getPointReduce(); if (pointsRet != null) { List<Point> listPoints = convertCPoint2DToPoint(pointsRet); //Creer les bodyelements List<BodyElement> elements = new List<BodyElement>(); for (int i = 0; i < listPoints.Count-1; i++) { Point p1 = listPoints[i]; Point p2 = listPoints[i + 1]; List<Point> pointsLine = new List<Point>(); pointsLine.Add(p1); pointsLine.Add(p2); BodyElement elem = new BodyElement(elements.Count, "Line" + elements.Count, 0, 0, 0, pointsLine); elements.Add(elem); if (listPoints.Count % 2 == 1) { if (i == listPoints.Count - 2) { Point p3 = listPoints[i + 1]; List<Point> pointsLine2 = new List<Point>(); pointsLine2.Add(p2); pointsLine2.Add(p3); BodyElement elem2 = new BodyElement(elements.Count, "Line" + elements.Count, 0, 0, 0, pointsLine2); elements.Add(elem2); } } } return elements; } } return null; }