Search in sources :

Example 11 with SBounds

use of org.bimserver.interfaces.objects.SBounds in project BIMserver by opensourceBIM.

the class ServiceImpl method getModelBoundsForConcreteRevision.

@Override
public SBounds getModelBoundsForConcreteRevision(Long croid) throws ServerException, UserException {
    DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
    try {
        ConcreteRevision concreteRevision = session.get(croid, OldQuery.getDefault());
        Bounds bounds = concreteRevision.getBounds();
        Vector3f min = bounds.getMin();
        Vector3f max = bounds.getMax();
        if (concreteRevision.getMultiplierToMm() != 1f) {
            min.setX(min.getX() * concreteRevision.getMultiplierToMm());
            min.setY(min.getY() * concreteRevision.getMultiplierToMm());
            min.setZ(min.getZ() * concreteRevision.getMultiplierToMm());
            max.setX(max.getX() * concreteRevision.getMultiplierToMm());
            max.setY(max.getY() * concreteRevision.getMultiplierToMm());
            max.setZ(max.getZ() * concreteRevision.getMultiplierToMm());
        }
        return getBimServer().getSConverter().convertToSObject(bounds);
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : ConcreteRevision(org.bimserver.models.store.ConcreteRevision) DatabaseSession(org.bimserver.database.DatabaseSession) Bounds(org.bimserver.models.geometry.Bounds) SBounds(org.bimserver.interfaces.objects.SBounds) SVector3f(org.bimserver.interfaces.objects.SVector3f) Vector3f(org.bimserver.models.geometry.Vector3f) ServiceException(org.bimserver.shared.exceptions.ServiceException) IOException(java.io.IOException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) SerializerException(org.bimserver.plugins.serializers.SerializerException) BcfException(org.opensourcebim.bcf.BcfException) UserException(org.bimserver.shared.exceptions.UserException) CannotBeScheduledException(org.bimserver.longaction.CannotBeScheduledException) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) ServerException(org.bimserver.shared.exceptions.ServerException) PluginException(org.bimserver.shared.exceptions.PluginException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException)

Aggregations

SBounds (org.bimserver.interfaces.objects.SBounds)11 SVector3f (org.bimserver.interfaces.objects.SVector3f)8 IOException (java.io.IOException)7 UnsupportedEncodingException (java.io.UnsupportedEncodingException)7 MalformedURLException (java.net.MalformedURLException)7 FileAlreadyExistsException (java.nio.file.FileAlreadyExistsException)7 MessagingException (javax.mail.MessagingException)7 AddressException (javax.mail.internet.AddressException)7 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)7 DatabaseSession (org.bimserver.database.DatabaseSession)7 CannotBeScheduledException (org.bimserver.longaction.CannotBeScheduledException)7 Bounds (org.bimserver.models.geometry.Bounds)7 ConcreteRevision (org.bimserver.models.store.ConcreteRevision)7 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)7 SerializerException (org.bimserver.plugins.serializers.SerializerException)7 PluginException (org.bimserver.shared.exceptions.PluginException)7 ServerException (org.bimserver.shared.exceptions.ServerException)7 ServiceException (org.bimserver.shared.exceptions.ServiceException)7 UserException (org.bimserver.shared.exceptions.UserException)7 BcfException (org.opensourcebim.bcf.BcfException)7