public final void translateToAbsolute(IFigure child, Translatable t) { if (child != null) { child.getParent().translateToParent(t); if (!(child instanceof ScreenFigure)){ translateToAbsolute(child.getParent(), t); } } }
/** * @see IFigure#translateFromParent(Translatable) */ public void translateFromParent(Translatable t) { if (useTranslate) t.performTranslate(getHorizontalRangeModel().getValue(), getVerticalRangeModel().getValue()); super.translateFromParent(t); }
/** * @see IFigure#translateToParent(Translatable) */ public void translateToParent(Translatable t) { if (useTranslate) t.performTranslate(-getHorizontalRangeModel().getValue(), -getVerticalRangeModel().getValue()); super.translateToParent(t); }
/** * @see IFigure#translateToAbsolute(Translatable) */ public final void translateToAbsolute(Translatable t) { if (getParent() != null) { getParent().translateToParent(t); getParent().translateToAbsolute(t); } }
/** * @see IFigure#translateToRelative(Translatable) */ public final void translateToRelative(Translatable t) { if (getParent() != null) { getParent().translateToRelative(t); getParent().translateFromParent(t); } }
/** * @see org.eclipse.draw2d.Figure#translateToParent(Translatable) */ public void translateToParent(Translatable t) { t.performScale(scale); }
/** * @see org.eclipse.draw2d.Figure#translateFromParent(Translatable) */ public void translateFromParent(Translatable t) { t.performScale(1 / scale); }
/** * @see IFigure#translateFromParent(Translatable) */ public void translateFromParent(Translatable t) { if (useLocalCoordinates()) t.performTranslate(-getBounds().x - getInsets().left, -getBounds().y - getInsets().top); }
/** * @see IFigure#translateToParent(Translatable) */ public void translateToParent(Translatable t) { if (useLocalCoordinates()) t.performTranslate(getBounds().x + getInsets().left, getBounds().y + getInsets().top); }
/** * @see org.eclipse.draw2d.Figure#translateFromParent(Translatable) */ @Override public void translateFromParent(Translatable t) { t.performScale(1.0 / scale); }
/** * @see org.eclipse.draw2d.Figure#translateToParent(Translatable) */ @Override public void translateToParent(Translatable t) { t.performScale(scale); }
static void swap() { Map<IFigure, Translatable> temp = finalStates; finalStates = initialStates; initialStates = temp; }
/** * Translates a {@link Translatable} in absolute coordinates to be * layout-relative, i.e. relative to the {@link #getLayoutContainer()}'s * origin, which is obtained via {@link #getLayoutOrigin()}. * * @param t * the Translatable in absolute coordinates to be translated to * layout-relative coordinates. * @since 3.7 */ protected void translateFromAbsoluteToLayoutRelative(Translatable t) { IFigure figure = getLayoutContainer(); figure.translateToRelative(t); figure.translateFromParent(t); Point negatedLayoutOrigin = getLayoutOrigin().getNegated(); t.performTranslate(negatedLayoutOrigin.x, negatedLayoutOrigin.y); }
/** * Translates a {@link Translatable} in layout-relative coordinates, i.e. * relative to {@link #getLayoutContainer()}'s origin which is obtained via * {@link #getLayoutOrigin()}, into absolute coordinates. * * @param t * the Translatable in layout-relative coordinates to be * translated into absolute coordinates. * @since 3.7 */ protected void translateFromLayoutRelativeToAbsolute(Translatable t) { IFigure figure = getLayoutContainer(); Point layoutOrigin = getLayoutOrigin(); t.performTranslate(layoutOrigin.x, layoutOrigin.y); figure.translateToParent(t); figure.translateToAbsolute(t); }
/** * Translates from a given figure to absolute coordinates. * * @param figure * the reference figure * @param t * the object to translate */ protected void makeAbsolute(IFigure figure, Translatable t) { figure.translateToAbsolute(t); }
/** * Translates from absolute to coordinates relative to the given figure. * * @param figure * the reference figure * @param t * the object to translate */ protected void makeRelative(IFigure figure, Translatable t) { figure.translateToRelative(t); }
/** * Translates a Translatable from this IFigure's parent's coordinates to * this IFigure's local coordinates. * * @param t * The object to translate */ void translateFromParent(Translatable t);
/** * Translates a Translatable that is relative to this figure's bounds to * absolute. * * @param t * The object to translate */ void translateToAbsolute(Translatable t);
/** * Translates a Translatable from this IFigure's coordinates to its parent's * coordinates. * * @param t * The object to translate */ void translateToParent(Translatable t);
/** * Translates a Translatable in absolute coordinates to be relative to this * figure's bounds. * * @param t * The object to translate */ void translateToRelative(Translatable t);