urgent: the problem with resizing svg figure [message #85919] |
Sat, 16 December 2006 03:57  |
Eclipse User |
|
|
|
Originally posted by: dzhpingbo.sohu.com
I can show svg figures properly by using the code below, but it comes out
problem when resizing the figure.You can see the the problem in the attached
picture.The "activity" figure only show half when decrease the size of
figure, and there comes out big space between figure and label when increase
the size of figure.
To my surprise, the presenter.svg which I download from cvs repository of
gmf, has no problem I mentioned above when resizing the figure.
So I wonder is there something special with the presenter.svg file, because
I run the activity.svg and present.svg with the same code list below.
looking forward to your answers, because my project requires me to show the
figures properly and it comes to the end of the project soon.
public static IPath path = new Path(TRANSLATE_PATH_ARGUMENT).append("icons"
+ IPath.SEPARATOR + "Activity.svg");;
protected NodeFigure createNodePlate() {
/*return new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode()
.DPtoLP(40));*/
URL presenterURL = null;
presenterURL = FileLocator.find(NewpmbeDiagramEditorPlugin
.getInstance().getBundle(), path, null);
RenderedImage rndImg = RenderedImageFactory.getInstance(presenterURL);
final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
true, true);
NodeFigure figure = new WrapperNodeFigure(sif) {
protected ConnectionAnchor createDefaultAnchor() {
return new SlidableImageAnchor(this, sif);
}
protected ConnectionAnchor createAnchor(PrecisionPoint p) {
if (p == null)
// If the old terminal for the connection anchor cannot be resolved (by
SlidableAnchor) a null
// PrecisionPoint will passed in - this is handled here
return createDefaultAnchor();
return new SlidableImageAnchor(this, sif, p);
}
};
return figure;
}
|
|
|
|
|
|
Re: urgent: the problem with resizing svg figure [message #86060 is a reply to message #85999] |
Sun, 17 December 2006 15:11   |
Eclipse User |
|
|
|
Hi,
From the way you construct the ScalableImageFigure I understand that you'd
like to preserve the original SVG image aspect ratio, correct?
final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
true, true);
You can try not to respect them and construct the image figure as
following:
final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
false, true);
This will render the SVG image to occupy the entire bounds of the figure.
If you really want your image to have aspect ratio of the oeriginal image
try use latest GMF from HEAD or R1_maintanance. There used to be a bug
with the aspect ratio of the images - the original aspect ratio wasn't
respected properly. It sounds like you're experiencing this bug - after
resizing the image it becomes cut off. (Bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=163123)
Hope this helps.
Cheers,
Alex
|
|
|
Re: urgent: the problem with resizing svg figure [message #86105 is a reply to message #86060] |
Mon, 18 December 2006 02:10   |
Eclipse User |
|
|
|
Thank you so much:) according to your help, I succed in showing the figure
properly:)
"Alex Boyko" <aboyko@ca.ibm.com>
??????:202da8233689efe4278f6394e9261abd$1@www.eclipse.org...
> Hi,
>
> From the way you construct the ScalableImageFigure I understand that you'd
> like to preserve the original SVG image aspect ratio, correct?
> final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
> true, true);
>
>
> You can try not to respect them and construct the image figure as
> following:
>
> final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
> false, true);
>
> This will render the SVG image to occupy the entire bounds of the figure.
>
> If you really want your image to have aspect ratio of the oeriginal image
> try use latest GMF from HEAD or R1_maintanance. There used to be a bug
> with the aspect ratio of the images - the original aspect ratio wasn't
> respected properly. It sounds like you're experiencing this bug - after
> resizing the image it becomes cut off. (Bug:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=163123)
> Hope this helps.
>
> Cheers,
> Alex
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04195 seconds