private void CreateCanvasViewer(string fname) { CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); RasterLayerBuilder.CreateAndLoadRasterLayerForHJ(_session, cv.Canvas, fname); }
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 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 CreateCanvasViewer(string fname) { L2ProductDefind[] l2Pros = L2ProductDefindParser.GetL2ProductDefs(fname); if (l2Pros == null || l2Pros.Length == 0) { return; } if (l2Pros.Length == 1) { CanvasView cv = new CanvasView(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); RasterLayerBuilder.CreateAndLoadRasterLayer(_session, cv.Canvas, fname, null); return; } using (frmFY3L2ProDataSelect frm = new frmFY3L2ProDataSelect(l2Pros)) { frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string proDesc = frm.ProDesc; if (string.IsNullOrEmpty(proDesc)) { return; } CanvasView cv = new CanvasView(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); object[] args = new object[] { new string[] { proDesc } }; RasterLayerBuilder.CreateAndLoadRasterLayer(_session, cv.Canvas, fname, args); } } }
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 void CreateCanvasViewer(string fname) { CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); //_session.SmartWindowManager.DisplayWindow(cv, new WindowPosition(DockStyle.Right, false)); RasterLayerBuilder.CreateAndLoadRasterLayer(_session, cv.Canvas, fname); }
private void CreateCanvasViewer(string fname) { CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); //如果不加载,则cv.Canvas为空,但此时上没有加载新的Layer RasterLayerBuilder.CreateAndLoadRasterLayer(_session, cv.Canvas, fname, new RgbStretcherProvider()); _session.SmartWindowManager.DisplayWindow(cv); // }
private ICanvasViewer CreateCanvasViewer(string fname, int[] rightBands, IRasterDrawing drawing1) { CanvasViewer cv = null; cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _smartSession); _smartSession.SmartWindowManager.DisplayWindow(cv); RasterLayerBuilder.CreateAndLoadRasterLayer(_smartSession, cv.Canvas, fname, drawing1.RgbStretcherProvider); return(cv); }
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); } }
private void OpenDataProvider(IGeoDataProvider provider) { if (provider is IRasterDataProvider) { string fname = (provider as IRasterDataProvider).fileName; CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); cv.Tag = fname; _session.SmartWindowManager.DisplayWindow(cv); RasterLayerBuilder.CreateAndLoadRasterLayer(_session, cv.Canvas, fname); } }
private void CreateVectorViewer(string fname) { using (frmMicapsDataTypeSelect frm = new frmMicapsDataTypeSelect()) { if (frm.DialogResult == DialogResult.OK) { string dataTypeId = "GroundObserveData"; CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); MicapsVectorLayerBuilder.CreateAndLoadVectorLayerForMicaps(_session, cv.Canvas, fname, dataTypeId); } } }
private void FileTypeIsSupport(string[] fnames) { foreach (string fname in fnames) { if (!File.Exists(fname)) { throw new ArgumentException("选择的文件:“" + Path.GetFileName(fname) + "”不存在。"); } if (!OpenFileFactory.SupportOpenFile(fname)) { throw new ArgumentException("选择的文件:“" + Path.GetFileName(fname) + "”类型不正确,无法生成动画。"); } } }
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(); } }
//判断文件是否能生成专题图 private static void CanCreatThemegraph(string fname) { if (string.IsNullOrEmpty(fname)) { throw new ArgumentException("选择的文件:“" + Path.GetFileName(fname) + "”不存在。"); } if (!File.Exists(fname)) { throw new ArgumentException("选择的文件:“" + Path.GetFileName(fname) + "”不存在。"); } if (!OpenFileFactory.SupportOpenFile(fname)) { throw new ArgumentException("选择的文件:“" + Path.GetFileName(fname) + "”类型不正确。"); } }
private void CreateCanvasViewer(string filename) { using (Hdf5DatasetSelection frm = new Hdf5DatasetSelection()) { frm.LoadFile(filename); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { filename = frm.FileName; string[] hdfOptions = frm.GetOpenOptions(); CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(filename), _session); _session.SmartWindowManager.DisplayWindow(cv); RasterLayerBuilder.CreateAndLoadRasterLayer(_session, cv.Canvas, filename, hdfOptions, new RgbStretcherProvider()); _session.SmartWindowManager.DisplayWindow(cv);// } } }
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); } } } }
public override bool Open(string fname, out bool memoryIsNotEnough) { memoryIsNotEnough = false; if (!MemoryIsEnoughChecker.MemoryIsEnouggWithMsgBoxForVector(fname)) { memoryIsNotEnough = true; return(false); } bool isSpatial = IsCanAddToView(fname); //string mcd = TryGetMcd(fname);//不能在这里用mcd替换 //if (!string.IsNullOrWhiteSpace(mcd)) // fname = mcd; if (_session.SmartWindowManager.ActiveViewer is ICanvasViewer && isSpatial) { AddVectorDataToCanvasViewer(fname, true); } else if (_session.SmartWindowManager.ActiveViewer is ILayoutViewer) { AddVectorDataToLayoutViewer(fname, true); } else { CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); IVectorHostLayer host = cv.Canvas.LayerContainer.VectorHost as IVectorHostLayer; if (host != null) { host.Set(cv.Canvas); AddVectorDataToCanvasViewer(fname, false); CodeCell.AgileMap.Core.IMap map = host.Map as CodeCell.AgileMap.Core.IMap; CodeCell.AgileMap.Core.FeatureLayer fetL = map.LayerContainer.Layers[0] as CodeCell.AgileMap.Core.FeatureLayer; CodeCell.AgileMap.Core.FeatureClass fetc = fetL.Class as CodeCell.AgileMap.Core.FeatureClass; CodeCell.AgileMap.Core.Envelope evp = fetc.FullEnvelope.Clone() as CodeCell.AgileMap.Core.Envelope; CoordEnvelope cvEvp = new CoordEnvelope(evp.MinX, evp.MaxX, evp.MinY, evp.MaxY); cv.Canvas.CurrentEnvelope = cvEvp; cv.Canvas.Refresh(enumRefreshType.All); } } RefreshLayerManager(); return(true); }
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 void CreateCanvasViewer(string fname) { using (frmComponentFileSelect frm = new frmComponentFileSelect()) { frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; frm.Apply(fname); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string cid = "ComponentID=" + frm.ComponentID; if (cid == null) { return; } CanvasViewer cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.DisplayWindow(cv); RasterLayerBuilder.CreateAndLoadRasterLayerForGeoEye(_session, cv.Canvas, fname, cid); } } }
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); }
private void CreateCanvasViewer(string fname) { CanvasViewer cv = null; try { cv = new CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); _session.SmartWindowManager.AddDocument(cv); RasterLayerBuilder.CreateAndLoadRasterLayer(_session, cv.Canvas, fname, GetRgbStretcherProvider(fname)); _session.SmartWindowManager.ActivateWindow(cv); } catch { if (cv != null) { cv.Close(); } throw; } }
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 bool CreateVectorViewer(string fname) { using (frmMicapsDataTypeSelect frm = new frmMicapsDataTypeSelect()) { frm.StartPosition = FormStartPosition.CenterScreen; if (frm.ShowDialog() == DialogResult.OK) { bool isSpatial = IsCanAddToView(fname); string dataTypeId = GetDataTypeIdByName(frm.SelectDataType); CanvasViewer.CanvasViewer cv = null; CodeCell.AgileMap.Core.IFeatureLayer layer = null; if (_session.SmartWindowManager.ActiveViewer is ICanvasViewer && isSpatial) { cv = GetCanvasViewer(fname); } if (cv == null && (_session.SmartWindowManager.ActiveViewer is ILayoutViewer)) { ICanvas canvas = GetCanvas(fname); layer = MicapsVectorLayerBuilder.CreateAndLoadVectorLayerForMicaps(_session, canvas, fname, dataTypeId); } else if (layer == null && cv == null) { cv = new CanvasViewer.CanvasViewer(OpenFileFactory.GetTextByFileName(fname), _session); } if (layer == null) { _session.SmartWindowManager.DisplayWindow(cv); layer = MicapsVectorLayerBuilder.CreateAndLoadVectorLayerForMicaps(_session, cv.Canvas, fname, dataTypeId); } if (layer != null) { return(true); } else { return(false); } } return(true); } }