use of org.bimserver.models.ifc2x3tc1.IfcRelDefines in project BIMserver by opensourceBIM.
the class IfcUtils method listProperties.
/**
* Lists all properties of a given IfcPopertySet that are of type IfcPropertySingleValue, all values are converted to the appropriate Java type
*
* @param ifcObject
* @param propertySetName
* @return
*/
public static Map<String, Object> listProperties(IfcObject ifcObject, String propertySetName) {
Map<String, Object> result = new HashMap<>();
for (IfcRelDefines ifcRelDefines : ifcObject.getIsDefinedBy()) {
if (ifcRelDefines instanceof IfcRelDefinesByProperties) {
IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines;
IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition();
if (propertySetDefinition instanceof IfcPropertySet) {
IfcPropertySet ifcPropertySet = (IfcPropertySet) propertySetDefinition;
if (ifcPropertySet.getName() != null && ifcPropertySet.getName().equalsIgnoreCase(propertySetName)) {
for (IfcProperty ifcProperty : ifcPropertySet.getHasProperties()) {
if (ifcProperty instanceof IfcPropertySingleValue) {
IfcPropertySingleValue propertyValue = (IfcPropertySingleValue) ifcProperty;
result.put(propertyValue.getName(), nominalValueToObject(propertyValue.getNominalValue()));
}
}
}
}
}
}
return result;
}
use of org.bimserver.models.ifc2x3tc1.IfcRelDefines in project BIMserver by opensourceBIM.
the class IfcUtils method getIfcQuantityVolume.
public static Double getIfcQuantityVolume(IfcProduct ifcProduct, String name) {
for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) {
if (ifcRelDefines instanceof IfcRelDefinesByProperties) {
IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines;
IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition();
if (propertySetDefinition instanceof IfcElementQuantity) {
if (propertySetDefinition.getName().equals("BaseQuantities")) {
IfcElementQuantity ifcElementQuantity = (IfcElementQuantity) propertySetDefinition;
for (IfcPhysicalQuantity ifcPhysicalQuantity : ifcElementQuantity.getQuantities()) {
if (ifcPhysicalQuantity instanceof IfcQuantityVolume) {
return ((IfcQuantityVolume) ifcPhysicalQuantity).getVolumeValue();
}
}
}
}
}
}
return null;
}
use of org.bimserver.models.ifc2x3tc1.IfcRelDefines in project BIMserver by opensourceBIM.
the class IfcUtils method getBooleanProperty.
public static Tristate getBooleanProperty(IfcObject ifcObject, String propertyName) {
for (IfcRelDefines ifcRelDefines : ifcObject.getIsDefinedBy()) {
if (ifcRelDefines instanceof IfcRelDefinesByProperties) {
IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines;
IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition();
if (propertySetDefinition instanceof IfcPropertySet) {
IfcPropertySet ifcPropertySet = (IfcPropertySet) propertySetDefinition;
for (IfcProperty ifcProperty : ifcPropertySet.getHasProperties()) {
if (ifcProperty instanceof IfcPropertySingleValue) {
IfcPropertySingleValue propertyValue = (IfcPropertySingleValue) ifcProperty;
if (ifcProperty.getName().equals(propertyName)) {
IfcBoolean label = (IfcBoolean) propertyValue.getNominalValue();
return label.getWrappedValue();
}
}
}
}
}
}
return null;
}
Aggregations