Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Major/minor grid and snapping
Major/minor grid and snapping [message #193339] Thu, 25 August 2005 10:54 Go to next message
Martijn van Steenbergen is currently offline Martijn van SteenbergenFriend
Messages: 16
Registered: July 2009
Junior Member
Does GEF currently support major and minor grids? If not, are there any
plans for this?

I can imagine clients might want to have, for example, a square grid of
size 1 cm, but snap to units of 1 mm. The latter could be considered a
minor grid, which may or may not be visible, independently from the
visibility of the major grid.

Regards,

Martijn.
Re: Major/minor grid and snapping [message #193358 is a reply to message #193339] Thu, 25 August 2005 16:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Isn't this merely an issue of how you paint the grid?

"Martijn van Steenbergen" <mvsteenbergen@eljakim.nl> wrote in message
news:dek817$cs8$1@news.eclipse.org...
> Does GEF currently support major and minor grids? If not, are there any
> plans for this?
>
> I can imagine clients might want to have, for example, a square grid of
> size 1 cm, but snap to units of 1 mm. The latter could be considered a
> minor grid, which may or may not be visible, independently from the
> visibility of the major grid.
>
> Regards,
>
> Martijn.
Re: Major/minor grid and snapping [message #193366 is a reply to message #193358] Thu, 25 August 2005 22:09 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
I think Martijn was also asking about snapping nodes to a grid, not just how
to draw it...

"Randy Hudson" <none@us.ibm.com> wrote in message
news:dekqlc$9c8$1@news.eclipse.org...
> Isn't this merely an issue of how you paint the grid?
>
> "Martijn van Steenbergen" <mvsteenbergen@eljakim.nl> wrote in message
> news:dek817$cs8$1@news.eclipse.org...
>> Does GEF currently support major and minor grids? If not, are there any
>> plans for this?
>>
>> I can imagine clients might want to have, for example, a square grid of
>> size 1 cm, but snap to units of 1 mm. The latter could be considered a
>> minor grid, which may or may not be visible, independently from the
>> visibility of the major grid.
>>
>> Regards,
>>
>> Martijn.
>
>
Re: Major/minor grid and snapping [message #193374 is a reply to message #193358] Thu, 25 August 2005 22:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Yes, it is. Martijn, override createGridLayer() in your root editpart to
return a custom GridLayer (you can override its paintGrid() method).

"Randy Hudson" <none@us.ibm.com> wrote in message
news:dekqlc$9c8$1@news.eclipse.org...
> Isn't this merely an issue of how you paint the grid?
>
> "Martijn van Steenbergen" <mvsteenbergen@eljakim.nl> wrote in message
> news:dek817$cs8$1@news.eclipse.org...
> > Does GEF currently support major and minor grids? If not, are there any
> > plans for this?
> >
> > I can imagine clients might want to have, for example, a square grid of
> > size 1 cm, but snap to units of 1 mm. The latter could be considered a
> > minor grid, which may or may not be visible, independently from the
> > visibility of the major grid.
> >
> > Regards,
> >
> > Martijn.
>
>
Re: Major/minor grid and snapping [message #193424 is a reply to message #193374] Fri, 26 August 2005 07:55 Go to previous messageGo to next message
Martijn van Steenbergen is currently offline Martijn van SteenbergenFriend
Messages: 16
Registered: July 2009
Junior Member
Yes, thank you, will do. :) I was just wondering if you might want to
put this kind of behaviour in GEF so that not every client implements
this in his/her own way, but perhaps it's too small a thing to be an issue.

Regards,

Martijn.

Pratik Shah wrote:
> Yes, it is. Martijn, override createGridLayer() in your root editpart to
> return a custom GridLayer (you can override its paintGrid() method).
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:dekqlc$9c8$1@news.eclipse.org...
>
>>Isn't this merely an issue of how you paint the grid?
Re: Major/minor grid and snapping [message #193431 is a reply to message #193424] Fri, 26 August 2005 07:58 Go to previous messageGo to next message
Martijn van Steenbergen is currently offline Martijn van SteenbergenFriend
Messages: 16
Registered: July 2009
Junior Member
Then again, if you generalize the idea of minor/major grids, you might
end up at the idea of having any number of independent grids, which is
exactly what GEF offers now, if I'm not mistaken. :)

M.
Re: Major/minor grid and snapping [message #193508 is a reply to message #193366] Fri, 26 August 2005 13:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

But wouldn't the snapping just be to the minor grid? We already handle that.

"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:delfc0$6ks$1@news.eclipse.org...
>I think Martijn was also asking about snapping nodes to a grid, not just
>how to draw it...
Re: Major/minor grid and snapping [message #193529 is a reply to message #193424] Fri, 26 August 2005 13:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Feel free to contribute this back to GEF. I would create some new viewer
property called something like GRID_INTERVAL. When the grid is painted, it
could skip the rows/columns that don't fall on the interval.

An interval might be easier than trying to enforce that major and minor are
multiples of each other. Simply attach code to a bugzilla and we will review
and commit it if we don't have any comments.

-Randy

"Martijn van Steenbergen" <mvsteenbergen@eljakim.nl> wrote in message
news:demhtf$9sd$1@news.eclipse.org...
> Yes, thank you, will do. :) I was just wondering if you might want to put
> this kind of behaviour in GEF so that not every client implements this in
> his/her own way, but perhaps it's too small a thing to be an issue.
>
> Regards,
>
> Martijn.
>
> Pratik Shah wrote:
>> Yes, it is. Martijn, override createGridLayer() in your root editpart to
>> return a custom GridLayer (you can override its paintGrid() method).
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:dekqlc$9c8$1@news.eclipse.org...
>>
>>>Isn't this merely an issue of how you paint the grid?
Re: Major/minor grid and snapping [message #193765 is a reply to message #193529] Mon, 29 August 2005 08:06 Go to previous messageGo to next message
Martijn van Steenbergen is currently offline Martijn van SteenbergenFriend
Messages: 16
Registered: July 2009
Junior Member
Randy Hudson wrote:
> Feel free to contribute this back to GEF. I would create some new viewer
> property called something like GRID_INTERVAL. When the grid is painted, it
> could skip the rows/columns that don't fall on the interval.
>
> An interval might be easier than trying to enforce that major and minor are
> multiples of each other. Simply attach code to a bugzilla and we will review
> and commit it if we don't have any comments.

I would like that, but I'm not sure when I'll be able to do this. Also,
I'm afraid you'll spend more time answering my questions than if you
implemented it yourself. :P

My idea was that the major and minor grid can both be independently
turned on and off. The major grid is drawn with a thicker/darker stroke
than the minor grid. Snap is always to the minor grid. If I understand
your suggestion correctly, I can't toggle the visibility of the minor
grid. I suppose I could just build that, but I want to make sure you're
okay with this. The following is a suggestion of how it could work:
- Currently, the grid only has a 'minor' grid, and its visibility is
'equivalent' to the layer's (figure's) visibility. For the minor and
major grid to be independent, there will have to be two extra
properties: MINOR_GRID_VISIBLE and MAJOR_GRID_VISIBLE, separate from the
current GRID_VISIBLE.
- Then there's the GRID_INTERVAL. This could be a two-dimensional thing:
you might want the horizontal interval to differ form the vertical
interval. Is a Dimension appropriate for this?

Is it true that I change the GridLayer class for this? I ask because you
mentioned 'viewer properties'. Or do I also change the GraphicalViewer
class? And the FreeformGraphicalRootEditPart's and
ScalableRootEditPart's refreshGridLayer()?

Then a question not regarding the implementation but the use of grids:
in my graphical editor, I'm not using the RootEditPart's GridLayer.
Rather, I have a specific kind of EditPart that has a local grid. Is GEF
designed to support this? I had to override
LayeredPane.usesLocalCoordinates() to return true. Also, I could not use
PROPERTY_GRID_VISIBLE, because this was already tied to the
RootEditPart's GridLayer, so I created my own property. Is it okay to
(ab)use PROPERTY_GRID_SPACING for my custom grids, or would you
discourage this?

And finally, a meta-question: is this the right place to ask these
questions? Or should I ask them on the mailing list? Or post them as
comments on a bug report?

Thanks in advance. :)

Regards,

Martijn.
Re: Major/minor grid and snapping [message #193877 is a reply to message #193765] Mon, 29 August 2005 15:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> I would like that, but I'm not sure when I'll be able to do this. Also,
> I'm afraid you'll spend more time answering my questions than if you
> implemented it yourself. :P
>
> My idea was that the major and minor grid can both be independently turned
> on and off. The major grid is drawn with a thicker/darker stroke than the
> minor grid. Snap is always to the minor grid. If I understand your
> suggestion correctly, I can't toggle the visibility of the minor grid. I
> suppose I could just build that, but I want to make sure you're okay with
> this. The following is a suggestion of how it could work:
> - Currently, the grid only has a 'minor' grid, and its visibility is
> 'equivalent' to the layer's (figure's) visibility. For the minor and major
> grid to be independent, there will have to be two extra properties:
> MINOR_GRID_VISIBLE and MAJOR_GRID_VISIBLE, separate from the current
> GRID_VISIBLE.

I think you need to rethink the usability here. What would it mean for
GRID_VISIBLE to be TRUE, and the other two values to be FALSE? IMO, you only
need one additional flag, and that even is overkill.

> - Then there's the GRID_INTERVAL. This could be a two-dimensional thing:
> you might want the horizontal interval to differ form the vertical
> interval. Is a Dimension appropriate for this?

I don't think rectangular grids are common enough to support.

> Is it true that I change the GridLayer class for this? I ask because you
> mentioned 'viewer properties'. Or do I also change the GraphicalViewer
> class? And the FreeformGraphicalRootEditPart's and ScalableRootEditPart's
> refreshGridLayer()?

Yes, but GridLayer uses a FigureUtilities method to paint hte grid, so that
would be changed too. (Probably a new method with more params).

>
> Then a question not regarding the implementation but the use of grids: in
> my graphical editor, I'm not using the RootEditPart's GridLayer. Rather, I
> have a specific kind of EditPart that has a local grid. Is GEF designed to
> support this?

Yes, that's why we make the utility method available to any figure.

IMO, the major grid interval would be based on the current zoom factor. So,
as I zoom in, I see more grid lines. Consider this instead of a fixed
interval.
Re: Major/minor grid and snapping [message #193884 is a reply to message #193877] Mon, 29 August 2005 15:03 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Oh yeah, I prefer bugzilla if you are going to at least:
- provide mockups of what the grid should look like
- describe the desired behavior in detail
and/or
- provide a patch
Previous Topic:EditPolicies/ layout question
Next Topic:ChildEditParts displaying on top of parent edit parts
Goto Forum:
  


Current Time: Thu Apr 25 09:07:25 GMT 2024

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

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

Back to the top