INCLUDE "mapbasic.def"
INCLUDE "icons.def"
INCLUDE "menu.def"
Declare Sub Main
Dim tabname(100), newtabname(100) As String
Dim i, j, numtabs as integer
Dim map_id as Integer 'Map Window ID aka FrontWindow()
Dim numlayers as SmallInt
' Dim ClipRegion as Object
'----------------------------------------------------------------------------------------
' CREATES MAPINFO .TAB FILES OF JUST THE DISPLAYED DATA (LAYERS)
' THAT ARE CONTAINED WITHIN THE CLIPPED REGION
'----------------------------------------------------------------------------------------
Sub Main
If NumTables() < 1 Then
Note "You must open a table before continuing."
End If
note numtables() + " tables opened to be processed"
i=1
j=0
numtabs = numtables()
map_id = FrontWindow()
numLayers = MapperInfo(map_id, MAPPER_INFO_LAYERS) 'Get the total number of layers
For i = 1 to NumLayers
IF LayerInfo(map_id, i, LAYER_INFO_DISPLAY) <> 0 ' LAYER_INFO_DISPLAY_OFF ' only want layers that are displayed
and LayerInfo(map_id, i, LAYER_INFO_TYPE) = LAYER_INFO_TYPE_NORMAL ' only want "normal" layers
THEN
j=j+1
tabname(j) = tableinfo(i,TAB_INFO_NAME)
newtabname(j) = "C:\temp\clipped_" + tabname(j)
ELSE
END IF
next
for i = 1 to j
Select * From tabname(i)
Where obj within (Select obj From ClipRegion)
into temp
Commit table temp as newtabname(i)
next
Close Table temp
Close Table ClipRegion
End Sub
_______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
