Search in sources :

Example 1 with IfcArcIndex

use of org.bimserver.models.ifc4.IfcArcIndex in project BIMserver by opensourceBIM.

the class TestIfc4TwoDimensional3 method test.

@Test
public void test() throws Exception {
    try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
        try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
            SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc4");
            SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
            Path path = Paths.get("../../TestFiles/TestData/data/ifc4add2tc1/slab-standard-case.ifc");
            SLongCheckinActionState actionState = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, (title, progress) -> System.out.println(title + ": " + progress));
            ClientIfcModel model = client.getModel(project, actionState.getRoid(), true, false);
            List<IfcIndexedPolyCurve> polyCurves = model.getAll(IfcIndexedPolyCurve.class);
            Assert.assertEquals(1, polyCurves.size());
            for (IfcIndexedPolyCurve ifcIndexedPolyCurve : polyCurves) {
                EList<IfcSegmentIndexSelect> segments = ifcIndexedPolyCurve.getSegments();
                Assert.assertEquals(4, segments.size());
                for (IfcSegmentIndexSelect ifcSegmentIndexSelect : segments) {
                    if (ifcSegmentIndexSelect instanceof IfcLineIndex) {
                        Assert.assertEquals(2, ((IfcLineIndex) ifcSegmentIndexSelect).getWrappedValue().size());
                    } else if (ifcSegmentIndexSelect instanceof IfcArcIndex) {
                        Assert.assertEquals(3, ((IfcArcIndex) ifcSegmentIndexSelect).getWrappedValue().size());
                    }
                }
            }
        }
        Thread.sleep(500);
    }
}
Also used : Path(java.nio.file.Path) IfcLineIndex(org.bimserver.models.ifc4.IfcLineIndex) ClientIfcModel(org.bimserver.client.ClientIfcModel) SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) SLongCheckinActionState(org.bimserver.interfaces.objects.SLongCheckinActionState) IfcIndexedPolyCurve(org.bimserver.models.ifc4.IfcIndexedPolyCurve) SProject(org.bimserver.interfaces.objects.SProject) IfcArcIndex(org.bimserver.models.ifc4.IfcArcIndex) BimServerClient(org.bimserver.client.BimServerClient) IfcSegmentIndexSelect(org.bimserver.models.ifc4.IfcSegmentIndexSelect) Test(org.junit.Test)

Aggregations

Path (java.nio.file.Path)1 BimServerClient (org.bimserver.client.BimServerClient)1 ClientIfcModel (org.bimserver.client.ClientIfcModel)1 JsonBimServerClientFactory (org.bimserver.client.json.JsonBimServerClientFactory)1 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)1 SLongCheckinActionState (org.bimserver.interfaces.objects.SLongCheckinActionState)1 SProject (org.bimserver.interfaces.objects.SProject)1 IfcArcIndex (org.bimserver.models.ifc4.IfcArcIndex)1 IfcIndexedPolyCurve (org.bimserver.models.ifc4.IfcIndexedPolyCurve)1 IfcLineIndex (org.bimserver.models.ifc4.IfcLineIndex)1 IfcSegmentIndexSelect (org.bimserver.models.ifc4.IfcSegmentIndexSelect)1 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)1 Test (org.junit.Test)1