Exemple #1
0
        private static void TryLoadAOIMaskLayer(ICanvas canvas, IRasterDrawing drawing, string fname)
        {
            string aoiFileName = Path.Combine(Path.GetDirectoryName(fname), Path.GetFileNameWithoutExtension(fname) + ".aoi");

            if (!File.Exists(aoiFileName))
            {
                return;
            }
            int[] aoi;
            using (FileStream fs = new FileStream(aoiFileName, FileMode.Open))
            {
                int count = (int)(fs.Length / Marshal.SizeOf(typeof(int)));
                aoi = new int[count];
                using (BinaryReader br = new BinaryReader(fs))
                {
                    for (int i = 0; i < count; i++)
                    {
                        aoi[i] = br.ReadInt32();
                    }
                }
            }
            ILayer lyr = canvas.LayerContainer.GetByName("蒙板层");

            if (lyr == null)
            {
                lyr = new MaskLayer();
                canvas.LayerContainer.Layers.Add(lyr);
            }
            IMaskLayer maskLayer = lyr as IMaskLayer;

            maskLayer.Update(Color.White, drawing.Size, drawing.OriginalEnvelope.Clone(), false, aoi);
        }
Exemple #2
0
        private void TryUpdateMaskLayer(ICanvasViewer cv, int[] aoi)
        {
            ILayer lyr = cv.Canvas.LayerContainer.GetByName("蒙板层");

            if (lyr == null)
            {
                lyr = new MaskLayer();
                cv.Canvas.LayerContainer.Layers.Add(lyr);
            }
            IMaskLayer     maskLayer = lyr as IMaskLayer;
            IRasterDrawing drawing   = cv.ActiveObject as IRasterDrawing;

            if (drawing == null)
            {
                return;
            }
            CoordEnvelope coordEnvelope = drawing.OriginalEnvelope.Clone();
            Size          rasterSize    = drawing.Size;

            maskLayer.Update(Color.Black, rasterSize, coordEnvelope, false, aoi);
            cv.Canvas.Refresh(enumRefreshType.All);
        }
Exemple #3
0
        private void TryApplyCustom(ICanvas canvas, Size size, string subIdentify,
                                    GeoDo.RSS.Core.DrawEngine.CoordEnvelope viewPrjEvp,
                                    GeoDo.RSS.Core.DF.CoordEnvelope viewGeoEvp, float resolution)
        {
            if (canvas == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(subIdentify))
            {
                return;
            }
            if (subIdentify != "CMED")
            {
                return;
            }
            string name = null;

            int[] aoi = null;
            GetAOIArgument(size, viewGeoEvp, resolution, out name, out aoi);
            if (name == null || aoi == null || aoi.Length == 0)
            {
                return;
            }
            _extInfos = "_";
            _extInfos = _extInfos + name;
            ILayer lry = canvas.LayerContainer.GetByName("蒙板层");

            if (lry == null)
            {
                lry = new MaskLayer();
                canvas.LayerContainer.Layers.Add(lry);
            }
            IMaskLayer mask = lry as IMaskLayer;

            mask.Update(Color.White, size, viewPrjEvp, false, aoi);
        }