Hi All

This might be of interest to some of you,

I use this strategy to control the seize an placement off text in a mapinfo
 table

1: first i open a mapper with my text table, set the coordsys and get the
windowid

2: i then use this function to recalculate the zoom of my mapper. The trick
 is by creating a dummy text and getting the seize of this text i can
calculate a zoom that gives me the correct seize of my text


''''''''''''''''''''''
      Set mapper window WinId CalculateZoom(myTextHeight, WinId)

function CalculateZoom(byval h as Float, byval winId as integer) as Float
    dim o as object,
        s as string,
        x, y as integer,
        ymin, ymax, dy, z, NewZoom as float

    Set Distance units "m"
    Set style font("Univers", 1, 72, 0 )
'    Set style font lFont
    s = "Test string"
    x = MapperInfo(winId, mapper_Info_centerx)
    Y = MapperInfo(winId, mapper_Info_centery)
    o = CreateText(winId, x, y, s, 0, 0, 0 )

    ymin = ObjectGeography(o, obj_Geo_miny)
    ymax = ObjectGeography(o, obj_Geo_maxy)

    z    = mapperInfo(winId, mapper_info_zoom)
    dy   =  yMax - yMin
    NewZoom = z / (dy / h) * 1.667

    CalculateZoom = NewZoom
End Function

3: i can now use the CreateText() function to place any text in any angel
at the correct seize in my table, i can even justify it to the center left
or right.

4: if i have to use another text height  i just recalculate the zoom

Peter Laulund
Natioanl Survey and Cadaster, Denmark


----------------------------------------------------------------------
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