Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagramming for WPF, V3.4 (Read 2409 times)
Forum Admin
YaBB Administrator
*****
Offline


Rock and Roll

Posts: 685
Joined: Apr 6th, 2003
Diagramming for WPF, V3.4
Mar 1st, 2016 at 1:00pm
Print Post  
We have released version 3.4 of WpfDiagram. It contains the following new features and improvements:

Free-form nodes
A FreeFormNode collects all points from users' mouse or touch input and displays them as node's outline. To let users draw free-form nodes interactively, set Diagram.Behavior to DrawFreeForms or LinkFreeForms. Use the Points property of FreeFormNode to get or set outline points programmatically. If the Closed property is set, the node is drawn as a closed shape and its interior filled, or otherwise the node is drawn as a poly-line. If the distance between first and last points drawn by user is shorter than Diagram.AutoCloseDistance, the node's Closed property is automatically set to true. AutoCloseDistance default value is Double.MaxValue, so free-form nodes are always closed.

Additional drawing modes, convenient for touch input, convert FreeFormNode objects drawn by user to ShapeNode objects with most similar shape. To enable them, set Behavior to DrawFreeShapes or LinkFreeShapes. The shapes against which the user's input is matched are set via diagram's FreeFormTargets property. By default it contains Rectangle, Decision and Ellipse shapes.



Shape control points
Shape formulas can now be parameterized by associating control points with Shape objects. Each control point is passed to the shape script as a named variable. Apart from the name, you can specify the default, min and max coordinates for each parameter via the ShapeControlPoint constructor, and whether to treat its values as percents or fixed offset.

For example, the following code creates an arrow shape with adjustable arrowhead and fletching sizes:
Code
Select All
string arrow60deg = @"
	x1 = p1.X;
	y1 = p1.Y;
	x2 = IIf(Width>=2*Height,0.5*Height*Tan(PI/6), 0.15*Width);
	x3 = IIf(Width>=2*Height, Height/4, 0.15*Width);
	MoveTo(0, Height * 0.5);
	LineTo(x1 , Height);
	LineTo(x1, Height - y1);
	LineTo(Width -x3 -x2 -x2, Height - y1);
	LineTo(Width -x3 -x2, Height);
	LineTo(Width, Height);
	LineTo(Width * p2.X / 100, Height * p2.Y / 100);
	LineTo(Width, 0);
	LineTo(Width - x3 -x2, 0);
	LineTo(Width -x3 -x2 -x2, y1);
	LineTo(x1, y1);
	LineTo(x1, 0);
	LineTo(0, Height * 0.5);
 ";

diagram.DefaultShape = new Shape(arrow60deg, "", new List<ShapeControlPoint>
{
	new ShapeControlPoint("p1",
		20, 0, -10, UnitType.Fixed,
		20, 0, 100, UnitType.Fixed) { MaxXRelativeToWidth = true },
	new ShapeControlPoint("p2",
		80, 60, 100, UnitType.Percentage,
		50, 50, -50, UnitType.Percentage) { MaxYRelativeToHeight = true }
},
	"arrow60deg"); 





Miscellaneous
~ Undo/redo records for in-place edit operations are now created automatically. They are represented by instances of the EditTextCmd class.
~ LinkTextStyle.Center improved for vertical links.
~ fixed a bug where link to a child node inside a nested container would not point to correct position if both nested and outer containers are folded.

API changes
Adjustment handles are no longer identified by integer values but by instances of AdjustmentHandle and derived classes. This changes the signatures of DiagramItem.HitTestHandle methods and the InteractionState constructor. Standard handle classes included are NodeAdjustmentHandle for changing a node's position and size, LinkAdjustmentHandle for changing link control point positions, ShapeAdjustmentHandle for adjusting shape formula parameters, and FreeFormHandle for changing the position of a FreeFormNode outline point.

Installer for the latest version can be downloaded here, or from the clients area on our site:
https://mindfusion.eu/WpfDiagTrial.zip

Updated assemblies are also available as MindFusion.Diagramming.Wpf NuGet package.

Enjoy!
« Last Edit: Mar 1st, 2016 at 4:57pm by Forum Admin »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint