Hi,
anyone knows how to detect and access a Map layer extension, such as a calculated property?
I don't mean by means of XML but by means of Map API:
- how do I detect whether a Map layer uses a extension/calculation?
- how do I access the extension properties?
Thanks, Rob
Solved! Go to Solution.
Hi,
here is what you need to do:
1) add FeatureSource-1_0_0.cs (or newer if applicable) to Studio, the file comes along the Map SDK (Map ObjectARX SDK 2013\Map Samples\Platform\Schema)
2) copy the GetResource method from UTIL class into your app
\Map ObjectARX SDK 2013\Map Samples\Platform\Platform.Samples.Util\Util.cs
3) sample code:
- for retrieving "schema:featureclass" names
foreach (MgLayerBase layer in layers)
{
//Struktur: "SchemaName:Featureclassname"
//Ausnahme: Layer mit CalcProp - dort ist "SchemaName:FCName" anders abzurufen:
if (layer.FeatureClassName.Contains(':')) // "normal FeatureClass"
{
featureClassDocName = layer.FeatureClassName.Split(':');
}
else // FeatureClass with extension such as a Calculation
{
FeatureSourceType fsSType = util.GetResource<FeatureSourceType>(layer.FeatureSourceId);
LayerDefinition fsLayerDef = util.GetResource<LayerDefinition>(layer.LayerDefinition.ToString());
featureClassDocName = getSchemaFCNameForExtensionProp(layer.FeatureClassName, fsSType, fsLayerDef).Split(':');
}
....
public string getSchemaFCNameForExtensionProp(string fc, FeatureSourceType fs, LayerDefinition layerDef)
{
string SchemaFCName = "";
BaseLayerDefinition baseLayerDefinition = layerDef.BaseLayerDefinition;
foreach (FeatureSourceTypeExtension ext in fs.Extension)
{
// see if got the extension we are looking for
if (ext.Name == fc)
{
fc = ext.FeatureClass;
SchemaFCName = ext.FeatureClass;
break;
}
}
return SchemaFCName;
}
Rob
Can't find what you're looking for? Ask the community or share your knowledge.