|
|
|
@@ -451,29 +451,29 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
|
|
|
|
|
}
|
|
|
|
|
if (coordops) {
|
|
|
|
|
for (auto& coordop : *coordops) {
|
|
|
|
|
IfcUtil::IfcBaseClass* source_crs = *coordop->as<IfcUtil::IfcBaseEntity>()->get("SourceCRS");
|
|
|
|
|
IfcUtil::IfcBaseClass* source_crs = coordop->as<IfcUtil::IfcBaseEntity>()->get("SourceCRS");
|
|
|
|
|
if (source_crs->declaration().is("IfcGeometricRepresentationContext")) {
|
|
|
|
|
IfcUtil::IfcBaseClass* target_crs = *coordop->as<IfcUtil::IfcBaseEntity>()->get("TargetCRS");
|
|
|
|
|
IfcUtil::IfcBaseClass* target_crs = coordop->as<IfcUtil::IfcBaseEntity>()->get("TargetCRS");
|
|
|
|
|
auto name_attr = target_crs->as<IfcUtil::IfcBaseEntity>()->get("Name");
|
|
|
|
|
if (coordop->declaration().is("IfcMapConversion")) {
|
|
|
|
|
|
|
|
|
|
if (!name_attr->isNull()) {
|
|
|
|
|
std::string epsg_code = *name_attr;
|
|
|
|
|
if (!name_attr.isNull()) {
|
|
|
|
|
std::string epsg_code = name_attr;
|
|
|
|
|
crs_epsg = epsg_code;
|
|
|
|
|
|
|
|
|
|
// @todo in which unit are these?
|
|
|
|
|
double eastings = *coordop->as<IfcUtil::IfcBaseEntity>()->get("Eastings");
|
|
|
|
|
double northings = *coordop->as<IfcUtil::IfcBaseEntity>()->get("Northings");
|
|
|
|
|
double height = *coordop->as<IfcUtil::IfcBaseEntity>()->get("OrthogonalHeight");
|
|
|
|
|
double eastings = coordop->as<IfcUtil::IfcBaseEntity>()->get("Eastings");
|
|
|
|
|
double northings = coordop->as<IfcUtil::IfcBaseEntity>()->get("Northings");
|
|
|
|
|
double height = coordop->as<IfcUtil::IfcBaseEntity>()->get("OrthogonalHeight");
|
|
|
|
|
height = 0.;
|
|
|
|
|
|
|
|
|
|
eastings_northings_elevation = { { eastings, northings, height} };
|
|
|
|
|
|
|
|
|
|
auto xaxis_attr = coordop->as<IfcUtil::IfcBaseEntity>()->get("XAxisAbscissa");
|
|
|
|
|
auto yaxis_attr = coordop->as<IfcUtil::IfcBaseEntity>()->get("XAxisOrdinate");
|
|
|
|
|
if (!xaxis_attr->isNull() && !yaxis_attr->isNull()) {
|
|
|
|
|
double xaxis = *xaxis_attr;
|
|
|
|
|
double yaxis = *yaxis_attr;
|
|
|
|
|
if (!xaxis_attr.isNull() && !yaxis_attr.isNull()) {
|
|
|
|
|
double xaxis = xaxis_attr;
|
|
|
|
|
double yaxis = yaxis_attr;
|
|
|
|
|
|
|
|
|
|
crs_x_axis = { { xaxis, yaxis, 0. } };
|
|
|
|
|
}
|
|
|
|
@@ -490,9 +490,9 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
|
|
|
|
|
auto lat_attr = (*sites->begin())->as<IfcUtil::IfcBaseEntity>()->get("RefLatitude");
|
|
|
|
|
auto lon_attr = (*sites->begin())->as<IfcUtil::IfcBaseEntity>()->get("RefLongitude");
|
|
|
|
|
|
|
|
|
|
if (!lat_attr->isNull() && !lon_attr->isNull()) {
|
|
|
|
|
std::vector<int> lat_dms = *lat_attr;
|
|
|
|
|
std::vector<int> lon_dms = *lon_attr;
|
|
|
|
|
if (!lat_attr.isNull() && !lon_attr.isNull()) {
|
|
|
|
|
std::vector<int> lat_dms = lat_attr;
|
|
|
|
|
std::vector<int> lon_dms = lon_attr;
|
|
|
|
|
|
|
|
|
|
auto to_decimal = [](const std::vector<int>& dms) {
|
|
|
|
|
double val = dms[0] + dms[1] / 60. + dms[2] / 3600.;
|
|
|
|
@@ -524,10 +524,10 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
|
|
|
|
|
if (contexts && contexts->size() > 0) {
|
|
|
|
|
auto context = (*contexts->begin())->as<IfcUtil::IfcBaseEntity>();
|
|
|
|
|
auto north_attr = context->get("TrueNorth");
|
|
|
|
|
if (!north_attr->isNull()) {
|
|
|
|
|
IfcUtil::IfcBaseClass* north = *north_attr;
|
|
|
|
|
if (!north_attr.isNull()) {
|
|
|
|
|
IfcUtil::IfcBaseClass* north = north_attr;
|
|
|
|
|
if (north->declaration().is("IfcDirection")) {
|
|
|
|
|
std::vector<double> ratios = *north->as<IfcUtil::IfcBaseEntity>()->get("DirectionRatios");
|
|
|
|
|
std::vector<double> ratios = north->as<IfcUtil::IfcBaseEntity>()->get("DirectionRatios");
|
|
|
|
|
crs_x_axis = { { ratios[1], -ratios[0], 0. } };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|