Exemplo n.º 1
0
        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;
                IGeoPanAdjust  adjust = rd as IGeoPanAdjust;
                if (adjust != null && adjust.IsHasUnsavedGeoAdjusted)
                {
                    DialogResult ret = MsgBox.ShowQuestionYesNoCancel("对当前影像的平移校正结果未保存,请确认是否保存?\n按【是】保存。\n按【否】不保存。\n按【取消】返回。");
                    if (ret == DialogResult.Cancel)
                    {
                        return;
                    }
                    else if (ret == DialogResult.Yes)
                    {
                        adjust.Save();
                    }
                    else
                    {
                        adjust.Cancel();
                    }
                }
            }
            _smartSession.UIFrameworkHelper.SetVisible(argument, false);
            _smartSession.UIFrameworkHelper.SetLockBesideX(argument, false);
        }
Exemplo n.º 2
0
        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 bmpFilename = GetBmpFilename(filename);
                CreateViewBitmap(rd.DataProvider.CoordEnvelope, rd.DataProvider.SpatialRef, bmpFilename);
            }
            catch (Exception ex)
            {
                MsgBox.ShowInfo(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void ClearListViewItems()
        {
            if (listView1.Items.Count != 0)
            {
                for (int i = listView1.Items.Count - 1; i >= 0; i--)
                {
                    if (RemoveFeature != null)
                    {
                        RemoveFeature(listView1.Items[i].Tag as Feature);
                    }
                }
                listView1.Items.Clear();
            }
            ILabelLayer lyr = FindLabelLayer(_layerName);

            if (lyr != null)
            {
                lyr.Dispose();
            }
            ICanvasViewer viewer = _session.SmartWindowManager.ActiveCanvasViewer;

            if (viewer != null)
            {
                ILabelService srv = (viewer as ICurrentRasterInteractiver).LabelService;
                srv.Reset();
            }
            _iceLineFeatureOid = 0;
        }
Exemplo n.º 4
0
        private void ClearLineLayers()
        {
            if (linLayerName == null || linLayerName.Count == 0)
            {
                return;
            }
            ICanvasViewer viewer = _session.SmartWindowManager.ActiveCanvasViewer;

            if (viewer == null)
            {
                return;
            }
            CodeCell.AgileMap.Core.ILayer removeLayer = null;
            foreach (string name in linLayerName)
            {
                foreach (GeoDo.RSS.Core.DrawEngine.ILayer layer in viewer.Canvas.LayerContainer.Layers)
                {
                    if (layer is IVectorHostLayer)
                    {
                        IVectorHostLayer hostLayer = layer as IVectorHostLayer;
                        IMap             map       = hostLayer.Map as IMap;
                        if (map.LayerContainer != null)
                        {
                            removeLayer = map.LayerContainer.GetLayerByName(name);
                        }
                        if (removeLayer != null)
                        {
                            map.LayerContainer.Remove(removeLayer);
                            break;
                        }
                    }
                }
            }
            Update();
        }
Exemplo n.º 5
0
        private string TryGetInfoFromActiveView(out AOIItem[] aoiItems)
        {
            ICanvasViewer canViewer = _smartSession.SmartWindowManager.ActiveCanvasViewer;

            if (canViewer == null)
            {
                throw new Exception("未获得激活的数据窗口");
            }
            IAOIProvider aoiProvider = canViewer.AOIProvider;

            if (aoiProvider == null)
            {
                throw new Exception("未从激活的数据窗口中获取感兴趣区域");
            }
            aoiItems = aoiProvider.GetAOIItems();
            IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing;

            if (rd == null)
            {
                throw new Exception("未从激活的数据窗口中获取数据提供者");
            }
            IRasterDataProvider rdp = rd.DataProvider;

            if (rdp == null)
            {
                throw new Exception("未从激活的数据窗口中获取数据提供者");
            }
            return(rdp.fileName);
        }
Exemplo n.º 6
0
        public override void Execute()
        {
            ICanvasViewer cv = _smartSession.SmartWindowManager.ActiveCanvasViewer;

            if (cv == null)
            {
                return;
            }
            ILayer layer = cv.Canvas.LayerContainer.GetByName("海陆背景");

            if (layer != null)
            {
                return;
            }
            string fname = AppDomain.CurrentDomain.BaseDirectory + @"数据引用\基础矢量\矢量模版\海陆模版.shp";

            if (!File.Exists(fname))
            {
                Console.WriteLine("文件\"" + fname + "\"未找到,无法应用默认背景。");
                return;
            }
            IBackgroundLayer lyr = new BackgroundLayer(fname);

            cv.Canvas.LayerContainer.Layers.Add(lyr);
            cv.Canvas.Refresh(enumRefreshType.All);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 防止在轨道文件上添加mcd
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        private bool IsCanAddToView(string filename)
        {
            string extName = Path.GetExtension(filename).ToUpper();

            if (extName == ".000")
            {
                return(true);
            }
            ICanvasViewer v = _session.SmartWindowManager.ActiveCanvasViewer;

            if (v == null)
            {
                return(false);
            }
            ICanvas c = v.Canvas;

            if (c == null)
            {
                return(false);
            }
            IRasterDrawing drawing = c.PrimaryDrawObject as IRasterDrawing;

            if (drawing == null)
            {
                return(false);
            }
            if (string.IsNullOrWhiteSpace(drawing.SpatialRef))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 8
0
        public override void Execute(string argument)
        {
            float          percent = float.Parse(argument);
            IRasterDrawing drawing = GetRasterDrawing();

            if (drawing == null)
            {
                return;
            }
            if (drawing.TileBitmapProvider.TileCountOfLoading > 0)
            {
                return;
            }
            PercentXStretcher st = new PercentXStretcher(_smartSession);

            object[] sts = st.GetStretcher(drawing.DataProvider, drawing.SelectedBandNos, percent);
            int      idx = 0;

            foreach (int bandNo in drawing.SelectedBandNos)
            {
                drawing.DataProvider.GetRasterBand(bandNo).Stretcher = sts[idx++];
            }
            drawing.Reset();
            ICanvasViewer viewer = _smartSession.SmartWindowManager.ActiveCanvasViewer;

            viewer.Canvas.Refresh(enumRefreshType.All);
        }
Exemplo n.º 9
0
        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);
            }
        }
Exemplo n.º 10
0
        private GeoDo.RSS.Core.DrawEngine.CoordEnvelope TryGetInfoFromActiveView()
        {
            ICanvasViewer canViewer = _smartSession.SmartWindowManager.ActiveCanvasViewer;
            IAOIProvider  aoi       = canViewer.AOIProvider;

            return(aoi.GetGeoRect());
        }
Exemplo n.º 11
0
        private string TryCheckArgsEnvironment(out GeoDo.RSS.Core.DrawEngine.CoordEnvelope[] envelopes)
        {
            ICanvasViewer canViewer = _smartSession.SmartWindowManager.ActiveCanvasViewer;

            if (canViewer == null)
            {
                throw new Exception("未获得激活的数据窗口");
            }
            IAOIProvider aoiProvider = canViewer.AOIProvider;

            if (aoiProvider == null)
            {
                throw new Exception("未从激活的数据窗口中获取感兴趣区域");
            }
            Core.DrawEngine.CoordEnvelope geoEnvelope = aoiProvider.GetGeoRect();
            if (geoEnvelope == null)
            {
                throw new Exception("未从激活的数据窗口中获取感兴趣区域");
            }
            envelopes = new Core.DrawEngine.CoordEnvelope[] { geoEnvelope };

            IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing;

            if (rd == null)
            {
                throw new Exception("未从激活的数据窗口中获取数据提供者");
            }
            IRasterDataProvider rdp = rd.DataProvider;

            if (rdp == null)
            {
                throw new Exception("未从激活的数据窗口中获取数据提供者");
            }
            return(rdp.fileName);
        }
Exemplo n.º 12
0
        static void ActiveViewerChanged(object sender, ISmartWindow oldWindow, ISmartWindow newWindow)
        {
            if (newWindow == null || !(newWindow is ICanvasViewer))
            {
                return;
            }
            if (newWindow == oldWindow)
            {
                return;
            }
            ICanvasViewer viewer = newWindow as ICanvasViewer;

            if (viewer.ActiveObject == null)    //{GeoDo.RSS.Core.RasterDrawing.RasterDrawing}
            {
                return;
            }
            IRasterDrawing draw = viewer.ActiveObject as IRasterDrawing;

            if (draw == null)
            {
                return;
            }
            if (draw.RgbProcessorStack != null && draw.RgbProcessorStack.Count > 0)     //已经应用过的不再加载方案
            {
                return;
            }
            ApplyImageEnhancor();
        }
Exemplo n.º 13
0
        public static string GetEnhanceNameCurDrawing(ISmartSession session)
        {
            if (session.SmartWindowManager == null)
            {
                return(null);
            }
            ICanvasViewer viewer = session.SmartWindowManager.ActiveCanvasViewer;

            if (viewer == null)
            {
                return(null);
            }
            IRasterDrawing drawing = viewer.ActiveObject as IRasterDrawing;

            if (drawing == null)
            {
                return(null);
            }
            IRasterDataProvider raster = drawing.DataProviderCopy;

            if (!EnhancePicture(raster))//如果不是通道数大于3的图片 则不进行图像增强
            {
                return(null);
            }
            IMonitoringSession msession    = session.MonitoringSession as IMonitoringSession;
            string             product     = GetProduct(msession);
            string             enhancePath = FindEnhanceFileNameByRasterFileName(raster, product);

            return(enhancePath);
        }
Exemplo n.º 14
0
        public override void Execute()
        {
            ICanvasViewer v = _smartSession.SmartWindowManager.ActiveCanvasViewer as ICanvasViewer;

            if (v == null)
            {
                return;
            }
            IRasterDrawing drawing = v.ActiveObject as IRasterDrawing;

            if (drawing == null || drawing.DataProviderCopy == null)
            {
                return;
            }
            ICanvas      canvas = v.Canvas;
            ProfileLayer layer  = canvas.LayerContainer.GetByName("ProfileLayer") as ProfileLayer;

            if (layer == null)
            {
                layer      = new ProfileLayer();
                layer.Name = "ProfileLayer";
                canvas.LayerContainer.Layers.Add(layer);
            }
            layer.NewProfile();
            canvas.Refresh(enumRefreshType.FlyLayer);
        }
Exemplo n.º 15
0
 private void ViewIsChanged(object sender, ISmartWindow oldV, ISmartWindow newV)
 {
     if (newV == null)
     {
         (this.Controls[0] as UCLayerManagerPanel).Apply(null);
         return;
     }
     if (newV is ICanvasViewer)
     {
         ICanvasViewer v = newV as ICanvasViewer;
         if (v == null)
         {
             return;
         }
         IVectorHostLayer host = v.Canvas.LayerContainer.VectorHost;
         if (host == null)
         {
             return;
         }
         (this.Controls[0] as UCLayerManagerPanel).Apply(v.LayerProvider as ILayersProvider);
     }
     else if (newV is ILayoutViewer)
     {
         ILayoutViewer v = newV as ILayoutViewer;
         if (v == null)
         {
             return;
         }
         (this.Controls[0] as UCLayerManagerPanel).Apply(v.LayerProvider as ILayersProvider);
     }
 }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        /// <param name="argument">间隔数值类型,密度分割文件,选择波段,最小值,间隔值
        ///                        间隔数值类型:1:int 2:float,默认:int</param>
        public override void Execute()
        {
            ICanvasViewer viewer = _smartSession.SmartWindowManager.ActiveCanvasViewer;

            if (viewer == null)
            {
                return;
            }
            _drawing = viewer.ActiveObject as IRasterDrawing;
            IProgressMonitor progress = _smartSession.ProgressMonitorManager.DefaultProgressMonitor;

            using (DensitySliceForm frm = new DensitySliceForm(_drawing))
            {
                frm.UpdateDensSliceEvent += new DensitySliceForm.UpdateDensSlice(frm_UpdateDensSliceEvent);
                frm.Progress              = progress;
                SetFormStatus(frm);
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    _drawing.SelectedBandNos = new int[] { frm.SelectBand };
                    _drawing.ApplyColorMapTable(frm.ColorTable);
                    ICanvasViewer cv = _smartSession.SmartWindowManager.ActiveCanvasViewer;
                    if (cv != null)
                    {
                        cv.Canvas.Refresh(Core.DrawEngine.enumRefreshType.All);
                    }
                }
            }
        }
