Esempio n. 1
0
        public void InitOverlay(
            IDictionary <XBlock, BoolSimulation> simulations,
            IBoolSimulationRenderer cacheRenderer)
        {
            SelectionReset();

            OverlayLayer.EnableSimulationCache = true;
            OverlayLayer.CacheRenderer         = null;

            foreach (var simulation in simulations)
            {
                BlockLayer.Hidden.Add(simulation.Key);
                OverlayLayer.Shapes.Add(simulation.Key);
            }

            EditorLayer.Simulations  = simulations;
            OverlayLayer.Simulations = simulations;

            OverlayLayer.CacheRenderer    = cacheRenderer;
            cacheRenderer.Renderer        = OverlayLayer.Renderer;
            cacheRenderer.NullStateStyle  = OverlayLayer.NullStateStyle;
            cacheRenderer.TrueStateStyle  = OverlayLayer.TrueStateStyle;
            cacheRenderer.FalseStateStyle = OverlayLayer.FalseStateStyle;
            cacheRenderer.Shapes          = OverlayLayer.Shapes;
            cacheRenderer.Simulations     = OverlayLayer.Simulations;

            BlockLayer.InvalidateVisual();
            OverlayLayer.InvalidateVisual();
        }
Esempio n. 2
0
 public SnapUiRoot()
 {
     OverlayLayer = new OverlayLayer();
     ((ISetLogicalParent)OverlayLayer).SetParent((ILogical)this);
     OverlayLayer.ZIndex = int.MaxValue;
     VisualChildren.Add(OverlayLayer);
 }
Esempio n. 3
0
        void ReleaseDesignerOutlets()
        {
            if (Toolbar != null)
            {
                Toolbar.Dispose();
                Toolbar = null;
            }

            if (OverlayLayer != null)
            {
                OverlayLayer.Dispose();
                OverlayLayer = null;
            }

            if (SplitView != null)
            {
                SplitView.Dispose();
                SplitView = null;
            }

            if (RomListSplitView != null)
            {
                RomListSplitView.Dispose();
                RomListSplitView = null;
            }

            if (MenuLayoutSplitView != null)
            {
                MenuLayoutSplitView.Dispose();
                MenuLayoutSplitView = null;
            }
        }
Esempio n. 4
0
        public void InvalidateLayers()
        {
            if (ShapeLayer.InvalidateVisual != null)
            {
                ShapeLayer.InvalidateVisual();
            }

            if (BlockLayer.InvalidateVisual != null)
            {
                BlockLayer.InvalidateVisual();
            }

            if (PinLayer.InvalidateVisual != null)
            {
                PinLayer.InvalidateVisual();
            }

            if (WireLayer.InvalidateVisual != null)
            {
                WireLayer.InvalidateVisual();
            }

            if (OverlayLayer.InvalidateVisual != null)
            {
                OverlayLayer.InvalidateVisual();
            }
        }
Esempio n. 5
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            OverlayLayer.GetOverlayLayer(this).Children.Add(FollowerControl);
            AdornerLayer.GetAdornerLayer(this).PointerMoved += LayerControlOnPointerMoved;
        }
Esempio n. 6
0
        protected override Color ProcessPixel(Layer layer, Point p)
        {
            Color background = layer.GetPixel(p);
            Color overlay;

            switch (Source)
            {
            case OverlaySource.Color:
            {
                overlay = OverlayColor;
                break;
            }

            case OverlaySource.Layer:
            {
                Rectangle targetRect = new Rectangle(0, 0, OverlayLayer.Width, OverlayLayer.Height);
                Point     targetPt   = new Point(p.X - Offset.X, p.Y - Offset.Y);

                if (!targetRect.Contains(targetPt) || OverlayLayer.IsTransparent(targetPt))
                {
                    return(background);
                }

                overlay = OverlayLayer.GetPixel(targetPt);
                break;
            }

            default:
            {
                overlay = new Color();
                break;
            }
            }

            switch (Mode)
            {
            default:
                return(background);

            case BlendMode.Replace:
                return(new Color(overlay, background.A));

            case BlendMode.AlphaBlend:
                return(background & overlay);

            case BlendMode.Add:
                return(background + overlay);

            case BlendMode.Subtract:
                return(background - overlay);

            case BlendMode.Multiply:
                return(background * overlay);
            }
        }
