use of org.opennms.features.topology.api.BoundingBox in project opennms by OpenNMS.
the class DefaultMapViewManager method setBoundingBox.
@Override
public void setBoundingBox(BoundingBox boundingBox) {
BoundingBox oldBoundingBox = getCurrentBoundingBox();
BoundingBox bbPrime = boundingBox.computeWithAspectRatio(getViewPortAspectRatio());
BoundingBox mPrime = m_mapBounds.computeWithAspectRatio(getViewPortAspectRatio());
double oldScale = m_scale;
m_scale = Math.log(bbPrime.getWidth() / (double) mPrime.getWidth()) / Math.log((m_viewPortWidth / 2.0) / (double) mPrime.getWidth());
m_scale = Math.min(1.0, m_scale);
m_scale = Math.max(0.0, m_scale);
m_scale = ((double) Math.round(m_scale * 10.0)) / 10.0;
Point oldCenter = m_center;
m_center = boundingBox.getCenter();
BoundingBox newBoundingBox = getCurrentBoundingBox();
// TODO: Sonar is warning on the equals comparison of m_scale and oldScale
if (!oldCenter.equals(m_center) || oldScale != m_scale || !oldBoundingBox.equals(newBoundingBox)) {
fireUpdate();
}
}
use of org.opennms.features.topology.api.BoundingBox in project opennms by OpenNMS.
the class DefaultLayout method getBounds.
@Override
public BoundingBox getBounds() {
if (m_locations.size() > 0) {
return computeBoundingBox(m_locations.keySet());
} else {
BoundingBox bBox = new BoundingBox();
bBox.addPoint(new Point(0, 0));
return bBox;
}
}
Aggregations