Exemplo n.º 18
0
 private void SetCurrentCanvasViewer()
 {
     if (_currentCanvasViewer != _session.SmartWindowManager.ActiveCanvasViewer)
     {
         _currentCanvasViewer = _session.SmartWindowManager.ActiveCanvasViewer;
     }
 }
Exemplo n.º 19
0
        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);
            }
        }
Exemplo n.º 20
0
        private string TryGetFileFromActiveView()
        {
            ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer;

            if (viewer == null)
            {
                throw new Exception("未获得激活的数据窗口");
            }
            ICanvasViewer canViewer = viewer as ICanvasViewer;

            if (canViewer == null)
            {
                throw new Exception("未获得激活的数据窗口");
            }
            IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing;

            if (rd == null)
            {
                throw new Exception("未从激活的数据窗口中获取数据提供者");
            }
            IRasterDataProvider rdp = rd.DataProvider;

            if (rdp == null)
            {
                throw new Exception("未从激活的数据窗口中获取数据提供者");
            }
            return(rdp.fileName);
        }
Exemplo n.º 21
0
        public void SaveImageEnhance()
        {
            if (_session == null)
            {
                return;
            }
            if (_session.SmartWindowManager == null)
            {
                return;
            }
            ICanvasViewer viewer = _session.SmartWindowManager.ActiveViewer as ICanvasViewer;

            if (viewer == null)
            {
                return;
            }
            IRasterDrawing drawing = viewer.ActiveObject as IRasterDrawing;

            if (drawing == null)
            {
                return;
            }
            string enhanceFileName;

            SaveImageEnhance(drawing, out enhanceFileName);
            if (!string.IsNullOrWhiteSpace(enhanceFileName))
            {
                SaveSelectedBands(drawing, enhanceFileName);
            }
        }
