use of org.bimserver.interfaces.objects.SBounds in project BIMserver by opensourceBIM.
the class DumpUnits method main.
public static void main(String[] args) {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
List<SProjectSmall> allRelatedProjects = client.getServiceInterface().getAllRelatedProjects(31588353L);
for (SProjectSmall projectSmall : allRelatedProjects) {
if (projectSmall.getLastRevisionId() != -1 && projectSmall.getNrSubProjects() == 0) {
SProject project = client.getServiceInterface().getProjectByPoid(projectSmall.getOid());
System.out.println(project.getName());
SBounds bounds = client.getServiceInterface().getModelBounds(project.getLastRevisionId());
if (bounds != null) {
System.out.println(bounds.getMin().getX() + ", " + bounds.getMin().getY() + ", " + bounds.getMin().getZ() + " --- " + bounds.getMax().getX() + ", " + bounds.getMax().getY() + ", " + bounds.getMax().getZ());
ClientIfcModel model = client.getModel(project, project.getLastRevisionId(), false, false);
System.out.println(IfcUtils.getLengthUnitPrefix(model));
}
}
}
}
} catch (BimServerClientException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.bimserver.interfaces.objects.SBounds in project BIMserver by opensourceBIM.
the class Bounds method toSBounds.
public SBounds toSBounds() {
SBounds bounds = new SBounds();
SVector3f min = new SVector3f();
min.setX(getMinX());
min.setY(getMinY());
min.setZ(getMinZ());
SVector3f max = new SVector3f();
max.setX(getMaxX());
max.setY(getMaxY());
max.setZ(getMaxZ());
bounds.setMin(min);
bounds.setMax(max);
return bounds;
}
use of org.bimserver.interfaces.objects.SBounds in project BIMserver by opensourceBIM.
the class ServiceImpl method getModelBoundsUntransformed.
@Override
public SBounds getModelBoundsUntransformed(Long roid) throws ServerException, UserException {
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
Revision revision = session.get(roid, OldQuery.getDefault());
ConcreteRevision lastConcreteRevision = revision.getLastConcreteRevision();
Bounds bounds = lastConcreteRevision.getBoundsUntransformed();
Vector3f min = bounds.getMin();
Vector3f max = bounds.getMax();
if (lastConcreteRevision.getMultiplierToMm() != 1f) {
min.setX(min.getX() * lastConcreteRevision.getMultiplierToMm());
min.setY(min.getY() * lastConcreteRevision.getMultiplierToMm());
min.setZ(min.getZ() * lastConcreteRevision.getMultiplierToMm());
max.setX(max.getX() * lastConcreteRevision.getMultiplierToMm());
max.setY(max.getY() * lastConcreteRevision.getMultiplierToMm());
max.setZ(max.getZ() * lastConcreteRevision.getMultiplierToMm());
}
return getBimServer().getSConverter().convertToSObject(bounds);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.interfaces.objects.SBounds in project BIMserver by opensourceBIM.
the class ServiceImpl method getModelBoundsUntransformedForConcreteRevision.
@Override
public SBounds getModelBoundsUntransformedForConcreteRevision(Long croid) throws ServerException, UserException {
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
ConcreteRevision concreteRevision = session.get(croid, OldQuery.getDefault());
Bounds bounds = concreteRevision.getBoundsUntransformed();
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();
}
}
use of org.bimserver.interfaces.objects.SBounds in project BIMserver by opensourceBIM.
the class Region method toSBounds.
public SBounds toSBounds() {
SBounds sBounds = new SBounds();
SVector3f min = new SVector3f();
SVector3f max = new SVector3f();
min.setX(this.min[0]);
min.setY(this.min[1]);
min.setZ(this.min[2]);
max.setX(this.max[0]);
max.setY(this.max[1]);
max.setZ(this.max[2]);
sBounds.setMin(min);
sBounds.setMax(max);
return sBounds;
}
Aggregations