Esempio n. 7
0
        public void ResetOverlay()
        {
            EditorLayer.Simulations    = null;
            OverlayLayer.Simulations   = null;
            OverlayLayer.CacheRenderer = null;

            BlockLayer.Hidden.Clear();
            OverlayLayer.Shapes.Clear();
            BlockLayer.InvalidateVisual();
            OverlayLayer.InvalidateVisual();
        }
        private void FinishInitialization(NSObject data)
        {
            var window = data as NSWindow;

            ProgressIndicatorController = new INTV.Shared.View.ProgressIndicatorController();
            var progressIndicatorView = ProgressIndicatorController.View;

            ProgressIndicatorController.InitializeDataContext(window, OverlayLayer.Bounds);
            OverlayLayer.AddSubview(progressIndicatorView);
            window.LayoutIfNeeded(); // Ensure that we get a refresh of layout after tinkering with the visual tree.
        }
Esempio n. 9
0
 internal static void CloseDialogOn(Control window, Control dialog)
 {
     Dispatcher.UIThread.Post(() =>
     {
         var layer = OverlayLayer.GetOverlayLayer(window);
         if (layer.Children.Contains(dialog))
         {
             layer.Children.Remove(dialog);
         }
     });
 }
Esempio n. 10
0
        protected override void LoadComplete()
        {
            base.LoadComplete();
            proxiedOverlayLayer = OverlayLayer.CreateProxy();

            if (drawableHitObject != null)
            {
                drawableHitObject.HitObjectApplied += onHitObjectApplied;
                onHitObjectApplied(drawableHitObject);
            }
        }
Esempio n. 11
0
 internal static void CloseDialogOn(WindowBase window, Control dialog)
 {
     Dispatcher.UIThread.Post(() =>
     {
         var layer = OverlayLayer.GetOverlayLayer(window);
         if (layer.Children.Contains(dialog))
         {
             layer.Children.Remove(dialog);
         }
         Debug.WriteLine("dialog closed");
     });
 }