Exemplo n.º 22
0
        private void ReadSelectedBands(string argument, ICanvasViewer viewer, IRasterDrawing drawing)
        {
            string bandsFile = Path.GetDirectoryName(argument) + "\\" + Path.GetFileNameWithoutExtension(argument) + ".bands";

            if (!File.Exists(bandsFile))
            {
                return;
            }
            string bandString = File.ReadAllText(bandsFile);

            string[] parts = bandString.Split(',');
            if (parts.Length == 1) //灰度
            {
                drawing.SelectedBandNos = new int[] { int.Parse(bandString) };
                viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
                return;
            }
            else if (parts.Length == 3) //RGB
            {
                int[] bands = new int[3];
                for (int i = 0; i < 3; i++)
                {
                    bands[i] = int.Parse(parts[i]);
                }
                drawing.SelectedBandNos = bands;
                viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
            }
        }
Exemplo n.º 23
0
 private bool CurrentRasterIsOK(ICanvasViewer cv)
 {
     if (cv == null)
     {
         return(false);
     }
     return(cv.ActiveObject is IRasterDrawing);
 }
Exemplo n.º 24
0
        private static void ReadImageEnhance(string argument, ICanvasViewer viewer, IRasterDrawing drawing)
        {
            IRgbProcessorStack stack = drawing.RgbProcessorStack;

            stack.Clear();
            stack.ReadXmlElement(argument);
            viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
        }
