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; }
private static Color takeFloorColor(BuildingModel buildingModel, BuildingPart bp, BuildingElementsTextureManager tm) { Color c = null; if (bp.getFloorColor() != null) { c = bp.getFloorColor(); } else if (buildingModel.getFloorColor() != null) { c = buildingModel.getFloorColor(); } return c; }
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; }
public static PolygonWithHolesList2d buildingPartToPolygonWithHoles(BuildingPart bp) { PolygonList2d outerPolygon = wallToOuterPolygon(bp.getWall()); List<PolygonList2d> innerList = new ArrayList<PolygonList2d>(); if (bp.getInlineWalls() != null) { for (Wall innerWall : bp.getInlineWalls()) { PolygonList2d innerPolygon = wallToOuterPolygon(innerWall); innerList.add(innerPolygon); } } return new PolygonWithHolesList2d(outerPolygon, innerList); }
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 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; }
/** * Parse building model from way. * * @param way * @param perspective * @return */ public static BuildingModel parseBuildingWay(Way way, Perspective perspective) { BuildingModel bm = new BuildingModel(); bm.setParts(parseBuildingPart(way, perspective)); return bm; }
private static TextureData takeRoofTextureData(BuildingModel buildingModel, BuildingPart bp, Wall w, BuildingElementsTextureManager tm, boolean colorable) { String mt = null; if (w.getRoofMaterialType() != null) { mt = w.getRoofMaterialType(); } else if (bp.getRoofMaterialType() != null) { mt = bp.getRoofMaterialType(); } else if (buildingModel.getRoofMaterialType() != null) { mt = buildingModel.getRoofMaterialType(); } TextureData td = tm.findTexture(new TextureFindCriteria(Type.ROOF, mt, null, null, null, colorable)); if (td == null) { td = new TextureData(null, 1, 1); } return td; }
public static PolygonList2d wallToOuterPolygon(Wall wall) { return wallPartsToPolygon(wall.getWallParts()); }
public double getDefaultMaxHeight() { if (maxHeight != null) { return maxHeight; } if (maxLevel != null) { return maxLevel * levelHeight; } return getDefaultMinHeight() + DEFAULT_BUILDING_HEIGHT; }
private static int getFacadeLevels(Wall w, BuildingPart bp) { return bp.getDefaultMaxLevel() - bp.getDefaultMinLevel() - bp.getDefaultRoofLevels(); }
/** * Parse building model from node. * * @param node * @param perspective * @return */ public static BuildingModel parseBuildingNode(Node node, Perspective perspective) { BuildingModel bm = new BuildingModel(); bm.setNodeParts(parseBuildingPart(node, perspective)); return bm; }
public static TextureData takeFloorTextureData(BuildingModel buildingModel, BuildingPart bp, BuildingElementsTextureManager tm, boolean colorable) { String mt = null; if (bp.getFloorMaterialType() != null) { mt = bp.getFloorMaterialType(); } else if (buildingModel.getFloorMaterialType() != null) { mt = buildingModel.getFloorMaterialType(); } TextureData td = tm.findTexture(new TextureFindCriteria(Type.FLOOR, mt, null, null, null, colorable)); if (td == null) { td = new TextureData(null, 1, 1); } return td; }
@Override public void preview(double value) { // sets height to current building part getBuildingPart().setMaxHeight(value); generatePreview(); };
@Override public void beforeProvide(Point3d point) { point.x = (bounds.getxMax() + bounds.getxMin()) / 2d; point.y = bp.getDefaultMaxHeight(); point.z = -(bounds.getyMax() + bounds.getyMin()) / 2d; } };
private static Color takeFacadeColor(BuildingModel buildingModel, NodeBuildingPart bp, BuildingElementsTextureManager tm) { Color c = null; if (bp.getFacadeColor() != null) { c = bp.getFacadeColor(); } else if (buildingModel.getFacadeColor() != null) { c = buildingModel.getFacadeColor(); } return c; }
private static WallPart getFirstWallPart(Wall w) { if (w == null) { return null; } if (w.getWallParts() != null && w.getWallParts().size() > 0) { return w.getWallParts().get(0); } return null; }
public int getDefaultMaxLevel() { if (maxLevel != null) { return maxLevel; } return getDefaultMinLevel() + 1; }
private static Integer hasWindowsCloumns(List<BuildingWallElement> list) { if (list == null) { return null; } for (BuildingWallElement buildingWallElement : list) { if (buildingWallElement instanceof WindowGridBuildingElement) { WindowGridBuildingElement w = (WindowGridBuildingElement) buildingWallElement; int numOfCols = w.getNumOfCols(); if (numOfCols > 0) { return numOfCols; } return null; } } return null; }