Esempio n. 12
0
 public Artboard(IViewObjectFactory viewObjectFactory, ViewExceptionCallback viewExceptionCallback)
 {
     this.ViewObjectFactory              = viewObjectFactory;
     this.contentBorder                  = new ArtboardBorder(viewExceptionCallback);
     this.contentBorder.BorderBrush      = (Brush)Brushes.Black;
     this.contentBorder.MinWidth         = 20.0;
     this.contentBorder.MinHeight        = 20.0;
     this.contentBorder.IsHitTestVisible = false;
     TextOptions.SetTextFormattingMode((DependencyObject)this.contentBorder, TextFormattingMode.Ideal);
     this.snapToGridRenderer = new SnapToGridRenderer(this);
     this.snapToGridRenderer.IsHitTestVisible = false;
     this.overlayLayer = new OverlayLayer();
     this.overlayLayer.IsHitTestVisible = false;
     this.adornerLayer = new AdornerLayer();
     this.adornerLayer.IsHitTestVisible  = false;
     this.adornerLayer.IsVisibleChanged += (DependencyPropertyChangedEventHandler)((s, e) => this.UpdateExtensibleAdornersVisibility());
     this.feedbackLayer = new FeedbackLayer();
     this.feedbackLayer.IsHitTestVisible = false;
     this.annotationLayer = new AnnotationLayer();
     this.annotationLayer.IsHitTestVisible = true;
     this.extraLayersCanvas = new Canvas();
     this.extraLayersCanvas.IsHitTestVisible = false;
     this.liveControlLayer = new Canvas();
     this.liveControlLayer.Resources.Add((object)typeof(TextBox), (object)new Style(typeof(TextBox), new TextBox().Style));
     this.liveControlLayer.Resources.Add((object)typeof(RichTextBox), (object)new Style(typeof(RichTextBox), new RichTextBox().Style));
     this.resourcesHost = new Canvas();
     this.resourcesHost.IsHitTestVisible = false;
     this.resourcesHost.Children.Add((UIElement)this.contentBorder);
     this.resourcesHost.Children.Add((UIElement)this.overlayLayer);
     this.designerView       = (DesignerView) new Artboard.BlendDesignerView();
     this.designerView.Child = (UIElement)this.resourcesHost;
     this.canvas             = new Canvas();
     this.canvas.Children.Add((UIElement)this.designerView);
     this.canvas.Children.Add((UIElement)this.liveControlLayer);
     this.canvas.Children.Add((UIElement)this.extraLayersCanvas);
     this.canvas.Children.Add((UIElement)this.snapToGridRenderer);
     this.canvas.Children.Add((UIElement)this.adornerLayer);
     this.canvas.Children.Add((UIElement)this.feedbackLayer);
     this.canvas.Children.Add((UIElement)this.annotationLayer);
     this.childrenVisuals = new VisualCollection((Visual)this);
     this.childrenVisuals.Add((Visual)this.canvas);
     this.adornerService = new AdornerService(this);
     this.SetValue(TabControl.TabStripPlacementProperty, (object)Dock.Top);
     this.InheritanceBehavior     = InheritanceBehavior.SkipToThemeNow;
     this.AllowDrop               = true;
     this.contentBorder.AllowDrop = false;
     AccessKeyManager.AddAccessKeyPressedHandler((DependencyObject)this.contentBorder, new AccessKeyPressedEventHandler(this.Content_AccessKeyPressed));
     AccessKeyManager.AddAccessKeyPressedHandler((DependencyObject)this.overlayLayer, new AccessKeyPressedEventHandler(this.Content_AccessKeyPressed));
     this.contentBorder.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Content_PreviewGotKeyboardFocus);
     this.overlayLayer.PreviewGotKeyboardFocus  += new KeyboardFocusChangedEventHandler(this.Content_PreviewGotKeyboardFocus);
     this.SetTextDefaults();
 }
Esempio n. 13
0
        static void UnsafeShow(string title, string content, TopLevel topLevel, bool activateIfOnDesktop = true)
        {
            if (activateIfOnDesktop && (topLevel is Window win))
            {
                win.Activate();
            }

            OverlayLayer.GetOverlayLayer(topLevel).Children.Add(ContentDialogFrame.GetFrame(new BasicMessageDialog()
            {
                Title   = title,
                Message = content
            }, topLevel));
        }
Esempio n. 14
0
 internal static void ShowDialogOn(Control window, Control dialog)
 {
     Dispatcher.UIThread.Post(() =>
     {
         var layer               = OverlayLayer.GetOverlayLayer(window);
         dialog.Width            = layer.Bounds.Width;
         dialog.Height           = layer.Bounds.Height;
         window.PropertyChanged += (s, e) =>
         {
             dialog.Width  = layer.Bounds.Width;
             dialog.Height = layer.Bounds.Height;
         };
         layer.Children.Add(dialog);
     });
 }
Esempio n. 15
0
    private void Start()
    {
        map = GetComponent <OnlineMaps>();

        if (map.control.resultIsTexture && overlayLayer != OverlayLayer.traffic)
        {
            Debug.LogWarning("This Control only supports Overlay Layer - Traffic.");
            overlayLayer = OverlayLayer.traffic;
        }

        OnlineMapsTileManager.OnTileLoaded += StartDownloadOverlay;

        map.control.OnMapClick += OnMapClick;
        Pano.OnPanoDestroy     += OnPanoDestroy;
    }
