Search in sources :

Example 6 with IfcProperty

use of org.bimserver.models.ifc2x3tc1.IfcProperty 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;
}
Also used : IfcProperty(org.bimserver.models.ifc2x3tc1.IfcProperty) IfcPropertySingleValue(org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue) HashMap(java.util.HashMap) EObject(org.eclipse.emf.ecore.EObject) IdEObject(org.bimserver.emf.IdEObject) IfcObject(org.bimserver.models.ifc2x3tc1.IfcObject) IfcRelDefinesByProperties(org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties) IfcPropertySet(org.bimserver.models.ifc2x3tc1.IfcPropertySet) IfcPropertySetDefinition(org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition) IfcRelDefines(org.bimserver.models.ifc2x3tc1.IfcRelDefines)

Aggregations

IfcProperty (org.bimserver.models.ifc2x3tc1.IfcProperty)6 IfcPropertySet (org.bimserver.models.ifc2x3tc1.IfcPropertySet)6 IfcPropertySetDefinition (org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition)6 IfcRelDefines (org.bimserver.models.ifc2x3tc1.IfcRelDefines)6 IfcRelDefinesByProperties (org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties)6 IfcPropertySingleValue (org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue)5 IfcValue (org.bimserver.models.ifc2x3tc1.IfcValue)3 URL (java.net.URL)2 HashSet (java.util.HashSet)2 IfcModelInterface (org.bimserver.emf.IfcModelInterface)2 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)2 SProject (org.bimserver.interfaces.objects.SProject)2 IfcBoolean (org.bimserver.models.ifc2x3tc1.IfcBoolean)2 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)2 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 IdEObject (org.bimserver.emf.IdEObject)1 IfcAreaMeasure (org.bimserver.models.ifc2x3tc1.IfcAreaMeasure)1