MapAround.Mapping.MapWorkspace.processAutoTitlesSettings C# (CSharp) Method

processAutoTitlesSettings() private method

private processAutoTitlesSettings ( XmlNode layerNode, FeatureLayer l ) : void
layerNode XmlNode
l FeatureLayer
return void
        private void processAutoTitlesSettings(XmlNode layerNode, FeatureLayer l)
        {
            XmlNode autoTitles = tryGetNodeByName(layerNode.ChildNodes, "auto_titles");
            if (autoTitles != null)
            {
                string attributeName = string.Empty;
                int attributeIndex = -1;
                bool nameExists = autoTitles.Attributes["attribute_name"] != null;
                bool indexExists = autoTitles.Attributes["attribute_index"] != null;

                if (nameExists)
                    attributeName = autoTitles.Attributes["attribute_name"].Value;
                if (indexExists)
                    attributeIndex = int.Parse(autoTitles.Attributes["attribute_index"].Value, CultureInfo.InvariantCulture);

                if (nameExists || indexExists)
                {
                    AutoTitleSettings settings = new AutoTitleSettings(attributeName, attributeIndex);
                    l.AutoTitleSettings = settings;
                }
            }
        }