Thanks to everyone who emailed me (especially David Booth and Keith
Campbell) regarding trying to view the entire area of an object from a
table. I got a few different solutions and in the end I went with the
following code. I may not have explained myself clearly but the issue was
that the extent of the object  may in some instances  be greater than the
vertical extent of the mapper. The issue is then how to zoom the mapper in
this regard.

Following is the code that Keith sent me which worked fantastically. The
only change I made was to add a multiplier to the Zoom statement to give a
greater margin between the selected object and the edge of the mapper.

Thanks,

Mike


Keith Campbell's Code 


To determine the extents of objects call the ObjectGeography function like
so: -

    fXmin = ObjectGeography(obj, OBJ_GEO_MINX)  
    fXmax = ObjectGeography(obj, OBJ_GEO_MAXX)
    fYmin = ObjectGeography(obj, OBJ_GEO_MINY)
    fYmax = ObjectGeography(obj, OBJ_GEO_MAXY)

This will not work for point, text or frame objects.

You can then centre the mapper as follows:-

        fXobj = fXmax - fXmin
        fYobj = fYmax - fYmin
        fXcen = (fXmin + ((fXmax - fXmin) / 2))
        fYcen = (fYmin + ((fYmax - fYmin) / 2))
        fXwin = MapperInfo(iWinID, MAPPER_INFO_MAXX) - MapperInfo(iWinID,
MAPPER_INFO_MINX)
        fYwin = MapperInfo(iWinID, MAPPER_INFO_MAXY) - MapperInfo(iWinID,
MAPPER_INFO_MINY)
        If (fXobj / fYobj) > (fXwin / fYwin) then               'if object
x/y is greater than map x/y...
        Set Map Window FrontWindow()    'object width determines window
width
                Center (fXcen, fYcen)
                Zoom (fXobj*1.10) Units sDistUnit 
        Else                                 
        Set Map Window FrontWindow()    'otherwise object height determines
window width
                Center (fXcen, fYcen)
                Zoom ((fYobj * (fXwin / fYwin))*1.10)Units sDistUnit 
        End If



_______________________________________________________________________
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