Hexagon Geospatial
MENU

Developers Knowledge Base

GeoMedia, a comprehensive and dynamic GIS, extracts compelling intelligence from geospatial data and integrates it to present actionable information.
Showing results for 
Search instead for 
Do you mean 

How to upgrade existing VB6, .NET, or C++ programs using the GM Desktop API Coordinate System References and Code Statements.

by Anonymous on ‎02-19-2016 10:04 AM - edited on ‎04-07-2016 05:44 AM by Moderator (1,611 Views)

Question

Beginning with the GM Desktop version 2015, the Comomon Coordinate System type libraries are now delivered instead of the PCSS type libraries that were delivered with earlier versions including versions 6.1, 2013, and 2014. This "How To" describes what modifications or actions to perform to properly upgrade existing programs using the PCSS type libraries and objects and also for newly created programs that use the GM Desktop 2015 API.

Answer

Setup

Because the CCS control is using registry-free COM, VB6 will not automatically load the control.  As a result the VB6.exe must be given manifest resource information regarding the CCS control and services components.  The control must also be made known to the VB6 application by registering it with VB6 one time.  Lastly there are cases at build time that require access to assemblies which require path modifications.

Step 1: Modify your vb6.exe to append items to its internal manifest (note run everything with administrative privileges).

  • From a Visual Studio 2010 command prompt go to the vb6.exe folder
    • Example:  cd C:\Program Files (x86)\Microsoft Visual Studio\vb98
  • Run the mt.exe to insert additional manifest information into the vb6.exe  (GeoMedia product must be loaded)
    • mt.exe -manifest “C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\manifests\x86\CSServices.manifest” “C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\manifests\x86\DefineCoordSystem.manifest” -outputresource:VB6.exe;#1

 

Step 2: Force a registry entry to be created for the reg-free CCS .ocx.  This is needed because CCS is now COM registry free.

  • Note that the previous step must be done prior to this step
  • Invoke the VB6.exe application
  • Create a new dummy project with a form
  • Go to the Project/Components menu item
  • In the dialog browse to the C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\Program\x86 folder and select the CCSDefCS.ocx
  • Okay out of the dialogs
  • Place the coordinate system control on the dummy form
  • Exit out (you do not need to save the project)
  • It should have created an OCA for the CCS ocx and registered the control in the VB6 hive.

 

Step 3: Add one item to your path

  • Add the following to the Path System Environment Variable:

C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\Program\x86

 

VB6 Considerations

.vbp Changes to References

Make the following changes to the VB6 project references in the.vbp files:

Replace lines containing the following string:

Reference=*\G{7D377100-8137-11D0-91C4-08003601E0C4}  

With:

Reference=*\G{52D9B556-6A40-47A6-9E1A-B0DD9ED1EA37}#1.2#0#C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\Program\x86\CCSCSServices.tlb#Intergraph Coordinate Systems 3.0

Replace lines containing the following string:

Reference=*\G{2E440D50-75F5-11D3-BFBB-00104B36468E}  …

With:

Reference=*\G{BC5EA723-B8E4-4549-9561-896A3B1060B5}#1.0#0#C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\Program\x86\CCSUserSuppliedTransformation.tlb#Intergraph Coordinate Systems User-Supplied Transformation 1.0

Replace lines containing the following string (note that this item could be referenced in two different ways for the control and form; one is with quotes and one is without):

Object={F08AD9FE-B964-11CF-A19A-08003601D502} 

With:

Object={86D3CAE9-A304-4C8C-A886-6328C96837AD}#1.0#0; CCSDefCS.ocx

 

Explicit Library References in Code

Where VB6 code in .frm, .cls, .bas, .ctl (etc.) has referenced Coordinate Systems Services objects using an explicit library reference such as "PCSS.CoordSystem" the library reference must change to use the new Common Coordinate Systems library name.  In this example the reference is "CommonCoordSystems.CoordSystem".

 

Define Coordinate System Dialog Control dropped on VB6 Form or Control

Similarly, the typelib name has changed for the Define Coordinate System Dialog Control, and references in .frm and .ctl source must also change the version number encoded into the reference.  Additionally, for reasons not clearly understood at this time, the form or control should explicitly specify that the CCS dialog control is not visible.

