Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Draw paralleled Arrow (Read 3243 times)
parkwonwoo
Junior Member
**
Offline


Open the Podbay Doors
HAL!

Posts: 61
Joined: Dec 8th, 2006
Draw paralleled Arrow
Dec 28th, 2006 at 4:54am
Print Post  
Draw paralleled Arrow

Code
Select All
procedure TForm1.FC1ArrowCreated(ASender: TObject;
  const arrow: IArrowItem);
var
  fbox, tbox: IBoxItem;
  Arr2: IArrowItem;
  dx, dy: single;  // vertical vector
  ddx, ddy: integer;  // line direction vector
  nn: single;
  ll: integer;  // parallel interval: vertical vector length
begin
  fbox:=arrow.DestinationBox;
  tbox:=arrow.OriginBox;
  ddx:=arrow.CtrlPtX[1]-arrow.CtrlPtX[0];
  ddy:=arrow.CtrlPtY[1]-arrow.CtrlPtY[0];

  nn:=ll/(sqrt(ddx*ddx+ddy*ddy));
  dx:=ddy*nn;
  dy:=-ddx*nn;
  Arr2:=fc1.CreateArrow(fbox, tbox);
  Arr2.CtrlPtX[0]:=Round(Arr2.CtrlPtX[0]+dx);  // x1
  Arr2.CtrlPtX[1]:=Round(Arr2.CtrlPtX[1]+dx);   // x2
  Arr2.CtrlPtY[0]:=Round(Arr2.CtrlPtY[0]+dy);  // y1
  Arr2.CtrlPtY[1]:=Round(Arr2.CtrlPtY[1]+dy);  // y2
  Arr2.Update;
  Arrow.CtrlPtX[0]:=Round(Arrow.CtrlPtX[0]-dx);
  Arrow.CtrlPtX[1]:=Round(Arrow.CtrlPtX[1]-dx);
  Arrow.CtrlPtY[0]:=Round(Arrow.CtrlPtY[0]-dy);
  Arrow.CtrlPtY[1]:=Round(Arrow.CtrlPtY[1]-dy);
  Arrow.Update;
end;
 



What do you think about this feature.
Code
Select All
 arrow.PairArrowInterval:=3;
 arrow.DrawPairArrow;
 

  

OS: WinXP sp2&&RAD: Borland Delphi7, C++Builder6, JBuilder9&&FrameWork: VCL+Win32 or J2SE&&FCX: FCX 4.1.x
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Draw paralleled Arrow
Reply #1 - Dec 28th, 2006 at 6:24am
Print Post  
Yes, I guess we could combine that with the Bezier code here -
http://mindfusion.org/cgi/Forum/YaBB.pl?board=fcnet_disc;action=display;num=1154...

and add a new property that will enable some kind of parallel arrows mode, in which the control will automatically move parallel links apart.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint