## SimpleGraph 2.5 released!

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.
Kambiz wrote:What do you think about having OnObjectMouseEnter and OnObjectMouseLeave events?

It's getting too detailed. I am not sure. I thought that there were such events already. How does the tooltip apears?

Does this event fire when dragging another node and entering/leaving the bounding rect of another?

Fotis

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

kokkoras wrote:Thank you!

If you are still in good mood please consider adding a method to equally size selected nodes (like those for alignment you added in 2.5).

size widths of selected to widest/narrowest node
size heights of selected to tallest/shortest node

I'm waiting for a good mood.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Kambiz wrote:I'm waiting for a good mood.

Fotis

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

What do you think about having OnObjectMouseEnter and OnObjectMouseLeave events?

Sounds very usefull to me!
More control than OnInfoTip alone.
And OnMouseMove of cource.
Hans-Peter
HPW
Moderator

Posts: 236
Joined: February 25th, 2006, 10:19 am
Location: Germany

kokkoras wrote:
Kambiz wrote:What do you think about having OnObjectMouseEnter and OnObjectMouseLeave events?

It's getting too detailed. I am not sure. I thought that there were such events already. How does the tooltip apears?

Does this event fire when dragging another node and entering/leaving the bounding rect of another?

A usage of OnObjectMouseEnter and OnObjectMouseLeave could be:

Code: Select all
procedure TMainForm.SimpleGraphObjectMouseEnter(Graph: TSimpleGraph;  GraphObject: TGraphObject);var  Rect: TRect;begin  if GraphObject is TRectangularNode then  begin    Rect := GraphObject.BoundsRect;    InflateRect(Rect, -4, -4);    Rect.TopLeft := SimpleGraph.GraphToClient(Rect.Left, Rect.Top);    Rect.BottomRight := SimpleGraph.GraphToClient(Rect.Right, Rect.Bottom);    Memo1.BoundsRect := Rect;    Memo1.Color := GraphObject.Brush.Color;    Memo1.Font := GraphObject.Font;    Memo1.Alignment := TGraphNode(GraphObject).Alignment;    Memo1.Text := GraphObject.Text;    Memo1.Visible := True;  end;end;procedure TMainForm.SimpleGraphObjectMouseLeave(Graph: TSimpleGraph;  GraphObject: TGraphObject);begin  if Memo1.Visible then  begin    GraphObject.Text := Memo1.Text;    Memo1.Visible := False;  end;end;

The above code enables user to edit text of a Rectangular Node directly on the graph.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

I think OnObjectMouseEnter and OnObjectMouseLeave events are more usefull to show/hide speed buttons on the objects.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Kambiz wrote:A usage of OnObjectMouseEnter and OnObjectMouseLeave could be:

Code: Select all
procedure TMainForm.SimpleGraphObjectMouseEnter(Graph: TSimpleGraph;  GraphObject: TGraphObject);var  Rect: TRect;begin  if GraphObject is TRectangularNode then  begin    Rect := GraphObject.BoundsRect;    InflateRect(Rect, -4, -4);    Rect.TopLeft := SimpleGraph.GraphToClient(Rect.Left, Rect.Top);    Rect.BottomRight := SimpleGraph.GraphToClient(Rect.Right, Rect.Bottom);    Memo1.BoundsRect := Rect;    Memo1.Color := GraphObject.Brush.Color;    Memo1.Font := GraphObject.Font;    Memo1.Alignment := TGraphNode(GraphObject).Alignment;    Memo1.Text := GraphObject.Text;    Memo1.Visible := True;  end;end;procedure TMainForm.SimpleGraphObjectMouseLeave(Graph: TSimpleGraph;  GraphObject: TGraphObject);begin  if Memo1.Visible then  begin    GraphObject.Text := Memo1.Text;    Memo1.Visible := False;  end;end;

The above code enables user to edit text of a Rectangular Node directly on the graph.

And where does this memo1 control live? Is it a public control for that purpose? Is it created (and then destroyed) on purpose?
Fotis

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

It's a TMemo dropped on SimpleGraph control.

SimpleGraph accepts child controls.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

ok, I think we talked about them too much. The idea is fine. If it's easy to implement just drop the events and let the developer deside for the usage.
========================

Please do not take the next requests seriously:

Regarding the polyline arrows: do you know the maths to draw splines between breakpoints? For 3 points A, B, and C, there must be 2 equations, say f1(x) and f2(x) for which the following are known:

