Hi all,
I'm after some ideas.
I have about 40 tables of bus routes open in a single mapper window,
some are within view, some are not.
Out of the 40 layers I need to determine which ones are actually
visible in the current mapper. Any ideas greatly appreciated.
MY ATTEMPT:
------------
I was thinking of creating a rectangle the size of the mapper window
into an object variable, and then running a query to see if my table
intersects the object variable - but it don't work - I don't even get
an error message! Reason for using an object variable was to optimise
speed - I'm gona be evaluating a lot of workspaces with a lot layers.
Here's the failed attempt code:
--------------------------------
Declare Sub Main
Declare Function LayerIsVisible
(
ByVal WinID as integer,
ByVal s_Layer as string
)
as logical
--------------------------------
Sub Main
Dim
i, WinID as integer,
s_Layer as string
Print chr$(12)
WinID = FrontWindow()
for i = 1 to MapperInfo(WinID, MAPPER_INFO_LAYERS)
s_Layer = LayerInfo(WinID, i, LAYER_INFO_NAME)
If LayerIsVisible(WinID, s_Layer) then
Print s_Layer
End if
next
End Sub
--------------------------------
Function LayerIsVisible(
ByVal WinID as integer,
ByVal s_Layer as string
)
as logical
Dim
Mx1, Mx2, My1, My2 as float,
o_Rectangle as object
LayerIsVisible = FALSE
Mx1 = MapperInfo(WinID, MAPPER_INFO_MINX)
My1 = MapperInfo(WinID, MAPPER_INFO_MINY)
Mx2 = MapperInfo(WinID, MAPPER_INFO_MAXX)
My2 = MapperInfo(WinID, MAPPER_INFO_MAXY)
Create Rect Into Variable o_Rectangle
(Mx1, My1) (Mx2, My2)
'*** The following bit must be wrong because
'*** it never evaluates to true.
If s_Layer intersects o_Rectangle then
LayerIsVisible = TRUE
end if
End Function
--------------------------------
Peter Zyczynski
Analyst Programmer
Insight GIS
Australia
Ph: (03) 6244-7344
Fax: (03) 6244-7028
[EMAIL PROTECTED]
www.insightgis.com.au
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 2331