Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » urgent: the problem with resizing svg figure
urgent: the problem with resizing svg figure [message #85919] Sat, 16 December 2006 08:57 Go to next message
Eclipse UserFriend
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 #85937 is a reply to message #85919] Sat, 16 December 2006 11:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

I know it relevents to viewbox, list below. But how can I know the width and
height of the svg file? which tool should I use to figure out the width and
height of the svg file?
<svg xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
width="35.81445" height="91.60449" viewBox="0 0 35.81445 91.60449"
overflow="visible" enable-background="new 0 0 35.81445 91.60449"
xml:space="preserve">

and I had alter activity.svg file by adding viewBox="150 0 70.81445
200.60449" just as presenter.svg file does, it come out properly before
resizing the figure, but it still can only show part of the figure when
resizing the figure, what is wrong with my svg file?

"dzh" <dzhpingbo@sohu.com> д
Re: urgent: the problem with resizing svg figure [message #85969 is a reply to message #85919] Sat, 16 December 2006 18:21 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
----++Omea_Parts_Splitter.426322526496985
Content-Type: text/plain; charset=utf-7
Content-Transfer-Encoding: quoted-printable

Hello=20dzh,

I'm=20not=20an=20expert=20in=20SVG,=20but=20by=20comparing=2 0Activity=2esvg=20and=20present=2esvg=20I=20found=20that=20t here=20is=20no=20+ACI-width/height+AD0AIg-=20and=20+ACI-view Box+ACI-=20attributes=20specified=20in=20Activity=2esvg=20At tached=20Activity=2esvg=20works=20well=2e

-----------------
Alex=20Shatalin

----++Omea_Parts_Splitter.426322526496985
Content-Type: application/octet-stream; name="Activity.svg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Activity.svg"

PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg0KPHN2ZyB3
aWR0aD0iMzIwIiBoZWlnaHQ9IjIwMCIgdmlld0JveD0iMCAwIDMyMCAyMDAi
Pg0KCTxnPg0KCQk8Zz4NCgkJCTxlbGxpcHNlIGN4PSIxNjAiIGN5PSIxMDAi
IHJ4PSIxNjAiIHJ5PSIxMDAiIHN0cm9rZT0iUkdCKDI1NSwwLDApIiBmaWxs
PSJSR0IoMjU1LDEyOCwxMjgpIiBzdHJva2Utd2lkdGg9IjEiIHN0cm9rZS1k
YXNoYXJyYXk9Im5vbmUiLz4NCgkJCTxnPg0KCQkJC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IHk9IjIwNSIgd2lkdGg9
IjMyMCIgaGVpZ2h0PSIyMCIgc3Ryb2tlPSJSR0IoMjU1LDI1NSwyNTUpIiBm
aWxsPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIHN0cm9rZS1kYXNoYXJyYXk9
Im5vbmUiLz4NCgkJCTwvZz4NCgkJPC9nPg0KCTwvZz4NCjwvc3ZnPg0K
----++Omea_Parts_Splitter.426322526496985--
Re: urgent: the problem with resizing svg figure [message #85999 is a reply to message #85969] Sun, 17 December 2006 02:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

Thank you for your answers:)
I know it relevents to viewbox now, because I delete viewBox="0 0 35.81445
91.60449" from presenter.svg, then it come out the problem the same as my
svg file, and be normal if I added viewBox="0 0 35.81445 91.60449".

But how can I know the width and height of the svg file? which tool should I
use to figure out the width and
height of the svg file?

presenter.svg:
<svg xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
width="35.81445" height="91.60449" viewBox="0 0 35.81445 91.60449"
overflow="visible" enable-background="new 0 0 35.81445 91.60449"
xml:space="preserve">

I had tried to alter activity.svg file by adding width="70.81445 " and
height=" 200.60449" viewBox="150 0 70.81445 200.60449" just as presenter.svg
file does, it come out properly(the figure is just on the center of the box
and can fully be seen) before
resizing the figure, but it still can only show part of the figure when
resizing the figure,how can I know the width and height of the svg file?
which tool should I use to figure out the width and height of the svg file?
=========
"Alex Shatalin" <vano@borland.com> д
Re: urgent: the problem with resizing svg figure [message #86060 is a reply to message #85999] Sun, 17 December 2006 20:11 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
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 07:10 Go to previous messageGo to next message
dzh is currently offline dzhFriend
Messages: 10
Registered: July 2009
Junior Member
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
>
>
>
Re: urgent: the problem with resizing svg figure [message #86195 is a reply to message #86105] Mon, 18 December 2006 16:41 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

Just want to let you know that with GMF 1.0.3 (which is out in February)
the original image aspect ratio feature is fixed, so you'll be able to use
ScalabaleImageFigure as you were using it initially.
Was glad to help.

Cheers,
Alex
Previous Topic:How to programmatically resize a structured edit part
Next Topic:Comparing GMF with other tools
Goto Forum:
  


Current Time: Thu Aug 01 03:23:45 GMT 2024

Powered by FUDForum. Page generated in 0.04953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top