private static void ShowFilteredData(FeatureLayer featureLayer, Collection <FilterCondition> conditions) { Collection <FeatureLayer> layers = new Collection <FeatureLayer>(); InMemoryFeatureLayer layer = new InMemoryFeatureLayer(); layer.Name = featureLayer.Name; layer.Open(); //foreach (var item in featureLayer.FeatureSource.LinkExpressions) //{ // layer.FeatureSource.LinkExpressions.Add(item); //} //foreach (var item in featureLayer.FeatureSource.LinkSources) //{ // layer.FeatureSource.LinkSources.Add(item); //} layer.Columns.Clear(); featureLayer.SafeProcess(() => { Collection <FeatureSourceColumn> columns = featureLayer.FeatureSource.GetColumns(); foreach (var column in columns) { layer.Columns.Add(column); } Collection <Feature> resultFeatures = featureLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns); foreach (var condition in conditions) { resultFeatures = condition.GetMatchingFeatures(resultFeatures); } foreach (Feature feature in resultFeatures) { layer.InternalFeatures.Add(feature); } }); layer.ZoomLevelSet = featureLayer.ZoomLevelSet; layers.Add(layer); DataViewerUserControl content = new DataViewerUserControl(layer, layers); content.IsHighlightFeatureEnabled = false; content.ShowDock(); }
//private List<string> GetLinkSourceNameStarts(IEnumerable<LinkSource> linkSources) //{ // return GetFlatLinkSources(linkSources).Select(l => l.Name + ".").ToList(); //} //internal IEnumerable<LinkSource> GetFlatLinkSources(IEnumerable<LinkSource> linkSources) //{ // return GetChildren(linkSources); //} //private static IEnumerable<LinkSource> GetChildren(IEnumerable<LinkSource> linkSources) //{ // return linkSources.Concat(linkSources.SelectMany(i => GetChildren(i.LinkSources))); //} private static void ShowFilteredData(FeatureLayer featureLayer, Collection <Feature> features, string title = "") { Collection <FeatureLayer> layers = new Collection <FeatureLayer>(); Collection <FeatureSourceColumn> addColumns = new Collection <FeatureSourceColumn>(); featureLayer.SafeProcess(() => { addColumns = featureLayer.FeatureSource.GetColumns(GettingColumnsType.FeatureSourceOnly); }); InMemoryFeatureLayer layer = new InMemoryFeatureLayer(addColumns, features); layer.Name = featureLayer.Name; layer.Open(); foreach (var column in addColumns) { layer.FeatureSource.SetColumnAlias(column.ColumnName, featureLayer.FeatureSource.GetColumnAlias(column.ColumnName)); } foreach (var zoomLevel in featureLayer.ZoomLevelSet.CustomZoomLevels) { layer.ZoomLevelSet.CustomZoomLevels.Add(zoomLevel); } //foreach (var expression in featureLayer.FeatureSource.LinkExpressions) //{ // layer.FeatureSource.LinkExpressions.Add(expression); //} //foreach (var linkSource in featureLayer.FeatureSource.LinkSources) //{ // layer.FeatureSource.LinkSources.Add(linkSource); //} layers.Add(layer); DataViewerUserControl content = new DataViewerUserControl(layer, layers); content.IsHighlightFeatureEnabled = false; content.Title = title; content.ShowDock(); }
public static MenuItem GetViewDataMenuItem(FeatureLayerPlugin featureLayerPlugin) { var command = new ObservedCommand(() => { UserControl userControl = null; if (featureLayerPlugin == null) { FeatureLayer selectedLayer = null; if (GisEditor.LayerListManager.SelectedLayerListItem != null) { selectedLayer = GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject as FeatureLayer; } userControl = new DataViewerUserControl(selectedLayer); } else { userControl = featureLayerPlugin.GetViewDataUI(); } ViewData(userControl); }, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0)); return(GetMenuItem("View data", "/GisEditorInfrastructure;component/Images/viewdata.png", command)); }