| 110 | |
| 111 | template <typename Schema> |
| 112 | double IfcParse::get_SI_equivalent(typename Schema::IfcNamedUnit* named_unit) { |
| 113 | double scale = 1.; |
| 114 | typename Schema::IfcSIUnit* si_unit = 0; |
| 115 | |
| 116 | if (named_unit->declaration().is(Schema::IfcConversionBasedUnit::Class())) { |
| 117 | typename Schema::IfcConversionBasedUnit* conv_unit = named_unit->template as<typename Schema::IfcConversionBasedUnit>(); |
| 118 | typename Schema::IfcMeasureWithUnit* factor = conv_unit->ConversionFactor(); |
| 119 | typename Schema::IfcUnit* component = factor->UnitComponent(); |
| 120 | if (component->declaration().is(Schema::IfcSIUnit::Class())) { |
| 121 | si_unit = component->template as<typename Schema::IfcSIUnit>(); |
| 122 | typename Schema::IfcValue* value = factor->ValueComponent(); |
| 123 | scale = value->template as<IfcUtil::IfcBaseClass>()->get_attribute_value(0); |
| 124 | } |
| 125 | } else if (named_unit->declaration().is(Schema::IfcSIUnit::Class())) { |
| 126 | si_unit = named_unit->template as<typename Schema::IfcSIUnit>(); |
| 127 | } |
| 128 | if (si_unit) { |
| 129 | if (si_unit->Prefix()) { |
| 130 | scale *= IfcSIPrefixToValue(Schema::IfcSIPrefix::ToString(*si_unit->Prefix())); |
| 131 | } |
| 132 | } else { |
| 133 | scale = 0.; |
| 134 | } |
| 135 | |
| 136 | return scale; |
| 137 | } |
| 138 | |
| 139 | #if defined(_MSC_VER) && _MSC_VER < 1900 |
| 140 |
nothing calls this directly
no test coverage detected