use of org.bboxdb.tools.gui.DistributionRegionComponent in project bboxdb by jnidzwetzki.
the class TreeJPanel method getToolTipText.
/**
* Get the text for the tool tip
*/
@Override
public String getToolTipText(final MouseEvent event) {
final MouseEvent scaledEvent = new MouseEvent(event.getComponent(), event.getID(), event.getWhen(), event.getModifiers(), (int) (event.getX() / zoomFactor), (int) (event.getY() / zoomFactor), event.getClickCount(), event.isPopupTrigger());
for (final DistributionRegionComponent component : regions) {
if (component.isMouseOver(scaledEvent)) {
return component.getToolTipText();
}
}
setToolTipText(null);
return super.getToolTipText(event);
}
use of org.bboxdb.tools.gui.DistributionRegionComponent in project bboxdb by jnidzwetzki.
the class TreeJPanel method calculateRootNodeXPos.
/**
* Calculate the root node X position
*/
protected void calculateRootNodeXPos() {
if (regions.isEmpty()) {
return;
}
BoundingBox minBoundingBox = BoundingBox.FULL_SPACE;
for (DistributionRegionComponent component : regions) {
minBoundingBox = BoundingBox.getCoveringBox(component.getBoundingBox(), minBoundingBox);
}
final double rootCoordinateLow = regions.get(0).getBoundingBox().getCoordinateLow(0);
final double bboxCoordinateLow = minBoundingBox.getCoordinateLow(0);
final int rootOffsetBBox = (int) (rootCoordinateLow - bboxCoordinateLow) + PADDING_LEFT_RIGHT;
final int rootOffsetWindowSize = (int) ((getVisibleRect().getWidth() - DistributionRegionComponent.WIDTH) / 2);
// If the screen is bigger as the bounding box, use the screen width
rootPosX = Math.max(rootOffsetBBox, rootOffsetWindowSize);
}
use of org.bboxdb.tools.gui.DistributionRegionComponent in project bboxdb by jnidzwetzki.
the class TreeJPanel method createDistribtionRegionComponents.
/**
* Create the distribution region components
* @param distributionRegion
* @param maxChildren
*/
protected void createDistribtionRegionComponents(final DistributionRegion distributionRegion, final int maxChildren) {
if (distributionRegion == null) {
return;
}
final DistributionRegionComponent distributionRegionComponent = new DistributionRegionComponent(distributionRegion, this, guiModel, maxChildren);
regions.add(distributionRegionComponent);
for (final DistributionRegion region : distributionRegion.getDirectChildren()) {
createDistribtionRegionComponents(region, maxChildren);
}
}
use of org.bboxdb.tools.gui.DistributionRegionComponent in project bboxdb by jnidzwetzki.
the class TreeJPanel method drawDistributionRegion.
/**
* Draw the given distribution region
* @param graphics2d
* @param maxChildren
* @param distributionRegion
* @return
*/
protected BoundingBox drawDistributionRegion(final Graphics2D graphics2d) {
BoundingBox minBoundingBox = BoundingBox.FULL_SPACE;
for (final DistributionRegionComponent component : regions) {
final BoundingBox boundingBox = component.drawComponent(graphics2d);
minBoundingBox = BoundingBox.getCoveringBox(boundingBox, minBoundingBox);
}
return minBoundingBox;
}
Aggregations