Esempio n. 16
0
        /// <summary>
        /// 根据名称获取一个绘制图层
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public OverlayLayer GetGraphicLayer(string target)
        {
            OverlayLayer gra = null;

            switch (target)
            {
            case "Highlight":
                gra = _highLightLayer;
                break;

            case "Drawing":
                gra = _drawingLayer;
                break;
            }
            return(gra);
        }
Esempio n. 17
0
 internal static void ShowDialogOn(WindowBase window, Control dialog)
 {
     Dispatcher.UIThread.Post(() =>
     {
         dialog.Width            = window.Bounds.Width;
         dialog.Height           = window.Bounds.Height;
         window.PropertyChanged += (s, e) =>
         {
             dialog.Width  = window.Bounds.Width;
             dialog.Height = window.Bounds.Height;
         };
         var layer = OverlayLayer.GetOverlayLayer(window);
         layer.Children.Add(dialog);
         Debug.WriteLine("dialog added");
     });
 }
Esempio n. 18
0
        private void LayerControlOnPointerMoved(object sender, PointerEventArgs e)
        {
            var cv = OverlayLayer.GetOverlayLayer(this.GetParentTOfVisual <Window>());

            double delta_v, delta_h;

            //double delta_vlow, delta_hlow;

            delta_v = e.GetCurrentPoint(FollowerControl).Position.Y; //Math.Min(e.GetCurrentPoint(FollowerControl).Position.Y, FollowerControl.Bounds.Height - FollowerControl.MinHeight);
            var t   = Canvas.GetTop(FollowerControl) + delta_v;
            var t_  = t - (FollowerControl.Bounds.Height / 2);
            var t_s = cv.Bounds.Height - t_ - FollowerControl.Bounds.Height;//


            if (t_s >= 0)
            {
                Canvas.SetBottom(FollowerControl, t_s);
                if (t_ >= 0)                            //Canvas.GetTop(FollowerControl) >= 0 || Canvas.GetBottom(FollowerControl) >= 0
                {
                    Canvas.SetTop(FollowerControl, t_); //
                }
            }

            delta_h = e.GetCurrentPoint(FollowerControl).Position.X; //Math.Min(e.GetCurrentPoint(FollowerControl).Position.X, FollowerControl.Bounds.Width + FollowerControl.MinWidth);

            var l = Canvas.GetLeft(FollowerControl) + delta_h;

            var l_ = l - (FollowerControl.Bounds.Width / 2);


            var l_s = cv.Bounds.Width - l_ - FollowerControl.Bounds.Width;//


            if (l_s >= 0)
            {
                Canvas.SetRight(FollowerControl, l_s);
                if (l_ >= 0) //Canvas.GetLeft(FollowerControl) >= 0 || Canvas.GetRight(FollowerControl) >= 0
                {
                    Canvas.SetLeft(FollowerControl, l_);
                }
            }

#if DEBUG
            //   Debug.WriteLine($"moved to Top:{t_} Bottom:{t_s} Left:{l_} Right:{l_s}");
#endif
        }
    private void Start()
    {
        map = OnlineMaps.instance;

        if (map.control.resultIsTexture && overlayLayer != OverlayLayer.traffic)
        {
            Debug.LogWarning("This Control only supports Overlay Layer - Traffic.");
            overlayLayer = OverlayLayer.traffic;
        }

        if (OnlineMapsCache.instance != null)
        {
            OnlineMapsCache.instance.OnLoadedFromCache += StartDownloadOverlay;
        }

        OnlineMapsTileManager.OnStartDownloadTile += OnStartDownloadTile;

        map.control.OnMapClick += OnMapClick;
    }
        public static ContentDialogFrame GetFrame(object content, TopLevel topLevel)
        {
            if (ContentDialog.IsShowingDialog)
            {
                throw new Exception("Cannot show more than one content dialog simultaneously!");
            }
            else
            {
                LastFocusedElement = FocusManager.Instance.Current;

                var layer = OverlayLayer.GetOverlayLayer(topLevel);
                return(new ContentDialogFrame()
                {
                    Content = content,
                    [!Button.WidthProperty] = layer.GetObservable(OverlayLayer.BoundsProperty).Select(x => x.Width).ToBinding(),
                    [!Button.HeightProperty] = layer.GetObservable(OverlayLayer.BoundsProperty).Select(x => x.Height).ToBinding()
                });
            }
        }
