use of org.eclipse.draw2d.geometry.PrecisionRectangle in project yamcs-studio by yamcs.
the class ROIFigure method getGeoBoundsFromROI.
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());
}
use of org.eclipse.draw2d.geometry.PrecisionRectangle in project yamcs-studio by yamcs.
the class ROIFigure method getROIFromGeoBounds.
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()));
}
use of org.eclipse.draw2d.geometry.PrecisionRectangle in project yamcs-studio by yamcs.
the class GraphicalFeedbackChildEditPolicy method showChangeBoundsFeedback.
/**
* Shows or updates feedback for a change bounds request.
*
* @param request
* the request
*/
@Override
protected void showChangeBoundsFeedback(final ChangeBoundsRequest request) {
IFigure feedbackFigure = getDragSourceFeedbackFigure();
PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
getHostFigure().translateToAbsolute(rect);
Point moveDelta = request.getMoveDelta();
rect.translate(moveDelta);
Dimension sizeDelta = request.getSizeDelta();
rect.resize(sizeDelta);
feedbackFactory.showChangeBoundsFeedback((AbstractWidgetModel) getHost().getModel(), rect, feedbackFigure, request);
feedbackFigure.repaint();
}
use of org.eclipse.draw2d.geometry.PrecisionRectangle in project yamcs-studio by yamcs.
the class WidgetXYLayoutEditPolicy method getConstraintForResize.
// super.super.getConstraintFor() has been overriden to fix a bug when handle bounds does not equal with bounds. For example, polyline figue.
/**
* Generates a draw2d constraint object derived from the specified child
* EditPart using the provided Request. The returned constraint will be
* translated to the application's model later using
* {@link #translateToModelConstraint(Object)}.
*
* @param request
* the ChangeBoundsRequest
* @param child
* the child EditPart for which the constraint should be
* generated
* @return the draw2d constraint
*/
protected Object getConstraintForResize(ChangeBoundsRequest request, GraphicalEditPart child) {
Rectangle bounds = child.getFigure().getBounds();
if (child.getFigure() instanceof HandleBounds) {
bounds = ((HandleBounds) child.getFigure()).getHandleBounds();
}
Rectangle rect = new PrecisionRectangle(bounds);
child.getFigure().translateToAbsolute(rect);
rect = request.getTransformedRectangle(rect);
child.getFigure().translateToRelative(rect);
rect.translate(getLayoutOrigin().getNegated());
return getConstraintFor(rect);
}
Aggregations