Future of SimpleGraph

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Future of SimpleGraph

Postby shternlib » June 28th, 2004, 7:38 am

Hi. Where can I know about your feature plans of TSimpleGraph? Do you plan to make polylines? Thanks.
shternlib
Active Member
Active Member
 
Posts: 5
Joined: June 28th, 2004, 7:34 am
Location: Russia

Postby Kambiz » June 28th, 2004, 9:24 am

Frankly, no future plan!

Defining a new polyline node is very easy. You just need to subclass a new class from TPloygonalNode and override two simple methods.

For example here is the definitian of TTriangularNode:

Code: Select all
TTriangularNode = class(TPolygonalNode)
  protected
    function GetMaxTextRect: TRect; override;
    class procedure DefineVertices(const ARect: TRect; var Points: TPointArray); override;
  end;

class procedure TTriangularNode.DefineVertices(const ARect: TRect;
  var Points: TPointArray);
begin
  SetLength(Points, 3);
  with ARect do
  begin
    with Points[0] do
    begin
      X := (Left + Right) div 2;
      Y := Top;
    end;
    with Points[1] do
    begin
      X := Right;
      Y := Bottom;
    end;
    with Points[2] do
    begin
      X := Left;
      Y := Bottom;
    end;
  end;
end;

function TTriangularNode.GetMaxTextRect: TRect;
begin
  with Result do
  begin
    Left := (Vertices[0].X + Vertices[2].X) div 2;
    Top := (Vertices[0].Y + Vertices[2].Y) div 2;
    Right := (Vertices[0].X + Vertices[1].X) div 2;
    Bottom := Vertices[1].Y;
  end;
  OffsetRect(Result, -Left, -Top);
  IntersectRect(Result, Result, inherited GetMaxTextRect);
end;

By the way, to be able to read a newly defined node from a stream, you have to register its class to SimpleGraph as follow:

Code: Select all
TSimpleGraph.Register(TTriangularNode);

That's all.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

I mean polyline link

Postby shternlib » June 28th, 2004, 10:43 am

Is it possible to make polyline link? F.e. link from node A to node B and another link from B to A?
shternlib
Active Member
Active Member
 
Posts: 5
Joined: June 28th, 2004, 7:34 am
Location: Russia

Postby Kambiz » June 28th, 2004, 11:56 am

For this purpose you have to subclass TGraphLink, and add some intermediate points to the link. Also, the new link class should be registered to the SimpleGraph, as same as node classes.

To be honest, it's lot of work and because of that I didn't implement it myself. Who knows, maybe in future I do it. :wink:
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

:D

Postby shternlib » June 28th, 2004, 1:53 pm

And what is needed to make this moment closure? :wink:
shternlib
Active Member
Active Member
 
Posts: 5
Joined: June 28th, 2004, 7:34 am
Location: Russia

Postby Kambiz » June 28th, 2004, 2:00 pm

:?: (Motivation + Spare Time) . (a lot)
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby shternlib » June 28th, 2004, 2:03 pm

Motivation is what? 8) If I understand you correct, spare time is consequence of motivation
shternlib
Active Member
Active Member
 
Posts: 5
Joined: June 28th, 2004, 7:34 am
Location: Russia

Postby Kambiz » June 28th, 2004, 2:33 pm

Currently I have three open projects in my hands. When I finished them, I may improve TGraphLink class to fit in your needs.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby shternlib » June 28th, 2004, 2:40 pm

Does anything can change the priority of your projects? I mean making TSimpleGraph before those three projects :)
shternlib
Active Member
Active Member
 
Posts: 5
Joined: June 28th, 2004, 7:34 am
Location: Russia

Postby Kambiz » June 28th, 2004, 4:04 pm

Two of them are contracted projects and I cannot postpone them. :(
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron