This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IM > IMapServer3 Interface > IMapServer3.GetMapTableSubtypeInfos Method (ArcObjects .NET 10.4 SDK) |
Returns the MapTableSubtypeInfos in the current map.
[Visual Basic .NET] Public Function GetMapTableSubtypeInfos ( _ ByVal MapName As String, _ ByVal pTableIDs As ILongArray _ ) As IMapTableSubtypeInfos
[C#] public IMapTableSubtypeInfos GetMapTableSubtypeInfos ( string MapName, ILongArray pTableIDs );
[C++]
HRESULT GetMapTableSubtypeInfos(
BSTR MapName,
ILongArray* pTableIDs,
IMapTableSubtypeInfos** ppMapTableSubtypeInfos
);
[C++]
Parameters MapName [in] MapName is a parameter of type BSTR pTableIDs [in]
pTableIDs is a parameter of type ILongArray ppMapTableSubtypeInfos [out, retval]
ppMapTableSubtypeInfos is a parameter of type IMapTableSubtypeInfos
Use GetMapTableSubtypeInfos to get the subtype and domain information for all or given layers and standalonetables from a Map. The function returns IMapTableSubtypeInfos which contains a collection of IMapTableSubtypeInfo for each layer/standalonetable whose HasSubtype value is True.
The function takes an array of standalonetable and layer ids. When this parameter is Nothing/Null, all layers and standalonetables are checked for subtypes. No IMapTableSubtypeInfo returned for layers/tables that does not have subtypes. Therefore the count of input TableIDs may not match with the count of returned array of IMapTableSubtypeInfo. Use TableID to find which layer/table one IMapTableSubtypeInfo belongs to.
IMapTableSubtypeInfo contains information about all subtypes and domains assigned at subtype level. When a field is invisible even though it may have domain assigned for a subtype, FieldDomainInfo for that field is not returned.
Also, note that subtype and domains are not returned from joined table.
The function returns empty result when the CodeCount of all CodedValueDomains from all layers and tables exceeds MaxDomainCodeCount. It does not affect DCOM clients.
Example: showing subtypes and domain information for a given layer
In this example, it is assumed that a TreeView control named tvwSD is available on a form
TreeNode pNodeRoot=null;
TreeNode pNodeSubtypes=null;
TreeNode pNodeST=null;
TreeNode pNodeFieldDomains=null;
TreeNode pNodeFD=null;
TreeNode pNodeDomain=null;
IMapTableSubtypeInfos pMapTableSubtypeInfos=null;
IMapTableSubtypeInfo pMTSTInfo=null;
ISubtypeInfos pSubtypeInfos=null;
ISubtypeInfo pSTInfo=null;
IFieldDomainInfos pFieldDomainInfos=null;
IFieldDomainInfo pFDInfo=null;
ICodedValueDomain pCVDomain=null;
IRangeDomain pRDomain=null;
IMapTableInfo pMapTableInfo=pMapServerInfo.MapLayerInfos.get_Element(1) as IMapTableInfo;
if (!pMapTableInfo.HasSubtype)
return;
ILongArray pIDs=new LongArrayClass();
pIDs.Add(1);
pMapTableSubtypeInfos=pMapServer.GetMapTableSubtypeInfos(strMapName , pIDs);
if (pMapTableSubtypeInfos.Count == 0)
return;
pMTSTInfo=pMapTableSubtypeInfos.get_Element(0);
pNodeRoot=tvwSD.Nodes.Add(pMapTableInfo.Name);
pNodeRoot.Nodes.Add("Subtype Field: " + pMTSTInfo.SubtypeFieldName);
pSubtypeInfos=pMTSTInfo.SubtypeInfos;
pNodeSubtypes=pNodeRoot.Nodes.Add("Subtypes >>");
for (int i=0; i < pSubtypeInfos.Count; i++)
{
pSTInfo=pSubtypeInfos.get_Element(i);
pNodeST=pNodeSubtypes.Nodes.Add("Subtype" + i.ToString());
pNodeST.Nodes.Add("Subtype Code: '" + pSTInfo.SubtypeCode + "'");
pNodeST.Nodes.Add("Subtype Name: '" + pSTInfo.SubtypeName + "'");
pNodeFieldDomains=pNodeST.Nodes.Add("FieldDomainInfos >>");
pFieldDomainInfos=pSTInfo.FieldDomainInfos;
for (int j=0; j < pFieldDomainInfos.Count; j++)
{
pFDInfo=pFieldDomainInfos.get_Element(j);
pNodeFD=pNodeFieldDomains.Nodes.Add("FieldDomain" + j.ToString());
pNodeFD.Nodes.Add("Field Name: '" + pFDInfo.FieldName + "'");
pNodeDomain=pNodeFD.Nodes.Add("Domains >>");
if (pFDInfo.IsInherited)
{
pNodeDomain.Nodes.Add("IsInherited: True");
continue;
}
if (pFDInfo.Domain is ICodedValueDomain)
{
pCVDomain=(ICodedValueDomain)pFDInfo.Domain;
for (int k=0; k < pCVDomain.CodeCount; k++)
{
pNodeDomain.Nodes.Add("Code: " + pCVDomain.get_Value(k).ToString() + " (Description: " + pCVDomain.get_Name(k) + ")");
}
}
else
{
pRDomain=(IRangeDomain)pFDInfo.Domain;
pNodeDomain.Nodes.Add("Min: '" + pRDomain.MinValue + "'");
pNodeDomain.Nodes.Add("Max: '" + pRDomain.MaxValue + "'");
}
}
}
pNodeRoot.ExpandAll();