## Zoom behavior in TSimpleGraph

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

### Zoom behavior in TSimpleGraph

Very busy but found time to test last version. Very interesting behavior of the zoom. For I've seen, it zooms taking like reference the center of control when possible.
Many time thinking around the idea (but no much time and knowledge of the zoom methods to make it working) of making a browser-Zoom. I'll explain it with these draws.
Attachments
Zooming2.JPG (101.25 KiB) Viewed 4556 times
Zooming1.JPG (64.17 KiB) Viewed 4556 times
elias
Senior Member

Posts: 90
Joined: November 8th, 2005, 12:09 pm
Location: Galicia, Spain

Honestly, I couldn't understand the different behaviors you described.

I added the following methods to SimpleGraph:

Code: Select all
function ChangeZoom(NewZoom: Integer; Origin: TGraphZoomOrigin): Boolean;function ChangeZoomBy(Delta: Integer; Origin: TGraphZoomOrigin): Boolean;

The Origin parameter is one of the following values:
• zoTopLeft
Tries to keep top left curnor of the current view visible.
• zoCenter
Tries to keep center of the current view, still centered.
• ZoCursor
Tries to keep point under cursor, still under cursor.
Kambiz

Kambiz

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

Kambiz wrote:I added the following methods to SimpleGraph:

Code: Select all
function ChangeZoom(NewZoom: Integer; Origin: TGraphZoomOrigin): Boolean;function ChangeZoomBy(Delta: Integer; Origin: TGraphZoomOrigin): Boolean;

The Origin parameter is one of the following values:
• zoTopLeft
Tries to keep top left curnor of the current view visible.
• zoCenter
Tries to keep center of the current view, still centered.
• ZoCursor
Tries to keep point under cursor, still under cursor.

Is this exactly what I wanted but didn't like to ask after all that effort of yours. Now we can zoom in the way we like.

• Zoom Range: zoom to the marquee area.
• Zoom Extends: zoom to the bounding rect of the graph.
Fotis

kokkoras
Moderator

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

Hey, nice to see another ACAD user and delphi-fan!
My main-language is still autolisp.
Hans-Peter
HPW
Moderator

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

HPW wrote:

Hey, nice to see another ACAD user and delphi-fan!
My main-language is still autolisp.

I just used to teach ACAD for a long time (~5000 hours). I am out of it since 2004 though (missing it ).

EDIT: I am too old for autolisp (even my account says I am a senior member ). Besides, my favorites was always Prolog and Delphi.
Fotis

kokkoras
Moderator

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

.. I am too old for autolisp

I do not believe that, but I am a huge lisp-fan at all.
So I am not objective.

Through my plugin even SimpleGraph gets lispy now, because the plugin support a direct-call interface to newLISP.dll

I am quite involved on the newLISP project and its windows DLL-port.
http://www.newlisp.org

Easy using even from delphi:
Code: Select all
type  TNewLispCall = function(string1: PChar): PChar;   stdcall;//...var        DllCall: TNewLispCall;//...  Handle := 0;  Handle := LoadLibrary(PChar('newlisp.dll'));  if Handle <> 0 then  begin @DllCall := GetProcAddress(Handle, PChar('newlispEvalStr'));    if Assigned(DllCall) then    begin      RetStr := nil;      RetStr := DllCall(PChar(DllParam1));    end;  end;
Hans-Peter
HPW
Moderator

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

HPW wrote:
.. I am too old for autolisp

I do not believe that, but I am a huge lisp-fan at all.
So I am not objective.

Through my plugin even SimpleGraph gets lispy now, because the plugin support a direct-call interface to newLISP.dll

I mean, I don't have time to invest on new langs, unless I got paid.

I believe that at some point in the future, the nodes should store code in some interpreted lang, name it Java, Lisp, Prolog, VB, scripting Pascal, whatever.

I am a big fan of declarative langs but unfortunately we live in a C/C++ world. If MS or Borland had developed shining Prolog/Lisp IDEs the world would have been different. Even Delphi is strangling.

EDIT: of course, we are off-topic
Last edited by kokkoras on March 23rd, 2006, 7:07 pm, edited 1 time in total.
Fotis

kokkoras
Moderator

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

I believe that at some point in the future, the nodes should store code in some interpreted lang, name it Java, Lisp, Prolog, VB, scripting Pascal, whatever.

The answer is the new data-property, which I want to use for this soon.

I am a big fan of declarative langs but unfortunately we live in a C/C++ world. If MS or Borland had developed shining Prolog/Lisp IDEs the world would have been different. Even Delphi is strugling.

When you mean the .NET future the answer for me is LSharp.NET
http://lsharp.sourceforge.net/
(Another Lisp-project I am involved)

PS: Sorry again to be so off-topic
Hans-Peter
HPW
Moderator

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

Do you know what? About 10-11 years ago, I used to work with ACAD too.
Kambiz

Kambiz

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

Kambiz wrote:Do you know what? About 10-11 years ago, I used to work with ACAD too.

It is all clear to me now! It sounds like an international conspirancy theory . I am also a die hard fan of Total Commander.
http://www.ghisler.com/
Fotis

kokkoras
Moderator

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

Ok, I was talking about just an algorithm; said with common words, when i have several objects at a graph, and i want to zoom one of them, I simply put the cursor over the desired point and zoom in. With this algorithm, the point starts to center at the control until it is completely centered. This corresponds to picture #2.
Zooming out cannot follow this way, so I just put the cursor where I'd want to have it (relative to the graph) after zoommig (Explained in #1).
This way pan-mode would not be necessary to browse around the graph.
¿Isn't anybody who understand me?
elias
Senior Member

Posts: 90
Joined: November 8th, 2005, 12:09 pm
Location: Galicia, Spain

Well, I'll try to find any time to implement it. I think you'll see the result amazing.
elias
Senior Member

Posts: 90
Joined: November 8th, 2005, 12:09 pm
Location: Galicia, Spain

elias wrote:Well, I'll try to find any time to implement it. I think you'll see the result amazing.

What you want is clear now.

You can also get the extends (bounding rect) of your object and zoom at that area with one command.
Fotis

kokkoras
Moderator

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

elias wrote:Ok, I was talking about just an algorithm; said with common words, when i have several objects at a graph, and i want to zoom one of them, I simply put the cursor over the desired point and zoom in. With this algorithm, the point starts to center at the control until it is completely centered. This corresponds to picture #2.
Zooming out cannot follow this way, so I just put the cursor where I'd want to have it (relative to the graph) after zoommig (Explained in #1).
This way pan-mode would not be necessary to browse around the graph.
¿Isn't anybody who understand me?

I think I got what you mean.
Kambiz

Kambiz

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

Talking about zoom, let's put them all together. IMHO the expected behaviours should be the following:

1. WheelZoom: when zooming with the mousewheel the point under the mouse should stay still.
2. Zoom Center: When clicking somewhere to zoom, that point, should become the center of the zoomed picture.
3. Zoom Extends: should maximaly zoom the graph bounds
4. Zoom Range: should maximaly zoom the selected area (Alt+Drag) trying to keep in view the the bigger dimension.

Kambiz, which one is currently not supported? (I mean, it's impossible/hard to implement due to library limitations)
Fotis

kokkoras
Moderator

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

Next

### Who is online

Users browsing this forum: No registered users and 1 guest