private string TryGetExtractingArgInfos() { try { MonitoringSession mss = (_session.MonitoringSession as MonitoringSession); if (mss != null && mss.CurrentCanvasViewer != null && mss.CurrentCanvasViewer.ActiveObject != null) { IExtractingSession ess = mss.ExtractingSession; if (ess != null && mss.ActiveMonitoringProduct != null && mss.ActiveMonitoringSubProduct != null && ess.CurrentSubProduct != null && ess.CurrentSubProduct.ArgumentProvider != null && ess.CurrentSubProduct.ArgumentProvider.ArgNames != null) { StringBuilder str = new StringBuilder(); str.AppendLine("参数信息"); foreach (string argname in ess.CurrentSubProduct.ArgumentProvider.ArgNames) { if (argname.IndexOf("CursorInfo:") != -1) { str.AppendLine(" " + argname.Replace("CursorInfo:", "") + " : " + ess.CurrentSubProduct.ArgumentProvider.GetArg(argname)); } } return(str.ToString()); } } return(""); } catch { return(""); } }
public MonitoringSession(ISmartSession session) { _session = session; _themeGraphGenerator = new ThemeGraphGenerator(session); _filenameGenerator = new FileNameGeneratorDefault(); _extractingSession = new ExtractingSession(session); LoadMonitoringTheme(); }
void c_OnArgumentValueChanged(object sender, IArgumentProvider arg) { if (_disableIntimeExtracting) { return; } IExtractingSession es = (_session.MonitoringSession as IMonitoringSession).ExtractingSession; if (es != null && es.IsActive || ckIntimeExtracting.Checked) { btnExtract_Click(null, null); } }
private string TryGetExtractingArea() { try { MonitoringSession mss = (_session.MonitoringSession as MonitoringSession); if (mss != null && mss.CurrentCanvasViewer != null && mss.CurrentCanvasViewer.ActiveObject != null) { IExtractingSession ess = mss.ExtractingSession; if (ess != null && mss.ActiveMonitoringProduct != null && mss.ActiveMonitoringSubProduct != null) { IPixelIndexMapper extResult = ess.GetBinaryValuesMapper(mss.ActiveMonitoringProduct.Identify, mss.ActiveMonitoringSubProduct.Identify); if (extResult != null) { string areaString = "0"; long count = extResult.Indexes.LongCount(); double area = 0; if (count != 0) { IRasterDataProvider raster = (mss.CurrentCanvasViewer.ActiveObject as RasterDrawing).DataProvider; if (raster != null) { float resolutionX = raster.ResolutionX; float resolutionY = raster.ResolutionY; double piexArea = 1; if (raster.SpatialRef == null || (raster.SpatialRef != null && raster.SpatialRef.ProjectionCoordSystem == null)) { piexArea = MIF.Core.AreaCountHelper.CalcArea(extResult.CoordEnvelope.Center.X, extResult.CoordEnvelope.Center.Y, resolutionX, resolutionY); } else { piexArea = resolutionX * resolutionY; } area = count * piexArea;//m² if (area > 1000000 * 100) { areaString = (area / 1000000).ToString("f2") + "(KM²)";//m²->km² } if (area > 1000000) { areaString = (area / 1000000).ToString("f4") + "(KM²)";//m²->km² } else { areaString = (int)area + "(M²)"; } } } StringBuilder str = new StringBuilder(); str.AppendLine("判识信息"); str.AppendLine(" 像元个数 : " + count); str.AppendLine(" 判识面积 : " + areaString); return(str.ToString()); } } } return(""); } catch { return(""); } }
private ICanvasViewer _activeViewer = null;//用于统计的窗口windows。 /// <summary> /// 窗口切换 /// </summary> /// <param name="sender"></param> /// <param name="oldWindow"></param> /// <param name="newWindow"></param> void ActiveWindowChanged(object sender, ISmartWindow oldWindow, ISmartWindow newWindow) { _extractedPixels = null; if (newWindow == null || !(newWindow is ICanvasViewer)) { return; } if (_activeViewer == newWindow) { return; } if (_filters != null) { _filters.Clear(); } if (_activeViewer != null) { if (oldWindow != null && oldWindow is ICanvasViewer) { ClearFeature(oldWindow as ICanvasViewer); } else { ClearFeature(_activeViewer); } _activeViewer.Canvas.Refresh(enumRefreshType.VectorLayer); } _activeViewer = newWindow as ICanvasViewer; _activeViewer.OnWindowClosed = (wSender, e) => { Free(); _activeViewer = null; }; StatContent statContent = null; GeoDo.RSS.Core.DrawEngine.ILayer[] layers = _activeViewer.Canvas.LayerContainer.Layers.ToArray(); foreach (GeoDo.RSS.Core.DrawEngine.ILayer layer in layers) { if (layer is BinaryBitmapLayer)//二值图层 { IExtractingSession se = (_session.MonitoringSession as MonitoringSession).ExtractingSession; _extractedPixels = se.GetBinaryValuesMapper(se.CurrentProduct.Identify, se.CurrentSubProduct.Identify); if (_extractedPixels == null) { continue; } string layerName = layer.Name; statContent = FeatureListStatConfig.MatchStatContent(layerName); } else if (layer is IRasterLayer) { IRasterLayer rasterLayer = layer as IRasterLayer; if (rasterLayer == null) { continue; } IRasterDrawing rasterDrawing = rasterLayer.Drawing as IRasterDrawing; if (rasterDrawing == null) { continue; } string layerName = layer.Name; statContent = FeatureListStatConfig.MatchStatContent(layerName); } } if (statContent != null) { Dictionary <string, Func <short, bool> > filters = new Dictionary <string, Func <short, bool> >(); Dictionary <string, int> sataItems = statContent.StatItems; string[] statKeys = sataItems.Keys.ToArray(); int[] statValues = sataItems.Values.ToArray(); for (int i = 0; i < statKeys.Length; i++) { string key = statKeys[i]; int value = statValues[i]; filters.Add(key, (val) => { return(val == value); }); } InitStatContent(filters); } if (_filters == null || _filters.Count == 0) { SataSimpleArea(); } else { StatFilterAreas(); } }