Replace old .frm and .ctl source references bolded below:

   Begin DEFCOORDSYSTEMLib.GMDefCoordSystem GMDefCoordSystem1

      Left            =   3630

      Top             =   2145

      _Version        =   393216

      _ExtentX        =   952

      _ExtentY        =   767

      _StockProps     =   2

   End

With bolded references:

  Begin CCSDefCoordSystem.GMDefCoordSystem GMDefCoordSystem1

      Left            =   3630

      Top             =   2145

      Visible         =   0

      _Version        =   65536

      _ExtentX        =   952

      _ExtentY        =   767

      _StockProps     =   2

   End

Manifest Additions

Also note that if your application includes stand-alone executables (utilities, etc.) built in VB6 that use the Define Coordinate System Dialog Control then you will need to run a similar mt.exe command to give the manifest resource to your executable in order for it to find the reg-free COM ocx at runtime.

For any VB6 standalone utility created, the following post build activity for that utility most be executed to make the COM coordinate system components known to the utility.

 

 mt.exe -manifest C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\manifests\x86\CSServices.manifest C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\manifests\x86\DefineCoordSystem.manifest -outputresource:UtilityExecutableName;#1

For C++ components that reference the COM coordinate system components, a build time activity must be added to the utilities executable that adds the additional manifests to the executable.  In the Visual Studio project property pages this is found under Configuration Properties -> Manifest Tool -> Input and Output -> Additional Manifest Files.  The Manifests to be added are:

C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\manifests\x86\CSServices.manifest

C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\manifests\x86\DefineCoordSystem.manifest

.NET Changes

The .NET code that references the PCSS interop will need to be changed to reference the new interop assembly delivered with CCS.  The reference changes are to remove "PCSS" as a reference and add the "Intergraph.CoordSystems.Interop" assembly.  In the properties of this new assembly, specify that the property of "Specific Version" is set to false.  If new deliveries of the platform are provided and the assembly number is bumped (not always meaning an assembly version problem), your components will build with whatever version on this system was available.  Note the "Specific Version" is only a build time dependency.  Runtime resolution is not impacted.

In the .NET code the name space for the PCSS component has changed also.  References that may have looked likePCSS.CoordSystem need to be changed to Intergraph.CoordSystems.Interop.CoordSystem

 

 From/to mappings for .NET items

Old Name

New Name

AxDCSOCX1_ocx.dll

Intergraph.CoordSystems.AxControls.dll

DCSOCX1_ocx.dll

Intergraph.CoordSystems.Interop.Controls.dll

PCSS_tlb.dll

Intergraph.CoordSystems.Interop.dll

UserSuppliedTransformation_tlb.dll

Intergraph.CoordSystems.Interop.UserSuppliedTrans.dll

 

.NET Use of Define Coordinate System Dialog Control

While most code that formerly used the PCSS Primary Interop Assembly (PIA) can convert directly to use the CCS PIA (Intergraph.Coordsystems.Interop.dll), .NET use of the Define Coordinate System Dialog Control (formerly via AxDCSOCX1_ocx.dll, etc.) is a special case.  It can be shown best by example.  The following C# code snips illustrate invocation of the CCS control from a button on a form derived from System.Windows.Forms.Form.  Note that CoordSystem objects from both the PIA assembly and the new .NET Public API assembly (Intergraph.CoordSystems.dll) are used in this example.  Typically, a CoordSystem object retrieved from a GeoMedia document or service (such as MeasurementService or ServerTransService) will be a PIA object.  The  AxWrapper for the Define Coordinate System Dialog Control requires a Public API object.  This code illustrates handling of this difference.

 

using Intergraph.CoordSystems.Interop;     // PIA

using Intergraph.CoordSystems.AxControls;  // AxWrapper

using CCS_NET = Intergraph.CoordSystems;   // Public API Assembly

// Form instance data

    CoordSystem _OutputCoordsystem = null// PIA object to be edited/defined

    AxCCSDefCoordSystem _DefineCoordSysDialog = null;

// Form load/initialization

  // (Here _OutputCoordsystem might be initialized from document, csf, etc.)

  // Create the control

      _DefineCoordSysDialog = new AxCCSDefCoordSystem();

      _DefineCoordSysDialog.CreateControl();