Esempio n. 21
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var Validation = (IValidationFunctions)validationContext.GetService(typeof(IValidationFunctions));

            if (!Validation.IsValidGeoJson(InputLayer.ToString()))
            {
                yield return(new ValidationResult("Invalid geojson in InputLayer", new[] { "InputLayer" }));
            }
            if (!Validation.IsValidGeoJson(OverlayLayer.ToString()))
            {
                yield return(new ValidationResult("Invalid geojson in OverlayLayer", new[] { "OverlayLayer" }));
            }
            if (!Validation.isPredicateValid(predicate, 0, 7))
            {
                yield return(new ValidationResult("Single value in predicate array must be between 0 and 7", new[] { "Predicate" }));
            }
            if (Distance != null && !Validation.isDistanceValid(Distance.ToString()))
            {
                yield return(new ValidationResult("Distance field must be int or float", new[] { "Distance" }));
            }
        }
Esempio n. 22
0
        public void InitMap()
        {
            if (_behaviors != null)
            {
                _behaviors.Clear();
            }
            MapObj.Layers.Clear();
            MapView.LayerLoaded -= MapView_LayerLoaded;
            MapView.LayerLoaded += MapView_LayerLoaded;

            LogUtil.Info(typeof(Map), "初始化地图...");

            MapView.MaxScale = ConfigUtil.MaxScale;
            MapView.MinScale = ConfigUtil.MinScale;

            var lo = ConfigUtil.TiledLayer;

            if (lo != null)
            {
                var tiledLayer = new ArcGISTiledMapServiceLayer(lo.Uri)
                {
                    ID          = lo.Id,
                    DisplayName = lo.Name
                };
                if (lo.Token != null)
                {
                    tiledLayer.Token = lo.Token.Replace("\r\n", "");
                    //tiledLayer.Token = "XDjutneIavm-1NSbIhZFhq3mCcseAViwRgf48LVcEbk.";
                }
                MapObj.Layers.Add(tiledLayer);
            }

            lo = ConfigUtil.ImageLayer;
            if (lo != null)
            {
                var imageLayer = new ArcGISImageServiceLayer(lo.Uri)
                {
                    ID          = lo.Id,
                    DisplayName = lo.Name
                };
                MapObj.Layers.Add(imageLayer);
            }

            var los = ConfigUtil.DynamicLayer;

            if (los != null)
            {
                foreach (var l in los)
                {
                    var dynamicLayer = new ArcGISDynamicMapServiceLayer(l.Uri)
                    {
                        ID = l.Id
                    };
                    if (l.Token != null)
                    {
                        dynamicLayer.Token = l.Token.Replace("\r\n", "");;
                    }

                    dynamicLayer.DisplayName = l.Name;
                    MapObj.Layers.Add(dynamicLayer);
                }
            }

            _drawingLayer = new OverlayLayer(MapCtrl)
            {
                DisplayName     = "用户绘图",
                SceneProperties = { SurfacePlacement = SurfacePlacement.Absolute }
            };
            MapObj.Layers.Add(_drawingLayer);

            _highLightLayer = new OverlayLayer(MapCtrl)
            {
                DisplayName     = "查询高亮",
                SceneProperties = { SurfacePlacement = SurfacePlacement.Absolute }
            };
            MapObj.Layers.Add(_highLightLayer);


            MapView.SetViewAsync(ConfigUtil.InitCenter, ConfigUtil.InitScale, new TimeSpan(10000));

            LogUtil.Info(typeof(Map), "地图初始化完成");
        }
 public DialogOverlayPopupHost(OverlayLayer overlayLayer)
 {
     _overlayLayer    = overlayLayer;
     _popupPositioner = new DialogPopupPositioner(this);
 }