Autodesk 15606-011408-9300 Developer Guide - Page 168

Show Properties Function (showProperties), DWG Filtering Application showProperties Example Code

Page 168 highlights

Show Properties Function (showProperties) The following are excerpts from the showProperties() function. This function gets and displays properties of selected map features in a table in the output frame of the Web page, including DWG properties associated with the DWG map layer. The basic operational flow of this function is as follows: 1 Write JavaScript and style sheet selection code to output frame. 2 Write output table headings. 3 Get the map and selected features using the getMap function and the map.getSelection, and sel.getMapObjectsEx(null) methods. 4 Iterate through the selected map features (map objects) and write the fea- ture(s) properties to the output table. In this example, we get the feature name and key using the MGMapObject.getName and getKey methods. 5 Get the layer name for current map feature. To do this, we first get the map layer of the selected feature using the MGMapObject.getMapLayer method. We then use the MGMapLayer.getName method. 6 Get the map layer and its DWG data source object. To do this we first get the map layer using map.getMapLayer with the layer name, then get the layer setup using mapLayer.getLayerSetup method. Then, we get the DWG data sources object of the layer using mapLayerSetup.getDwgDataSources. 7 Using MGDwgDataSources methods, we get the DWG properties of the map layer, including getDataSource, getDwg, getKeyColumn, getKeyColumnType, and getKeyTable. 8 Next, using the getLayerFilter method, we get the DWG layer filters used to display the current map view, and indicate that if no filter was applied if layerFilter is null. 9 Finally, we complete the table by listing the remaining DWG properties using the MGDwgDataSources methods getNameColumn, getNameTable, getUrlColumn, and getUrlTable. DWG Filtering Application showProperties Example Code // Show Properties Function // Shows properties of the selected map feature(s), including DWG properties of the layer function showProperties() { // Write javascript and style sheet selection code to output frame ... // Write table headings parent.outputframe.document.write (""); parent.outputframe.document.write (""); 168 | Chapter 7 Applications

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208

168
|
Chapter 7
Applications
Show Properties Function (showProperties)
The following are excerpts from the
showProperties()
function. This
function gets and displays properties of selected map features in a table in the
output frame of the Web page, including DWG properties associated with the
DWG map layer. The basic operational flow of this function is as follows:
1
Write JavaScript and style sheet selection code to output frame.
2
Write output table headings.
3
Get the map and selected features using the
getMap
function and the
map.getSelection
, and
sel.getMapObjectsEx(null)
methods.
4
Iterate through the selected map features (map objects) and write the fea-
ture(s) properties to the output table. In this example, we get the feature
name and key using the
MGMapObject.getName
and
getKey
methods.
5
Get the layer name for current map feature. To do this, we first get the map
layer of the selected feature using the
MGMapObject.getMapLayer
method. We then use the
MGMapLayer.getName
method.
6
Get the map layer and its DWG data source object. To do this we first get
the map layer using
map.getMapLayer
with the layer name, then get the
layer setup using
mapLayer.getLayerSetup
method. Then, we get the
DWG data sources object of the layer using
mapLayerSetup.getDwgDataSources
.
7
Using
MGDwgDataSources
methods, we get the DWG properties of the
map layer, including
getDataSource
,
getDwg
,
getKeyColumn
,
getKeyColumnType
, and
getKeyTable
.
8
Next, using the
getLayerFilter
method, we get the DWG layer filters
used to display the current map view, and indicate that if no filter was
applied if
layerFilter
is null.
9
Finally, we complete the table by listing the remaining DWG properties
using the
MGDwgDataSources
methods
getNameColumn
,
getNameTable
,
getUrlColumn
, and
getUrlTable
.
DWG Filtering Application showProperties Example Code
// Show Properties Function
// Shows properties of the selected map feature(s), including DWG properties of
the layer
function showProperties()
{
// Write javascript and style sheet selection code to output frame
...
// Write table headings
parent.outputframe.document.write ("<TABLE BORDER=1 WIDTH='100%'>");
parent.outputframe.document.write ("<TR>");