fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7323] Fixed test, added IfcSystem object to model (n


From: Petur Thorsteinsson
Subject: [Fmsystem-commits] [7323] Fixed test, added IfcSystem object to model (not complete yet)
Date: Sun, 29 May 2011 20:47:21 +0000

Revision: 7323
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7323
Author:   peturbjorn
Date:     2011-05-29 20:47:19 +0000 (Sun, 29 May 2011)
Log Message:
-----------
Fixed test, added IfcSystem object to model (not complete yet)

Modified Paths:
--------------
    
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/Zone.java
    
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/ZoneTest.java
    
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/element/FurnishingTest.java

Added Paths:
-----------
    
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/SystemObject.java
    
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/SystemObjectTest.java

Added: 
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/SystemObject.java
===================================================================
--- 
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/SystemObject.java
                              (rev 0)
+++ 
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/SystemObject.java
      2011-05-29 20:47:19 UTC (rev 7323)
@@ -0,0 +1,76 @@
+package no.bimconverter.ifc.v2x3.object;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import jsdai.SIfc2x3.AIfcobjectdefinition;
+import jsdai.SIfc2x3.AIfcrelassignstogroup;
+import jsdai.SIfc2x3.EIfcgroup;
+import jsdai.SIfc2x3.EIfcobjectdefinition;
+import jsdai.SIfc2x3.EIfcrelassignstogroup;
+import jsdai.SIfc2x3.EIfcspace;
+import jsdai.SIfc2x3.EIfcsystem;
+import jsdai.SIfc2x3.EIfczone;
+import jsdai.lang.EEntity;
+import jsdai.lang.SdaiException;
+import jsdai.lang.SdaiIterator;
address@hidden
+public class SystemObject extends CommonObjectImpl implements 
FacilityManagementEntity{
+       final static private Class<EIfcsystem> ifcEntityType = EIfcsystem.class;
+       
+       public SystemObject() {
+       }
+       
+       @Override
+       public Class<? extends EIfcobjectdefinition> getIfcEntityType() {
+               return ifcEntityType;
+       }
+       
+       @Override
+       public void load(EIfcobjectdefinition object) {
+               super.load(object);
+               EIfcsystem entity = (EIfcsystem)object;
+               try {
+                       this.loadClassification(entity);
+                       this.loadProperties(entity);
+                       
+               } catch (SdaiException e) {
+                       e.printStackTrace();
+               }
+       }
+       
+       private void loadAssignment(EIfczone entity) throws SdaiException {
+               List<String> spaceIds = this.loadAssignments(entity, 
EIfczone.class, EIfcspace.class);
+               for ( String spaceId : spaceIds) {
+                       this.zoneAssignment.addSpaceId(spaceId);
+               }
+               List<String> zoneIds = this.loadAssignments(entity, 
EIfcsystem.class, EIfczone.class);
+               for ( String spaceId : zoneIds) {
+                       this.zoneAssignment.addZoneId(spaceId);
+               }
+               
+       }
+       
+       protected List<String> loadAssignments(EIfcgroup entity, Class<? 
extends EEntity> relatingGroupClass, Class<? extends EEntity> 
relatedObjectClass) throws SdaiException {
+               List<String> guidList = new ArrayList<String>();
+               AIfcrelassignstogroup groupAgg = entity.getIsgroupedby(null, 
null);
+               SdaiIterator groupIterator = groupAgg.createIterator();
+               while(groupIterator.next()) {
+                       EIfcrelassignstogroup now = 
groupAgg.getCurrentMember(groupIterator);
+                       EIfcgroup group = now.getRelatinggroup(null);
+                       if(group.isKindOf(relatingGroupClass)) {
+                               AIfcobjectdefinition relatedObjects = 
now.getRelatedobjects(null);
+                               SdaiIterator objectIterator = 
relatedObjects.createIterator();
+                               while(objectIterator.next()) {
+                                       EIfcobjectdefinition objDef = 
relatedObjects.getCurrentMember(objectIterator);
+                                       if(objDef.isKindOf(relatedObjectClass)) 
{
+                                               
guidList.add(objDef.getGlobalid(null));
+                                       }
+                               }
+                       }
+               }
+               return guidList;
+       }
+}

Modified: 
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/Zone.java
===================================================================
--- 
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/Zone.java
      2011-05-28 11:19:48 UTC (rev 7322)
+++ 
thirdparty/BIM_converter/trunk/src/main/java/no/bimconverter/ifc/v2x3/object/Zone.java
      2011-05-29 20:47:19 UTC (rev 7323)
@@ -1,5 +1,8 @@
 package no.bimconverter.ifc.v2x3.object;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.xml.bind.annotation.XmlRootElement;
 
 import no.bimconverter.ifc.jaxb.ZoneAssignment;
@@ -12,10 +15,11 @@
 import jsdai.SIfc2x3.EIfcspace;
 import jsdai.SIfc2x3.EIfcsystem;
 import jsdai.SIfc2x3.EIfczone;
+import jsdai.lang.EEntity;
 import jsdai.lang.SdaiException;
 import jsdai.lang.SdaiIterator;
 @XmlRootElement
-public class Zone extends CommonObjectImpl implements FacilityManagementEntity{
+public class Zone extends SystemObject implements FacilityManagementEntity{
        final static private Class<EIfczone> ifcEntityType = EIfczone.class;
        private ZoneAssignment zoneAssignment = new ZoneAssignment();
        public Zone() {
@@ -30,7 +34,6 @@
                super.load(object);
                EIfczone entity = (EIfczone)object;
                try {
-                       this.loadAttributes(entity);
                        this.loadClassification(entity);
                        this.loadProperties(entity);
                        this.loadAssignment(entity);
@@ -38,9 +41,20 @@
                        e.printStackTrace();
                }
        }
+       
+       
 
        private void loadAssignment(EIfczone entity) throws SdaiException {
-               // TODO Auto-generated method stub
+               List<String> spaceIds = this.loadAssignments(entity, 
EIfczone.class, EIfcspace.class);
+               for ( String spaceId : spaceIds) {
+                       this.zoneAssignment.addSpaceId(spaceId);
+               }
+               List<String> zoneIds = this.loadAssignments(entity, 
EIfcsystem.class, EIfczone.class);
+               for ( String spaceId : zoneIds) {
+                       this.zoneAssignment.addZoneId(spaceId);
+               }
+               
+               /*
                AIfcrelassignstogroup groupAgg = entity.getIsgroupedby(null, 
null);
                SdaiIterator groupIterator = groupAgg.createIterator();
                while(groupIterator.next()) {
@@ -71,6 +85,7 @@
                                }
                        }
                }
+               */
        }
 
        public ZoneAssignment getZoneAssignment() {

Added: 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/SystemObjectTest.java
===================================================================
--- 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/SystemObjectTest.java
                          (rev 0)
+++ 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/SystemObjectTest.java
  2011-05-29 20:47:19 UTC (rev 7323)
@@ -0,0 +1,41 @@
+package no.bimconverter.ifc.v2x3.object;
+
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import no.bimconverter.ifc.IfcTestMethods;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SystemObjectTest extends IfcTestMethods{  
+       
+       List<SystemObject> systemList;
+       
+       @Before
+       public void setUp() {
+               super.createTestRepo();
+               systemList = (List<SystemObject>) 
model.getFacilityManagementEntity(new SystemObject());
+       }
+
+       @After
+       public void tearDown() throws Exception {
+       }
+       
+       @Test
+       public void testInit() {
+               assertNotNull(systemList);
+               assertEquals(3, systemList.size());
+       }
+       
+       @Test
+       public void displaySystems() {
+               for(SystemObject so : this.systemList) {
+                       super.outputXmlToSystemOut(so);
+               }
+       }
+
+}

Modified: 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/ZoneTest.java
===================================================================
--- 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/ZoneTest.java
  2011-05-28 11:19:48 UTC (rev 7322)
+++ 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/ZoneTest.java
  2011-05-29 20:47:19 UTC (rev 7323)
@@ -1,6 +1,8 @@
 package no.bimconverter.ifc.v2x3.object;
 
 
+import static org.junit.Assert.*;
+
 import java.util.List;
 import java.util.Map;
 
@@ -9,6 +11,8 @@
 import javax.xml.bind.Marshaller;
 
 import no.bimconverter.ifc.IfcTestMethods;
+import no.bimconverter.ifc.jaxb.Attributes;
+import no.bimconverter.ifc.jaxb.ZoneAssignment;
 import no.bimconverter.ifc.v2x3.object.Zone;
 import org.junit.After;
 import org.junit.Assert;
@@ -34,8 +38,25 @@
        
        @Test
        public void testZone1() throws JAXBException {
-               //super.outputXmlToSystemOut(zone1);
+               super.outputXmlToSystemOut(zone1);
                Assert.assertNotNull(zone1);
        }
+       
+       @Test
+       public void testZone1Attributes(){
+               Attributes attributes = zone1.getAttributes();
+               assertEquals("0h$ksovXH3Jeg0w$Hl1aaf", attributes.getGuid());
+               assertEquals("Zone-001", attributes.getName());
+               assertEquals("Security zone for entrance", 
attributes.getDescription());
+       }
+       
+       @Test
+       public void testZone1Assigment() {
+               ZoneAssignment zoneAssignment = zone1.getZoneAssignment();
+               List<String> zoneSpaces = zoneAssignment.getSpaces();
+               assertTrue(zoneSpaces.contains("0h$ksovXH3Jeg0w$H7s8af"));
+               assertTrue(zoneSpaces.contains("0h$ksovXH3Je2d9dH7s8af"));
+               assertTrue(zoneSpaces.contains("0h$ksovXH3Jeg02dH7s8af"));
+       }
 
 }

Modified: 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/element/FurnishingTest.java
===================================================================
--- 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/element/FurnishingTest.java
    2011-05-28 11:19:48 UTC (rev 7322)
+++ 
thirdparty/BIM_converter/trunk/src/test/java/no/bimconverter/ifc/v2x3/object/element/FurnishingTest.java
    2011-05-29 20:47:19 UTC (rev 7323)
@@ -74,7 +74,7 @@
        
        public void testDisplayFurnishing(Furnishing theFurnishing) throws 
JAXBException {
                assertNotNull(theFurnishing);
-               //super.outputXmlToSystemOut(theFurnishing);
+               super.outputXmlToSystemOut(theFurnishing);
        }
        @Test
        public void testDisplayFurnishings() throws JAXBException {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]