Exemplo n.º 25
0
 private IRasterDrawing GetRasterDrawing(ICanvasViewer viewer)
 {
     if (viewer == null || viewer.ActiveObject == null)
     {
         return(null);
     }
     return(viewer.ActiveObject as IRasterDrawing);
 }
Exemplo n.º 26
0
        public CurrentRasterInteractiver(ICanvasViewer canvasViewer)
        {
            _canvasViewer = canvasViewer;
            _labelService = new LabelService(_canvasViewer);
            Control control = _canvasViewer.Canvas.Container;

            control.MouseUp += new MouseEventHandler(control_MouseUp);
        }
Exemplo n.º 27
0
        private ResultObject GetResultObject(ICanvasViewer viewer, IMonitoringProduct product, IMonitoringSubProduct subProduct)
        {
            IRasterDataProvider prd          = GetRasterDataProvider(viewer);
            IPixelIndexMapper   binaryValues = GetBinaryValuesMapper(prd, product, subProduct);
            IBinaryBitampLayer  binaryLayer  = GetBinaryLayer(viewer, prd, product, subProduct);

            return(new ResultObject(binaryValues, binaryLayer));
        }
Exemplo n.º 28
0
 public void Dispose()
 {
     if (_layers != null)
     {
         Reset();
         //_layers = null;
     }
     _canvasViewer = null;
 }
