/// <summary> /// 根据所选的文件提取产品标识和子产品标识,自动匹配应该生成的专题图类型,如ndvi /// </summary> /// <param name="session"></param> /// <param name="isCustom"></param> /// <param name="multiSelect"></param> /// <returns></returns> private static IExtractResult CreateThemeGraphyBase(ISmartSession session, string algorithmName, bool isCustom, bool multiSelect) { IMonitoringSubProduct msp = (session.MonitoringSession as IMonitoringSession).ActiveMonitoringSubProduct; if (msp == null) { return(null); } object obj = msp.ArgumentProvider.GetArg("SelectedPrimaryFiles"); //从工作空间中获取选择的文件名 if (!SetSelectedPrimaryFiles(session, ref obj, msp.ArgumentProvider, algorithmName)) { return(null); } string[] files = obj as string[]; if (files == null || files.Length == 0) { if (File.Exists(obj.ToString())) { files = new string[] { obj.ToString() } } ; else { return(null); } } //添加对生成专题图文件类型的判断,排除生成的专题图和统计结果文件,add by wangyu,20120923 foreach (string fname in files) { CanCreatThemegraph(fname); } string outFileIdentify = null; string templateName = null; GetTemplateName(msp.Definition.SubProductInstanceDefs, files, multiSelect, out outFileIdentify, out templateName); if (string.IsNullOrEmpty(outFileIdentify) || string.IsNullOrEmpty(templateName)) { return(null); } if (isCustom && !SetAOIArugment(files, msp, multiSelect)) { return(null); } else if (!isCustom) { msp.ArgumentProvider.SetArg("AOI", null); } IThemeGraphGenerator tgg = (session.MonitoringSession as IMonitoringSession).ThemeGraphGenerator; msp.ArgumentProvider.SetArg("ThemeGraphyGenerator", tgg); msp.ArgumentProvider.SetArg("OutFileIdentify", outFileIdentify); msp.ArgumentProvider.SetArg("ThemeGraphTemplateName", templateName); IExtractResult result = msp.Make(null); DisplayResultClass.DisplayResult(session, msp, result, false); return(result); }
public void Batch(IMonitoringProduct product, Action <IMonitoringSubProduct, string> statusPrinter, Action <int, string> processTracker) { if (product == null || product.SubProducts.Count == 0) { return; } int count = product.SubProducts.Count; int steps = 100 / count; for (int i = 0; i < count; i++) { IMonitoringSubProduct sub = product.SubProducts[i]; if (processTracker != null) { processTracker(steps, "正在生成\"" + sub.Name + "\"..."); } try { _setter.Fill(product, sub); if (!sub.CanDo) { continue; } IExtractResult result = sub.Make(null); _collecter.Collect(sub, result); } catch (Exception ex) { if (processTracker != null) { processTracker(steps, "生成\"" + sub.Name + "\"时发生错误:" + ex.Message); } } } }
public static void TrySaveFileToWorkspace(IMonitoringSubProduct subProduct, IMonitoringSession mession, string fname, IExtractResult restult) { if (string.IsNullOrEmpty(fname)) { return; } IWorkspace wks = mession.GetWorkspace(); RasterIdentify rst = new RasterIdentify(fname); ICatalog c = wks.GetCatalog("CurrentExtracting"); if (c != null) { c.AddItem(new CatalogItem(fname, c.Definition as SubProductCatalogDef)); } if (_contextEnvironment != null && subProduct != null) { rst.SubProductIdentify = subProduct.Identify; IExtractResultBase erb = restult as IExtractResultBase; if (erb != null && !string.IsNullOrEmpty(erb.OutIdentify)) { rst.SubProductIdentify = erb.OutIdentify; } GetOutFileIdentify(ref rst, subProduct); if (!string.IsNullOrEmpty(restult.Name) && restult.Name != rst.SubProductIdentify) { rst.SubProductIdentify = restult.Name; } _contextEnvironment.PutContextVar(rst.SubProductIdentify, fname); } }
private void btnSave_Click(object sender, EventArgs e) { IMonitoringSubProduct subProduct = GetCurrentSubProduct(); if (subProduct == null) { return; } if (!subProduct.Definition.IsNeedCurrentRaster) { return; } IWorkspace wks = (_session.MonitoringSession as IMonitoringSession).Workspace; (_session.MonitoringSession as IMonitoringSession).ExtractingSession.AddToWorkspace(wks); (_session.MonitoringSession as IMonitoringSession).ExtractingSession.Saved(); //后续产品制作 IPixelIndexMapper piexd = (_session.MonitoringSession as IMonitoringSession).ExtractingSession.GetBinaryValuesMapper(subProduct.Definition.ProductDef.Identify, subProduct.Definition.Identify); IExtractResult result = (subProduct).MakeExtProduct(piexd, null); if (result == null) { return; } if (!(result is IPixelIndexMapper) && !(result is IExtractResultArray)) { _isAutoSave = false; } DisplayResultClass.DisplayResult(_session, subProduct, result, true); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { _isInit = true; txtAITxtDir.Tag = null; if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } txtAITxtDir.Tag = arp.DataProvider == null ? null : arp.DataProvider.fileName; GetDefaultPathFromTxt(); SearchCurRasterAI(); SaveArgsFile(null, null); _isInit = false; }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } string filename = arp.DataProvider.fileName; if (string.IsNullOrEmpty(filename) || !File.Exists(filename)) { filename = arp.GetArg("mainfiles").ToString(); } _currentFileName = filename; }
void c_OnAlgorithmChanged(object sender, AlgorithmDef algDef) { IMonitoringSession msession = _session.MonitoringSession as IMonitoringSession; IMonitoringSubProduct subProduct = msession.ActiveMonitoringSubProduct; if (subProduct == null) { return; } if (subProduct.Definition.IsNeedCurrentRaster) { DataIdentify did = GetCurrentRasterIdentify(); if (did != null) { subProduct.ResetArgumentProvider(algDef.Identify, did.Satellite, did.Sensor); } } else { subProduct.ResetArgumentProvider(algDef.Identify); } subProduct.ArgumentProvider.SetArg("AlgorithmName", algDef.Identify); SetSystemArguments(subProduct); SetCurrentRasterArgument(subProduct); SetBandArgs(subProduct); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } Tag = arp; InitFileDir(); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { _isInit = true; txtNatrueColorDir.Tag = null; if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } SaveArgsFile(null, null); //string filename = arp.DataProvider.fileName; //if (string.IsNullOrEmpty(filename) || !File.Exists(filename)) // return; //txtNatrueColorDir.Tag = filename; //txtDir_TextChanged(null, null); _isInit = false; }
public bool Start(ICanvasViewer viewer, IMonitoringProduct product, IMonitoringSubProduct subProduct) { _canvasViewer = viewer; if (_canvasViewer == null) { return(false); } _canvasViewer.OnWindowClosed += new EventHandler((sender, e) => { Stop(); }); _currentProduct = product; _currentSubProduct = subProduct; ResultObject resultObj = GetResultObject(viewer, product, subProduct); string name = GetName(product, subProduct); if (!_resultObjects.ContainsKey(name)) { _resultObjects.Add(name, resultObj); } else { _resultObjects[name].BinaryLayer.Dispose(); _resultObjects[name].BinaryValues.Dispose(); _resultObjects[name] = resultObj; } AttachCanvasViewerMenuHandlers(); _isActived = true; _isUpdated = false; return(true); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { expFilename = string.Empty; if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } string path = AppDomain.CurrentDomain.BaseDirectory + "\\SystemData\\ProductArgs\\" + subProduct.Definition.ProductDef.Identify; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } expFilename = Path.Combine(path, subProduct.Definition.Identify + "LandExpInfo.xml"); txtFilename.Text = Path.GetFileName(expFilename); if (_handler != null) { _handler(GetArgumentValue()); } }
private IMonitoringSubProduct CreateMonitoringSubProduct(string rstFileName, string productIdentify, string subProductIdentify) { MonitoringSession session = new MonitoringSession(_session); IMonitoringProduct monitorProduct = session.ChangeActiveProduct(productIdentify); IMonitoringSubProduct subprd = session.ChangeActiveSubProduct(subProductIdentify); RasterIdentify rstIdentify = new RasterIdentify(rstFileName); ExtractAlgorithmIdentify id = new ExtractAlgorithmIdentify(); id.Satellite = rstIdentify.Satellite; id.Sensor = rstIdentify.Sensor; AlgorithmDef alg = subprd.Definition.GetAlgorithmDefByAlgorithmIdentify(id); if (alg == null) { PrintInfo("没有匹配的算法:" + "卫星" + rstIdentify.Satellite + ",传感器" + rstIdentify.Sensor); return(null); } subprd.ResetArgumentProvider(alg.Identify); subprd.ArgumentProvider.SetArg("AlgorithmName", alg.Identify); if (alg.Bands != null && alg.Bands.Length > 0) { MonitoringThemeFactory.SetBandArgs(subprd, rstIdentify.Satellite, rstIdentify.Sensor); foreach (BandDef band in alg.Bands) { if (subprd.ArgumentProvider.GetArg(band.Identify).ToString() == "-1") { PrintInfo("从波段映射表获取\"" + band.Identify + "\"的波段序号失败,生成过程终止!"); return(null); } } } TryHandleCustomArguments(subprd.ArgumentProvider, alg); return(subprd); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { //调整监测分析面板窗体宽度,以显示完整整个控件 if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp != null) { object obj = arp.GetArg("SmartSession"); ISmartSession session = obj as ISmartSession; if (session != null) { ISmartToolWindow wnd = session.SmartWindowManager.SmartToolWindowFactory.GetSmartToolWindow(_extractWindowID); (wnd as DockWindow).TabStrip.SizeInfo.AbsoluteSize = new System.Drawing.Size(_extractWindowWidth, 0); } } InitArgument(); //if (_handler != null) // _handler(GetArgumentValue()); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp != null) { if (arp.DataProvider != null) { _dataProvider = arp.DataProvider; } object obj = arp.GetArg("SmartSession"); if (obj != null) { ISmartSession session = obj as ISmartSession; _progress = session.ProgressMonitorManager; } } InitArgument(); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } string filename = arp.DataProvider.fileName; if (string.IsNullOrEmpty(filename) || !File.Exists(filename)) { return; } SearchDBLVFormWorkSpace(filename, subProduct.Identify); }
public IMonitoringSubProduct ChangeActiveSubProduct(string identify) { _activeMonitoringSubProduct = null; if (_activeMonitoringProduct == null || string.IsNullOrEmpty(identify)) { return(null); } foreach (IMonitoringSubProduct subprd in _activeMonitoringProduct.SubProducts) { if (subprd.Identify == identify) { _activeMonitoringSubProduct = subprd; break; } } if (ExtractPanelWidow != null) { ExtractPanelWidow.Apply(Workspace, _activeMonitoringSubProduct); } //by chennan 20130330 不明白做什么用 //if (!_activeMonitoringSubProduct.Definition.IsDisplayPanel) //{ //} return(_activeMonitoringSubProduct); }
private void ApplyAOI(IRasterDataProvider prd, IMonitoringSubProduct subprd) { if (!subprd.Definition.IsUseAoiTemplate || prd == null) { return; } string aoistring = subprd.Definition.AoiTemplates; if (string.IsNullOrEmpty(aoistring)) { return; } string[] aoiNames = aoistring.Split(','); CoordEnvelope evp = prd.CoordEnvelope; Size size = new Size(prd.Width, prd.Height); int[] retAOI = null; foreach (string aoiName in aoiNames) { int[] aoi = AOITemplateFactory.MakeAOI(aoiName, evp.MinX, evp.MaxX, evp.MinY, evp.MaxY, size); if (retAOI == null) { retAOI = aoi; } else { retAOI = AOIHelper.Merge(new int[][] { retAOI, aoi }); } } subprd.ArgumentProvider.AOI = retAOI; }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp != null) { if (arp.DataProvider != null) { _currentRasterFile = arp.DataProvider.fileName; } object obj = arp.GetArg("SmartSession"); if (obj != null) { _session = obj as ISmartSession; } } }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } _arp = subProduct.ArgumentProvider; if (_arp == null) { return; } _arp.SetArg("ucAnlysisTool", this); }
private void btnExcute_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_currentRasterFile) || lstFiles.Items.Count < 1) { return; } if (_session == null) { return; } ICanvasViewer cv = _session.SmartWindowManager.ActiveCanvasViewer; if (cv == null) { return; } int[] drawedAOI = cv.AOIProvider.GetIndexes(); IMonitoringSession msession = _session.MonitoringSession as IMonitoringSession; IMonitoringSubProduct subProduct = msession.ActiveMonitoringSubProduct; IPixelIndexMapper pixelMapper = (_session.MonitoringSession as IMonitoringSession).ExtractingSession.GetBinaryValuesMapper(subProduct.Definition.ProductDef.Identify, subProduct.Definition.Identify); IPixelIndexMapper resultPixelMapper = GenerateHistoryResultByAOI(pixelMapper, drawedAOI); if (pixelMapper != null) { DisplayResultClass.DisplayResult(_session, subProduct, resultPixelMapper, true); } }
private void TrySetSelectedPrimaryFilesArgs(ISmartSession session, IMonitoringSubProduct subProduct) { if (!SetSelectedPrimaryFiles(session, subProduct.ArgumentProvider)) { return; } }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } ckNCalc.Checked = _ckNCalcChecked; UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } _arp = subProduct.ArgumentProvider; if (_arp.DataProvider != null) { string rasterfilename = _arp.DataProvider.fileName; IntivalAngles(rasterfilename); } }
private void SetBandArgs(IMonitoringSubProduct subProduct) { if (!subProduct.Definition.IsNeedCurrentRaster) { return; } DataIdentify id = GetCurrentRasterIdentify(); if (id == null) { return; } if (!subProduct.ArgumentProvider.BandArgsIsSetted) { MonitoringThemeFactory.SetBandArgs(subProduct, id.Satellite, id.Sensor); } else { AlgorithmDef alg = subProduct.ArgumentProvider.CurrentAlgorithmDef; if (!alg.Satellites.Contains(id.Satellite) || !alg.Sensors.Contains(id.Sensor)) { MonitoringThemeFactory.SetBandArgs(subProduct, id.Satellite, id.Sensor); } } }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } _productIdentify = subProduct.Definition.ProductDef.Identify; _subProductIdentify = subProduct.Identify; IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } _currentFileName = arp.DataProvider.fileName; }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { _isInit = true; txtNatrueColorDir.Tag = null; if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } SaveArgsFile(null, null); _isInit = false; }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } Tag = arp; _dataProvider = arp.DataProvider; if (_handler != null) { _handler(GetArgumentValue()); } }
private static void DisplayFileResult(IMonitoringSubProduct subProduct, ISmartSession session, IExtractResult restult) { string filename = (restult as IFileExtractResult).FileName; RecordFileForAfterProcess(filename); IFileExtractResult fileResult = restult as IFileExtractResult; if (fileResult.Add2Workspace) { TrySaveFileToWorkspace(subProduct, session, filename, restult, null); } if (!(restult as IExtractResultBase).Display) { return; } if (NeedOpenFile()) { object obj = subProduct.ArgumentProvider.GetArg("fileOpenArgs"); string[] args = null; if (obj != null && !string.IsNullOrEmpty(obj.ToString())) { args = new string[] { obj.ToString() } } ; ICommand cmd = session.CommandEnvironment.Get(2000); if (cmd != null) { cmd.Execute(filename, args); } } }
private static IExtractResult StatAnalysisVgt(ISmartSession session, string outFileIdentify, string productTitle, bool isCustom) { (session.MonitoringSession as IMonitoringSession).ChangeActiveSubProduct("VTAT"); IMonitoringSubProduct msp = (session.MonitoringSession as IMonitoringSession).ActiveMonitoringSubProduct; if (msp == null) { return(null); } object obj = msp.ArgumentProvider.GetArg("SelectedPrimaryFiles"); if (obj == null || !File.Exists(obj.ToString())) { if (!SetSelectedPrimaryFiles(session, ref obj, msp.ArgumentProvider)) { return(null); } } msp.ArgumentProvider.SetArg("IsCustom", isCustom); if (!string.IsNullOrEmpty(outFileIdentify)) { msp.ArgumentProvider.SetArg("OutFileIdentify", outFileIdentify); } if (!string.IsNullOrEmpty(productTitle)) { msp.ArgumentProvider.SetArg("ProductTitle", productTitle); } GetCommandAndExecute(session, 6602); return(null); }
public void InitControl(IExtractPanel panel, ArgumentBase arg) { if (panel == null) { return; } UCExtractPanel ucPanel = panel as UCExtractPanel; if (ucPanel == null) { return; } IMonitoringSubProduct subProduct = ucPanel.MonitoringSubProduct; if (subProduct == null) { return; } IArgumentProvider arp = subProduct.ArgumentProvider; if (arp == null) { return; } string filename = arp.DataProvider.fileName; _currentRasterDir = Path.GetDirectoryName(filename); }
private void DisplayIndexResult(IMonitoringSubProduct subProduct, string name, IPixelIndexMapper pixelIndexMapper, IRasterDataProvider dataProvider) { ICanvasViewer cv = _session.SmartWindowManager.ActiveCanvasViewer; if (cv == null) { return; } using (IBinaryBitmapBuilder builder = new BinaryBitmapBuilder()) { Size bmSize = new Size(dataProvider.Width, dataProvider.Height); Color productColor = GetBinaryColor(subProduct); Bitmap bitmap = builder.CreateBinaryBitmap(bmSize, productColor, Color.Transparent); int[] indexes = pixelIndexMapper.Indexes.ToArray(); builder.Fill(indexes, new Size(dataProvider.Width, dataProvider.Height), ref bitmap); // IBinaryBitampLayer layer = cv.Canvas.LayerContainer.GetByName(name) as IBinaryBitampLayer; if (layer == null) { layer = new BinaryBitmapLayer(name, bitmap, GetCoordEnvelope(dataProvider), dataProvider.CoordType == enumCoordType.GeoCoord); cv.Canvas.LayerContainer.Layers.Add(layer); } else { layer.Bitmap = bitmap; } cv.Canvas.Refresh(Core.DrawEngine.enumRefreshType.All); } }