private PrecisionRectangle getGeoBoundsFromROI(Rectangle roiDataBounds) { PrecisionPoint lt = ((GraphArea) getParent()) .getGeoLocation( roiDataBounds.preciseX() - intensityGraphFigure.getCropLeft(), roiDataBounds.preciseY() - intensityGraphFigure.getCropTop()); PrecisionPoint rb = ((GraphArea) getParent()) .getGeoLocation( roiDataBounds.preciseX() + roiDataBounds.preciseWidth() - intensityGraphFigure.getCropLeft(), roiDataBounds.preciseY() + roiDataBounds.preciseHeight() - intensityGraphFigure.getCropTop()); return new PrecisionRectangle( lt.preciseX() - getBounds().x, lt.preciseY() - getBounds().y, rb.preciseX() - lt.preciseX(), rb.preciseY() - lt.preciseY()); }
private Rectangle getROIFromGeoBounds(PrecisionRectangle roiBounds) { PrecisionPoint lt = ((GraphArea) getParent()).getDataLocation(roiBounds.preciseX(), roiBounds.preciseY()); PrecisionPoint rb = ((GraphArea) getParent()) .getDataLocation( roiBounds.preciseX() + roiBounds.preciseWidth(), roiBounds.preciseY() + roiBounds.preciseHeight()); return new Rectangle( (int) Math.round(lt.preciseX()) + intensityGraphFigure.getCropLeft(), (int) Math.round(lt.preciseY()) + intensityGraphFigure.getCropTop(), (int) Math.ceil(rb.preciseX() - lt.preciseX()), (int) Math.ceil(rb.preciseY() - lt.preciseY())); }