Search in sources :

Example 1 with Geometry

use of org.bimserver.plugins.services.Geometry in project BIMserver by opensourceBIM.

the class BimServerClient method getGeometry.

@Override
public Geometry getGeometry(long roid, IdEObject ifcProduct) {
    try {
        SSerializerPluginConfiguration serializerByPluginClassName = getPluginInterface().getSerializerByPluginClassName("org.bimserver.serializers.binarygeometry.BinaryGeometrySerializerPlugin");
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        download(roid, serializerByPluginClassName.getOid(), outputStream);
        Files.write(Paths.get("bin.bin"), outputStream.toByteArray());
        ByteArrayInputStream bain = new ByteArrayInputStream(outputStream.toByteArray());
        return new Geometry(bain, ifcProduct.getOid());
    } catch (ServerException e) {
        e.printStackTrace();
    } catch (UserException e) {
        e.printStackTrace();
    } catch (PublicInterfaceNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (BimServerClientException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : Geometry(org.bimserver.plugins.services.Geometry) ServerException(org.bimserver.shared.exceptions.ServerException) ByteArrayInputStream(java.io.ByteArrayInputStream) PublicInterfaceNotFoundException(org.bimserver.shared.exceptions.PublicInterfaceNotFoundException) SSerializerPluginConfiguration(org.bimserver.interfaces.objects.SSerializerPluginConfiguration) ByteArrayOutputStream(java.io.ByteArrayOutputStream) UserException(org.bimserver.shared.exceptions.UserException) IOException(java.io.IOException) BimServerClientException(org.bimserver.shared.exceptions.BimServerClientException)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 SSerializerPluginConfiguration (org.bimserver.interfaces.objects.SSerializerPluginConfiguration)1 Geometry (org.bimserver.plugins.services.Geometry)1 BimServerClientException (org.bimserver.shared.exceptions.BimServerClientException)1 PublicInterfaceNotFoundException (org.bimserver.shared.exceptions.PublicInterfaceNotFoundException)1 ServerException (org.bimserver.shared.exceptions.ServerException)1 UserException (org.bimserver.shared.exceptions.UserException)1