private void processLayer(XmlNode node)
{
XmlAttribute layerType = node.Attributes["type"];
LayerBase l;
if (layerType != null && node.Attributes["type"].Value.ToString().Equals("raster"))
{
RasterLayer rl = new RasterLayer();
processBinding(node, rl);
processRasterStyle(node, rl);
processDataProvider(node, rl);
processAppData(node, rl);
l = rl;
}
else
{
FeatureLayer fl = new FeatureLayer();
if (node.Attributes["datasource"] != null)
{
#pragma warning disable 618
fl.DataSource = node.Attributes["datasource"].Value;
fl.DataSourceType = (LayerDataSourceType)int.Parse(node.Attributes["datasource_type"].Value, CultureInfo.InvariantCulture);
#pragma warning restore 618
}
if (node.Attributes["dynamic_data_load"] != null)
fl.AreFeaturesAutoLoadable = node.Attributes["dynamic_data_load"].Value == "1";
fl.FeaturesSelectable = node.Attributes["shapes_selectable"].Value == "1";
processTitleStyle(node, fl.TitleStyle);
processPolygonStyle(node, fl.PolygonStyle);
processPolylineStyle(node, fl.PolylineStyle);
processPointStyle(node, fl.PointStyle);
processIndicies(node, fl);
processLegendSettings(node, fl);
processAutoTitlesSettings(node, fl);
processDataProvider(node, fl);
processAppData(node, fl);
l = fl;
XmlNode layer_extensions = tryGetNodeByName(node.ChildNodes, "layer_extensions");
if (layer_extensions!= null)
{
foreach (XmlNode layerExtension in layer_extensions.ChildNodes)
{
if (layerExtension.Name == "layer_extension")
processLayerExtension(layerExtension, fl);
}
}
}
l.Title = node.Attributes["title"].Value;
l.Description = node.Attributes["description"].Value;
if (node.Attributes["alias"] != null)
l.Alias = node.Attributes["alias"].Value;
l.Visible = node.Attributes["visible"].Value == "1";
if (node.Attributes["minimum_visible_scale"] != null)
l.MinVisibleScale = double.Parse(node.Attributes["minimum_visible_scale"].Value, CultureInfo.InvariantCulture);
if (node.Attributes["maximum_visible_scale"] != null)
l.MaxVisibleScale = double.Parse(node.Attributes["maximum_visible_scale"].Value, CultureInfo.InvariantCulture);
if (node.Attributes["controllable"] != null)
l.Controllable = node.Attributes["controllable"].Value == "1";
if (node.Attributes["cacheable"] != null)
l.Cacheable = node.Attributes["cacheable"].Value == "1";
_map.AddLayer(l);
}