private static WallPart parseWallPart(ReversableWay rw, Perspective pPerspective) { Way way = rw.getWay(); WallPart wp = new WallPart(); List<WallNode> wnList = new ArrayList<WallNode>(); if (!rw.isReversed()) { for (int i = 0; i < way.getNodesCount(); i++) { WallNode wn = parseWallNode(way.getNode(i), pPerspective); wnList.add(wn); } } else { for (int i = way.getNodesCount() - 1; i >= 0; i--) { WallNode wn = parseWallNode(way.getNode(i), pPerspective); wnList.add(wn); } } wp.setNodes(wnList); wp.setBuildingElements(parseBuildingAttributeWallElement(way)); // String parseFacadeName = // BuildingAttributeParser.parseFacadeMaterialName(w); // wp.setFacadeTextureData(BuildingAttributeParser.parseFacadeTexture(parseFacadeName, // this.textureLibraryService)); // wp.setColor(BuildingAttributeParser.parseFacadeColor(w)); wp.setFacadeMaterialType(BuildingAttributeParser.parseFacadeMaterialName(way)); wp.setFacadeColor(BuildingAttributeParser.parseFacadeColor(way)); wp.setRoofMaterialType(BuildingAttributeParser.parseRoofMaterialName(way)); wp.setRoofColor(BuildingAttributeParser.parseRoofColor(way)); return wp; }
private static PolygonList2d wallPartsToPolygon(List<WallPart> wallParts) { List<Point2d> points = new ArrayList<Point2d>(); for (WallPart p : wallParts) { if (points.size() > 0 && p.getNodes().size() > 0) { Point2d lastAdded = points.get(points.size() - 1); Point2d newToAdd = p.getNodes().get(0).point; if (lastAdded.equals(newToAdd)) { points.remove(points.size() - 1); } } for (WallNode n : p.getNodes()) { points.add(n.point); } } // if (points.size() > 1) { if (points.get(0).equals(points.get(points.size()-1))) { points.remove(points.size()-1); } else { throw new IllegalArgumentException("wall is not closed!!!"); } return new PolygonList2d(points); }
private static Color takeFacadeColor(BuildingModel buildingModel, BuildingPart bp, Wall w, WallPart wp, BuildingElementsTextureManager tm) { Color c = null; if (wp != null && wp.getFacadeColor() != null) { c = wp.getFacadeColor(); } else if (w.getFacadeColor() != null) { c = w.getFacadeColor(); } else if (bp.getFacadeColor() != null) { c = bp.getFacadeColor(); } else if (buildingModel.getFacadeColor() != null) { c = buildingModel.getFacadeColor(); } return c; }
private static Color takeRoofColor(BuildingModel buildingModel, BuildingPart bp, Wall w, WallPart wp, BuildingElementsTextureManager tm) { Color c = null; if (wp != null && wp.getRoofColor() != null) { c = wp.getRoofColor(); } else if (w.getRoofColor() != null) { c = w.getRoofColor(); } else if (bp.getRoofColor() != null) { c = bp.getRoofColor(); } else if (buildingModel.getRoofColor() != null) { c = buildingModel.getRoofColor(); } return c; }
public static TextureData takeFacadeTextureData(BuildingModel buildingModel, BuildingPart bp, Wall w, WallPart wp, BuildingElementsTextureManager tm, boolean colorable) { String mt = null; if (wp != null && wp.getFacadeMaterialType() != null) { mt = wp.getFacadeMaterialType(); } else if (w.getFacadeMaterialType() != null) { mt = w.getFacadeMaterialType(); } else if (bp.getFacadeMaterialType() != null) { mt = bp.getFacadeMaterialType(); } else if (buildingModel.getFacadeMaterialType() != null) { mt = buildingModel.getFacadeMaterialType(); } TextureData td = tm.findTexture(new TextureFindCriteria(Type.FACADE, mt, null, null, null, colorable)); if (td == null) { td = new TextureData(null, 1, 1); } return td; }
private static TextureData generateWindowsOverlayTextureData(Wall wall, double minHeight, double wallHeight, BuildingPart buildingPart, BuildingModel buildingModel, BuildingElementsTextureManager tm, WallPart wallPart, double wallLength) { Integer windowsCols = hasWindowsCloumns(wallPart.getBuildingElements()); if (windowsCols != null && windowsCols != 0) { /* Check if wall has any windows column defined. */ TextureData windowsTextureData = takeWindowsColumnsTextureData(buildingModel, buildingPart, wall, wallPart, tm); double windowsSegmetLength = wallLength / (double) windowsCols; int facadeLevels = getFacadeLevels(wall, buildingPart); /* * Adjust texture data size to match wall size multiply by number of * window columns and levels. */ double windowsSegmentHeight = (wallHeight - minHeight) / facadeLevels; return new TextureData(windowsTextureData.getTex0(), windowsSegmetLength, windowsSegmentHeight); } return null; }
private static double calcWallPartLength(WallPart wp) { double wallLength = 0; List<WallNode> nodes = wp.getNodes(); int size = nodes.size(); WallNode n1 = nodes.get(0); for (int i = 1; i < size; i++) { WallNode n2 = nodes.get(i); wallLength += n1.getPoint().distance(n2.getPoint()); n1 = n2; } return wallLength; }
private Bbox2d calcBounds(BuildingPart bp) { Bbox2d bbox = new Bbox2d(); List<WallPart> wallParts = bp.getWall().getWallParts(); for (WallPart wp : wallParts) { for (WallNode wn : wp.getNodes()) { Point2d p = wn.getPoint(); bbox.addPoint(p); } } return bbox; }
List<WallNode> nodes = wp.getNodes(); int size = nodes.size();
List<WallPart> wallParts = bp.getWall().getWallParts(); for (WallPart wp : wallParts) { for (WallNode wn : wp.getNodes()) {