Hi Tony

You can't query the scale directly but you can calculate it.

1: find the widt of the frame  in cm
2: get the zoom of your map window in m
3: you can now calculate the scale as 100 * zoom / width

include "mapbasic.def"
declare sub main
Declare Function FindScale(Byval mapid as integer)as integer

sub main
    print "Scale = 1:" & FindScale(Frontwindow())
end sub

Function FindScale(Byval mapid as integer)as integer
    dim z, sca as integer,
        x0, x1 as float,
        tFrame as object

    set distance units "m"
    Set Paper units "cm"
    z = mapperinfo(mapid, mapper_info_zoom)
    Select * from Layout1 where Str$(ObjectInfo(obj, obj_info_framewin)) =
Str$(MapId)
    tFrame = Selection.object
    Set coordsys Layout Units "cm"
    x1  = objectGeography(tFrame, obj_geo_maxx)
    x0  = objectGeography(tFrame, obj_geo_minx)
    sca = 100 * z / (x1 - x0)
    Set coordsys window MapId
    FindScale = Sca
end function

Peter Laulund
National Survey and Cadastre, Denamrk






Tony Shepherd <[EMAIL PROTECTED]> - 26-08-99 21:12:09

Til:    "MapInfo Email Group (E-mail)" <[EMAIL PROTECTED]>
cc:      (bcc: Peter Laulund/MI/KMS)
Vedrørende:    MI Finding scale of a frame on a layout.



I have written a lot of MB code but for the life of me I cant find out
how to query a frame on a layout as to its scale. i.e. when you double
click the frame it comes up with its height, width, scale etc.
Can somebody point me in the right direction.
Cheers
Tony

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Tony Shepherd, GIS / IT Support
Gore District Council, Gore, New Zealand
Gore,The Brown Trout Capital
 .. .. .. .. check out or sites! .. .. .. ..
    .. . www.mataura.com . ..
   .. . www.goredc.govt.nz  . ..
- - - - - - - - - - - - - - - - - - - - - - - - - - -

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]


Reply via email to