Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to draw rectangle with scalable polygon
How to draw rectangle with scalable polygon [message #188755] Thu, 22 May 2008 13:11 Go to next message
Eclipse UserFriend
Originally posted by: matthias.schmidt.xactium.com

Hello everybody,

I've got a simple problem, but can't solve it.

I want to draw a custom figure with a scalable polygon and the outer
line of it should fit to the shapes borders. So when a select the shape
the selection frame should match this outer line.

The top left corner should have the coordinates (0,0), that's
straightforward. But I don't know how to set the bottom right corner.


Any hints?
Cheers,

Matthias
Re: How to draw rectangle with scalable polygon [message #189280 is a reply to message #188755] Sat, 24 May 2008 19:14 Go to previous message
Lazar Codrut-Lucian is currently offline Lazar Codrut-LucianFriend
Messages: 91
Registered: July 2009
Member
Create a custom figure where you override the paintFigure() method (don't
forget to call super.paintFigure() method also in it).
And draw a rectangle on the graphics according to the bounds of the figure.
You can use a field for 'selected' attribute, which can be changed with a
setter, or you can find some other way to make the figure aware of
the 'selected' state.
Use this custom figure as the figure of your node.

You could also do the same thing in the generated figure for the node, in
the edit part. This way you won't need to use a custom figure. And if the
method doesn't have a @generated tag, it will be preserved during future
re-generations of the code.

I opted for a custom figure, because this way I can maintain the
not-generated code much easier.

        Lucian
Previous Topic:Expand node in the compartment
Next Topic:Don't use GMF for a form based diagram ?
Goto Forum:
  


Current Time: Thu Apr 25 23:53:31 GMT 2024

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

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

Back to the top