Scale factor for feedback layer [message #636451] |
Mon, 01 November 2010 12:35 |
Eclipse User |
|
|
|
Originally posted by: torsten.keil.isx-software.de
We use the feedback layer of the diagram
(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) to add
additional information to elements selected in another view.
This works perfect as long as the scale factor is 1 (100%) or the
figures drawn in the feedback layer are "independent" from the elements
in the default layer.
If the diagram is scaled it doesn't work, because the scale factor of
the graphics provided to the figures in the feedback layer is always 1
(100%) and the graphics object isn't an advanced graphics object like
the one used in the default layer.
Is there a common way to solve the problem of the unknown scale factor?
Do i have a chance to get another advanced graphics object for figures
in the feedback layer?
Thanks in advance,
Torsten
|
|
|
Re: Scale factor for feedback layer [message #636642 is a reply to message #636451] |
Tue, 02 November 2010 10:05 |
Eclipse User |
|
|
|
Originally posted by: torsten.keil.isx-software.de
After further investigation i figured out the difference between scaled
and unscaled layers. The layer returned for
org.eclipse.gef.LayerConstants.FEEDBACK_LAYER is an unscaled layer.
There could be also a scaled feedback layer that is normally installed
in
org.eclipse.gef.editparts.ScalableFreeformRootEditPart.creat eScaledLayers(),
but the GMF
org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEdit Part.createScaledLayers()
doesn't install a layer for
org.eclipse.gef.LayerConstants.SCALED_FEEDBACK_LAYER (Why? Is there a
reason?)
The solution is to "ask" for the scaled feedback layer and install a new
one if it doesn't exist already.
private IFigure getScaledFeedbackLayer() {
DiagramRootEditPart dep = getDiagramRootEditPart();
if (dep != null) {
IFigure layer = dep.getLayer(LayerConstants.SCALABLE_LAYERS);
if (layer instanceof ScalableFreeformLayeredPane) {
Layer feedbackLayer = ((ScalableFreeformLayeredPane)
layer).getLayer(LayerConstants.SCALED_FEEDBACK_LAYER);
if (feedbackLayer == null) {
feedbackLayer = new FreeformLayer();
feedbackLayer.setEnabled(false);
layer.add(feedbackLayer, LayerConstants.SCALED_FEEDBACK_LAYER);
}
return feedbackLayer;
}
}
return null;
}
It's important to install the new layer into the scalable layered pane,
so that the ZoomManager for the scaled layers automatically handels it.
Torsten
Am 01.11.2010 13:35, schrieb Torsten Keil:
> We use the feedback layer of the diagram
> (org.eclipse.gef.editparts.ScalableFreeformRootEditPart) to add
> additional information to elements selected in another view.
>
> This works perfect as long as the scale factor is 1 (100%) or the
> figures drawn in the feedback layer are "independent" from the elements
> in the default layer.
>
> If the diagram is scaled it doesn't work, because the scale factor of
> the graphics provided to the figures in the feedback layer is always 1
> (100%) and the graphics object isn't an advanced graphics object like
> the one used in the default layer.
>
> Is there a common way to solve the problem of the unknown scale factor?
> Do i have a chance to get another advanced graphics object for figures
> in the feedback layer?
>
> Thanks in advance,
> Torsten
|
|
|
Powered by
FUDForum. Page generated in 0.02489 seconds