Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Isometric graph designer (Read 8880 times)
Alexey Kiselev
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Oct 15th, 2012
Isometric graph designer
Oct 15th, 2012 at 1:43pm
Print Post  
Hello!

I need to develop graph designer application. I am considering to use your library, but i need some clarification.
All samples in gallery contain only flat graph diagrams.
Is it possible to create isometric graph diagram with your library? Any samples will be appreciated.

Thanks in advance!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Isometric graph designer
Reply #1 - Oct 15th, 2012 at 2:10pm
Print Post  
Hi,

I'm not sure what you mean by "isometric graph diagram". If you need to display graphs in 3D space, we don't have support for this in the WPF control. There is a DiagramView3D control coming with our Windows Forms library - you might check the SpringLayout and MoleculeViewer sample projects installed with it:
https://www.mindfusion.eu/FCNetDemo.zip

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


I Love MindFusion!

Posts: 5
Joined: Oct 15th, 2012
Re: Isometric graph designer
Reply #2 - Oct 15th, 2012 at 3:00pm
Print Post  
I mean not a real 3D but an isometric view of pipes diagram. For example http://www.wermac.org/images/iso_k1.gif or http://pipingdesigns.net/wp-content/uploads/2009/12/iso-drafting-pointers.jpg

Could you tell me is it possible to customize snapping logic between 2D objects on diagram?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Isometric graph designer
Reply #3 - Oct 16th, 2012 at 6:13am
Print Post  
Snapping links to degrees divisible by 60 could be done using a custom link class:

Code
Select All
class IsoLink : DiagramLink
{
	private Point AlignPoint(Point point)
	{
		double a = 0, r = 0;
			MindFusion.Geometry2D.Convert.CartesianToPolar(
			StartPoint, point, ref a, ref r);
		a = ((int)(a - 90) / 60) * 60 + 90;
		return MindFusion.Geometry2D.Convert.PolarToCartesian(StartPoint, a, r);
	}

	protected override void UpdateCreate(Point current)
	{
		current = AlignPoint(current);
		base.UpdateCreate(current);
	}

	protected override void CompleteCreate(Point end)
	{
		end = AlignPoint(end);
		base.CompleteCreate(end);
	}

	// todo: UpdateModify
} 



You can let users draw such links interactively using a custom behavior class:

Code
Select All
class MyBehavior : DrawLinksBehavior
{
	public MyBehavior(Diagram diagram) : base(diagram) {}

	protected override DiagramLink  CreateLink()
	{
		return new IsoLink();
	}
}

diagram.CustomBehavior = new MyBehavior(diagram);
 



You could also skew the shape of nodes to look as projected isometrically with code like this:

Code
Select All
Shape SkewShape(Shape shape)
{
	var transform = new SkewTransform(0, 30, 50, 50);
	var outline = new ElementTemplate[shape.Outline.Length];
	for (int i = 0; i < shape.Outline.Length; i++)
	{
		var element = shape.Outline[i];

		var line = element as LineTemplate;
		if (line != null)
		{
			var pt1 = new Point(line.Coordinates[0], line.Coordinates[1]);
			var pt2 = new Point(line.Coordinates[2], line.Coordinates[3]);
			pt1 = transform.Transform(pt1);
			pt2 = transform.Transform(pt2);
			outline[i] = new LineTemplate(pt1.X, pt1.Y, pt2.X, pt2.Y);
		}

		// todo: bezier, arc, roundrect elements
	}

	return new Shape(outline, FillRule.Nonzero);
}

shapeNode.Shape = SkewShape(Shapes.Collate); 



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


I Love MindFusion!

Posts: 5
Joined: Oct 15th, 2012
Re: Isometric graph designer
Reply #4 - Oct 18th, 2012 at 2:59pm
Print Post  
Thank you!

Now I should try this.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint