|
12 | 12 | #include <spdlog/spdlog.h>
|
13 | 13 | #include "../web-ifc/modelmanager/ModelManager.h"
|
14 | 14 | #include "../version.h"
|
| 15 | +#include "../web-ifc/geometry/operations/bim-geometry/extrusion.h" |
| 16 | +#include "../web-ifc/geometry/operations/bim-geometry/sweep.h" |
| 17 | +#include "../web-ifc/geometry/operations/bim-geometry/revolution.h" |
| 18 | +#include "../web-ifc/geometry/operations/bim-geometry/cylindricalRevolution.h" |
| 19 | +#include "../web-ifc/geometry/operations/bim-geometry/parabola.h" |
| 20 | +#include "../web-ifc/geometry/operations/bim-geometry/clothoid.h" |
| 21 | +#include "../web-ifc/geometry/operations/bim-geometry/arc.h" |
| 22 | +#include "../web-ifc/geometry/operations/bim-geometry/alignment.h" |
| 23 | +#include "../web-ifc/geometry/operations/bim-geometry/utils.h" |
15 | 24 |
|
16 | 25 | namespace webifc::parsing {
|
17 | 26 | void p21encode(std::string_view input, std::ostringstream &output);
|
@@ -245,6 +254,30 @@ std::vector<webifc::geometry::IfcAlignment> GetAllAlignments(uint32_t modelID)
|
245 | 254 | alignments.push_back(alignment);
|
246 | 255 | }
|
247 | 256 |
|
| 257 | + for (size_t i = 0; i < alignments.size(); i++) |
| 258 | + { |
| 259 | + webifc::geometry::IfcAlignment alignment = alignments[i]; |
| 260 | + std::vector<glm::dvec3> pointsH; |
| 261 | + std::vector<glm::dvec3> pointsV; |
| 262 | + for (size_t j = 0; j < alignment.Horizontal.curves.size(); j++) |
| 263 | + { |
| 264 | + for (size_t k = 0; k < alignment.Horizontal.curves[j].points.size(); k++) |
| 265 | + { |
| 266 | + pointsH.push_back(alignment.Horizontal.curves[j].points[k]); |
| 267 | + } |
| 268 | + } |
| 269 | + for (size_t j = 0; j < alignment.Vertical.curves.size(); j++) |
| 270 | + { |
| 271 | + for (size_t k = 0; k < alignment.Vertical.curves[j].points.size(); k++) |
| 272 | + { |
| 273 | + pointsV.push_back(alignment.Vertical.curves[j].points[k]); |
| 274 | + } |
| 275 | + } |
| 276 | + webifc::geometry::IfcCurve curve; |
| 277 | + curve.points = bimGeometry::Convert2DAlignmentsTo3D(pointsH, pointsV); |
| 278 | + alignments[i].Absolute.curves.push_back(curve); |
| 279 | + } |
| 280 | + |
248 | 281 | return alignments;
|
249 | 282 | }
|
250 | 283 |
|
@@ -752,6 +785,52 @@ void ResetCache(uint32_t modelID) {
|
752 | 785 | if (manager.IsModelOpen(modelID)) manager.GetGeometryProcessor(modelID)->GetLoader().ResetCache();
|
753 | 786 | }
|
754 | 787 |
|
| 788 | +bimGeometry::AABB CreateAABB() |
| 789 | +{ |
| 790 | + return bimGeometry::AABB(); |
| 791 | +} |
| 792 | + |
| 793 | +bimGeometry::Extrusion CreateExtrusion() |
| 794 | +{ |
| 795 | + return bimGeometry::Extrusion(); |
| 796 | +} |
| 797 | + |
| 798 | +bimGeometry::Sweep CreateSweep() |
| 799 | +{ |
| 800 | + return bimGeometry::Sweep(); |
| 801 | +} |
| 802 | + |
| 803 | +bimGeometry::Revolve CreateRevolution() |
| 804 | +{ |
| 805 | + return bimGeometry::Revolve(); |
| 806 | +} |
| 807 | + |
| 808 | +bimGeometry::CylindricalRevolution CreateCylindricalRevolution() |
| 809 | +{ |
| 810 | + return bimGeometry::CylindricalRevolution(); |
| 811 | +} |
| 812 | + |
| 813 | +bimGeometry::Parabola CreateParabola() |
| 814 | +{ |
| 815 | + return bimGeometry::Parabola(); |
| 816 | +} |
| 817 | + |
| 818 | +bimGeometry::Clothoid CreateClothoid() |
| 819 | +{ |
| 820 | + return bimGeometry::Clothoid(); |
| 821 | +} |
| 822 | + |
| 823 | +bimGeometry::Arc CreateArc() |
| 824 | +{ |
| 825 | + return bimGeometry::Arc(); |
| 826 | +} |
| 827 | + |
| 828 | +bimGeometry::Alignment CreateAlignment() |
| 829 | +{ |
| 830 | + return bimGeometry::Alignment(); |
| 831 | +} |
| 832 | + |
| 833 | + |
755 | 834 | EMSCRIPTEN_BINDINGS(my_module) {
|
756 | 835 |
|
757 | 836 | emscripten::class_<webifc::geometry::IfcGeometry>("IfcGeometry")
|
@@ -832,7 +911,8 @@ EMSCRIPTEN_BINDINGS(my_module) {
|
832 | 911 |
|
833 | 912 | emscripten::value_object<webifc::geometry::IfcAlignment>("IfcAlignment")
|
834 | 913 | .field("Horizontal", &webifc::geometry::IfcAlignment::Horizontal)
|
835 |
| - .field("Vertical", &webifc::geometry::IfcAlignment::Vertical); |
| 914 | + .field("Vertical", &webifc::geometry::IfcAlignment::Vertical) |
| 915 | + .field("Absolute", &webifc::geometry::IfcAlignment::Absolute); |
836 | 916 |
|
837 | 917 | emscripten::value_object<glm::dvec3>("glmDvec3")
|
838 | 918 | .field("x", &glm::dvec3::x)
|
@@ -868,6 +948,79 @@ EMSCRIPTEN_BINDINGS(my_module) {
|
868 | 948 |
|
869 | 949 | emscripten::register_vector<double>("DoubleVector");
|
870 | 950 |
|
| 951 | + //bimGeometry |
| 952 | + |
| 953 | + emscripten::value_object<bimGeometry::Buffers>("Buffers") |
| 954 | + .field("fvertexData", &bimGeometry::Buffers::fvertexData) |
| 955 | + .field("indexData", &bimGeometry::Buffers::indexData) |
| 956 | + ; |
| 957 | + |
| 958 | + emscripten::register_vector<float>("vector<float>"); |
| 959 | + |
| 960 | + emscripten::class_<bimGeometry::AABB>("AABB") |
| 961 | + .constructor<>() |
| 962 | + .function("GetBuffers", &bimGeometry::AABB::GetBuffers) |
| 963 | + .function("SetValues", &bimGeometry::AABB::SetValues) |
| 964 | + ; |
| 965 | + |
| 966 | + |
| 967 | + emscripten::class_<bimGeometry::Extrusion>("Extrusion") |
| 968 | + .constructor<>() |
| 969 | + .function("GetBuffers", &bimGeometry::Extrusion::GetBuffers) |
| 970 | + .function("SetValues", &bimGeometry::Extrusion::SetValues) |
| 971 | + ; |
| 972 | + |
| 973 | + emscripten::class_<bimGeometry::Sweep>("Sweep") |
| 974 | + .constructor<>() |
| 975 | + .function("GetBuffers", &bimGeometry::Sweep::GetBuffers) |
| 976 | + .function("SetValues", &bimGeometry::Sweep::SetValues) |
| 977 | + ; |
| 978 | + |
| 979 | + emscripten::class_<bimGeometry::Revolve>("Revolution") |
| 980 | + .constructor<>() |
| 981 | + .function("GetBuffers", &bimGeometry::Revolve::GetBuffers) |
| 982 | + .function("SetValues", &bimGeometry::Revolve::SetValues) |
| 983 | + ; |
| 984 | + |
| 985 | + emscripten::class_<bimGeometry::CylindricalRevolution>("CylindricalRevolution") |
| 986 | + .constructor<>() |
| 987 | + .function("GetBuffers", &bimGeometry::CylindricalRevolution::GetBuffers) |
| 988 | + .function("SetValues", &bimGeometry::CylindricalRevolution::SetValues) |
| 989 | + ; |
| 990 | + |
| 991 | + emscripten::class_<bimGeometry::Parabola>("Parabola") |
| 992 | + .constructor<>() |
| 993 | + .function("GetBuffers", &bimGeometry::Parabola::GetBuffers) |
| 994 | + .function("SetValues", &bimGeometry::Parabola::SetValues) |
| 995 | + ; |
| 996 | + |
| 997 | + emscripten::class_<bimGeometry::Clothoid>("Clothoid") |
| 998 | + .constructor<>() |
| 999 | + .function("GetBuffers", &bimGeometry::Clothoid::GetBuffers) |
| 1000 | + .function("SetValues", &bimGeometry::Clothoid::SetValues) |
| 1001 | + ; |
| 1002 | + |
| 1003 | + emscripten::class_<bimGeometry::Arc>("Arc") |
| 1004 | + .constructor<>() |
| 1005 | + .function("GetBuffers", &bimGeometry::Arc::GetBuffers) |
| 1006 | + .function("SetValues", &bimGeometry::Arc::SetValues) |
| 1007 | + ; |
| 1008 | + |
| 1009 | + emscripten::class_<bimGeometry::Alignment>("Alignment") |
| 1010 | + .constructor<>() |
| 1011 | + .function("GetBuffers", &bimGeometry::Alignment::GetBuffers) |
| 1012 | + .function("SetValues", &bimGeometry::Alignment::SetValues) |
| 1013 | + ; |
| 1014 | + |
| 1015 | + emscripten::function("CreateAABB", &CreateAABB); |
| 1016 | + emscripten::function("CreateExtrusion", &CreateExtrusion); |
| 1017 | + emscripten::function("CreateSweep", &CreateSweep); |
| 1018 | + emscripten::function("CreateRevolution", &CreateRevolution); |
| 1019 | + emscripten::function("CreateCylindricalRevolution", &CreateCylindricalRevolution); |
| 1020 | + emscripten::function("CreateParabola", &CreateParabola); |
| 1021 | + emscripten::function("CreateClothoid", &CreateClothoid); |
| 1022 | + emscripten::function("CreateArc", &CreateArc); |
| 1023 | + emscripten::function("CreateAlignment", &CreateAlignment); |
871 | 1024 | emscripten::function("LoadAllGeometry", &LoadAllGeometry);
|
872 | 1025 | emscripten::function("GetAllCrossSections", &GetAllCrossSections);
|
873 | 1026 | emscripten::function("GetAllAlignments", &GetAllAlignments);
|
|
0 commit comments