TSimplegraph in Sourceforge and some nice extensions

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

TSimplegraph in Sourceforge and some nice extensions

Postby Dimitris » December 28th, 2007, 10:03 pm

Hi, this is my first post, so i would like first to thank you for this great component. I believe that SG makes Delphi an even more powerfull choice for developing graphics applications.

I am a fun delphi developer so, these are my suggestions based on some extensions i've already made (i can give you the code if you like):


Last Updated (3/1/2008)

1. Text position should be allowed not only inside shapes, but also above, below, left and right. This can be handled with a new TextPosition property similar to TextAlignment. An other more flexible solution, is to make a text object which is connected (transparently) with its node and it can be moved around using the mouse.

2. Copy of nodes should not copy the links except those links which are inside the selected nodes. If not so, copy of large graphs will not be satisfying.

3. InsertLink calls CreateNew link on InsertObjectByMouse which is called on mousedown. It is not correct to create a link graphobject on mousedown because it will be not easy to revoke it if some conditions are not fullfiled (consider for example what happens if two nodes should not be connected). On the contrary, it is more convenient to draw a simple dump line while dragging which is not an object.

4. There should be a property which allows or not link connections between nodes only, and not link connections between nodes and the background or the background itself.

5. Antialiasing of all shapes for professional look and feel would give better zoom appearance. As you may already know this is possible using Scanlines. Notice that a new zoom logic will be required which redraws every shape with appropriate zoom factor instead of stretching.

---------------------------------------------------------------------------------

I would be glad to hear from you, and see an active and uptodate project for SG in sourceforge sometime, so anyone can contribute.

Best regard and happy new year 2008,

Dimitris
Attachments
SG_antialised_mode.png
Anti-aliasing property for SG
SG_antialised_mode.png (14.39 KiB) Viewed 2574 times
Last edited by Dimitris on January 2nd, 2008, 11:32 pm, edited 7 times in total.
Dimitris
Active Member
Active Member
 
Posts: 5
Joined: December 28th, 2007, 8:31 pm

Postby kokkoras » January 2nd, 2008, 5:11 pm

Welcome!

There was an older atempt to go the sourceforge way but it swamped. It's probably time for a second try but Kambiz is the one who decides.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Dimitris » January 2nd, 2008, 6:30 pm

You are right kokkoras, there is an old project in sourceforge
named "a canvas for drawing graphs in delphi" and Kampiz is
not in the developers' list (?).

If Kampiz says ok, i would be glad to participate to a new one.

By the way, i'm from Thessaloniki too.

Xronia polla kai eytyxismeno to neo etos (wishes in Greek) :lol:
Dimitris
Active Member
Active Member
 
Posts: 5
Joined: December 28th, 2007, 8:31 pm

Postby kokkoras » January 2nd, 2008, 6:59 pm

Dimitris wrote:You are right kokkoras, there is an old project in sourceforge named "a canvas for drawing graphs in delphi" and Kampiz is
not in the developers' list (?).


It's the project I mentioned above - Kambiz was too busy to contribute more.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Dimitris » January 4th, 2008, 12:17 am

I submit here a solution for the second suggestion described above. In fact, it was better to alter the ToggleSelection procedure instead of CopyToClipboard.

Code: Select all

procedure TSimpleGraph.ToggleSelection(const Rect: TRect; KeepOld: Boolean;
  GraphObjectClass: TGraphObjectClass);
var
  GraphObject: TGraphObject;
  I: Integer;
  ASource: TGraphObject;
  ATarget: TGraphObject;
begin
  if not Assigned(GraphObjectClass) then
    GraphObjectClass := TGraphObject;
  for I := 0 to Objects.Count - 1 do
  begin
    GraphObject := Objects[I];
    if (fToggleSelectionMode = smInsideLinks) and GraphObject.IsLink then
    begin
      GraphObject.Selected := False;
      Continue;
    end;
    if (GraphObject is GraphObjectClass) and GraphObject.ContainsRect(Rect) then
      GraphObject.Selected := not (KeepOld and GraphObject.Selected)
    else if not KeepOld then
      GraphObject.Selected := False;
  end;

  if fToggleSelectionMode=smInsideLinks then begin
    for I := 0 to Objects.Count - 1 do
    begin
      GraphObject := Objects[I];
      if not GraphObject.IsLink then Continue;
      ASource := TGraphLink(GraphObject).Source;
      ATarget := TGraphLink(GraphObject).Target;
      if not assigned(ASource) or not assigned(ATarget) then Continue;
      if ASource.Selected and ATarget.Selected
        then GraphObject.Selected := not GraphObject.Selected;
    end;
  end;;

end;


I have introduced ToggleSelectionMode property to leave the user a choice between ssAll (Toggle Selection of all nodes and all links - the original code) and ssInsideLinks (ToggleSelection of all Nodes and links inside nodes only).

An additional desirable property, would be the restriction of connected links only, as mentioned in suggestion 4.

Any idea about suggestion 3? I think it is important that links are not created on mousedown.

Dimitris
Dimitris
Active Member
Active Member
 
Posts: 5
Joined: December 28th, 2007, 8:31 pm

Postby Kambiz » January 4th, 2008, 1:53 am

In my opinion, it is better to write simplegraph from scratch because adding new features to the current implementation is like patching.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » January 4th, 2008, 2:46 am

although there is a lot of great functionality, that's true
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron