use of org.bimserver.client.GeometryTargetImpl in project BIMserver by opensourceBIM.
the class TestGetGeometry 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), "ifc2x3tc1");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
Path path = Paths.get("../../TestFiles/TestData/data/export1.ifc");
SLongCheckinActionState actionState = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, (title, progress) -> System.out.println(title + ": " + progress));
PackageMetaData packageMetaData = client.getMetaDataManager().getPackageMetaData("ifc2x3tc1");
GeometryTargetImpl geometryTargetImpl = new GeometryTargetImpl(packageMetaData);
GeometryLoader geometryLoader = new GeometryLoader(client, packageMetaData, geometryTargetImpl);
Set<Long> oids = new HashSet<>();
// Only to gather oids
ClientIfcModel model = client.getModel(project, actionState.getRoid(), true, false, false);
for (IfcWall ifcWall : model.getAllWithSubTypes(IfcWall.class)) {
oids.add(ifcWall.getOid());
}
geometryLoader.loadProducts(actionState.getRoid(), oids);
System.out.println(geometryTargetImpl);
Set<Long> geometryDataOids = new HashSet<>();
for (GeometryInfo geometryInfo : geometryTargetImpl.getAllGeometryInfo()) {
GeometryData geometryData = geometryInfo.getData();
System.out.println(geometryInfo.getPrimitiveCount());
System.out.println(geometryData.getNrIndices());
geometryDataOids.add(geometryData.getOid());
}
geometryTargetImpl = new GeometryTargetImpl(packageMetaData);
geometryLoader = new GeometryLoader(client, packageMetaData, geometryTargetImpl);
geometryLoader.loadGeometryData(actionState.getRoid(), geometryDataOids);
System.out.println(geometryTargetImpl);
}
}
Thread.sleep(1000);
}
Aggregations