166
|
Chapter 7
Applications
DWG Filtering Application Example Code
This example illustrates some basic tasks an application can perform when
working with DWG data. It primarily focuses on setting DWG filters and
getting DWG data, but it can easily be modified to change other Autodesk
MapGuide map layer properties, such as the DWG file, the DWG data source,
and so on.
In this example, DWG processing is performed on a map with a single
Autodesk MapGuide map layer called
Floor Plan
. Processing is performed
by two functions:
selChanged()
and
showProperties()
. The operational
flow of these functions is described in the following sections. To see the full
source code for this example, choose Help
➤
Contents
➤
Examples Advanced
➤
Filter DWG Layers in the
Autodesk MapGuide Viewer API Help
. When the
application loads, click the view source link in the right frame.
Selection Changed Function (selChanged)
The following are excerpts from the
selChanged()
function. This function
is called when a user selects or deselects one or more DWG filters from a list
box displayed on the map page. This function sets the layer filter of the DWG
map layer to layers selected by the user. The basic operational flow of this
function is as follows:
1
Use the
getMap
function, the current map is assigned to the variable
map
.
2
Use the
map.getMapLayer
method to get the map’s single map layer
named
Floor Plan
. Assign the map layer to a variable called
mapLayer
.
3
Get the DWG data source object for the layer by first getting the layer
setup using
mapLayer.getLayerSetup
, and then using the layer setup
to get the DWG data sources object of the layer using
mapLayerSetup.getDwgDataSources
.
4
Use
map.createObject("MGCollection")to
create a collection object
called
mapDwgLayerFilters
. This object will hold filters selected by the
user from the filters list box.
5
Iterate through list box selections and add each to the collection object
mapDwgLayerFilters.
6
Create a comma-delimited string named
filterList
containing selected
filters. Note that the
setLayerFilter
method used next expects a
comma-delimited string of filters.
Summary of Contents for 15606-011408-9300 - MAP R6.3 UPG
Page 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Page 6: ...vi ...
Page 16: ...16 ...
Page 30: ...30 ...
Page 84: ...84 ...
Page 134: ...134 ...
Page 202: ...202 ...