private void DoBandMath(IRasterDrawing drawing, string outFilename, string expression) { string extName = Path.GetExtension(outFilename).Replace(",", "").ToUpper(); if (extName == ".DAT") { extName = "MEM"; } else { extName = "LDF"; } IBandMathTool bandMathTool = new BandMathTool(); IProgressMonitor progress = _smartSession.ProgressMonitorManager.DefaultProgressMonitor; try { progress.Reset("正在执行波段运算...", 100); progress.Start(false); bandMathTool.Compute(drawing.DataProviderCopy, expression, extName, outFilename, (idx, tip) => { progress.Boost(idx, "正在执行波段运算..."); }); } finally { progress.Finish(); //if (MsgBox.ShowQuestionYesNo("波段运算已输出文件\"" + outFilename + "\",要打开文件吗?") == System.Windows.Forms.DialogResult.Yes) { OpenFileFactory.Open(outFilename); } } }
private void btnOpenSelectedFiles_Click(object sender, EventArgs e) { string[] filesSelected = GetCheckededFiles(); if (filesSelected.Length == 0) { return; } int fileOpenCount = filesSelected.Length; if (fileOpenCount > 20) { if (MsgBox.ShowQuestionYesNo("要打开的文件过多(>20),点确认打开前20个,点取消重新选择文件") == DialogResult.OK) { fileOpenCount = 20; } else { return; } } for (int i = 0; i < fileOpenCount; i++) { OpenFileFactory.Open(filesSelected[i]); } }
private void btnJoin_Click(object sender, EventArgs e) { try { if (txtFileList.Items == null || txtFileList.Items.Count == 0) { MsgBox.ShowInfo("请至少选择一个待拼接文件!"); return; } int[] selectedBands = GetSelectedBands(); if (selectedBands == null) { MsgBox.ShowInfo("请至少选择一个拼接波段!"); return; } if (ckResolution.Checked) { int reduceRes; if (Int32.TryParse(txtResolution.Text, out reduceRes)) { _reduceRes = reduceRes; } } _processInvaild = ckProcessInvaild.Checked; _invaildValues = GetInvaildString(txtVaild.Text); string[] srcFileNames = GetArgsItems(); _outDir = txtOutFileName.Text; string resultFileName = MoasicFiles(srcFileNames, _processInvaild, _invaildValues, _outDir, _outCoordEnvelope, selectedBands, _session.ProgressMonitorManager.DefaultProgressMonitor); OpenFileFactory.Open(resultFileName); } catch (Exception exception) { MsgBox.ShowError(exception.Message); } }
public override void Execute(string filename) { if (!File.Exists(filename)) { return; } OpenFileFactory.Open(filename); }
private IExtractResult NCIMAlgorithm() { //工作路径 string outImageDir = Convert.ToString(_argumentProvider.GetArg("OutImageDir")); if (string.IsNullOrWhiteSpace(outImageDir)) { MessageBox.Show("没有设置工作路径,不能进行数据处理!"); return(null); } string day = DateTime.Now.ToString("yyyyMMdd"); string outdir = Path.Combine(outImageDir, day); if (!Directory.Exists(outdir)) { Directory.CreateDirectory(outdir); } //真彩图处理逻辑 string natrueColorFile = Convert.ToString(_argumentProvider.GetArg("NatrueColorFile")); if (string.IsNullOrWhiteSpace(natrueColorFile)) { return(null); } string[] files = natrueColorFile.Split(new char[] { ',' }); if (files.Length != 2) { return(null); } string filename = files[0]; string newfilename = files[1]; string newfile = Path.Combine(outdir, newfilename); if (File.Exists(newfile)) { try { File.Delete(newfile); } catch (Exception ex) { MessageBox.Show("新文件被占用不能删除,请手动删除后尝试运行!"); return(null); } } File.Copy(filename, newfile); OpenFileFactory.Open(newfile); return(null); }
private void AddData2CanvasViewer(string fname) { ICanvasViewer cv = _smartSession.SmartWindowManager.ActiveCanvasViewer; if (cv == null) { OpenFileFactory.Open(fname); return; } AddData2CanvasViewer(cv, fname); }
private void OpenFile(string filename) { if (!File.Exists(filename)) { MsgBox.ShowInfo("文件不存在或无法访问" + filename); } else { OpenFileFactory.Open(filename); } }
void toolBlock_Click(object sender, EventArgs e) { ToolStripItem tool = sender as ToolStripItem; //补充 HdDataProvider hdProvider = new HdDataProvider(); BlockInfo[] blocks = hdProvider.GetBlockByFile(tool.Text, getBlockType()); int length = blocks.Length; for (int i = 0; i < length; i++) { OpenFileFactory.Open(DataPathHelper.DataServerBlockPath + blocks[i].datapath); Application.DoEvents(); } }
public override void Execute() { if (_smartSession.SmartWindowManager.ActiveCanvasViewer == null) { return; } ICanvasViewer canvasViewer = _smartSession.SmartWindowManager.ActiveCanvasViewer; using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Filter = "等值线(*.xml)|*.xml"; if (dlg.ShowDialog() == DialogResult.OK) { OpenFileFactory.Open(dlg.FileName); } } }
public override void Execute(string argument) { ICanvasViewer canViewer = _smartSession.SmartWindowManager.ActiveCanvasViewer; if (canViewer == null) { return; } IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing; if (rd == null) { return; } string filename = rd.FileName; try { string theme = SelectLayoutTheme(); if (string.IsNullOrWhiteSpace(theme)) { return; } string bmpFilename = CreateViewBitmap(rd.DataProvider.CoordEnvelope, rd.DataProvider.SpatialRef, filename); string gxdFilename = SaveGxdFilename(rd); if (string.IsNullOrWhiteSpace(gxdFilename)) { return; } ThematicGraphHelper thematic = new ThematicGraphHelper(_smartSession, Path.GetFileNameWithoutExtension(theme)); //thematic.AOI = MasicAOI(aoi, ref extInfos); //thematic.SetOrbitTimes(obtTimes); //thematic.DateString = dateString; string resultFilename = thematic.CreateThematicGraphic(bmpFilename, theme, gxdFilename, null, null); //return new FileExtractResult(outFileIdentify, resultFilename); if (!string.IsNullOrWhiteSpace(resultFilename)) { OpenFileFactory.Open(resultFilename); } } catch (Exception ex) { MsgBox.ShowInfo(ex.Message); } }
private unsafe void TryExport2ShapeFile(IRasterDataProvider dataProvider, ContourLine[] cntLines, string shpFileName, IProgressMonitor progress, bool isNeedDisplay) { int cntCount = cntLines.Length; string tip = "正在将等值线导出为矢量文件({0}/{1})..."; progress.Reset("正在将等值线导出为矢量文件...", cntLines.Length); IEsriShapeFilesWriter writer = new EsriShapeFilesWriterII(shpFileName, enumShapeType.Polyline); writer.BeginWrite(); try { double resX = dataProvider.CoordEnvelope.Width / dataProvider.Width; double resY = dataProvider.CoordEnvelope.Height / dataProvider.Height; double minX = dataProvider.CoordEnvelope.MinX; double maxY = dataProvider.CoordEnvelope.MaxY; Feature[] buffer = new Feature[1]; for (int i = 0; i < cntCount; i++) { if (cntLines[i] == null) { continue; } Feature fet = GetFeature(cntLines[i], resX, resY, minX, maxY, i); if (fet != null) { buffer[0] = fet; writer.Write(buffer); } progress.Boost(i, string.Format(tip, i + 1, cntCount)); } } finally { writer.EndWriter(); progress.Boost(cntCount); //没有直接显示则打开矢量文件 if (!isNeedDisplay) { if (MsgBox.ShowQuestionYesNo("是否打开矢量文件\"" + shpFileName + "\"?") == DialogResult.Yes) { OpenFileFactory.Open(shpFileName); } } } }
private void OpenFiles(string[] files) { if (files == null || files.Length == 0) { return; } for (int i = 0; i < files.Length; i++) { string fileName = files[i]; if (!string.IsNullOrWhiteSpace(fileName)) { OpenFileFactory.Open(fileName); } } if (ProjectionFinished != null) { ProjectionFinished(this, null); } }
private IExtractResult NCIMAlgorithm() { //真彩图处理逻辑 string natrueColorFile = Convert.ToString(_argumentProvider.GetArg("NatrueColorFile")); OpenFileFactory.Open(natrueColorFile); IMonitoringSession ms = _argumentProvider.EnvironmentVarProvider as IMonitoringSession; ms.ChangeActiveSubProduct("0IMG"); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("OutFileIdentify", "NCIM"); ms.DoAutoExtract(false); ms.ChangeActiveSubProduct("0IMG"); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("OutFileIdentify", "ONCI"); ms.DoAutoExtract(false); ms.ChangeActiveSubProduct("OAIM"); return(null); }
private void TryDisplay(ContourLine[] cntLines, frmContourSettings.ContourItem[] items, bool isLabel, bool isFillColor, bool isNew, IRasterDataProvider dataProvider) { if (cntLines == null || cntLines.Length == 0) { return; } var v = cntLines.Where((cntLine) => { return(cntLine != null); }); if (v == null || v.Count() == 0) { return; } ContourClass[] dstItems = ToContourClass(items); foreach (ContourLine cntLine in v) { for (int i = 0; i < dstItems.Length; i++) { if (Math.Abs(dstItems[i].ContourValue - cntLine.ContourValue) < double.Epsilon) { cntLine.ClassIndex = i; break; } } } if (isNew) { string fname = dataProvider.fileName; dataProvider.Dispose(); OpenFileFactory.Open(fname); } ICanvasViewer cv = _smartSession.SmartWindowManager.ActiveCanvasViewer; if (cv == null) { return; } IContourLayer lyr = new ContourLayer("等值线"); lyr.Apply(v.ToArray(), dstItems, isLabel, isFillColor); cv.Canvas.LayerContainer.Layers.Add(lyr as GeoDo.RSS.Core.DrawEngine.ILayer); cv.Canvas.Refresh(Core.DrawEngine.enumRefreshType.All); }
void _radListView_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e) { if (_fileRadListView.SelectedItem == null) { return; } _view.HidePopup(); object v = _fileRadListView.SelectedItem.Tag; if (File.Exists(v.ToString())) { OpenFileFactory.Open(v.ToString()); } else { MsgBox.ShowInfo("文件\"" + v.ToString() + "\"不存在。"); _session.RecentFilesManager.Remove(v.ToString()); LoadItemsByRecentUsedFiles(); } }
private IExtractResult RFIMAlgorithm() { string day = DateTime.Now.ToString("yyyyMMdd"); //影像数据处理逻辑 string rasterFile = Convert.ToString(_argumentProvider.GetArg("RFIMFile")); if (string.IsNullOrWhiteSpace(rasterFile)) { return(null); } string[] files = rasterFile.Split(new char[] { ',' }); if (files.Length != 2) { return(null); } string filename = files[0]; OpenFileFactory.Open(filename); return(null); }
private IExtractResult NCIMAlgorithm() { //真彩图处理逻辑 string natrueColorFile = Convert.ToString(_argumentProvider.GetArg("NatrueColorFile")); OpenFileFactory.Open(natrueColorFile); //return new FileExtractResult("HAE", natrueColorFile, false); /* * <Instance name="监测示意图" fileprovider="ContextEnvironment:DBLV" * outfileidentify="0MSI" layoutname="大雾监测示意图模板" * aoiprovider="SystemAOI:DefaultAOI" autogenerategroup="Ord,Dis"/> */ IMonitoringSession ms = _argumentProvider.EnvironmentVarProvider as IMonitoringSession; ms.ChangeActiveSubProduct("0IMG"); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("OutFileIdentify", "0MSI"); ms.DoAutoExtract(false); return(null); }
public override void Execute(string argument) { OpenFileFactory.Open(argument); }
public override void Execute(string argument) { ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer; if (viewer != null) { ICanvasViewer canViewer = viewer as ICanvasViewer; if (canViewer == null) { return; } IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing; if (rd == null || rd.RgbProcessorStack == null) { return; } List <IRgbProcessor> rgbProcessors = new List <IRgbProcessor>(); foreach (IRgbProcessor processor in rd.RgbProcessorStack.Processors) { rgbProcessors.Add(processor); } rgbProcessors.Reverse(); int[] selectBands = rd.SelectedBandNos; IGeoPanAdjust adjust = rd as IGeoPanAdjust; if (adjust != null) { if (adjust.IsHasUnsavedGeoAdjusted) { DialogResult ret = MsgBox.ShowQuestionYesNoCancel("对当前影像的平移校正结果未保存,请确认是否保存?\n按【是】保存。\n按【否】不保存。\n按【取消】返回。"); if (ret == DialogResult.Cancel) { return; } else if (ret == DialogResult.Yes) { PanAdjustTool adjustTool = new PanAdjustTool(); string fileName = null; try { fileName = adjustTool.SaveGeoAdjust(rd.EnvelopeBeforeAdjusting, rd.DataProviderCopy); } catch (Exception e) { MessageBox.Show(e.Message); } adjust.Cancel(); if (File.Exists(fileName)) { OpenFileFactory.Open(fileName); IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing; draw.SelectedBandNos = selectBands; if (rgbProcessors != null && rgbProcessors.Count > 0) { draw.RgbProcessorStack.Clear(); foreach (IRgbProcessor processor in rgbProcessors) { draw.RgbProcessorStack.Process(processor); } } } } else { adjust.Cancel(); } } else { string dirTXTFname = AppDomain.CurrentDomain.BaseDirectory + "MonitoringProductArgs\\COMM\\AdjustSaveFile.txt"; if (File.Exists(dirTXTFname)) { string[] fileNames = File.ReadAllLines(dirTXTFname, Encoding.Default); int length = fileNames.Length; string lastFile = fileNames[length - 1]; AdjustConfig config = new AdjustConfig(); bool IsOpenResult = true; bool.TryParse(config.GetConfigValue("IsOpenResult"), out IsOpenResult); if (IsOpenResult && File.Exists(lastFile)) { try { OpenFileFactory.Open(lastFile); IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing; draw.SelectedBandNos = selectBands; if (rgbProcessors != null && rgbProcessors.Count > 0) { draw.RgbProcessorStack.Clear(); foreach (IRgbProcessor processor in rgbProcessors) { draw.RgbProcessorStack.Process(processor); } } } catch (Exception e) { MessageBox.Show(e.Message); } } File.Delete(dirTXTFname); } } } } _smartSession.UIFrameworkHelper.SetVisible(argument, false); _smartSession.UIFrameworkHelper.SetLockBesideX(argument, false); }
private void GeoCorrect_Click(object sender, EventArgs e) { if (_listGCP.Count < 3) { MessageBox.Show("请至少选择3个控制点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (_baseDataControl.GetSpatialRef() == null) { MessageBox.Show("基准数据没有地理坐标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (File.Exists(OutPath.Text)) { DialogResult dlgResult = MessageBox.Show("输出文件已存在,是否替换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgResult == DialogResult.No) { return; } } CalGeoCoef calCoef = new CalGeoCoef(); double[] imgX = new double[_listGCP.Count]; double[] imgY = new double[_listGCP.Count]; double[] baseX = new double[_listGCP.Count]; double[] baseY = new double[_listGCP.Count]; for (int i = 0; i < _listGCP.Count; i++) { imgX[i] = _listGCP[i].ImagePoint.X; imgY[i] = _listGCP[i].ImagePoint.Y; baseX[i] = _listGCP[i].BasePoint.X; baseY[i] = _listGCP[i].BasePoint.Y; } IProgressMonitor progress = _smartSession.ProgressMonitorManager.DefaultProgressMonitor; try { if (progress != null) { progress.Reset("", 100); progress.Start(false); } int coordType = 0; int imgType = _imageControl.GetCoordType(); int baseType = _baseDataControl.GetCoordType(); if ((imgType == 0) && (baseType == 0)) { coordType = 0; } else if ((imgType == 0) && (baseType == 1)) { coordType = 1; } else if ((imgType == 0) && (baseType == 2)) { coordType = 2; } else if ((imgType == 1) && (baseType == 0)) { coordType = 3; } else if ((imgType == 1) && (baseType == 1)) { coordType = 4; } else if ((imgType == 1) && (baseType == 2)) { coordType = 5; } else if ((imgType == 2) && (baseType == 0)) { coordType = 6; } else if ((imgType == 2) && (baseType == 1)) { coordType = 7; } else if ((imgType == 2) && (baseType == 2)) { coordType = 8; } string spatialRef = _baseDataControl.GetSpatialRef().ToProj4String(); if (_listGCP.Count >= 6) { double[] coefX = new double[6]; double[] coefY = new double[6]; double[] RcoefX = new double[6]; double[] RcoefY = new double[6]; calCoef.PolyCoef2(baseX, baseY, imgX, imgY, _listGCP.Count, out coefX, out coefY); calCoef.PolyCoef2(imgX, imgY, baseX, baseY, _listGCP.Count, out RcoefX, out RcoefY); PolyCorrection polyCorrect = new PolyCorrection(); polyCorrect.PolyOrder = 2; polyCorrect.DoPolyCorrection(_imageControl.RasterName, OutPath.Text, coordType, coefX, coefY, RcoefX, RcoefY, spatialRef, "LDF", new Action <int, string>((int progerss, string text) => { if (progress != null) { progress.Boost(progerss, text); } })); } else { double[] coefX = new double[3]; double[] coefY = new double[3]; double[] RcoefX = new double[3]; double[] RcoefY = new double[3]; //imgX[0] = 13.0; //imgX[1] = 116.0; //imgX[2] = 228.0; //imgY[0] = 13.0; //imgY[1] = 132.0; //imgY[2] = 241.0; //baseX[0] = 119.515789; //baseX[1] = 120.036845; //baseX[2] = 120.612091; //baseY[0] = 39.099891; //baseY[1] = 38.556071; //baseY[2] = 38.085306; calCoef.PolyCoef1(baseX, baseY, imgX, imgY, _listGCP.Count, out coefX, out coefY); calCoef.PolyCoef1(imgX, imgY, baseX, baseY, _listGCP.Count, out RcoefX, out RcoefY); PolyCorrection polyCorrect = new PolyCorrection(); polyCorrect.PolyOrder = 1; polyCorrect.DoPolyCorrection(_imageControl.RasterName, OutPath.Text, coordType, coefX, coefY, RcoefX, RcoefY, spatialRef, "LDF", new Action <int, string>((int progerss, string text) => { if (progress != null) { progress.Boost(progerss, text); } })); } } finally { if (progress != null) { progress.Finish(); } } string strText = "几何精校正处理完成,是否打开输出影像" + Path.GetFileName(OutPath.Text) + "?"; DialogResult result = MessageBox.Show(strText, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { OpenFileFactory.Open(OutPath.Text); } }
private void OpenFileToWindows(string file) { OpenFileFactory.Open(file); }
private IExtractResult NCIMAlgorithm() { //工作路径 string outImageDir = Convert.ToString(_argumentProvider.GetArg("OutImageDir")); if (string.IsNullOrWhiteSpace(outImageDir)) { MessageBox.Show("没有设置工作路径,不能进行数据处理!"); return(null); } string day = DateTime.Now.ToString("yyyyMMdd"); string outdir = Path.Combine(outImageDir, day); if (!Directory.Exists(outdir)) { Directory.CreateDirectory(outdir); } //真彩图处理逻辑 string natrueColorFile = Convert.ToString(_argumentProvider.GetArg("NatrueColorFile")); if (string.IsNullOrWhiteSpace(natrueColorFile)) { return(null); } string[] files = natrueColorFile.Split(new char[] { ',' }); if (files.Length != 2) { return(null); } string filename = files[0]; string newfilename = files[1]; string newfile = Path.Combine(outdir, newfilename); if (filename.ToUpper() != newfile.ToUpper()) { if (File.Exists(newfile)) { try { File.Delete(newfile); } catch (Exception ex) { MessageBox.Show("新文件被占用不能删除,请手动删除后尝试运行!"); return(null); } } File.Copy(filename, newfile); } OpenFileFactory.Open(newfile); bool onlyOpen = bool.Parse(_argumentProvider.GetArg("OnlyOpen").ToString()); if (onlyOpen) { return(null); } float resolution = 0f; int width = 0, height = 0; string rasterfilename = GetRasterFilenameFromDrawing(out resolution, out width, out height); IMonitoringSession ms = _argumentProvider.EnvironmentVarProvider as IMonitoringSession; IMonitoringSubProduct subDef = ms.ActiveMonitoringProduct.GetSubProductByIdentify("0IMG"); if (subDef != null) { try { subDef.Definition.IsKeepUserControl = true; ms.ChangeActiveSubProduct("0IMG"); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("OutFileIdentify", "NCIM"); // 低分 "霾监测示意图模板"); string tempname1 = GetThemeGraphTemplateName(resolution, width, height, TemplateType.低分); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("HEAThemeGraphTemplateName", tempname1); ms.DoAutoExtract(false); ms.ChangeActiveSubProduct("0IMG"); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("OutFileIdentify", "TNCI"); // 原始分辨率 //string tempname2 = GetThemeGraphTemplateName(resolution, width, height, TemplateType.低分); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("HEAThemeGraphTemplateName", ""); ms.DoAutoExtract(false); ms.ChangeActiveSubProduct("0IMG"); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("OutFileIdentify", "ONCI"); // 原始 string tempname3 = GetThemeGraphTemplateName(resolution, width, height, TemplateType.原始); ms.ActiveMonitoringSubProduct.ArgumentProvider.SetArg("HEAThemeGraphTemplateName", tempname3); ms.DoAutoExtract(false); ms.ChangeActiveSubProduct("NCIM"); } finally { if (subDef != null) { subDef.Definition.IsKeepUserControl = false; } } } return(null); }
public override void Execute() { ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer; if (viewer == null) { return; } ICanvasViewer canViewer = viewer as ICanvasViewer; IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing; if (rd == null || rd.RgbProcessorStack == null) { return; } List <IRgbProcessor> rgbProcessors = new List <IRgbProcessor>(); foreach (IRgbProcessor processor in rd.RgbProcessorStack.Processors) { rgbProcessors.Add(processor); } rgbProcessors.Reverse(); int[] selectBands = rd.SelectedBandNos; IGeoPanAdjust adjust = rd as IGeoPanAdjust; if (rd == null) { return; } GeoAdjustHelper helper = new GeoAdjustHelper(); string fileName = null; string dblvFileName = null; try { CoordEnvelope envelopeAfter = new CoordEnvelope(rd.Envelope.MinX, rd.Envelope.MinY, rd.Envelope.Width, rd.Envelope.Height); fileName = helper.SaveGeoAdjustByChangeCoordEnvelope(envelopeAfter, rd.DataProviderCopy); //调整对应的判识结果文件 dblvFileName = AdjustDBLVFile(envelopeAfter, rd.DataProviderCopy); adjust.Cancel(); if (File.Exists(fileName)) { OpenFileFactory.Open(fileName); IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing; draw.SelectedBandNos = selectBands; if (rgbProcessors != null && rgbProcessors.Count > 0) { draw.RgbProcessorStack.Clear(); foreach (IRgbProcessor processor in rgbProcessors) { draw.RgbProcessorStack.Process(processor); } } //生成多通道合成图 LayoutCreater layoutCreater = new LayoutCreater(); string mcsiFileName = layoutCreater.CreateMCSI(_smartSession); if (!string.IsNullOrEmpty(mcsiFileName) && File.Exists(mcsiFileName)) { OpenFileFactory.Open(mcsiFileName); } //生成二值图 if (!string.IsNullOrEmpty(dblvFileName)) { string imgFileName = layoutCreater.CreateDBLVLayout(dblvFileName, draw.FileName); if (!string.IsNullOrEmpty(imgFileName) && File.Exists(imgFileName)) { OpenFileFactory.Open(imgFileName); } } } } catch (Exception e) { MessageBox.Show(e.Message); } if (fileName != null && File.Exists(fileName)) { string adjustTxtDir = AppDomain.CurrentDomain.BaseDirectory + "MonitoringProductArgs\\COMM\\"; if (!Directory.Exists(adjustTxtDir)) { Directory.CreateDirectory(adjustTxtDir); } string txtFileName = Path.Combine(adjustTxtDir, "AdjustSaveFile.txt"); using (StreamWriter sw = new StreamWriter(txtFileName, true, Encoding.Default)) { sw.WriteLine(fileName); if (dblvFileName != null && File.Exists(dblvFileName)) { sw.WriteLine(dblvFileName); } } } }
private void TryAddAsVector(string fname) { OpenFileFactory.Open(fname); }
public override void Execute(string argument) { ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer; if (viewer != null) { ICanvasViewer canViewer = viewer as ICanvasViewer; if (canViewer == null) { return; } IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing; if (rd == null || rd.RgbProcessorStack == null) { return; } List <IRgbProcessor> rgbProcessors = new List <IRgbProcessor>(); foreach (IRgbProcessor processor in rd.RgbProcessorStack.Processors) { rgbProcessors.Add(processor); } rgbProcessors.Reverse(); int[] selectBands = rd.SelectedBandNos; IGeoPanAdjust adjust = rd as IGeoPanAdjust; if (adjust != null) { if (adjust.IsHasUnsavedGeoAdjusted) { DialogResult ret = MsgBox.ShowQuestionYesNoCancel("对当前影像的平移校正结果未保存,请确认是否保存?\n按【是】保存。\n按【否】不保存。\n按【取消】返回。"); if (ret == DialogResult.Cancel) { return; } else if (ret == DialogResult.Yes) { GeoAdjustHelper adjustTool = new GeoAdjustHelper(); string fileName = null; string dblvFileName = null; try { fileName = adjustTool.SaveGeoAdjustByChangeCoordEnvelope(rd.DataProvider.CoordEnvelope, rd.DataProviderCopy); dblvFileName = AdjustDBLVFile(rd.DataProvider.CoordEnvelope, rd.DataProviderCopy); } catch (Exception e) { MessageBox.Show(e.Message); } adjust.Cancel(); if (File.Exists(fileName)) { OpenFileFactory.Open(fileName); IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing; draw.SelectedBandNos = selectBands; if (rgbProcessors != null && rgbProcessors.Count > 0) { draw.RgbProcessorStack.Clear(); foreach (IRgbProcessor processor in rgbProcessors) { draw.RgbProcessorStack.Process(processor); } } //生成多通道合成图 LayoutCreater layoutCreater = new LayoutCreater(); string mcsiFileName = layoutCreater.CreateMCSI(_smartSession); if (!string.IsNullOrEmpty(mcsiFileName) && File.Exists(mcsiFileName)) { OpenFileFactory.Open(mcsiFileName); } //生成二值图 if (!string.IsNullOrEmpty(dblvFileName)) { string imgFileName = layoutCreater.CreateDBLVLayout(dblvFileName, draw.FileName); if (!string.IsNullOrEmpty(imgFileName) && File.Exists(imgFileName)) { OpenFileFactory.Open(imgFileName); } } } } else { adjust.Cancel(); } } else { string dirTXTFname = AppDomain.CurrentDomain.BaseDirectory + "MonitoringProductArgs\\COMM\\AdjustSaveFile.txt"; if (File.Exists(dirTXTFname)) { string[] fileNames = File.ReadAllLines(dirTXTFname, Encoding.Default); int length = fileNames.Length; string lastFile = fileNames[length - 1]; if (File.Exists(lastFile)) { try { OpenFileFactory.Open(lastFile); IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing; draw.SelectedBandNos = selectBands; if (rgbProcessors != null && rgbProcessors.Count > 0) { draw.RgbProcessorStack.Clear(); foreach (IRgbProcessor processor in rgbProcessors) { draw.RgbProcessorStack.Process(processor); } } } catch (Exception e) { MessageBox.Show(e.Message); } } File.Delete(dirTXTFname); } } } } //_smartSession.UIFrameworkHelper.SetVisible(argument, false); //_smartSession.UIFrameworkHelper.SetLockBesideX(argument, false); }