use of org.bimserver.interfaces.objects.SGeometryInfo in project BIMserver by opensourceBIM.
the class ServiceImpl method getGeometryInfo.
@Override
public SGeometryInfo getGeometryInfo(Long roid, Long oid) throws UserException, ServerException {
requireAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<SGeometryInfo> action = new GetGeometryInfoDatabaseAction(getBimServer(), session, getInternalAccessMethod(), roid, oid, getAuthorization());
return session.executeAndCommitAction(action);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.interfaces.objects.SGeometryInfo in project BIMserver by opensourceBIM.
the class GetGeometryInfoDatabaseAction method execute.
@Override
public SGeometryInfo execute() throws UserException, BimserverDatabaseException, BimserverLockConflictException {
Revision revision = getDatabaseSession().get(roid, OldQuery.getDefault());
Project project = revision.getProject();
PackageMetaData packageMetaData = bimServer.getMetaDataManager().getPackageMetaData(project.getSchema());
IdEObject ifcProduct = getDatabaseSession().get(oid, new OldQuery(packageMetaData, project.getId(), revision.getId(), revision.getOid()));
if (ifcProduct == null) {
throw new UserException("Object with oid " + oid + " not found");
}
EStructuralFeature geometryFeature = packageMetaData.getEClass("IfcProduct").getEStructuralFeature("geometry");
GeometryInfo geometry = (GeometryInfo) ifcProduct.eGet(geometryFeature);
SGeometryInfo convertToSObject = bimServer.getSConverter().convertToSObject(geometry);
return convertToSObject;
}
Aggregations