Hi Gearoid

This should get you one your way getting selected polylines
coords/attributes in to your VB program. It's not a complete solution:

***** VB 6.0 *****

    Set mi = GetObject(, "MapInfo.Application") ' Getting an instance of an
open MapInfo
    
    NumLinesSel = mi.eval("SelectionInfo(3)") ' Getting the number of
selected lines in MapInfo
    
    If NumLinesSel = 0 Then
        MsgBox ("Atleast one polyline/object has to be selected")
        Frmvalg.Show
        Exit Sub
    End If
    
    BaseTabname = mi.eval("SelectionInfo(1)") ' getting the name of the
table that holds the object(s)
    
    SelTabname = mi.eval("SelectionInfo(2)") ' getting the name of the table
that holds the selection i.g. "Query2"

    midoString = "Fetch First From " & SelTabname ' commanding MapInfo to
get the first object of the selection
    mi.do midoString
    
    For i = 1 To NumLinesSel ' for each object selected
                
        ObjectType = mi.eval("ObjectInfo(Selection.obj,1)") ' getting the
objecttype

        VMTPMapInfoRecordID = mi.eval(SelTabname + ".RECORD_NUMBER")'
getting a value from a table in MapInfo
        
        Select Case ObjectType  ' Objekttype fra MapInfo
                
            Case 4, 7, 8 'Pline,Region,Rectangle
                NumPoints = mi.eval("ObjectInfo(Selection.obj,20)") '
getting the number of point contained in the i'th object
                                
                ReDim ObjectCoords(2, ((2 * NumPoints) + 1)) ' Redim array
to hold the coords
                                
                midoString = "Set Map Window FrontWindow() CoordSys Earth
Projection 21, 28, ""m"", 9, 0, 0.9996, 500000, 0" ' Setting the map
coordsys
                mi.do midoString
                midoString = "Set CoordSys Earth Projection 21, 28, ""m"",
9, 0, 0.9996, 500000, 0" ' setting MapInfo's coordsys
                mi.do midoString
                                
                For j = 1 To NumPoints
                    mievalString = "Format$(ObjectNodeX(Selection.obj,1," &
Str$(j) & "), "",#.##"")" ' Getting X and 11storing it into the array (The
format changes for diff. coordsys)
                    ObjectCoords(1, j) = mi.eval(mievalString)

                    mievalString = "Format$(ObjectNodeY(Selection.obj,1," &
Str$(j) & "), "",#.##"")" ' Getting Y
                    ObjectCoords(2, j) = mi.eval(mievalString)
                Next
        End Select
Next

***** VB 6.0 *****

Ragards

Thomas Brix Lyng
Frederikshavn Munincipal Administration
Denmark


> ----------
> Fra:  Gearoid O'Riain[SMTP:[EMAIL PROTECTED]]
> Sendt:        11. september 2002 15:52
> Til:  '[EMAIL PROTECTED]'
> Emne:         MI-L MI: Integrated mapping - Return selected polys to VB
> app
> 
> 
> Hi !
> 
> Does anyone have sample code that shows how to retrieve a user selection
> from MapInfo to a VB application (an integrated VB/MI application) -
> using,
> I expect, callbacks ? 
> 
> I want to develop an app that integrates with MI, user can view a number
> of
> map layers, selects certain polys in a table using one of a number of
> standard selection tools, list of selected polys gets returned, this is
> checked for intersection with a number of maptile grids, and the list of
> intersected map tile grids is set to the VB app.  The VB app in turn
> copies
> the map tiles e.g. photos, rasters, vector tiles, to special directories
> for
> burning to CDs for distribution to sub-offices.
> 
> If anyone wants a short technical spec on requirements I can send this.  I
> expect someone has done a similar thing before either via MapX/VB or
> Integrated Mapping (MI/VB).
> 
> Thanks -
> 
> Gearoid
> 
> **********************************************************************
>  Gear�id � Riain             
>  Compass Informatics     Tel   +353-1-6705761 / 087-2902343
>  19 Nassau Street          Fax  +353-1-6703037 
>  Dublin 2, Ireland            Email [EMAIL PROTECTED]
>   
>  Visit www.compass.ie !
>  And enter the Compass GeoShop at www.compass.ie/geoshop/.
>  
> ***********************************************************************
>   
>  This email and any files transmitted with it are confidential and
>  may contain commercially sensitive material. They are intended 
>  solely for the use of the individual(s) to whom they are addressed 
>  and should not be released to a third party without the consent 
>  of Compass Informatics.
>  
>  ***********************************************************************
> 
> 
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 2974
> 

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 2992

Reply via email to