private String debugPolygon(PolygonWithHolesList2d buildingTransformed) { StringBuffer sb = new StringBuffer(); sb.append("** Debug for polygon **\n"); List<Point2d> outer = buildingTransformed.getOuter().getPoints(); sb.append("List<Point2d> polygon = new ArrayList<Point2d>();\n"); for (Point2d p : outer) { sb.append("polygon.add(new Point2d(" + p.x + ", " + p.y + "));\n"); } List<List<Point2d>> inners = PolygonWithHolesList2dUtil.getListOfHolePoints(buildingTransformed); int holeCount = 0; for (List<Point2d> polygonList2d : inners) { holeCount++; sb.append("\nList<Point2d> hole" + holeCount + " = new ArrayList<Point2d>();\n"); for (Point2d p : polygonList2d) { sb.append("hole" + holeCount + ".add(new Point2d(" + p.x + ", " + p.y + "));\n"); } } sb.append("****"); return sb.toString(); }
public static PolygonWithHolesList2d transformationPolygonWithHoles(PolygonWithHolesList2d polygonWithHoles, SimpleMatrix transformLocal) { PolygonList2d outer = transformPolygon(polygonWithHoles.getOuter(), transformLocal); List<PolygonList2d> inner = new ArrayList<PolygonList2d>(); if (polygonWithHoles.getInner() != null) { for (PolygonList2d pi : polygonWithHoles.getInner()) { inner.add(transformPolygon(pi, transformLocal)); } } return new PolygonWithHolesList2d(outer, inner); }
private static Polygon convert(PolygonWithHolesList2d polygonWithHoles) { Polygon outer = convert(polygonWithHoles.getOuter()); if (polygonWithHoles.getInner() != null) { for (PolygonList2d inner : polygonWithHoles.getInner()) { outer.addHole(convert(inner)); } } return outer; }
private boolean isComplex(PolygonWithHolesList2d buildingPolygon, DormerRoofModel roof) { if (roof.getDirection() != null) { return false; } if (roof.getOrientation() != null) { return false; } if (buildingPolygon.getInner() != null && buildingPolygon.getInner().size() > 0) { // has any holes return true; } List<Point2d> points = buildingPolygon.getOuter().getPoints(); RectanglePointVector2d orientedBBox = RectangleUtil.findRectangleContur(points); double orientedBBoxArea = orientedBBox.getHeight() * orientedBBox.getWidth(); float polygonArea = Math.abs(PolygonUtil.area(points)); return orientedBBoxArea > polygonArea * 1.2; }
@Override public RoofTypeOutput buildRoof(Point2d startPoint, PolygonWithHolesList2d buildingPolygon, DormerRoofModel roof, double height, RoofMaterials roofTextureData) { SimpleMatrix transformLocal = TransformationMatrix2d.tranA(-startPoint.x, -startPoint.y); List<Point2d> polygon = buildingPolygon.getOuter().getPoints(); polygon = TransformationMatrix2d.transformList(polygon, transformLocal); Double h1 = null; Double angle = null; Measurement measurement = roof.getMeasurements().get(MeasurementKey.HEIGHT_1); if (isUnit(measurement, MeasurementUnit.DEGREES)) { angle = measurement.getValue(); } else { h1 = getHeightMeters(roof.getMeasurements(), MeasurementKey.HEIGHT_1, DEFAULT_ROOF_HEIGHT); } RoofTypeOutput rto = build(polygon, h1, angle, roofTextureData); SimpleMatrix transformGlobal = TransformationMatrix3d.tranA(startPoint.x, height - rto.getHeight(), -startPoint.y); rto.setTransformationMatrix(transformGlobal); return rto; }
@Override public RoofTypeOutput buildRoof(Point2d pStartPoint, PolygonWithHolesList2d buildingPolygon, DormerRoofModel pRoof, double height, RoofMaterials roofTextureData) { SimpleMatrix transformLocal = TransformationMatrix2d.tranA(-pStartPoint.x, -pStartPoint.y); List<Point2d> polygon = buildingPolygon.getOuter().getPoints(); polygon = TransformationMatrix2d.transformList(polygon, transformLocal); Double h1 = null; Double angle = null; Measurement measurement = pRoof.getMeasurements().get(MeasurementKey.HEIGHT_1); if (isUnit(measurement, MeasurementUnit.DEGREES)) { angle = measurement.getValue(); } else { h1 = getHeightMeters(pRoof.getMeasurements(), MeasurementKey.HEIGHT_1, DEFAULT_ROOF_HEIGHT); } RoofTypeOutput rto = build(polygon, h1, angle, roofTextureData); SimpleMatrix transformGlobal = TransformationMatrix3d.tranA(pStartPoint.x, height - rto.getHeight(), -pStartPoint.y); rto.setTransformationMatrix(transformGlobal); return rto; }
List<Point2d> outer = buildingTransformed.getOuter().getPoints(); List<List<Point2d>> inners = PolygonWithHolesList2dUtil.getListOfHolePoints(buildingTransformed);
List<Point2d> pBorderList = buildingPolygon.getOuter().getPoints();
List<Point2d> polygon = buildingPolygon.getOuter().getPoints();
List<Point2d> outlineList = buildingPolygon.getOuter().getPoints();
@Override public RoofTypeOutput buildRoof(Point2d pStartPoint, PolygonWithHolesList2d buildingPolygon, DormerRoofModel pRoof, double height, RoofMaterials roofTextureData) { List<Point2d> pPolygon = buildingPolygon.getOuter().getPoints(); SimpleMatrix transformLocal = TransformationMatrix2d.tranA(-pStartPoint.x, -pStartPoint.y); pPolygon = TransformationMatrix2d.transformList(pPolygon, transformLocal); // rectangleContur = // TransformationMatrix2d.transformArray(rectangleContur, // transformLocal); PolygonList2d borderPolygon = new PolygonList2d(pPolygon); Circle circle = CircleInsidePolygon.iterativeNonConvex(borderPolygon, 0.01); int isection = getIsection(pRoof.getRoofTypeParameter()); boolean soft = isSoft(pRoof.getRoofTypeParameter()); Bend[] bends = getBends(pRoof.getMeasurements(), circle); RoofTypeOutput rto = build(pPolygon, circle.getPoint(), bends, isection, soft, roofTextureData); SimpleMatrix transformGlobal = TransformationMatrix3d.tranA(pStartPoint.x, height - rto.getHeight(), -pStartPoint.y); rto.setTransformationMatrix(transformGlobal); return rto; }
TextureData roofTexture = roofTextureData.getRoof().getTextureData(); List<Point2d> pBorderList = buildingPolygon.getOuter().getPoints(); PolygonList2d borderPolygon = new PolygonList2d(pBorderList);
List<Point2d> outlineList = buildingPolygon.getOuter().getPoints();
TextureData roofTexture = roofTextureData.getRoof().getTextureData(); List<Point2d> pBorderList = buildingPolygon.getOuter().getPoints(); PolygonList2d borderPolygon = new PolygonList2d(pBorderList);
nb.normalize(); List<Point2d> pBorderList = buildingPolygon.getOuter().getPoints();
List<Point2d> pBorderList = buildingPolygon.getOuter().getPoints();
normalBottom.normalize(); List<Point2d> outline = PolygonUtil.makeCounterClockwise(buildingPolygon.getOuter().getPoints()); PolygonList2d borderPolygon = new PolygonList2d(outline);
normalBottom.normalize(); List<Point2d> outline = PolygonUtil.makeCounterClockwise(buildingPolygon.getOuter().getPoints()); PolygonList2d borderPolygon = new PolygonList2d(outline);
nb.normalize(); List<Point2d> pBorderList = buildingPolygon.getOuter().getPoints();