《geomedia 二次开发手册》
TRANSCRIPT
-
8/3/2019 GeoMedia
1/79
GeoMedia4.0
Automation
GeoMedia GeoMedia
1 OLE
2 COM?
3 OLE
4
5
6
7 Excel
8 GeoMedia
9 GeoMedia
GeoMedia GeoMedia
GeoMedia
GeoMedia
GDatabase GRecrdset GField MapView Legend
LegendEntries Style DataView
/ GeoMedia
Execl
GeoMedia
- 1 -
-
8/3/2019 GeoMedia
2/79
- 2 -
-
8/3/2019 GeoMedia
3/79
1 OLE
GeoMedia
GeoMedia
OLE
(Object Linking and Embedding)OLE
Word Excel
Excel OLE
OLE OLE
OLE -
OLE Excel
Visual Basic GeoMedia
(MapViews)(Pipes) Visual Basic Visual C++
OLE OLE COMOLE
GeoMedia
OLE
COM
GeoMedia
(COM) GeoMedia
OLE COM COM
COM COM
- 3 -
-
8/3/2019 GeoMedia
4/79
COM
COM COM COM
COM
OLE OLE
COM COM Windows NT
COM Windows
Unix Macintosh COM
MSDN.Microsoft.com)Kraig Brockschmidt OLE 2
OLE
OLE OLE (Doument-centric)
(Application-centric)
OLE
OLE OLE
OLE GeoMedia
OLE COM
IUnknown
COM
GeoMedia
OLE OLE OLE
VC++Visual BasicPowerBuilderDeveloper 200Delphi
OLE
- 4 -
-
8/3/2019 GeoMedia
5/79
OLE
VBVC
(Setting)/ (Getting)
Type Library
GeoMedia DLLOCX EXE
.tlb Visual Basic DLL
GeoMedia
Property
Method(Event)
click
(member object)GeoMedia Application
- 5 -
-
8/3/2019 GeoMedia
6/79
Document Document Application
Dependent Object
GeoMedia GDO GField
GTableDef GField GTableDef
(Collection)
Windows Window Queries Query
GeoMedia Windows
DataViewWindow MapViewWindow Queries
Query
Count Item
Count Item
For I = 1 To objCollention.Count
ObjX = objCollention.Item(I)
Next I
1 1 0
0 0 GeoMedia GDO 0
GeoMedia 1
_NewEnum For Each
Item
objCollection.Item(I)
objCollection(I)
Text
txtControl1.Text
txtControl1
- 6 -
-
8/3/2019 GeoMedia
7/79
Table - 1
/
Application Document Document Name
Name
Application.Document.Name
With
Application.Document.Name = Automation Overview
Application.Document.Date = 7/12/97
Application.Document.Author = John Doe
Set tmpDoc = Application.Document
tmpDoc.Name = Automation Overview
tmpDoc.Date = 7/12/97
tmpDoc.Author = John Doe
With Application.Document
.Name = Automation Overview
- 7 -
-
8/3/2019 GeoMedia
8/79
.Date = 7/12/97
.Author = John Doe
End With
DimNewCreateObject
Visual Basic Dim Dim (Object
Variables)Dim ObjX As Object ObjX
Object
ObjX
Dim objDoc As Object
Set objDoc = Application.Document
MyApplication
Set objDoc = CreateObject(MyApplication.Document)
Visual Basic New
Dim objDoc As New Document
New
CreateObject Dim
(DLL)(EXE)
EXE EXE DLL
- 8 -
-
8/3/2019 GeoMedia
9/79
GeoMedia
UUIDGUIDCLSIDPROGID
(GUID: Globally Unique Identifier)GUID 128
GUID (IID)(CLSID)
IIDIID
IID
IID
CLSID CLSID CLSID
IID
ProgIDProgID
Windows ProgID CLSID API (_)
(.) ProgID GeoMedia CLSID GeoMedia
ProgID CreateObject
GeoMedia.Application GeoMedia.Connection GeoMedia.ColorSchemes ProgID
Access.GDatabase Access GDO ProgID
C++
HRESULT
IUnknown IDispatch
- 9 -
-
8/3/2019 GeoMedia
10/79
Excel
GeoMedia OLE
Intergraph Microsoft
Excel Excel GeoMedia
- 10 -
-
8/3/2019 GeoMedia
11/79
Application Workbooks Workbooks
Workbook
Workbook WorksheetsDialogSheetsCharts Modules .
Worksheets Worksheet
Worksheet Range
Range Areas Border
Excel
Range
Application.Workbooks(1).Worksheets(1).Range
Excel Metacollections
2 Excel
- 11 -
-
8/3/2019 GeoMedia
12/79
Excel
Excel
Visual Basic
(Workbook)
8 GeoMedia
GeoMedia
GeoMedia GeoMedia
GeoMedia
GeoMedia
GeoMedia
GeoMedia
-
GeoMedia
GeoMedia /GeoMedia
GDO Server GeoMedia
GeoMedia GDO Server
- 12 -
-
8/3/2019 GeoMedia
13/79
GeoMedia
1GDO
GDO(Geographic Data Objects) OLE
GDO Intergraph Visual Basic OLE Intergraph Open GIS
Consortium (OGC) GDO GDO
Microsoft DAO RDO Microsoft OLE
GIS
GIS GDO GIS
GDO
GDO
2Grecordset
GRecordset GRecordset
() ()GeoMedia GRecordset
GRecordset (cursor)
GRecordset GFields
Recordset GRecordset
GRecordset GRecordset
GRecordset
GRecordset MoveNext Bookmark
GeoMedia
GDO Term Database Other Synonyms
GDatabase Database Warehouse, server
GTableDef Table Feature Class
GField Column Attribute, field
GRecordset Cursor Recordset
Active row (bookmark) Current row Feature instance, row
- 13 -
-
8/3/2019 GeoMedia
14/79
3Legend
GeoMedia Legend
GeoMedia
feature
4Pipe
Pipe GeoMedia Pipe
GRecordset GeoMedia GRecordset
Pipe
Pipe GeoMedia GeoMedia
Pipe GRecordset
GRecordset GRecordset Pipe
GRecordset Pipe
5Coordinate System
GIS
GeoMedia
GeoMedia
Projected coordinate systems X,Y,H
X Y h
Geographic coordinate systems(lon)(lat)
(h)
GeoMedia
6Feature Class
Feature class GeoMedia
feature class feature classes
7Feature
Feature
feature class feature feature class
- 14 -
-
8/3/2019 GeoMedia
15/79
GeoMedia
GeoMedia GeoMedia
GeoMedia
GeoMedia
Legend Style
GeoMedia Style
- 15 -
-
8/3/2019 GeoMedia
16/79
s y y
ies Application.Document.Connections
Application.ActiveWindow.MapView.Legend.LegendEntries
Application.Document.Connections(1).ConnectionName
skip the next object as you continue through the hierarchy.
Application.Document.Windows(1).Mapview.Visible
QuerySubFolders QueryFolder QueryFolders
1Application
GeoMedia Application
Windows - Application
Active Window - DataWindow
MapWindow PreferenceSet - GeoMedia
UnitsOfMeasure - ()
Category / Command - t GeoMedia
Menubar / MenuItem - MenubarMenuItem
Accelerator - ( F1)
Toolbar / ToolBarButton ToolbarToolBarButton
Toolbar
DockableControl - GeoMedia ActiveX
Document
Document Application GeoMedia
(FRAMME, MGE) (Access, Oracle
SDO) Geoworkspacedocument
document document GeoMedia
- 16 -
-
8/3/2019 GeoMedia
17/79
document
document
2Document
document
Connections Connection GDO
Windows document windows (
Application.Windows)
MasterLegend legend GeoMedia recordsets
Legends legend
QueryFolder query classifications query classification
query
SelectedObjects
CoordSystemsMgr
SpatialFilters connection
PropertySet -
ColorSchemes
Windows MapWindow DataWindow .DataWindow DataView DataView
3MapWindow
MapWindow MapViewNorthArrow ScaleBar
NorthArrow OLE
ScaleBar MapView (1
= 100 )
MapView
MapView Legend
CoordSystemsMgr
Legend MapView
LegendEntries
HighlightedObjects MapView
MapViewSelectedObjects Document MapView SelectedObjects
- 17 -
-
8/3/2019 GeoMedia
18/79
CoordSystemsMgr MapView
4Coordinate Systems
CoordSystemsMgr CoordSystem
GIS
CoordSystem
RefSpaceMgr
UnitFormatSpec
GeogSpace RefSpaceMgr
PaperSpace -
RefSpaceMgr
ProjSpace RefSpaceMgr
AltCoordSystemPaths AltCoordSystemPath
AltCoordSystemPath CoordSystemsMgr
LeastSquares -
DatumTransformation -
- 18 -
-
8/3/2019 GeoMedia
19/79
5Legend
legend (Legend Entry)
(GRecordset)
RecordLegendEntry
RasterLegendEntry
RecordLegendEntry
RasterLegendEntry
RangeLegendEntry
UniqueValueLegendEntry
Style
TitleFont, SubtitleFont, HeadingFont
Range
UniqueValue
DisplayedObjects - HighlightedObjects MapViewSelectedObjects
- 19 -
-
8/3/2019 GeoMedia
20/79
RecordsetObject -
RecordObject -
GeometryObject -
RasterObject -
6GDO
GeoMedia GDO
GDO
GDatabase
GTableDef
GField
GIndex
GRecordset
GError
- 20 -
-
8/3/2019 GeoMedia
21/79
GFRMAdminExtension FRAMME
GFRMSeg FRAMME
ExtendedPropertySet OriginatingPipe
Name
Notification
Errors - GErrors
CoordSystem - GRecordset
7Geometry and Styles
GIS
GIS FRAMME MGE
GeoMedia Access Oracle SDO
GDO(Blob)
BlobGeoMedia Geometry Geometry
Geometry
Geometry Blob
Style GIS Style
GeoMedia Style Style
- 21 -
-
8/3/2019 GeoMedia
22/79
GeometryCollection Geometry
PointGeometry
Origin X, Y, Z
Vector - I, J, K
Matrix - 4 x 4
OrientedPointGeometry
TextPointGeometry
LineGeometry
PolylineGeometry
RectangleGeometry
PolygonGeometry
BoundaryGeometry
Holes
RasterGeometry
ArcGeometry -
CompositePolylineGeometry - polyline geometrie
CompositePolygonGeometry - polygon geometrie
- 22 -
-
8/3/2019 GeoMedia
23/79
AreaStyle gdbAreal Style
TextStyle gdbGraphicsText Style
LinearStyle gdbLinear Style
BitmapStyle gdbPoint Style
SymbolFontStyle gdbPoint Style
HandleStyle handle Style PointSymbolStyle - gdbPoint Style
PatternedLinearStyle - gdbLinear Style
PatternedAreaStyle - gdbAreal Style
8Service Pipes
GeoMedia Application
Application Application
Application Controls GeoMedia
Services Pipes
Pipe Service Pipes
Service
- 23 -
-
8/3/2019 GeoMedia
24/79
AttributeFilterPipe SQL
BufferZonePipe
SpatialQueryPipe
CSSTransformPipe
OriginatingPipe
NameExtendedPropertySetNotification
SortPipe
SortKey SortPipe
CenterPointPipe -
EquijoinPipe -
GraphicsTextPipe -
MovePipe -
SchemaProjectPipe -
SpatialFilterPipe -
StatisticsService
GeometryDigitizeService
- 24 -
-
8/3/2019 GeoMedia
25/79
GeometryEditService
GeometryStorageService Geometry Blob Geometry
ServerTransService
RasterPropertiesService
MeasurementService
MetadataService GDO GTableDef
TableProperty MetadataService
FieldProperty MetadataService
SmartLocateService
AutoPanService -
OutputTableService -
SnapService -
SymbolFileService - symbol Style
- 25 -
-
8/3/2019 GeoMedia
26/79
GMMapView MapView OLE
GMDataView DataView OLE
GMDefCoordSystem OLE
GMEventControl MapView OLE
GMFeatureCombobox feature OLE
GMFeatureListbox feature OLE
GMNorthArrow OLE
GMScaleBar OLE
GMWebBrowser - Internet Explorer OLE
GMPlacement - feature feature Geometry OLE
- 26 -
-
8/3/2019 GeoMedia
27/79
GMProperties - feature OLE
GMTextPlacement - OLE
GMPrecisionCoordinate - OLE
PickQuickDialog -
PageSetup - mapview
Print - mapview
GMFeatureComboboxInput - OLE
GMFeatureListboxInput - OLE
GMQueryStorage - OLE
GMTableStorage - GDO OLE
GMLegendEntryOutput - OLE
GMDataWindowOutput - OLE
GMJoinProperties - EquijoinPipe GUI OLE
GMLabelProperties - GUI OLE
EventServer
MapViewListeners MapViews
GeoMathUtilities - C
Intergraph GIS GeoMedia
GeoMedia
GeoMedia
- 27 -
-
8/3/2019 GeoMedia
28/79
1
GeoMedia GeoMedia
2
GeoMedia
- 28 -
-
8/3/2019 GeoMedia
29/79
3 GeoMedia
GeoMedia
GeoMedia GeoMedia GeoMedia
GeoMedia
Tools > Customize (Menu
Bar)
Map
Data None
HKEY_CURRENT_USER\Software\Intergraph\GeoMedia\02.00
- 29 -
-
8/3/2019 GeoMedia
30/79
(MenuBar/MenuItem, Accelerator,
Category/Command, ToolBar/ToolBarButton)
GeoMedia GeoMedia
GeoMedia GeoMedia
C:\Program Files\GeoMedia\Program\Installusrcmd.exe
MyCommand.dll MyCommand.ini
dll ini ini
GeoMedia
dll
GeoMedia
PowerBuilder 5.0 dll GeoMedia
OLE PowerBuilder VB
Wrapper PowerBuilder
Application.CreateService GeoMedia
- 30 -
-
8/3/2019 GeoMedia
31/79
GeoMedia
GeoMedia GeoMedia
DLL GeoMedia DLLs
GeoMedia -0-2
-0-2
Application Windows ActiveWindow
Category(s) Command(s) MenuBar(s)
MenuItem(s) Accelerator(s) Document
DataWindow MapWindow MasterLegend
SelectedObjects MapViewListeners GMFeatureCombobox
GMFeatureListbox ToolBar(s) ToolBarButton(s)
GMFeatureComboboxInput GMFeatureListbox Input GMQueryStorage
GMTableStorage GMLegendEntryOutput GMDataWindowOutput
GeoMedia
GeoMedia
GeoMedia GeoMedia
(license) GeoMedia
Help > About MyApp... command.
Intergraph GeoMedia GeoMedia
Object Bundles
GeoMedia
- 31 -
-
8/3/2019 GeoMedia
32/79
PowerBuilder PowerBuilder DLL
Intergraph OEM GeoMedia
GeoMedia
GeoMedia
GeoMedia GeoMedia
GeoMedia
GeoMedia GeoMedia
Visual Basic Excel
GeoMedia GeoMedia
Application.CreateService GeoMedia
CreateObject GeoMedia
GeoMedia
OLE/COM OLE
/
/
GUID, ProgID
- 32 -
-
8/3/2019 GeoMedia
33/79
Geomedia
GDO
GeoMedia
GeoMedia
1. GeoMedia
2. COM
3.
4. OLE
5. GeoMedia
6.
7. GeoMedia RecordLegendEntry
8.
9.
Dim objMD as Object
Set objMD = CreateObject(MService.MetadataService)
1. GeoMedia
2. GeoMedia :GDatabase GRecrdset GField MapView
Legend LegendEntries Style DataView
GDO
- 33 -
-
8/3/2019 GeoMedia
34/79
, GIS - GeoMedia
warehouse GDO MGE
MGE GDO Access Access GDO
Gdatabase OpenDatabase
Dim objAccessDbs As GDatabase
Set objAccessDbs = CreateObject(Access.GDatabase)
objAccessDbs.OpenDatabaseC:\wherever\myDB.mdb
CreateObject()
Dim objAccessDbs As New GDatabase
GeoMedia GDO
Access Access
ArcInfo AI
Oracle Spatial Cartridge GW
MGE MGE
FRAMME FRAMME
MGE Segment Manager MGSM
- 34 -
-
8/3/2019 GeoMedia
35/79
ArcView AV
MGDM MGDM
CAD Server GCAD
Gdatabase GIS
Connection Connection
Connections Connection
MetadataService OriginatingPipe Connection
Connection Gdatabase
Dim objConnections As New Connections
Dim objConnection As Connection
Set objConnection
=objConnections.Add(c:\wherever\myDB.mdb)
With objConnection
.Type = "Access.GDatabase"
.Location = c:\wherever\myDB.mdb
.Connect
End With
Connection Connections
>, >,>
GeoMedia Program
Autoexec.bat path=
;C:\Program Files\GeoMedia\Program
1 Visual Basic C:\TGM\Labs\CustomApp\src\CustomApp.vbp.
Project Modules modDatabase, View> Code
- 35 -
-
8/3/2019 GeoMedia
36/79
2 OpenDatabase
gobjConnections modGlobals.bas
3 Type Location Connect
4 CloseDatabase frmDatabase lstDatabases
5 Project Forms mfrmMain View>Code
6 MDIForm_Unload
gobjConnections gobjConnections
Disconnect Nothing
7
8 Mode
gmcModeReadOnly
MetadataService
OriginatingPipe fields
GRecordset
Grecordset Gdatabase
OpenRecordset OriginatingPipe
GeoMedia
GDatabase
GDatabase OpenRecordSet
Dim objRS As GRecordset
Set objRS = objAccessDbs.OpenRecordset (Parcels)
Set objRS = objAccessDbs.OpenRecordset (SELECT * FROM Parcels)
- 36 -
-
8/3/2019 GeoMedia
37/79
Set objRS = objAccessDbs.OpenRecordset (SELECT * FROM
Parcels WHERE AssessedValue > 100000)
1. GdbOpenDynaset
2. GdbSnapshot
Set objRS = objAccessDbs.OpenRecordset (SELECT * FROM Parcels
GdbSnapshot)
OriginatingPipe
OriginatingPipe
GeoMedia
Connection CreateOriginatingPipe OriginatingPipe
OutputRecordset
Dim objOP As OriginatingPipe
gobjConnections(1).CreateOriginatingPipe objOP
objOP.Table = Oarcels
- 37 -
-
8/3/2019 GeoMedia
38/79
objOP.Filter = AssessedValue > 100000
Dim objRS As GRecordset
Set objRS = objOP.OutputRecordset
MoveMoveFirstMoveLastMoveNext
MovePrevious BookMark
Set objRS = objDB.OpenRecordset (Parcels)
If Not (objRS.EOF and objRS.BOF) Then
Do Until objRS.EOF
.
code processing the individual records
.
objRS.MoveNext
Loop
Else
MsgBox (No Parcels found.)
End If
EOF BOF True
RecordCount
MoveLast
MoveNext
(Collection)
- 38 -
-
8/3/2019 GeoMedia
39/79
Dim objField As GField
For Each objField in objRS.GFields
Print #1, objField.Name & : & CStr(objField.Value)
Next objField
GeoMedia
WWW.ingr.com GeoMedia Team of GeoMedia
GField Type Type gdbSpatial
gdbGraphic SubType
Type / SubType Description
GdbSpatial Classification of data suchthat the coordinateinformation is assumedspatially accurate
GdbLinear Geometry which is
comprised of a series ofpoints
GdbAreal Geometry which iscomprised of a series ofpoints where the first andlast point are coincident.The area may include oneor more holes.
GdbAnySpatial Geometry which might
either contain one ofeach type of geometry(gdbPoint, gdbLinear,gdbAreal) in a collectionor might contain any oneof these types in a givenfeature class
GdbCoverage Geometry describing animage (raster data)
GdbPoint Geometry defined by asingle point
- 39 -
-
8/3/2019 GeoMedia
40/79
GdbGraphic Classification of data suchthat while coordinateinformation is identifiedrelative to the earth, the
spatial location is notsignificant. This type isusually associated withannotative data likelabels.
GdbSpatial Same as in gdbSpatial.
GdbLinear Same as in gdbSpatial.
GdbAreal Same as in gdbSpatial.
GdbAnySpatial Same as in gdbSpatial.
GdbCoverage Same as in gdbSpatial.
GdbGraphicsText
Geometry defined by apoint and a text string.
gdbPoint Same as in gdbSpatial.
Geometry GeometryStorageService
Geometry
Analyze > Recordset Information
AnalyzeRecordset
1. VB C:\TGM\Labs\CustomApp\src\CustomApp.vbp.
Forms , frmSelectFeature, View > Code.
2. cboDatabases_Click, Table
lstFeatures.
GTableDef.Name
objMDSrvc
GetTables
vTableList vTableList Variant
UBound
LBound
- 40 -
-
8/3/2019 GeoMedia
41/79
3. Modules , modRecordset,
View > Code. CreateRecordset, OriginatingPipe
.
GetSelectFeatureInfo
objActiveConnection CreateOriginatingPipe
OriginatingPipe OriginatingPipe Table
GetSelectFeatureInfo . OriginatingPipe
OutputRecordset CreateRecordset (objRS).
CreateRecordset .
transformation
4. AnalyzeRecordset CreateRecordset
This is the sub procedure called when you select Analyze > Recordset
Information Recall that a subroutine calling statement does not require
parenthesis around the arguments. ObjRS is the argument to
CreateRecordset.
5. frmRecordsetInfotxtFeature
Use the value ofSourceTable on one of the recordsets fields.
6. lstFieldsand tally (keep a
running count) each of the types of fields.
Gfields GField Type
objField
7. txtCount
EOF BOF
8. Analyze > Recordset Information
Choose the Start command from the toolbar or Run menu. In your
application main window, main menubar, select File > Open. In the
Common File Open dialog, choose an Access database (e.g., US Sample
Data.mdb in the Warehouses directory). Select Analyze > Recordset
Information, and choose a feature to analyze.
- 41 -
-
8/3/2019 GeoMedia
42/79
MetadataService
OriginatingPipe fields
GDO Grecordset DAO Recordset
GeoMedia
MapView
MapView
(Legend) MapView
MapView
Dim objLegend As New Legend
Set ocxMapView.Legend = objLegend
Set objLegend = Nothing
LegendEntries
RecordLegendEntry
GeoMedia
GeoMedia
ServerTransService CSSTransformPipe
CoordSystemsMgr
ocxMapView.CoordSystemsMgr =
CreateObject(CoordSystemsMgr)
- 42 -
-
8/3/2019 GeoMedia
43/79
ServerTransService
CreateSimpleTransFromCSMtoServer
CSSTransformPipe
LoadData
View > Add
Feature form MapView
1. VB C:\TGM\Labs\CustomApp\src\CustomApp.vbp.
FormsfrmMap View > Object MapView
2. MapViewProject > Components
ComponentsControls GMMapview OLE Custom
Control module OK
GMMapView
MapViewProject > Components
ComponentsControlsIntergraph GeoMedia
Mapview Control 2.0 OK
GMMapView
GMMapView frmMap
3. Name ocxMapView. leftright 0,
0
4. FormsfrmMapView >
Code Form_LoadCoordSystemsMgr
CoordSystem.RefSpaceMgr.PaperSpace
NominalMapScaleDenominator CoordSystemsMgr
ocxMapView
CoordSystem CoordSystemsMgr , map view
Cylindrical Equirectangular
On-the-fly
- 43 -
-
8/3/2019 GeoMedia
44/79
5. Form_Load, Legend map view
GeoMedia ProgID Legend
ocxMapView Legend
6. mnuViewLegend_Click, Legend on off.
Legend, boolean Visible legend
(Visible = True), Checked
MnuViewLegend
7. View
> Legend
: mnuDisplayFeature_Click,
You are calling CreateRecordset from the previous lab.
, GetLegendEntry Given the
RecordLegendEntryreturned from that function,
DisplayTheLegendEntry map view
8. ModulesmodMap, View >
Code.
RecordLegendEntry
9. ExtendedPropertySet
OriginatingPipe PrimaryGeometryFieldName.
Name legend entry
title
GetLegendEntryRecordLegendEntry
objExtName legend entry Title.
Note: Similarly, the extended property GeometryType is used to get the
geometry type which is passed to the function GetStyleObject. This
function returns a style (based on the given geometry type) that is then
assigned as the Style property of the RecordLegendEntry. Style objects
will be covered in more detail in a later lab. This function will abstract that
for us during this lab.
10. As we have discussed, a transformation must be established between
each coordinate system used by your application. In the
- 44 -
-
8/3/2019 GeoMedia
45/79
CreateRecordset procedure, the ServerTransService is created to create
a transformation between the projection of the coordinate system of the
map view and the data being returned from the server. This one method
call is all that is needed to accomplish this. Now that the transformation
has been created, a CSSTransformPipe is created to take the inputrecordset and give an output recordset whose geometries have been
ransformed from the server side to the client side. Take that output
recordset from the pipe object and assign it to the legend entry
Recordset property.
Using the Set keyword, assign the OutputRecordset from the
objCSSPipe to the GetLegendEntry variable.
11. In Sub DisplayTheLegendEntry, the legend entry is checked to be
sure it is a valid object, and then ValidateSource is called to ensure thatit has a recordset and proper geometry field set. Append the legend entry
to the legend LegendEntries collection, and load the data by calling the
LoadData method on the legend entry. If it is the first legend entry being
loaded on the map view, then do a fit of the data in the map view.
The Append method has a first argument of a legend entry and then two
optional arguments eforeIndex and AfterIndex. It must be called without
an index when appending the first Legend Entry. The second and
subsequent times Append is called requires using either the BeforeIndex
or the AfterIndex argument, but not both. For this exercise, append thesecond and subsequent legend entries to the top of the legend (i.e., give
them a BeforeIndex of 1). The legend entry to append is stored in objLE.
If this is the first legend entry, we want to call Fit on the map view.
12. Now, test your code by running the application, and selecting View
> Add Feature from the Main Window after you have opened a
connection and activated the Map Window.
Choose the Start command from the toolbar or Run menu. In your
application
main window, main menubar, select File > Open. In theCommon File Open dialog, choose an Access database (e.g., US Sample
Data.mdb in the Warehouses directory). Select Window > Activate
Map. Select View > Add Feature, and choose a feature to display.
Notice that if you view the legend now (View > Legend), you will see the
newly created legend entry.
Summary: In Lab 4, you have placed a map view control on your form.
The paper scale of the coordinate system has been adjusted to control the
thickness of the lines in the display. The legend entry was created this
- 45 -
-
8/3/2019 GeoMedia
46/79
involved finding the geometry field using ExtendedPropertySet,
creating a default style, and appending the entry to the collection. A
coordinate transformation was established between the server and the
view
coordinate system. Finally, the legend entry was validated and thedata loaded into the geometry cache
Style
AnyStyle gdbAnySpatial
Color Width BackColor BackWidth
GeoMedia true type MicroStation
HKEY_CURRENT_USER\Software\Intergraph\Applications\GeoMedia\PrefSets\Options-FileLocations\Font1, ...\Font2, and ...\Font3
GeoMedia GeoMedia
MicroStation cell AutoCad block
.FSM GeoMedia
GeoMedia
GeoMedia -
=1/72 0.0139inch
=0.353
gmsStyleUnitsPaper HIMETRIC 1
HIMETRIC=0.01
=35 HIMETRIC
- 46 -
-
8/3/2019 GeoMedia
47/79
300 GeoMedia 9
3 1/8
StyleUnits gmsStyleUnitsView
StyleUnits gmsStyleUnitsPaperAsNonscaling gmsStyleUnitsPaper gmsStyleUnitsView
View Independent HIMETRIC
36 1/2inch
Style Object Normally Applied To Covered inLab?
AreaStyle Subtype = gdbAreal Yes
AnyStyle Subtype = gdbAnySpatial Yes
BitmapStyle Subtype = gdbPoint No
HandleStyle Not applicable No
LinearStyle Subtype = gdbLinear No
SymbolFontStyle Subtype = gdbPoint Yes
TextStyle Subtype = gdbGraphicsText Yes
PointSymbolStyle Subtype = gdbPoint No
PatternedLinearStyle Subtype = gdbLinear No
PatternedAreaStyle Subtype = gdbAreal No
GeoMedia
NorthArrowScaleBar MapViewID
MapView
In this lab, we will add the custom controls to our map view. We will set the necessary properties
in the form load operation and turn on their display.
Section A: North Arrow
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
- 47 -
-
8/3/2019 GeoMedia
48/79
The project window will appear.
2. Select frmMap from the Forms list, and select View > Object.
The Map Window form will appear.
3. Delete the existing GMNorthArrow control by selecting this control
on the form and pressing the delete key. From the toolbox, select the
GMNorthArrow control.
The cursor will change to cross or plus sign.
4. Create a rectangle by placing the cursor in the upper right corner of
the form and dragging to create a 495 x 495 box.
An arrow bitmap will appear. The name of the control will default to
GMNorthArrow1.
5. Adjust the properties of the control to set BackTransparent to True in
the Properties Window. This only applies to the printed north arrow and
not to the display.
6. Set the BackColor to the color of your map view.
Select the Palette tab in the Properties Windowto associate a particular
color.
7. Select frmMap from the Forms list, and select View > Code.
8. Select the Form object and Load from the procedure list. Add logic to
assign the Dispatch pointer of the map view control to the MapViewID
property of the north arrow.
Both the GMNorthArrow1 and ocxMapView are properties offrmMap.
The code skeleton includes logic for adjusting the controls position within
the map view control.
9. Save and compile the application. Test the application.
Open a database. Select Window > Activate Map. The NorthArrow
should appear at the location you placed the control. The area
surrounding the arrow should be the same color as the map view.
Summary: In Lab 6, Section A, you placed the control on the form and
established the communication through the map view. Many other
properties can be configured for the North Arrow.
- 48 -
-
8/3/2019 GeoMedia
49/79
Section B: Scale Bar
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmMap from the Forms list, and select View > Object.
The Map Window form will appear.
3. Delete the existing GMScaleBar control by selecting this control on
the form and pressing the delete key. From the toolbox, select the
GMScaleBar control.
The cursor will change to cross or plus sign.
4. Create a rectangle by placing the cursor in the upper right corner of
the form and dragging to create a 3255 x 495 box.
A scale bar will appear. The name of the control will default to
GMScaleBar1.
5. Adjust the properties of the control to set BackTransparent to True inthe Properties Window. This only applies to the printed scale bar and not
to the display.
6. Set the BackColor to the color of your map view.
Select the Palette tab in the Properties Windowto associate a particular
color.
7. Select frmMap from the Forms list, and select View > Code.
8. Select the Form object and Load from the procedure list. Add logic toassign the Dispatch pointer of the map view control to the MapViewID
property of the scale bar.
Both the GMScaleBar1 and ocxMapView are properties offrmMap.
The code skeleton includes logic for adjusting the controls position within
the map view control.
9. Save and compile the application. Test the application.
Open a database. Select Window > Activate Map. Select File > Open
to open a database. Select View > Add Feature and display the States
- 49 -
-
8/3/2019 GeoMedia
50/79
feature. The ScaleBar should appear at the location you placed the
control. The area surrounding the scale bar should be the same color as
the map view. The ScaleBar will adjust to the scale of the data.
Summary: In Lab 6, Section B, you placed the control on the form and
established the communication through the map view. Many other
properties can be configured for the ScaleBar.
GeoMedia PageSetup
PreferenceSet
UnitsOfMeasure
Print
Postscript
Postscript
map Window Page SetupPrinter PropertiesDocument
Properties Options Encapsulated Postscript File
GeoMedia GeoMedia
GeoMedia Imagineer
OPTIONAL Lab 7: Printing
For this lab, we will implement the Map > File > Print command for the map view.
Section A: PageSetup
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmMap from the Forms list, and select View > Code.
- 50 -
-
8/3/2019 GeoMedia
51/79
3. Select the mnuFilePrint object, and select the Clickprocedure.
4. Call the PageSetup method on the objPageSetup command object.
The calling sequence for this method is: PageSetup( Dispatch,
PreferenceSet, ApplicationName, HelpFileName, UOM) as Long
where the Dispatch argument is the value of the Dispatch property from
the map view control. The PreferenceSet is the object of type
PreferenceSet. In your application, this is declared globally. The
ApplicationName is the text string used for the print queue entry name.
Any value may be used. The HelpFileName is the text string indicating
the name of the help file used if the help button is selected on one of the
dialogs. Any value may be used Finally, the UOM is an object of type
UnitsOfMeasure. The return value is always zero.
1. Save the project, and compile the executable by selecting File >
Make customapp.exe.
2. Test the application.
Open a database. Select Window > Activate Map. Select View > Add
Feature, select a feature, and select OK. Select File > Print. The
PageSetup dialog should appear. Select OKor Cancel.
Summary: In Lab 7, Section A, you created the preference set object and
UnitsOfMeasure objects. These are used by the page setup to determine
size of the areas. You configured the command to display this dialog.
Section B: Print
1. Return to the project.
2. Select frmMap from the Forms list, and select View > Code.
3. Select the mnuFilePrint object, and select the Clickprocedure.
4. Add logic to call the Print method on the print command object.
The calling sequence for this method is: Print( Dispatch,
ApplicationName, PreferenceSet, HelpFileName) as Long where
Dispatch is the value of the Dispatch property from the map view control.
ApplicationName is a text string used for the print queue entry name. Any
value may be used. PreferenceSet is an object of type PreferenceSet.
Finally, HelpFileName is a text string indicating the name of the help file
- 51 -
-
8/3/2019 GeoMedia
52/79
used if the help button is selected on one of the dialogs. Any value may
be used.
5. Save the project, and compile the executable by selecting File >
Make customapp.exe
6. Test the application.
Open a database. Select Window > Activate Map. Select View > Add
Feature, select a feature, and select OK. Select File > Print. The
PageSetup dialog should appear. Select OKor Cancel. The Print dialog
should appear. Select OKor Cancel. If a printer is available, review your
results.
Summary: In Lab 7, Section B, you initiated the print dialog. Again, themap view dispatch is used to establish the location of the map view. This
component actually drives the print operation.
GeoMedia GeoMedia
featureclass
query
GeoMedia
GeoMedia
GeoMedia query GeoMedia
GDO
OpenRecordset
OriginatingPipe SpatialQueryPipe
Dim objOP As OriginatingPipe
gobjConnections(1).CreateOriginatingPipe objOP
objOP.Table = Parcels
objOP.SpatialOperator = gdbTouches
Dim vSpatialFilter as Variant
- 52 -
-
8/3/2019 GeoMedia
53/79
vSpatialFilter = objHiwayTbl.GFields(Geometry).Value
objOP.SpatialFilter = vSpatialFilter
objOP.GeometryFieldName = Geometry
Dim objRS As GRecordset
Set objRS = objOP.OutputRecordset
SpatialQueryPipe
GeoMedia
GeoMedia
Spatial Query Pipe
Spatial Query
Pipe
Spatial Query Pipe
gmsqWithinDistance
- 53 -
-
8/3/2019 GeoMedia
54/79
gmsqMeet
gmsqOverlap
- 54 -
-
8/3/2019 GeoMedia
55/79
gmsqContains
gmsqContainedBy
gmsqEntirelyContains gmsqContains
gmsqEntirelyContainedBy gmsqContainedBy
gmsqSpatiallyEqual
- 55 -
-
8/3/2019 GeoMedia
56/79
gmsqTouches
Property Description
DerivedGeometryFieldName Set this property to include thegeometry object resulting from thespatial comparison. This field namemust be unique.
Distance Applicable only when theSpatialOperator isgmsqWithinDistance.
ErrorCount Populated at the completion of thespatial comparison and indicates howmany geometry values where skippedduring processing. The spatialanalysis is completed ignoring thesegeometries in its output.
FirstGeometryFieldName Specifies the name of the geometryfield in the first recordset that willparticipate in the spatial analysis.
FirstRecordset The set of data representing the left
side of the expression. That is, for theexpression A overlap B, A is the
- 56 -
-
8/3/2019 GeoMedia
57/79
FirstRecordset.
OutputRecordset The result of the spatial analysis. If you set the ReferenceFirstRecordsetflag to true, the recordset contains the
feature instances from the firstrecordset that satisfy the analysis.
ReferenceFirstRecordset If true, indicates that the attributes ofthe first recordset should be includedin the output recordset.
ReferenceSecondRecordset If true, indicates that the attributes ofthe second recordset should beincluded in the output recordset.
SecondGeometryFieldName Specifies the name of the geometryfield in the second recordset that will
participate in the spatial analysis.
SecondRecordset The set of data representing the rightside of the expression. That is, for theexpression A overlap B, B is theSecondRecordset.
SpatialOperator A constant that identifies the type of spatial analysis to perform.
spatial query pipe
CSSTransformPipe
gmsqWithinDistance
A overlap B A
B B overlap A B A
Lab 8: Spatial Query
This section of the lab will add the logic to display the list of linear measurements in the
combobox.
Section A: Populating Form
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmSpatialQuery from the Forms list, and select View >
Code.
- 57 -
-
8/3/2019 GeoMedia
58/79
3. Select the Form object, and select the Load procedure.
4. Add logic to retrieve the list of linear measurement types from
UnitsOfMeasure object.
First create a UnitsOfMeasure object. Store the result in objUOM. Then
execute the GetUnitIDs method to retrieve the list of distance unit
identifiers and store this in the temporary variable objUnitIDs. Iterate
through the collection of unit identifiers and use the GetUnitName
method to get the name of each unit from the UnitsOfMeasure object.
Finally, put the names in the combobox.
5. Set the default distance/unit to 1 m (one meter).
Use the constant igDistanceMeter as an argument to the GetUnitName
method on the objUOM variable.
6. Save the project, and compile the executable from File > Make
customapp.exe.
7. Test the application.
Open a database. Select Window > Activate Map. Select Analyze >
Spatial Query. Select the within distance operator to test the display of
the list. Cancel the dialog, as the code has not been finished yet to
process OK.
Summary: In Lab 8, Section A, you retrieved the linear measurement
types from the UnitsOfMeasure object and displayed them in the
combobox control. You tested the processing of the command to display
the special within distance controls when that spatial operator is selected.
This section of the lab will create the input recordsets, set up the pipe, and retrieve the output
recordset.
Section B: Processing the Request
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmSpatialQuery from the Forms list, and select View >
Code.
3. Select the btnOKobject, and select the Clickprocedure.
- 58 -
-
8/3/2019 GeoMedia
59/79
4. Add a function to check that a feature has been selected in both
treeview controls on the form. Also, if the spatial operator is
gmsqWithinDistance, check that a valid distance has been entered.
Create a boolean function called ValidSpatialInput that checks bothtreeview controls and returns a status of True if the user has selected a
feature in each. The function also return the names of the two selected
features in sFeature1 and sFeature2. If the result is Not true, you will
exit the subroutine.
5. Add logic to retrieve the recordsets associated with the two selections.
Create an OriginatingPipe recordset using the feature names retrieved in
the previous step. Note: In order to get the connection that corresponds
to the selected feature each connection node in the treeview control was
assigned the correct index in its Tag property. So, get the
treeview.SelectedItem.Parent.Tag, convert it to a number and use it
as the index into the gobjConnections collection.
Populate the Table property on the pipe with the sFeature1 and
sFeature2 values and store the results in objRS1 and objRS2
respectively.
6. Add logic to check for matching coordinate systems. If the systems
are not the same, perform a transformation of one of the recordsets.
Use the GetCSGUID function to retrieve the GUID of each recordset
created in the previous step. These are stored in RS1CSGUID and
RS2CSGUID. If they are not equal call the function
TransformSpatialRS. This function returns transformed recordsets that
should be stored in the variables objTransRS1 and objTransRS2. In this
routine, a ServerTransService object is created and uses the
CreateSimpleTransFromCSMtoServer method to register the recordset
GUID as an alternate transformation. Then it creates a CSSTransformPipe
and transform the recordset to the map view coordinate system.
In the first part of this ifstatement, assign the transformed recordsets to
the FirstRecordset and SecondRecordset properties on the
SpatialQueryPipe (objSQPipe). In the second part of the ifstatement,
use the original recordsets (objRS1 and objRS2).
7. If the operator is gmsqWithinDistance, convert the units to the units
of the recordsets.
Create a UnitsOfMeasure object (objUOM). Get the distance and units
from the form. Convert the distance to meters using the
- 59 -
-
8/3/2019 GeoMedia
60/79
ConvertUnitToUnit method. The resulting distance is stored in
dblNewDist.
8. Display the results of the spatial query in the map view.
Add code identical to that which you did in Lab 4 using the
GetLegendEntry and DisplayTheLegendEntry functions. Only create a
legend entry if there are rows in the recordset. This can be determined by
testing the EOF and BOF properties. The input to the GetLegendEntry
function is objSQRS while the output should be stored in objLE.
9. Save the project, and compile the executable from File > Make
customapp.exe.
10.Test the application.
Open a database. Select Window > Activate Map. Select Analyze >
Spatial Query. Select two features and an operator. Select OK.
Processing should complete although you wont see any displayed data.
Summary: In Lab 8, Section B, you created the OriginatingPipe recordsets for the selected
features. You compared coordinate systems through the CoordSystemGUID values. If they
were not the same, you transformed one recordset to the other coordinate system. If the
operator was Within Distance, you converted the input value to the units of the data. You
reused your existing functions for creating and displaying a legend entry.
BufferzonePipe GeoMedia
multiplestackedor multiple ringed
BufferzonePipe
OutputRecordset
Buffer Zone
BufferzonePipe
Property Description
BufferType :
gmbtAreaInside, gmbtAreaOutside,
gmbtLinearButtEnd,
- 60 -
-
8/3/2019 GeoMedia
61/79
gmbtLinearRoundEnd,
gmbtLinearSquareEnd, gmbtPoint,
gmbtPointRinged, gmbtPointStacked.
DistanceType :
gmbdConstant, gmbdVariable.
ErrorCount
InputDistance DistanceType DistanceType
InputGeometryFieldName
InputRecordset
Merge
gmbmAll, gmbmNone, gmbmOverlap.
OutputGeometryFieldName
OutputRecordset
Tolerance 0.01.
Section A: Creating a Buffer Zone
In this section of the lab, the custom application will display a buffer zone form upon selecting the
Analyze > Buffer Zone map view menu item. You will select the feature to buffer, enter the
distance from the feature to measure the buffer zone, and choose the units of measure for that
distance. In order to view the buffer zone in the map view, you must also select a database and
table to store the results in. The output database must be read/write. The form will automaticallydefault a new output table name (e.g., BufferZone1). You can either accept or modify the name or
pick an existing table for the results. Once the OKbutton is selected, the application will create
theBufferzonePipe object, calculate a buffer zone, populate an output table, and display the results
in the map view.
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmBuffer.frm from the Forms list, and select View Form.
- 61 -
-
8/3/2019 GeoMedia
62/79
The Buffer Zone form will appear. All of the controls have been placed on
the form already. You will add code to the procedure for the OK button to
perform the actual bufferzone computation.
3.
Double click on the OKbutton.
The code window will appear with the focus set to the btnOK_Click
function.
4. Create the BufferzonePipe object.
Use the objBufferZoneSrvc variable for this object.
5. Select the SetupBZPipe function. Convert the distance and unit
strings from the forms unit selection to meters.
You will need to create a UnitsOfMeasure object (objUOM), and pass the
distance and unit values from the form to the ConvertUnitToUnit method
to get the distance in meters.
6. Calculate the true projected input distance and assign this to the
BufferzonePipe.
First get the scale factor from the coordinate system with the
StorageToProjectionScale method. Use this value (dblGeomFactor) as
the denominator and the value in Step 5 (dblNewDist) as the numerator
in the calculation the projected distance. Set this property on theBufferzonePipe.
7. Set the BufferType property on the BufferzonePipe.
This will vary based on the geometry type of the feature that is to be
buffered. Use the Object Browser to find the values for the
BufferZoneTypeConstants.
8. Set the geometry field properties for both the input and output tables.
The input geometry field name has already been retrieved and stored instrInputGeometryFieldName .
9. Calculate the buffer zone.
Return to the btnOK_Clickfunction. Set a recordset variable
(objBufferZoneRS) equal to the OutputRecordset property of the
BufferzonePipe.
10. Create a new table with the name of the bufferzone feature class.
- 62 -
-
8/3/2019 GeoMedia
63/79
Scroll down to the UpdateOutputTable function. Create a
MetadataService object (objMetadataSrvc) and set the connection
(objConn) on it. Execute the CreateTableDefmethod on the associated
database within the connection object.
11. Create an originating pipe object to create a recordset for the
bufferzone data.
Scroll to the AddLegendEntry function. Create an OriginatingPipe
(objOP) recordset (objRS) of the buffer zone feature class. The template
already includes the logic to create a coordinate transform for this
recordset.
12. Display the buffer zone feature on the map view.
Again, in the AddLegendEntry function, add code similar to that whichyou did in Lab 4 using the GetLegendEntry and
DisplayTheLegendEntry functions. The call to GetLegendEntry will
have the input objRS and will populate the variable objLE.
13. Save and compile the application. Test the application.
Open a map view. Select the Analyze > Buffer Zone command. After
pressing the OKbutton, you should see the mouse pointer change to an
hourglass and after a few seconds the bufferzone feature will display in
the map view.
Summary: In Lab 9, you established the pipe input properties from the
users selections. The units specified by the user are converted to meters.
The database scale is retrieved and is used in the calculation for the pipes
input distance. Meters is the common measurement unit for all internal
operations within coordinate systems and measurement. A new database
table is created in the warehouse and metadata information added for the
table. The table is populated from the output recordset of the pipe. Once
the data is stored, you created an originating pipe recordset on the new
table. You again reused the GetLegendEntry and
DisplayTheLegendEntry functions to complete the command.
SmartLocateService
EventServer and EventControl
- 63 -
-
8/3/2019 GeoMedia
64/79
LocatedObjectsCollection
HighlightedObjects
SmartLocateService
Locate
SmartLocateService LocatedObjectsCollection
Property/Method Description
FenceMode
locFenceInside orlocFenceOverlap.
PixelTolerance
Locate
Dim objSmartLocSvrc As New SmartLocateService
objSmartLocSvrc.Locate objPointGeometry, ocxMapVw, _
objLocatedObjects
LocatedObjectsCollection Locate
EventServer and EventControl
SmartLocateService EventControl
EventControl EventControl
EventControl AddMapView
EventServerEventServer
EventControl EventServer
EventControl
Dim objEvServer As New EventServer
ocxEvCtrl.AddMapView ocxMapVw1.Dispatch, objEvServer
ocxEvCtrl.AddMapView ocxMapVw2.Dispatch, objEvServer
- 64 -
-
8/3/2019 GeoMedia
65/79
RemoveMapView EventServer
LocatedObjectsCollection
SmartLocateService
HighlightedObjects
highlight set or select set.
LocatedObjectsCollection
ocxMapVw.HighlightedObjects.SetDisplayColor GB(255,0,0)
ocxMapVw.HighlightedObjects.Add objLocObjects.Item(1)
Property/Method Description
Count Number of highlighted objects in the collection.
SetDisplayColor Set the highlight color.
Add Add an item to the collection.
Clear Clear the highlight set.
GetRange Returns the corner points of the minimum bounding rectangle that holds all highlightedfeatures.
IsMember Takes as input a pointer to a feature and returnstrue or false indicating if the object is in thecollection.
Remove Remove an item from the collection
Lab 10: Locate
This lab selects a feature or features in the map view, and then iterates through the highlightedobjects. You will access the recordset corresponding to the selected feature, and finally display the
- 65 -
-
8/3/2019 GeoMedia
66/79
associated database record in a form.
Section A: Locating a Feature
In this section, the custom application will prompt you to select a feature after selecting the
Analyze > Attributes item from the map view menu. Before running this command, you must
first run the View > Add Feature command so that there are features in the map view to select.
The event control will detect when the user has clicked in the map view and then fire a click event.
You will add code in the click method of the event control to determine what feature is near the
click point using the SmartLocateService. This process will retrieve a recordset and access a
particular row. You can then iterate through the recordsets fields and display the results in a
textbox on a simple review form. You will review the results, select OK to dismiss the dialog, and
then terminate the command.
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmMap.frm. Delete the existing EventControl control by
selecting this control on the form and pressing the delete key. Place an
EventControl OCX on the map view.
Set the name property on the control to ocxEventControl.
3. Select the Analyze > Attributes menu item.
The code window will appear with the focus set to the
mnuAnalyzeAttributes_Clickfunction.
4. Set the locate tolerance on the SmartLocateService to five.
The service is referenced by the variable, objSmartLocSvrc.
5. Add the map view and EventServer to the EventControl.
Use the AddMapView method on the EventControl. The first argument isthe ocxMapView.Dispatch pointer.
6. Set the status bar prompt to ask the end user to select a feature.
The property on the status bar is SimpleText.
7. Clear the located and highlighted collections. Populate the
LocatedObjectsCollection using the SmartLocateService.
Scroll down to the ocxEventControl_Clickfunction. First, use the Clear
method on objLocatedObjects. Next, use the Clear method on theocxMapView.HighlightedObjects collection. Now, populate the
- 66 -
-
8/3/2019 GeoMedia
67/79
objPointGeometrys Origin property with the world coordinate values.
Then, you will use the Locate method on the SmartLocateService
object. Use the Object Browser to check the order of the arguments.
8.
Populate the map views HighlightedObjects.
Use the Add method.
9. Get the recordset associated with the highlighted feature.
Remember to set the bookmark after you have assigned the recordset
from the LocatedObjectsCollection .
10. Iterate through the recordsets fields, and display the fields and values
in the form.
Scroll to the DisplayReviewDialog function. This is listed in the
(General) section. Generate a string with the field name and field value
for each field in the recordset. Add the string to the listbox on the form.
You should always check database values for Null before manipulating
them.
11. Add the code to display the form.
This action is supported by the Show method. The argument value of one
(1) indicates that the dialog is modal.
12. When the user selects the OK button, end the command.
Scroll back to the ocxEventControl_Clickfunction. Remember to execute
the RemoveMapView method on the EventControl and then clear the
two collections. In the Wrapup section of this function release the
SmartLocateService, LocatedObjectsCollection, and EventServer
objects The variables you will reference are ocxEventControl,
ocxMapView, and objLocatedObjects.
13. Save and compile the application. Test the application.
Open a map view. Add a feature to the map view. Select the Analyze >
Attribute command. Select a feature, and you should see the review
form display with a database record that corresponds to the selected
feature.
Summary: In Lab 10, you placed the event control and established the
communication between the view and the control with the event server.
The SmartLocateService and the LocatedObjectsCollection are
instantiated to perform the Locate operation. The feature that is found
- 67 -
-
8/3/2019 GeoMedia
68/79
first is highlighted and its field names and values are displayed in the
dialog.
data view control
,
OriginatingPipe
Mode Key Sequence Result
Cell Left Mouse Click Select a cell
Left Mouse Click Drag Select multiple contiguouscells
Control Left Mouse Click Selects a hypertext cellwithout activating the value
Left / Right Arrow Select the next cell
Shift Left / Right Arrow Select a contiguous block of
cells
- 68 -
-
8/3/2019 GeoMedia
69/79
Control Left / Right Arrow Select a cell one page left orright
Up / Down Arrow Select the next cell
Shift Up / Down Arrow Select a contiguous block ofcells
Control Up / Down Arrow Select a cell one page up ordown
Home Select the first cell
Shift Home Select all cells between thecurrent cell and the first cell
End Select the last cell
Shift End Select all cells between thecurrent cell and the last cell
Column Left Mouse Click Select a single column
Shift Left Mouse Click Unselect all columns andselect contiguous columns
Control Left Mouse Click Select or unselectdiscontiguous columns
Left / Right Arrow Unselect all active columnsand select the next column
Shift Left / Right Arrow Unselect all active columnsand select contiguouscolumns
Control Left / Right Arrow Adds column selections tothe current set of selectedcolumns
Row Left Mouse Click Single select a row
Shift Left Mouse Click Select contiguous rows
Control Left Mouse Click Select or unselect
discontiguous rows
Up / Down Arrow Unselect all active rows andselect the next row
Shift Up / Down Arrow Unselect all active rows andselect contiguous rows
Page Up / Down Unselect all active rows andselect the first row in thenext page (rows visiblewithin the data view)
Shift Page Up / Down Unselect all active rows and
- 69 -
-
8/3/2019 GeoMedia
70/79
select a page of rows
Control Page Up / Down Add rows between thecurrent row and one page upor down to the currently
selected rows
Home / End Unselect all active rows andselect the top or bottom row
Shift Home / End Unselect all active rows andselect all rows between thecurrent row and the top orbottom
Control Home / End Add rows between thecurrent row and the top or bottom to the currently
selected rows
Event Description
DeleteRows Not currently fired. The application should include a
command to delete a selected row.
GotFocus Standard control behavior.
LostFocus Standard control behavior. Lost focus is usuallyused to complete any pending action.
NewCell Not currently fired.
SelectCell Fired when one or more cells is selected by the user.You may control the enabling of menu options whenthis event is fired.
SelectColumn Fired when one or more columns is selected by theuser. Also fired when a cell is selected. You maycontrol the enabling of menu options when this eventis fired.
SelectRow Fired when one or more rows is selected by the useror when the pointer is set to a particular row. Youmay control the enabling of menu options when thisevent is fired.
UpdateCell Fired after the data content of a row is modified.The dataview will update the active row in thedatabase when the focus changes to a different row
or view. Multiple cells (fields) within the row maybe modified for each UpdateCell event.
- 70 -
-
8/3/2019 GeoMedia
71/79
OPTIONAL Lab 11: Data View Construction
This lab covers the basic operation of the data view. You will place the control on your form and
allow the user to select a table to display.
Section A: Placing the Control
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmData.frm, and select View Object.
The Data Window form will appear.
3. Delete the existing GMDataView control by selecting this control on
the form and pressing the delete key. From the toolbox, select the
GMDataview control.
The cursor will change to cross or plus sign.
4. Create a rectangle by placing the cursor in the upper left corner of the
form and dragging to the lower right corner.
A white box will appear. The name of the control will default to
GMDataview1.
5. Adjust the position of the control to set Top = 0 and Left = 0 inthe
Properties Window.
6. Select frmData in the Project Window, and select View Code. Select
the Form object and the Resize procedure. Add logic to adjust the sizeof the data view when the form resizes.
Use the ScaleHeight and ScaleWidth properties of the form and assign
them to the controls properties.
7. Save and compile the application. Test the application.
Open a database. Select Window > Activate Data. Select a feature and
select OK. The form should appear with the data view as a white square.
Test resizing the form and notice the adjustment of the data view control.
- 71 -
-
8/3/2019 GeoMedia
72/79
Summary: In Lab 11, Section A, you placed the data view control,
adjusted its position, and added the logic to automatically resize it.
In this section of the lab, you will display a recordset in the data view.
Section B: Associating the Recordset
1. Return to the Visual Basic project. Select mfrmMain in the Project
Window, and select View Code. Select the mnuWindowData object,
and select the Clickprocedure.
2. Add logic to associate the recordset with the data view.
Use the SetRecordset method on the control. The inputs to this function
are a database pointer, a caption, and, a recordset. The database pointer
need not be initialized. Use objDB which is defined in the function. Use
the name of the table as the caption. The name of the table can be found
by looking at the SourceTable property on the first field of the recordset.
Finally, the recordset, objRS is returned from the CreateRecordset
function.
3. Save and compile the application. Test the application
Open a database. Select Window > Activate Data. Select a feature and
select OK. The form should appear displaying the contents of the selected
feature.
Summary: In Lab 11, Section B, you created a recordset and associated
it with the data view.
In this section of the lab, you will change the recordset displayed in the data view.
Section C: Changing the Recordset
1. Return to the Visual Basic project. Select frmData in the Project
Window, and select View Code. Select the mnuToolsChange object,
and select the Clickprocedure.
2. Add logic to change the recordset associated with the data view.
Again, use the SetRecordset method on the control. The inputs are the
same as in the previous section of the exercise.
- 72 -
-
8/3/2019 GeoMedia
73/79
3. Select frmMap in the Project Window, and select View Code. Select
the mnuWindowData object, and select the Clickprocedure.
4. Add logic to make sure a recordset is active before showing the data
window from the active map view.
Again, this is the same logic as implemented in step 2.
5. Save and compile the application. Test the application
Open a database. Select Window > Activate Data. Select a feature and
select OK. The form should appear displaying the contents of the selected
feature. Select Tools > Change Contents. Select a feature and select
OK. The contents of the view should change to reflect the new feature
class.
Summary: In Lab 11, Section C, you again used the SetRecordset method to implement the
Change Contents command.
A:
B:
C:
OPTIONAL Lab 12: Multiple Key Sort
This lab involves a common operation on tabular data sorting. The GeoMedia product supports
a single key sort operation. The SortPipe object is used to perform the sorting. The pipe object
actually supports a multiple key sort.
Section A: Setting up the Form
1. Open the project, C:\TGM\Labs\CustomApp\src\customapp.vbp.
The project window will appear.
2. Select frmData.frm, and select View Code. Select mnuToolsSort
from the object list, and select the Clickprocedure.
The command, Tools > Sort is enabled when the data view is active. The
function simply calls SortRecordset.
3. Select modSort.bas from the project window, and select View Code.
- 73 -
-
8/3/2019 GeoMedia
74/79
The file contains the function SortRecordset. The function is fully
defined to display the fields associated with the recordset displayed in the
data window.
4.
Review the code for retrieving the recordset and adding the fields tothe form.
5. Test the application.
Open a database and display the data window. Select Tools > Sort.
Verify that the list of attributes is populated on the left.
Summary: In Lab 12, Section A, you reviewed the logic for populating the
form with the recordset fields available for sorting.
The remaining section of the lab will create a sort key
for each field chosen from the left list and moved to
the right list. As fields are dropped from the right, the
sort key will be removed. Finally, when the OK button
is selected, the data view will be updated with the
output of the sort pipe.
Section B: Setting up the Pipe
1. Return to the Visual Basic project. Select frmSort in the Project
Window, and select View Code. Select the btnAdd object, and select the
Clickprocedure.
2. Add logic to set the name of the field for one of the sort keys and the
ascending flag value. Append the key to the collection on the SortPipe
object.
The pipe has been created in the Form_Load subroutine. objSortPipe is
available globally within the file. You will need to populate the objKeyvariable, setting the SortFieldName to the currently selected attribute
lstAvailable.List(lstAvailable.ListIndex). Use the value of
optFlag(0).Value to set the SortAscendingFlag. Finally, append
objKey to the SortKeys collection on objSortPipe.
3. Select the btnClear object and the Clickprocedure.
4. Add logic to remove the fields selected in the right list from the
collection of keys.
- 74 -
-
8/3/2019 GeoMedia
75/79
Simply re-create the SortKeys collection on objSortPipe to clear the list
of entries. The SortPipe keys collection does not support a remove
method. An alternative implementation is to manage your own collection
ofSortKey objects and delete them from this list.
5. Save the project, compile, and test the application.
Open the database, activate the data window, and select Tools > Sort.
Test your work by adding several attributes and clearing the sort list.
Summary: In Lab 12, Section B, you created a SortKey for each selected
field and set the SortAscendingFlag appropriately. You added logic to
clear the collection of keys in case the user selected them in the wrong
order.
Finally, you will see the sorted recordset. The sort is controlled by the order that the keys are
added to the collection. For instance, if you want an alphabetic list of employees by their last
name, you would first add the LastName field to the collection. Follow this by FirstName and
MiddleInitial to get a list sorted first by last name. Within the same last name, the list is sorted by
first names. Finally, when both last and first name are the same, the data is ordered by the middle
initial.
Section C: Updating the Data View
1. Return to the Visual Basic project. Select frmSort in the Project
Window, and select View Code. Select the btnOKobject, and select the
Clickprocedure.
2. Add logic to retrieve the recordset from the data view. Use it as input
to objSortPipe.
Use the GetRecordset method on the data view control to populate
objRS. Assign this to objSortPipe.InputRecordset . Use the temporary
variable, objRS, to pass to GetRecordset on the data view control.
3. Retrieve the output recordset from the pipe, and associate it with the
data view.
Use the SetRecordset method on the data view control. Again, objDB is
nothing (no active object assigned to the variable) and the caption can be
derived from the SourceTable of one of the recordsets fields. To
distinguish the sorted recordset, you should concatenate Sorted to the
table name. Use objSortPipe.OutputRecordset as the final argument.
4. Save the project, compile, and test the application.
- 75 -
-
8/3/2019 GeoMedia
76/79
Open the database, activate the data window, and select Tools > Sort.
Test your work by adding several attributes and selecting OK.
Summary: In Lab 12, Section C, you established the recordset associated
with data view as the InputRecordset for the SortPipe. You then
retrieved the OutputRecordset from the pipe and assigned it to the data
view.
GeoMedia
GeoMedia
GeoMedia
GeoMedia
application
GeoMedia
geoworkspace
- 76 -
-
8/3/2019 GeoMedia
77/79
Visual Basic Visual C++
GeoMedia
GeoMedia
GeoMedia
GDO
GeoMedia
originating pipe
Connection.BroadcastDatabase
GDO GDO refresh
requery
GeoMedia
- 77 -
-
8/3/2019 GeoMedia
78/79
Command GeoMedia Command
Command
Intergraph
GeoMedia
DLL,TypeLib,OCX GeoMedia
uninstall
Intergraph GeoMedia
DLL GeoMedia
GeoMedia
GeoMedia
1 GDO
2
3 MapView
4
5
6
7 data view
GeoMedia
Connections, Connection
GDatabase
GRecordset, OriginatingPipe
GFields, GField
GMMapView
Legend
LegendEntries
- 78 -
-
8/3/2019 GeoMedia
79/79
RecordLegendEntry
Styles
GMNorthArrow
GMScaleBar
MetadataService
SpatialQueryPipe
BufferZonePipe
SmartLocateService
EventServer and
EventControl
LocatedObjectsCollecti
on
HighlightedObjects
GMDataView
SortPipe