Select to view content in your preferred language

IGxObject.Category Values

2239
6
07-12-2010 09:37 PM
ThomasPolden
Emerging Contributor
Does anyone know if there is a list of possible values for the IGxObject.Category property?

Cheers
6 Replies
ThomasPolden
Emerging Contributor
I have done a bit of searching, but I can only find reference to ESRI probably having one not actually were to find it. Not having much luck with the ArcGIS program help either.
0 Kudos
AndrewMay
Emerging Contributor
You can have unlimited values as you can create your own impementation of the IGXObject interface - and specify whatever you want for the Catalog property.  So you can't really have a definitive list.  It does seem odd though that it's not easy to find a list of the standard ESRI ones.

The only help I can give is that if you run ArcGIS\bin\categories.exe and look under ESRI GX Object Factories then this gives you a list of all the implementations of IGXObject on your machine, although it doesn't give you the Catalog values.

What did you need a full list for?
0 Kudos
KenBuja
MVP Esteemed Contributor
Take a look at this thread for alternate code to determine the type of an object from IGXObject. One problem I ran into when using IGxObject.Category is that the values are localized. For example, I wrote an application that worked perfectly fine on English language machines, but crashed in other languages. In my code, I was checking the type of table that was selected by a user. If I select a dbf file, this code will return a ShapefileWorkspaceFactoryClass.

        Select Case pGxObj.Category
          Case "Personal Geodatabase Table"
            pFact = New ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass
          Case "File Geodatabase Table"
            pFact = New ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass
          Case "dBASE Table"
            pFact = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass
          Case "SDC Feature Class"
            pFact = New ESRI.ArcGIS.DataSourcesFile.SDCWorkspaceFactoryClass
          Case "SDE Table"
            pFact = New ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactory
          Case Else
            System.Windows.Forms.MessageBox.Show("Data type '" & pGxObj.Category & "' has not been coded yet...")
        End Select


However, when a user with a German language machine selected a dbf file, he reported getting the error message "Data type 'dBASE-Tabelle' has not been coded yet".
0 Kudos
ThomasPolden
Emerging Contributor
I have a application that searches through our filesystem and reports back on spatial data. I was using IGxObject.Category to catch the spatial data. But I noticed that it was not reporting back on some raster files. I eventually figured out I was only catching "File Geodatabase Raster Dataset" files when some of them were actually coming through IGxObject.Category as "fgdb Raster" or something similar. I just wanted a list of standard ESRI categories to make sure I was not missing anything else. But I have figured out a better way of catching everything now.

Still, it would be usefully to have such a list. One has to exist somewhere.
0 Kudos
BrianO_Hare
New Contributor
Thomas,

What's the better way of catching the objects that you've found? I'm coding in C# so can't use GetType as it just returns System.__ComObject (other casts I've tried return null for some reason. I need to get a reference to the IWorkspace from the currently selected IGXObject.

cheers,

Brian O'Hare
0 Kudos
NeilClemmons
Honored Contributor
Thomas,

What's the better way of catching the objects that you've found? I'm coding in C# so can't use GetType as it just returns System.__ComObject (other casts I've tried return null for some reason. I need to get a reference to the IWorkspace from the currently selected IGXObject.

cheers,

Brian O'Hare


Brian, try the following code.  You'll have to translate to C#.

If TypeOf gxObject Is IGxDataset Then
  Dim gxDataset As IGxDataset = DirectCast(gxObject, IGxDataset)
  Dim dataset As IDataset = gxDataset.Dataset
  Dim workspace As IWorkspace = dataset.Workspace
End If
0 Kudos