PDA

Click to See Complete Forum and Search --> : Zoom in and out with VB


jagadeesh
Dec 17th, 2001, 03:12 AM
Hello

We are developing one tools for GIS related Projects.
In this tools we draw lines and points on the vb form
by taking values form the text file.
Every thing is fine up to drawing of the lines and points.
Now we want to add Zoom in and Zoom out functionality to
that.
We deviding the form as per the min and max values which
are taken from the text file for the first time.
After that i want to set up the min and max values for
the map as per mouse clicks. This mouse clicks are for
, We drag the mouse to select the part that is to be Zoomed.
For this i want min and max (x and y)values.
At present i am taking mouse down values for minx and miny.
and mouse up values for maxx and maxy values.
but according to i am not getting exactly what i want.

Below is the code to draw line, reading values from the
text file.This is only the part that is which convert or
divides the form as per min and max values which are read
from the text file.


dx = 768 / ((maxx - minx))
dy = 521 / ((maxy - miny))
diffx1 = Abs(((minx - X1)) * dx)
diffy1 = Abs(((miny - Y1)) * dy)
diffx2 = Abs(((minx - X2)) * dx)
diffy2 = Abs(((miny - Y2)) * dy)
Newy1 = Totalheight - (diffy1)
Newy2 = Totalheight - (diffy2)
Line (diffx1, Newy1)-(diffx2, Newy2), QBColor(5)

Now i want to write code for the Zoom.
Can any one help me on this.
If u want any clarifications feel free to ask

Thank in advance

Jotaf98
Dec 17th, 2001, 05:01 PM
That's easy, try this formula:

NewX = OriginalX * PercentZoom / 100

Use that for both the X and Y coordinate of the points in the lines, it should work fine :)

jagadeesh
Dec 18th, 2001, 01:11 AM
Hello

I am unable to understand what is newx and originalx
in this formula

NewX = OriginalX * PercentZoom / 100

Can u explain once again(in detailed).

If u want i can send u VB form and code on which i am
working and what i want.

Thanks

Jotaf98
Dec 18th, 2001, 06:37 AM
The OriginalX is the X position you have. NewX is the X position where it should be once it's zoomed :)
Just don't forget to do it for both the X and Y coordinates of ALL points ;)

jagadeesh
Dec 21st, 2001, 03:59 AM
Send me your e-mail id to suryadevara75@yahoo.com. I will send my attachment to your id,because you can get better understand of my problem.

Jotaf98
Dec 23rd, 2001, 05:18 PM
It's not that hard, but ok :)

Sastraxi
Dec 23rd, 2001, 06:52 PM
Basically any X (left) parameters of stuff you're drawing would go into that zoom "filter". Say you have 2x zoom:Obj.ZoomX = Obj.X * 200 / 100That would be the code for doing what you are doing. That is only hypothetical, if you had a UDT for the objects inside.