Esempio n. 1
0
        private static void LoadFeatureSetAsLayer(IFeatureLayer layer, FeatureSet fs, string newLayerName)
        {
            var layerType = layer.GetType();
            var newLayer  = (FeatureLayer)Activator.CreateInstance(layerType, fs);

            if (layer.GetParentItem() is IGroup parent)
            {
                int index = parent.IndexOf(layer);
                parent.Insert(index + 1, newLayer);
                var child = parent[index + 1];
                child.LegendText = newLayer.DataSet.Name = newLayer.Name = newLayerName;
            }
        }
Esempio n. 2
0
        private static void LoadFeatureSetAsLayer(IFeatureLayer e, FeatureSet fs, string newLayerName)
        {
            var layerType = e.GetType();
            var newLayer = (FeatureLayer)Activator.CreateInstance(layerType, fs);

            var parent = e.GetParentItem() as IGroup;
            if (parent != null)
            {
                int index = parent.IndexOf(e);
                parent.Insert(index + 1, newLayer);
                var child = parent[index + 1];
                child.LegendText = newLayer.DataSet.Name = newLayer.Name = newLayerName;

            }
        }