Drawing a complex rectangle in Dolphin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Drawing a complex rectangle in Dolphin

Bruno Brasesco
I'm trying to make a Class Modelator like Rational Rose Arena, but much ....
much more simple.

But I'm trying to make a Rectangle (like Rose class), but I can not do it..

Anyone use Dolphin to make graphic element ?

My first intent
Add a subclass UMLCLass to Square (from Playground package). But, at the
moment is not working.

My second
Add a subclass UMLClass to StaticRectangle. But is not working.

My third
I made an especific View (UMLClassView) in the view composer, but I'm not
sure if it the best choice.
(and the view is not so good).

Any comments ?

Best Regards
Bruno Brasesco


Reply | Threaded
Open this post in threaded view
|

Re: Drawing a complex rectangle in Dolphin

Bill Schwab-2
Bruno,

> I'm trying to make a Class Modelator like Rational Rose Arena, but much
....
> much more simple.
>
> But I'm trying to make a Rectangle (like Rose class), but I can not do
it..
>
> Anyone use Dolphin to make graphic element ?

As you've obviously already considered, one option is to represent objects
by subviews of another view; but, I doubt this is what you'll want to do.

The short version on "custom" graphics is that you need to obtain an
appropriate Canvas, and then draw on it by sending message to it.   Some of
those messages, such as #pen:, will involve other objects that you'll create
separately.  I like to get the device resolution, start with physical
dimensions, and then scale to pixels before drawing.  The result is that the
distances scale correctly for both screen and printer display.

You'll probably want to subclass View to display your graphics, which you'll
do by overriding #onPaintRequired: to draw on a canvas that you'll obtain
from the paint event.  It's a good idea to try to locate the code that does
all of the work of drawing (on the canvas) in some other object so that you
can simply call it again for display on a printer or a bitmap.  Note that
Ian offers a device-independent bitmap class that can save to a file, which
is very handy for some jobs.

Does that help?

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]