예제 #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);
        }
예제 #2
0
        private void LoadSystemLayers()
        {
            //浮动工具栏
            IFloatToolBarLayer toolbar = new FloatToolBarLayer();

            toolbar.ToolItemClicked = new Action <FloatToolItem>(FloatToolItemClick);
            toolbar.IsAutoHide      = false;
            FloatToolItem[] items = GetFloatToolItems();
            toolbar.ToolItems.AddRange(items);
            _canvas.LayerContainer.Layers.Add(toolbar as GeoDo.RSS.Core.DrawEngine.ILayer);
            _floatToolBar = toolbar as FloatToolBarLayer;
            //AOI容器
            _aoiContainer              = new AOIContainerLayer();
            _aoiContainer.Color        = Color.Red;
            _aoiContainer.LineWidth    = 1;
            _aoiContainer.IsOnlyOneAOI = !_ismultiAoi;
            _canvas.LayerContainer.Layers.Add(_aoiContainer as GeoDo.RSS.Core.DrawEngine.ILayer);
            //SelectedAOI容器
            _selectedAOILayer           = new SelectedAOILayer();
            _selectedAOILayer.Color     = Color.Yellow;
            _selectedAOILayer.LineWidth = 1;
            _canvas.LayerContainer.Layers.Add(_selectedAOILayer as GeoDo.RSS.Core.DrawEngine.ILayer);
            //蒙板
            ILayer lyr = new MaskLayer();

            _canvas.LayerContainer.Layers.Add(lyr);
        }
예제 #3
0
        public void PopShadeStack()
        {
            if (masks.Count > 0)
            {
                MaskLayer last = masks [masks.Count - 1];

                masks.Remove(last);
                Destroy(last.gameObject);
            }
        }
예제 #4
0
        public DemoState()
            : base()
        {
            ResourceManager.Load <SpriteSheet>("Buildings1.png");
            ResourceManager.Load <SpriteSheet>("Buildings2.png");
            ResourceManager.Load <SpriteSheet>("Stars.png");
            var font = ResourceManager.Load <Font>("hammersmithone.ttf");

            var starsl = Screen.CreateLayer("stars", 0, false);
            var back1l = Screen.CreateLayer("back1", 1, false);
            var back2l = Screen.CreateLayer("back2", 2, false);
            var osdl   = Screen.CreateLayer("osd", 3, false);

            var stars = new Sprite(new string[] { "Stars" });
            var back1 = new Sprite(new string[] { "Buildings2" });
            var back2 = new Sprite(new string[] { "Buildings1" });

            stars.X = -stars.W / 2;
            stars.Y = -stars.H + (int)Core.ScrH / 2;
            back1.Y = stars.H - back1.H + stars.Y;
            back2.Y = stars.H - back2.H + stars.Y;
            back1.X = -back1.W / 2;
            back2.X = -back2.W / 2;

            starsl.ScrollSpeed = 0.5f;
            back1l.ScrollSpeed = 0.8f;
            back2l.ScrollSpeed = 1f;
            osdl.ScrollSpeed   = 0f;

            starsl.Insert(stars);
            back1l.Insert(back1);
            back2l.Insert(back2);

            var text = new Text(font);

            text.Size  = 14;
            text.X     = -(int)Core.ScrW / 2 + 32;
            text.Y     = -(int)Core.ScrH / 2 + 32;
            text.Value = "Z: toggle front layer visibility";
            text.Color = SFML.Graphics.Color.White;

            osdl.Insert(text);

            // Masking test

            var maskl = new MaskLayer("mask", back2l, 5);

            Screen.InsertLayer(maskl);

            maskl.X           = back2l.X;
            maskl.Y           = back2l.Y;
            maskl.ScrollSpeed = back2l.ScrollSpeed;
            maskl.Bypass      = false;
            maskl.Alpha       = 0;
        }
