Search in sources :

Example 1 with DistributionRegionComponent

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);
}
Also used : MouseEvent(java.awt.event.MouseEvent) DistributionRegionComponent(org.bboxdb.tools.gui.DistributionRegionComponent)

Example 2 with DistributionRegionComponent

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);
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) DistributionRegionComponent(org.bboxdb.tools.gui.DistributionRegionComponent)

Example 3 with DistributionRegionComponent

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);
    }
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) DistributionRegionComponent(org.bboxdb.tools.gui.DistributionRegionComponent)

Example 4 with DistributionRegionComponent

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;
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) DistributionRegionComponent(org.bboxdb.tools.gui.DistributionRegionComponent)

Aggregations

DistributionRegionComponent (org.bboxdb.tools.gui.DistributionRegionComponent)4 BoundingBox (org.bboxdb.commons.math.BoundingBox)2 MouseEvent (java.awt.event.MouseEvent)1 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)1