Exemplo n.º 29
0
        public override void Execute()
        {
            ICanvasViewer v = _smartSession.SmartWindowManager.ActiveCanvasViewer as ICanvasViewer;

            if (v != null)
            {
                v.Canvas.CurrentViewControl = new ZoomControlLayerWithBoxGDIPlus(GeoDo.RSS.Core.DrawEngine.ZoomControlLayerWithBox.enumZoomType.ZoomOut);
            }
        }
Exemplo n.º 30
0
        void _radDock_DockWindowClosed(object sender, DockWindowEventArgs e)
        {
            //触发注册在视窗上的关闭事件
            ISmartWindow smartWindow = e.DockWindow as ISmartWindow;

            if (smartWindow != null)
            {
                if (smartWindow.OnWindowClosed != null)
                {
                    smartWindow.OnWindowClosed(smartWindow, e);
                }
            }
            //
            if (e.DockWindow.Equals(_activeViewer))
            {
                _activeViewer = null;
            }
            //
            if (e.DockWindow.Equals(_newestCreatedCanvasViewer))
            {
                _newestCreatedCanvasViewer = null;
            }
            //
            _linkableViewerManager.Unlink(e.DockWindow as ILinkableViewer);
            e.DockWindow.Dispose();

            /*
             * 以下1行释放Telerik不能释放的资源
             */
            if (e.DockWindow is Telerik.WinControls.IGeoDoFree)
            {
                (e.DockWindow as Telerik.WinControls.IGeoDoFree).Free();
            }
            if (e.DockWindow is ISmartWindow)
            {
                (e.DockWindow as ISmartWindow).Free();
            }

            /*
             * 以下三行释放视图资源(CanvasViewer,LayoutViewer)
             */
            ISmartViewer smartViewer = e.DockWindow as ISmartViewer;

            if (smartViewer != null)
            {
                smartViewer.DisposeViewer();
                //
                SetActiveViewer(null, smartViewer is ICanvasViewer);
            }

            /*
             * 以下一句解决LayoutEventArgs引用DocumentTabStrip对象导致对象不释放的问题
             */
            _radDock.MainDocumentContainer.PerformLayout();
            //
            GC.Collect();
        }