Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Cartesian coordinates (Read 4726 times)
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Cartesian coordinates
Feb 23rd, 2012 at 11:12am
Print Post  
Hi,
We are implementing an application that is similar to a very basic 2D CAD.
The application should allow to place canonical and more complex parametric shapes n a 2D cartesian plan.
We are trying to use your WPFDiagram but we have found some limitations:

1. We would like to customize the ruler so that it becomes a sort of cartesian axes system:
the point having (0,0) coordinates should be the center of the diagram and the vertical ruler should be flipped (Y coordinates shall increase from bottom to top)
2. We have not been able to align the ruler ticks with the alignment grid points
3. We would like to resize and rotate the nodes without moving its center (the center should be the pivot for resize and rotate operations)
4. We would like to use the node center as the point used to align the node to the grid

Can you help me?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cartesian coordinates
Reply #1 - Feb 23rd, 2012 at 3:09pm
Print Post  
Hi,

1. Point (0,0) can be moved to the center by setting Diagram.Bounds to a rectangle centered around it. The Y axis direction cannot be changed at this time. I suppose we could add some property to the Ruler component to show negated Y values, but the actual diagram coordinates will still grow downwards.

2. Try setting the GridOffsetX and GridOffsetY properties to 0.

3. Rotation is already done around the center. The pivot point for resize is always the opposite handle and this cannot be changed at this time. I suppose you could change the node's Bounds from the NodeModifying event handler to keep it symmetric around its original center.

4. That's not supported out of the box. You could align nodes in response to NodeCreated and NodeModified handlers, with the help of the AlignPointToGrid method. Once a node is created or moved to a new location, find the grid point nearest to the node center, and offset the node so that its center coincides with the grid point.

Stoyan
  
Back to top
 
IP Logged
 
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Re: Cartesian coordinates
Reply #2 - Feb 27th, 2012 at 3:25pm
Print Post  
Stoyo,
Thanks a lot for your very prompt answer.

1. Changing the Diagrams.Bounds seems not changing the ruler tick labels (ruler (0,0) point remains at the top left corner). Do you think I can subclass your ruler to change its behavior to fit my needs?

2. OK. I was not able to correctly align the grid with ruler ticks because I have changed the GridSize and I was not able to find again the "magic" 15,... value that make all work.

3. OK

4. OK

Danilo
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cartesian coordinates
Reply #3 - Feb 29th, 2012 at 11:37am
Print Post  
1. I think this does not work correctly. Our Windows Forms Ruler control shows the actual diagram coordinates, while in WPF it shows offset from the origin so it always starts counting from 0. Our developer will fix it in the next few days.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cartesian coordinates
Reply #4 - Mar 2nd, 2012 at 7:57am
Print Post  
Hi,

You can find a link to an updated version of the control on the PM page. It should show the diagram origin on the ruler and adds a bool NegatedY property. Follow the "you have X messages" link at the top of the forum to open the PM page.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Re: Cartesian coordinates
Reply #5 - Mar 2nd, 2012 at 1:18pm
Print Post  
Thank you very much.
I will try it immediately!!1 Smiley
  
Back to top
 
IP Logged
 
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Re: Cartesian coordinates
Reply #6 - Mar 9th, 2012 at 1:12pm
Print Post  
Thanks again for your very precious support Stoyan, I tried it and it works as I need.

I have a couple of feature suggestions for next releases:

1. There should be an option to keep grid points automatically aligned to ruler marks, also when the zoom factor changes (the gridSizeX and gridSizeY properties should be kept equal to the distance between two adjacent ruler marks)

2. attached nodes should rotate togheter with their main node also when the rotation is applied setting the RotationAngle property (as they rotate if the main node is rotated through the rotation handle)

Regards,
Danilo
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cartesian coordinates
Reply #7 - Apr 23rd, 2012 at 6:47am
Print Post  
1) You should be able to achieve this by setting the GridOffsetX/Y properties to 0, and GridSize to your ruler's unit, optionally divided by 2 or 10 (depending on which of the unit marks you wish to align to).

2) This version changes the type of the bool Group.FollowMasterRotation property to enum GroupRotation:
https://mindfusion.eu/_beta/wpfdiag282.zip

Set it to GroupRotation.RotateChildren to make the attached nodes rotate together with the group's master node.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint