use of org.bimserver.models.ifc2x3tc1.IfcObject in project BIMserver by opensourceBIM.
the class IfcUtils method getStringProperty.
public static String getStringProperty(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)) {
IfcValue nominalValue = propertyValue.getNominalValue();
return nominalValueToString(nominalValue);
}
}
}
}
}
}
return null;
}
use of org.bimserver.models.ifc2x3tc1.IfcObject 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.IfcObject 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