예제 #5
0
        private static void IsOpenChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool           isOpen       = (bool)e.NewValue;
            ContentControl owner        = MaskLayerBehavior.GetOwner(d) as ContentControl;
            MaskLayer      layerContent = d as MaskLayer;

            if (owner != null)
            {
                if ((bool)e.NewValue)
                {
                    //蒙板
                    Grid layer = new Grid()
                    {
                        Background = new SolidColorBrush(Color.FromArgb(160, 0, 0, 0))
                    };

                    layer.PreviewMouseLeftButtonUp += delegate
                    {
                        MaskLayerBehavior.SetIsOpen(d, false);
                    };

                    //父级窗体原来的内容
                    UIElement original = owner.Content as UIElement;
                    owner.Content = null;

                    //容器Grid
                    Grid container = new Grid();
                    container.Children.Add(original); //放入原来的内容
                    container.Children.Add(layer);    //在上面放一层蒙板,将装有原来内容和蒙板的容器赋给父级窗体
                    owner.Content = container;

                    layerContent.AllowsTransparency = true;
                    layerContent.StaysOpen          = true;
                    layerContent.SetValue(PopopHelper.PopupPlacementTargetProperty, owner);
                    layerContent.PlacementTarget = owner;
                    layerContent.Placement       = PlacementMode.Center;
                    layerContent.IsOpen          = true;
                }
                else
                {
                    //容器Grid
                    Grid grid = owner.Content as Grid;
                    //父级窗体原来的内容
                    UIElement original = VisualTreeHelper.GetChild(grid, 0) as UIElement;
                    //将父级窗体原来的内容在容器Grid中移除
                    grid.Children.Remove(original);
                    //赋给父级窗体
                    owner.Content = original;
                }
            }
        }
예제 #6
0
        public void PushShade(Color c)
        {
            GameObject M  = Instantiate(MapManager.instance.tileMask);
            MaskLayer  ml = M.GetComponent <MaskLayer> ();

            ml.Color(c);
            if (masks.Count > 0)
            {
                ml.SetParent(masks [masks.Count - 1]);
            }
            else
            {
                ml.transform.SetParent(transform, false);
                ml.transform.localPosition = Vector3.zero;
                ml.transform.localScale    = ml.transform.localScale * ml.scaleFactor;
            }

            masks.Add(ml);
        }
예제 #7
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);
        }
예제 #8
0
        /// <summary>
        /// 获取此团队的所有荣耀
        /// </summary>
        /// <returns></returns>
        public ActionResult GetHonorInfo()
        {
            HttpCookie loginUserCookie = Request.Cookies["loginUserInfo"];

            if (loginUserCookie != null)
            {
                try
                {
                    int teamId     = Common.GetID.GetTeamID(loginUserCookie, TeamapplicantService);
                    var honorInfos = HonorService.LoadEntities(h => h.iTeamID == teamId && h.IsDel == false && h.bReviewOfWorks == true).ToList();
                    List <HonorInfo> honorInfoList = new List <HonorInfo>();
                    foreach (var honor in honorInfos)
                    {
                        HonorInfo honorInfo = new HonorInfo();
                        honorInfo.honorId     = honor.ID;
                        honorInfo.honorName   = honor.vcHonorName;
                        honorInfo.guidTeacher = honor.vcGuideTeacher;
                        honorInfo.submitTime  = (DateTime)honor.dSubmitTime;
                        honorInfoList.Add(honorInfo);
                    }
                    MaskLayer maskLayer = new MaskLayer();
                    maskLayer.HonorList = honorInfoList;
                    var timerConverter = new IsoDateTimeConverter {
                        DateTimeFormat = "yyyy-MM-dd"
                    };
                    string jsonTxt = JsonConvert.SerializeObject(maskLayer, Newtonsoft.Json.Formatting.Indented);
                    return(Content(jsonTxt));
                }
                catch (Exception ex)
                {
                    return(Content("Not logged in"));
                }
            }
            else
            {
                return(Content("Not logged in"));
            }
        }
예제 #9
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);
        }
예제 #10
0
 public void SetParent(MaskLayer m)
 {
     SpriteRenderer.transform.SetParent(m.transform, false);
     SpriteRenderer.transform.localScale    = scaleFactor * m.SpriteRenderer.transform.localScale;
     SpriteRenderer.transform.localPosition = Vector3.zero;
 }