/** * 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 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 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; }
/** * 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; }
BuildingModel bm = new BuildingModel(); List<BuildingPart> bps = new ArrayList<BuildingPart>(); bm.setParts(bps); bm.setNodeParts(nbps);
/** * Build 3d Model of building. * * @param buildingModel * building model * @param tm * texture manager * @return building model and debug informations */ public static BuildingOutput buildModel(BuildingModel buildingModel, BuildingElementsTextureManager tm) { List<BuildingPartOutput> partsOut = new ArrayList<BuildingPartOutput>(); ModelFactory mf = ModelFactory.modelBuilder(); if (buildingModel.getParts() != null) { for (BuildingPart bp : buildingModel.getParts()) { partsOut.add(buildPart(bp, buildingModel, mf, tm)); } } if (buildingModel.getNodeParts() != null) { for (NodeBuildingPart bp : buildingModel.getNodeParts()) { partsOut.add(buildNodePart(bp, buildingModel, mf, tm)); } } BuildingOutput out = new BuildingOutput(); out.setModel(mf.toModel()); out.setBuildingPartOutput(partsOut); return out; }
public static TextureData takeFacadeTextureData(BuildingModel buildingModel, NodeBuildingPart bp, BuildingElementsTextureManager tm, boolean colorable) { String mt = null; 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; }
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; }
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 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 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; }
/** * Parse building model from multipolygon. * * @param pRelation * @param pers * @return */ public static BuildingModel parseBuildingMultiPolygon(Relation pRelation, Perspective pers) { if (!pRelation.isMultipolygon()) { throw new IllegalArgumentException("for multipolygon relations!"); } BuildingModel bm = new BuildingModel(); List<BuildingPart> bps = new ArrayList<BuildingPart>(); bm.setParts(bps); List<BuildingPart> bp = parseBuildingMultiPolygonPart(pRelation, pers); if (bp != null) { bps.addAll(bp); } return bm; }
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; }
BuildingModel buildingModel = new BuildingModel(); buildingModel.setParts(Arrays.asList(bp));