Hi All

I sendt this mail to the list ca. 9 months ago but it is still rellevant

If you want to controll the text then forget all about labels and use
textobject insted, this way you have almost absolut control over the seize
and placement of text.

This is just one off the tecnics i use to control text in MapInfo. If you
can calculate the zoom witout the mb function you can doo evrything using
the MapBasic Window.

Good luck Peter
---------------------- Videresendt af Peter Laulund/MI/KMS - 21-03-2001
09:37 ---------------------------


[EMAIL PROTECTED] - 30-06-2000 09:40:37
                                                                 
                                                                 
                                                                 
 Til:        [EMAIL PROTECTED]                                   
                                                                 
 cc:         (bcc: Peter Laulund/MI/KMS)                         
                                                                 
                                                                 
                                                                 
 Vedrørende: MI MapInfo Fonts and text placement                 
                                                                 








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. Using an update statemaent

Update MyTab set obj = CreateText(MapWinId, x, y, angle, 6, 0)

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]


Med venlig hilsen
Peter Laulund

*************************************************************
Kort & Matrikelstyrelsen  ·  www.kms.dk
National Survey and Cadastre - Denmark
Rentemestervej 8  ·  DK 2400 København NV
E-mail:  [EMAIL PROTECTED]  ·  Home: [EMAIL PROTECTED]
Phone: +45 3587 5050  ·  Direct: +45 3587 5173

*************************************************************




_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to