Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Support for control points (Read 7208 times)
jf2020
Junior Member
**
Offline


I love FlowChart!

Posts: 63
Joined: Feb 23rd, 2006
Support for control points
Aug 10th, 2013 at 10:13am
Print Post  
Now that we have nice handles (thanks!), it would be very nice to have support for control points. Some time ago you implemented the possibility to define shapes using formulas, which is very nice when you don't want the shape to always resize proportionally (e.g. for arrows).  This is very nice and I think this should be advertised more. For instance the formula compiler implements many undocumented functions like If(condition, value when true, value when false) which name actually is Iif. I think that it would be nice to add the list in the doc for people that don't have the control source code.
For instance, it can be used like in Visio for the Arrow 60 degrees tail
Code (C++)
Select All
string arrow60deg = @"
    x1 = IIf(Width >= 1.5*Height,0.5*Height*Tan(PI/6),0.25*Width);
    y1 = Height / 3;
    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 -x2, 0.5 *Height);
    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);
 "; 



So what I'm now missing is the possibility to define control points to allow the end user to modify the shape (the yellow loange handles) Could you please consider implement it?   They could be defined and used in the formula using a function like ControlPoint(x, y, x constraints, y constraints) and then used for shape coordinates calculations.

Another feature request would be the built-in possibility to flip on the horizontal or vertical axis. This is very useful for non symmetric shapes (arrows again).

  

Arrow60degreesTail.PNG (Attachment deleted)
Control_points.PNG (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Support for control points
Reply #1 - Aug 13th, 2013 at 4:50pm
Print Post  
We'll have it in mind for next release Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Support for control points
Reply #2 - Sep 12th, 2013 at 8:52am
Print Post  
You can find a preview version implementing shape control points here:
https://mindfusion.eu/_beta/fcnet61_shape_cpoints.zip

For each point, you can specify the name you want to use in the script, its default, min and max coordinates, and whether to treat the values as percents or fixed offset:

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, 100, AnchorUnitType.Fixed,
			20, 0, 100, AnchorUnitType.Fixed),
		new ShapeControlPoint("p2",
			80, 60, 100, AnchorUnitType.Percentage,
			50, 50, 50, AnchorUnitType.Percentage)
	},
	"arrow60deg"); 



With that code, you will be able to move the point where the arrowhead meets the shaft, and the quill end point. The vertical position of the latter is constrained to the middle of the node's height:



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