protected override void BuildIndexCore(FeatureLayer featureLayer) { lock (layersInBuildingIndex) { if (!layersInBuildingIndex.Contains(featureLayer)) { layersInBuildingIndex.Add(featureLayer); } } if (layersInBuildingIndex.Count > 0) { ShapeFileFeatureSource.BuildingIndex -= ShapeFileFeatureSource_BuildingIndex; ShapeFileFeatureSource.BuildingIndex += ShapeFileFeatureSource_BuildingIndex; } var uri = LayerPlugin.GetUri(featureLayer); if (uri != null) { ShapeFileFeatureLayer.BuildIndexFile(uri.LocalPath, BuildIndexMode.DoNotRebuild); lock (layersInBuildingIndex) { if (layersInBuildingIndex.Contains(featureLayer)) { layersInBuildingIndex.Remove(featureLayer); } if (layersInBuildingIndex.Count == 0) { ShapeFileFeatureSource.BuildingIndex -= new EventHandler <BuildingIndexShapeFileFeatureSourceEventArgs>(ShapeFileFeatureSource_BuildingIndex); } } } }
protected override void BuildIndexCore(FeatureLayer featureLayer) { lock (layersInBuildingIndex) { if (!layersInBuildingIndex.Contains(featureLayer)) { layersInBuildingIndex.Add(featureLayer); } } var uri = LayerPlugin.GetUri(featureLayer); if (uri != null) { KmlFeatureLayer.BuildIndexFile(uri.LocalPath, BuildIndexMode.DoNotRebuild); lock (layersInBuildingIndex) { if (layersInBuildingIndex.Contains(featureLayer)) { layersInBuildingIndex.Remove(featureLayer); } } } }
protected override void BuildIndexCore(FeatureLayer featureLayer) { var uri = LayerPlugin.GetUri(featureLayer); if (uri != null) { TabFeatureLayer.BuildIndexFile(uri.LocalPath, BuildIndexMode.DoNotRebuild); } }
protected override void BuildIndexCore(FeatureLayer featureLayer) { TobinBasFeatureSource.BuildingIndex += TobinBasFeatureSource_BuildingIndex; var uri = LayerPlugin.GetUri(featureLayer); if (uri != null) { TobinBasFeatureSource.BuildIndexFile(uri.LocalPath, Path.ChangeExtension(uri.LocalPath, ".idx"), null, string.Empty, string.Empty, BuildIndexMode.DoNotRebuild); } }
public static string GetFeatureIdColumn(FeatureLayer featureLayer) { string featureIdColumn = string.Empty; if (featureLayer != null) { LayerPlugin layerPlugin = GisEditor.LayerManager.GetLayerPlugins(featureLayer.GetType()).FirstOrDefault(); if (layerPlugin != null) { Uri uri = null; try { uri = layerPlugin.GetUri(featureLayer); } catch { } if (uri != null && GisEditor.LayerManager.FeatureIdColumnNames.ContainsKey(uri.ToString())) { featureIdColumn = GisEditor.LayerManager.FeatureIdColumnNames[uri.ToString()]; GisEditor.LayerManager.FeatureIdColumnNames.Remove(uri.ToString()); GisEditor.LayerManager.FeatureIdColumnNames[featureLayer.FeatureSource.Id] = featureIdColumn; } else if (GisEditor.LayerManager.FeatureIdColumnNames.ContainsKey(featureLayer.FeatureSource.Id)) { featureIdColumn = GisEditor.LayerManager.FeatureIdColumnNames[featureLayer.FeatureSource.Id]; } else if (GisEditor.LayerManager.FeatureIdColumnNames.Count == 0) { if (string.IsNullOrEmpty(featureIdColumn) && featureLayer.FeatureSource.IsOpen) { var apnColumn = featureLayer.FeatureSource.GetColumns().FirstOrDefault(c => { return(c.ColumnName == "APN"); }); if (apnColumn != null) { featureIdColumn = "APN"; } } } } } return(featureIdColumn); }
public static void CloseInOverlay(this FeatureLayer featureLayer) { featureLayer.CloseAll(); LayerPlugin currentFeatureLayerPlugin = GisEditor.LayerManager.GetLayerPlugins(featureLayer.GetType()).FirstOrDefault(); if (currentFeatureLayerPlugin != null) { Uri currentFeatureLayerUri = currentFeatureLayerPlugin.GetUri(featureLayer); IEnumerable <LayerOverlay> layerOverlays = GisEditor.GetMaps(). SelectMany(map => map.Overlays). OfType <LayerOverlay>(). Where(layerOverlay => { FeatureLayer matchingShpLayer = layerOverlay.Layers.OfType <FeatureLayer>().Where(tempLayer => { LayerPlugin tempFeatureLayerPlugin = GisEditor.LayerManager.GetLayerPlugins(tempLayer.GetType()).FirstOrDefault(); return(tempFeatureLayerPlugin.GetUri(tempLayer) == currentFeatureLayerUri); }).FirstOrDefault(); if (matchingShpLayer != null) { matchingShpLayer.CloseAll(); return(true); } return(false); }); foreach (var layerOverlay in layerOverlays) { layerOverlay.Close(); } } else { LayerOverlay layerOverlay = GisEditor.ActiveMap.Overlays.OfType <LayerOverlay>().Where(lo => lo.Layers.Contains(featureLayer)).FirstOrDefault(); if (layerOverlay != null) { layerOverlay.Close(); } } }