mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-06 04:16:25 +00:00
update_default_style() and default material for IfcSpace
This commit is contained in:
@@ -737,6 +737,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (vmap.count("force-space-transparency")) {
|
if (vmap.count("force-space-transparency")) {
|
||||||
settings.force_space_transparency(force_space_transparency);
|
settings.force_space_transparency(force_space_transparency);
|
||||||
|
IfcGeom::update_default_style("IfcSpace").Transparency().reset(force_space_transparency);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<GeometrySerializer> serializer; /**< @todo use std::unique_ptr when possible */
|
boost::shared_ptr<GeometrySerializer> serializer; /**< @todo use std::unique_ptr when possible */
|
||||||
|
|||||||
@@ -96,7 +96,10 @@ namespace IfcGeom {
|
|||||||
boost::optional<double>& Specularity() { return specularity; }
|
boost::optional<double>& Specularity() { return specularity; }
|
||||||
};
|
};
|
||||||
|
|
||||||
IFC_GEOM_API const SurfaceStyle* get_default_style(const std::string& ifc_type);
|
IFC_GEOM_API const SurfaceStyle* get_default_style(const std::string& ifc_type);
|
||||||
|
|
||||||
|
IFC_GEOM_API SurfaceStyle& update_default_style(const std::string& ifc_type);
|
||||||
|
|
||||||
IFC_GEOM_API void set_default_style_file(const std::string& json_file);
|
IFC_GEOM_API void set_default_style_file(const std::string& json_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ void InitDefaultMaterials() {
|
|||||||
default_materials.insert(std::make_pair("IfcPlate", IfcGeom::SurfaceStyle("IfcPlate")));
|
default_materials.insert(std::make_pair("IfcPlate", IfcGeom::SurfaceStyle("IfcPlate")));
|
||||||
default_materials["IfcPlate"].Diffuse().reset(IfcGeom::SurfaceStyle::ColorComponent(0.8, 0.8, 0.8));
|
default_materials["IfcPlate"].Diffuse().reset(IfcGeom::SurfaceStyle::ColorComponent(0.8, 0.8, 0.8));
|
||||||
|
|
||||||
|
default_materials.insert(std::make_pair("IfcSpace", IfcGeom::SurfaceStyle("IfcSpace")));
|
||||||
|
default_materials["IfcWindow"].Diffuse().reset(IfcGeom::SurfaceStyle::ColorComponent(0.65, 0.75, 0.8));
|
||||||
|
default_materials["IfcWindow"].Transparency().reset(0.8);
|
||||||
|
|
||||||
default_material = IfcGeom::SurfaceStyle("DefaultMaterial");
|
default_material = IfcGeom::SurfaceStyle("DefaultMaterial");
|
||||||
default_material.Diffuse().reset(IfcGeom::SurfaceStyle::ColorComponent(0.7, 0.7, 0.7));
|
default_material.Diffuse().reset(IfcGeom::SurfaceStyle::ColorComponent(0.7, 0.7, 0.7));
|
||||||
|
|
||||||
@@ -121,3 +125,12 @@ const IfcGeom::SurfaceStyle* IfcGeom::get_default_style(const std::string& s) {
|
|||||||
const IfcGeom::SurfaceStyle& surface_style = it->second;
|
const IfcGeom::SurfaceStyle& surface_style = it->second;
|
||||||
return &surface_style;
|
return &surface_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IfcGeom::SurfaceStyle& IfcGeom::update_default_style(const std::string& s) {
|
||||||
|
if (!default_materials_initialized) InitDefaultMaterials();
|
||||||
|
std::map<std::string, IfcGeom::SurfaceStyle>::iterator it = default_materials.find(s);
|
||||||
|
if (it == default_materials.end()) {
|
||||||
|
throw std::runtime_error("No style registered for " + s);
|
||||||
|
}
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user