Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Finding arrow with Origin and Dest Box. (Read 5223 times)
parkwonwoo
Junior Member
**
Offline


Open the Podbay Doors
HAL!

Posts: 61
Joined: Dec 8th, 2006
Finding arrow with Origin and Dest Box.
Feb 26th, 2007 at 9:29am
Print Post  

What is the Method of Finding arrow with Origin and Dest Box.
My purpose is finding the inverse direction arrow.

My coarse Method is here --;

Code
Select All
Fc1.PathFindingOptions.Directed:=true;
Path:=Fc1.FindShortestPath(arrow.DestinationBox, arrow.OriginBox);
Arr2:=Path[0];
 



Thanksin advance.
  

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: Finding arrow with Origin and Dest Box.
Reply #1 - Feb 26th, 2007 at 10:51am
Print Post  
It will be faster to look for the arrow in originBox.OutgoingArrows instead of using the path-finding methods:

Code
Select All
Public Function arrowBetween(box1 As box, box2 As box) As Boolean
    Dim a As arrow
    For Each a In box1.OutgoingArrows
	  If a.DestinationBox Is box2 Then
		arrowBetween = True
		Exit Function
	  End If
    Next a
    arrowBetween = False
End Function
 



Stoyan
  
Back to top
 
IP Logged
 
parkwonwoo
Junior Member
**
Offline


Open the Podbay Doors
HAL!

Posts: 61
Joined: Dec 8th, 2006
Re: Finding arrow with Origin and Dest Box.
Reply #2 - Feb 27th, 2007 at 12:07am
Print Post  
Above VB Code is not a "finding arrow between func", but a "IsArrow between. func".

Correct Delphi Code here :

Code
Select All
function arrowBetween(box1: box; box2: box):arrow;
var
  a: IArrowItem;
  i: integer;
begin
  for i:=0 to box1.OutgoingArrows.count-1 do begin
    a:=box1.OutgoingArrows[i];
    if a.DestinationBox=box2 then begin
	arrowBetween := a;
	Exit;
    end;
  end;
  arrowBetween := nil;
End;
 



Thanks at any rate.
  

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: Finding arrow with Origin and Dest Box.
Reply #3 - Feb 27th, 2007 at 5:44am
Print Post  
ok, you are right  8)
  
Back to top
 
IP Logged
 
parkwonwoo
Junior Member
**
Offline


Open the Podbay Doors
HAL!

Posts: 61
Joined: Dec 8th, 2006
Re: Finding arrow with Origin and Dest Box.
Reply #4 - Feb 27th, 2007 at 5:49am
Print Post  
At this time, I'll try it to C++Builder coding of same function.

Code
Select All
// function  --------------------------------------------
IArrowItemPtr arrowBetween( IBoxItemPtr box1, IBoxItemPtr box2 )
{
  IArrowItemPtr a;
  for ( int i =0; i<box1->OutgoingArrows->get_count(); i++ )
  {
    a = box1->OutgoingArrows->get_Item(i);
    if ( a->DestinationBox == box2 )
    {
	return a;
	//exit;
    }
  }
  //return NULL;
}
// Call --------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  IBoxItemPtr b1, b2;
  IArrowItemPtr a1, a2;

  b1=FCX->CreateBox(10, 10, 10, 10);
  b2=FCX->CreateBox(100, 100, 10, 10);

  a1=FCX->CreateArrow(b1, b2);
  a2=arrowBetween(b1, b2);   // Error Here *****
  a2->set_Color(clRed);

}
 



But, There is error at Marked Line.

What's wrong with it ?.
  

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: Finding arrow with Origin and Dest Box.
Reply #5 - Feb 27th, 2007 at 6:29am
Print Post  
Is it a compiler error or runtime one? What is the error message?
  
Back to top
 
IP Logged
 
parkwonwoo
Junior Member
**
Offline


Open the Podbay Doors
HAL!

Posts: 61
Joined: Dec 8th, 2006
Re: Finding arrow with Origin and Dest Box.
Reply #6 - Feb 27th, 2007 at 10:51pm
Print Post  
Error Meesage:

Code
Select All
[Linker Error] Unresolved external 'TForm1::arrowBetween(TComInterface<Flowchartlib_tlb::IBoxItem, IID_IBoxItem>, TComInterface<Flowchartlib_tlb::IBoxItem, IID_IBoxItem>)' referenced from E:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\BCB_FCX_FUNCTION\UNIT1.OBJ
 

  

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: Finding arrow with Origin and Dest Box.
Reply #7 - Feb 28th, 2007 at 5:37am
Print Post  
Have you added the method declaration to the TForm1.h header file?
  
Back to top
 
IP Logged
 
parkwonwoo
Junior Member
**
Offline


Open the Podbay Doors
HAL!

Posts: 61
Joined: Dec 8th, 2006
Re: Finding arrow with Origin and Dest Box.
Reply #8 - Mar 5th, 2007 at 5:51am
Print Post  
Yes Of course.

May be it is not that problem...
  

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: Finding arrow with Origin and Dest Box.
Reply #9 - Mar 5th, 2007 at 6:01am
Print Post  
What if you declare the method prototype as shown in the error message? i.e.

arrowBetween(TComInterface<Flowchartlib_tlb::IBoxItem, IID_IBoxItem>, TComInterface<Flowchartlib_tlb::IBoxItem, IID_IBoxItem>)

instead of

arrowBetween( IBoxItemPtr box1, IBoxItemPtr box2 )

Or if C++ builder imports the box and arrow classes as TBoxItem and TArrowItem types, try using them instead of IBoxItemPtr/IArrowItemPtr.

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