AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Map layer with extension (calculation) - access

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
478 Views, 1 Reply

Map layer with extension (calculation) - access

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

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

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.

Post to forums  

Autodesk Design & Make Report