Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Need an advice
Need an advice [message #202320] Tue, 08 November 2005 15:32 Go to next message
Eclipse UserFriend
Originally posted by: radicr.stop.spam.gmail.com

Hi all,

I just need to have short advice about the project i am intending to create.
There is a need to import building projects (map of the floor, with flats
and other things.) It would be jpg or gif image exported from some CAD tool.
Then, i can import it to my GEF editor where this image would be a
background of the diagram ( i did something similar). User could see flat
borders, and drawing lines and polygons on it - i should be able to extract
model parts. So when first and last point of the flat are connected, i
should show some property sheet to the user where he could enter data about
the flat that he marked. This would represent some EditPart, and figure
(flat, an apartment) on it will not be always regular shape because it can
be any kind of the polygon.

I have seen something similar on GIS project
http://udig.refractions.net/confluence/display/UDIG/Home , and downloaded
the source. They have map importing, and then they have something called
Polygon Edit Tool. With this tool user can draw points and lines, closing
polygon and so extracting parts of the map with non rectangular shapes.
Looking at the source, i realized they dont use GEF at all, but there is EMF
plugin in there. They have some awt classes included, and they convert awt
to swt graphics because project is RCP application.

Maybe i was not very clear, but i wonder if something similar could be done
with GEF and EMF. Biggest question is, is there posibility that editparts
hold non rectangular figures (that would represent flats on the floor). Any
experiences and thoughts would be helpful

Thanks in advance

--
Pozdrav,
Radovan
Re: Need an advice [message #202331 is a reply to message #202320] Tue, 08 November 2005 19:38 Go to previous messageGo to next message
venkataramana m is currently offline venkataramana mFriend
Messages: 86
Registered: July 2009
Member
Figures in GEF could be of any shape composed with painting instructions available with Graphics class of GEF (Is a sort of wrapper over GC of SWT). Outlining routines like drawPolyline, drawArc, drawImage, drawText etc., and fill routines like fillRect, fillEllipse, fillPolygon etc., available with Graphics class should be good enough to render any shape.

[code]
class MyShape extends Shape /* Shape extends Figure */
{
protected void outlineShape(Graphics g)
{
/* DRAW OUTLINE using g:Graphics */
}

protected void fillShape(Graphics g)
{
/* FILL using g:Graphics */
}
}
[code]

Hope it helps.

I advice you to check working examples, open source projects to feel what GEF can do ?

Thanks
Venkat
Re: Need an advice [message #202383 is a reply to message #202331] Wed, 09 November 2005 09:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: radicr.stop.spam.gmail.com

Thank you Venat,

I completely forgot i can use Shape for this purpose. I was using only Panel
before, but now i realize i can use Shape figure to draw any kind of the
shape for my model of apartments.
Now i need to find the way to implement drawing option to my editor. I had
some difficulties catching mouse and keyboard events on GEF editors and
viewers. I have been using mouse events on Figure, but i think it would be
better if i could use it inside of the EditPart or editor itself. Is there
some good article that would describe this?

Radovan

"venkataramana" <venkataramanam@gmail.com> wrote in message
news:27131323.1131478773957.JavaMail.root@cp1.javalobby.org...
> Figures in GEF could be of any shape composed with painting instructions
available with Graphics class of GEF (Is a sort of wrapper over GC of SWT).
Outlining routines like drawPolyline, drawArc, drawImage, drawText etc., and
fill routines like fillRect, fillEllipse, fillPolygon etc., available with
Graphics class should be good enough to render any shape.
>
> [code]
> class MyShape extends Shape /* Shape extends Figure */
> {
> protected void outlineShape(Graphics g)
> {
> /* DRAW OUTLINE using g:Graphics */
> }
>
> protected void fillShape(Graphics g)
> {
> /* FILL using g:Graphics */
> }
> }
> [code]
>
> Hope it helps.
>
> I advice you to check working examples, open source projects to feel what
GEF can do ?
>
> Thanks
> Venkat
Re: Need an advice [message #202405 is a reply to message #202383] Wed, 09 November 2005 14:53 Go to previous messageGo to next message
venkataramana m is currently offline venkataramana mFriend
Messages: 86
Registered: July 2009
Member
> I had some difficulties catching mouse and keyboard events on GEF editors
> and viewers. I have been using mouse events on Figure, but i think it would
> be better if i could use it inside of the EditPart or editor itself. Is
> there some good article that would describe this?

I haven't come across any article which describes dealing with mouse and
keyboard events in the context of GEF. But most of the things which are
needed for a typical UML like diagramming domain are in place. All you
need to do is to install edit policies and write commands to change models
and reflect the changes in models through events to editparts..editparts
in turn refresh the visuals. What I meant essentially was resize handlers,
moving a figure with mouse, dragging a figure etc., are all part of GEF
framework. Nothing much needs to be done as such from our end.

Thanks
Venkat
Re: Need an advice [message #202413 is a reply to message #202405] Wed, 09 November 2005 15:15 Go to previous message
Eclipse UserFriend
Originally posted by: radicr.stop.spam.gmail.com

Thanks for the effort Venkat,

I was exploring today a bit and i realized i should implement class that
extends AbstractTool or TargetingTool class from GEF package.

public interface Tool interprets Mouse and Keyboard input from an EditDomain
and its EditPartViewers. The active Tool and its state determines how the
EditDomain will interpret input. Input flows from a Viewer, to the
EditDomain, to the EditDomain's active Tool.

This could help me to create PolygonDrawingTool. I was hoping that there is
this kind of tool or similar already implemented, but i wasnt able to find
anything on the net.

Radovan

"venkataramana" <venkataramanam@gmail.com> wrote in message
news:21ea07d7338a6c667676540d363a988c$1@www.eclipse.org...
> > I had some difficulties catching mouse and keyboard events on GEF
editors
> > and viewers. I have been using mouse events on Figure, but i think it
would
> > be better if i could use it inside of the EditPart or editor itself. Is
> > there some good article that would describe this?
>
> I haven't come across any article which describes dealing with mouse and
> keyboard events in the context of GEF. But most of the things which are
> needed for a typical UML like diagramming domain are in place. All you
> need to do is to install edit policies and write commands to change models
> and reflect the changes in models through events to editparts..editparts
> in turn refresh the visuals. What I meant essentially was resize handlers,
> moving a figure with mouse, dragging a figure etc., are all part of GEF
> framework. Nothing much needs to be done as such from our end.
>
> Thanks
> Venkat
>
>
>
>
Previous Topic:stereotypes & code generation
Next Topic:XOR-Bug (and Mac and solution)
Goto Forum:
  


Current Time: Thu Apr 25 11:32:40 GMT 2024

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

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

Back to the top