f1(A), f1(B), f2(B), f2(C): f1 and f2 satisfy (X,Y) of A, B, C
f1'(A), f2'(C): first derivations can be set ad-hoc (how the line starts/ends)
f1(B)= f2(B) : boundary condition for f1, f2. B is common point.
f1'(B)=f2'(B): boundary condition for derivations of f1, f2

By solving this system we get nice splines for arrows.

Fotis

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

kokkoras wrote:Regarding the polyline arrows: do you know the maths to draw splines between breakpoints? For 3 points A, B, and C, there must be 2 equations, say f1(x) and f2(x) for which the following are known:

f1(A), f1(B), f2(B), f2(C): f1 and f2 satisfy (X,Y) of A, B, C
f1'(A), f2'(C): first derivations can be set ad-hoc (how the line starts/ends)
f1(B)= f2(B) : boundary condition for f1, f2. B is common point.
f1'(B)=f2'(B): boundary condition for derivations of f1, f2

By solving this system we get nice splines for arrows.

It's much easier to use PolyBezier Windows API (Bézier curves).

I'm more interested to add grouping support to the control. But it's scary to begin something that needs some efforts.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Kambiz wrote:I'm more interested to add grouping support to the control. But it's scary to begin something that needs some efforts.

I had told you once about the issue of drawing links on top of nodes because I wanted to have, at least visualy, a nesting situation, that is, graphs inside nodes. I think that drawing wise, we just need the graph to get painted after the container node. Of course, management wise, we need some new structures. I aggre that it's complicated and even thinking of it abstractly is scary. I hope to get my hands back on my stalled project seriously during the summer.
Fotis

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

What about ZOrder and DrawOrder properties? Cannot be managed by these properties?

By the way, could you please attach an image regarding to your last post about splines and arrows? Maybe I didn't get what you meant.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Kambiz wrote:What about ZOrder and DrawOrder properties? Cannot be managed by these properties?

By the way, could you please attach an image regarding to your last post about splines and arrows? Maybe I didn't get what you meant.

Visually wise, it can be handled. But I need some extra functionality. For example, when moving the container node I want all the internals to follow. I also want this nesting situation recursive. That is have node A containing Node B and inside B I want graph G and inside node GA of graph G I want........ got it?

In my app, the objects are Concepts (Rect Nodes), Relations (Oval Nodes), Arrows (Links), Graphs (interconected Concepts, Relations and Arrows). What is missing are NestingNodes, that is, a special kind of concept object (or a new object type, anyway) that has other concepts or graphs inside it. Here it comes the need for nesting.

I think you were talking abstractly about the ability to group simplegraph objects. That's fine. I can use them to define the visualization of my NestingNode objects.

So, a groupNode should have at least a container (TList?) with all the simple objects it owns, and should be created on the fly by selecting some objects and issuing a group command. I am not sure though if special draw handling is required. These groupNodes must be also stored in the disk.

As you mentioned, it's a complex task that requires some time.

BTW, in my app I store my objects in an XML file and re-create them when loading. I am not using your save facilities, although I am considering utilizing them in the future, in order to remove all the visual aspects from my XML file (position, dims, colors, fonts, etc).

Regards
Fotis

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Kambiz wrote:By the way, could you please attach an image regarding to your last post about splines and arrows? Maybe I didn't get what you meant.

I basicaly recall the way ACAD draws splines. It asks for (X,Y) points (breakpoints) and the direction (1st derivation) at the begining and the end of the line. The parts of the line (between succesive points) are (if my memory serves well ) 2nd order polynomial equations (the f1, f2 in my past post). These equations have some functors that must be defined for the spline to get precise form. This requires to solve a set of equations (those mentioned in the other post). The problenm is that this set of equations must be somehow solved, probably with arithmetic methods.

I have no idea though on what is available in Win API about beziers.
Attachments
Untitled.gif (1.9 KiB) Viewed 5194 times
Fotis

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

• I also think having groups resolves your case. To be honest, while grouping is not implemented, I'm not happy about SimpleGraph.
• Converting save format of SimpleGraph to XML is another task should be done. SVG format is the best choice, but I think it's easier to have a private format and use RTTI to save published properties.
• In Bézier curves for each point there are two control points. So, it's more or less like what you described.
Kambiz

Kambiz