// On button-click to invoke Define CS Dialog Control

  // UnitsOfMeasure reference is a Public API object cast to appropriate interface

        ((IDefineCoordSystem)_DefineCoordSysDialog).UnitsOfMeasure =

                              (CCS_NET.IUnitsOfMeasure)new CCS_NET.UnitsOfMeasure();

  // Control needs Public API CoordSystem object

        CCS_NET.CoordSystem coordSystem = new CCS_NET.CoordSystem();

  // If editing _OutputCoordsystem defined previously (from doc, etc.)

  // then use it to seed the CS given to control

        if (_OutputCoordsystem != null)

        {

          _OutputCoordsystem.CopyTo(coordSystem.InteropCoordSystem);

        }

 

  // Give CS to control

        ((IDefineCoordSystem)_DefineCoordSysDialog).CoordSystem = coordSystem;

  // Invoke control

        Int32 result = ((IDefineCoordSystem)_DefineCoordSysDialog).Show();

  // Integer return values are defined in CCSDefCoordSystemReturnConstants

  // Following handling of _OutputCoordsystem will likely be dependent upon

  // return value (won’t be needed on cancel, for example)

  // If interop CoordSystem being edited was not previously defined

        if (_OutputCoordsystem == null)

          _OutputCoordsystem = new CoordSystem();

  // This copies content from control’s Public API object to

  // the interop object our form/command is using

        coordSystem.InteropCoordSystem.CopyTo(_OutputCoordsystem);

 

Other Mappings

From/to mappings for ProgIDs

Old Name

New Name

UnitAndFormatSpec

Intergraph.CCS.UnitAndFormatSpec

GMRefSpaceMgr

Intergraph.CCS.RefSpaceMgr

CoordSystem

Intergraph.CCS.CoordSystem

DatumTransformation

Intergraph.CCS.DatumTransformation

GMTransMgr

Intergraph.CCS.TransMgr

GMAltCoordSystemPath

Intergraph.CCS.AltCoordSystemPath

CoordSystemsMgr

Intergraph.CCS.CoordSystemsMgr

UnitsOfMeasure

Intergraph.CCS.UnitsOfMeasure

GeoMedia.LeastSquares

Intergraph.CCS.LeastSquares

GeoMedia.GMDefCoordSystem

Intergraph.CCS.DefCoordSystem

 

From/to mappings for Typelib references (#import, etc.)

Old Name

New Name

PCSS.tlb

CCSCSServices.tlb

DefCoordSystem.tlb

CCSDefCS.tlb

UserSuppliedTransformation.tlb

CCSUserSuppliedTransformation.tlb

DCSOCX1.ocx

CCSDefCS.ocx

 

C++ COM Considerations

As noted in the previous table, applications that use #import to build code referencing PCSS.tlb will need to change that reference to now #import CCSCSServices.tlb.

However, some applications may not currently be referencing PCSS.tlb directly while they are #import-ing other GeoMedia type libraries that have internal references to the coordinate systems platform’s type library.  Two examples of type libraries in this category are PClient.tlb and PDBPipe.tlb.  Compilation of #import of such libraries may now fail because the compiler can no longer find the internally-referenced coordinate system types via registry lookup (because the new CCS platform is using registry-free COM).  The error seen will likely say “#import referenced a type from a missing type library.”

To resolve such errors you must first ensure that the system’s PATH environment variable contains paths to both the GeoMedia type libraries (PClient.tlb, PDBPipe.tlb, PBasic.tlb, etc.) and to the CCS type library.  For installations of the GeoMedia Desktop or GeoMedia Objects products, these paths on a 64-bit operating system will typically be “C:\Program Files (x86)\Common Files\Intergraph\GeoMedia\Program” and “C:\Program Files (x86)\Common Files\Intergraph\Coordinate Systems SDK\3.0\Program\x86”.  Junction points and/or drive substitutions may be used to simplify these paths if desired.

Adding these two folder paths to the system’s PATH environment variable may be enough to resolve problems with #import directives.  If problems persist, some applications have found the need for one or both of the following steps:

  • Add an explicit #import reference to CCSCSServices.tlb (for cases where no such #import previously existed but where #imports for type libraries such as PClient.tlb do exist).
  • Add the “no_registry” qualifier to the #import of the type library (PClient, PDBPipe, etc.) that was giving the missing-type-library errors.
Overview
Contributors