Exemplo n.º 1
0
        internal void PositionAtCenter(uint nodeId)
        {
            IGraphVisualHost visualHost = this.graphController.GetVisualHost();

            if (visualHost != null)
            {
                DrawingVisual      visual    = visualHost.GetDrawingVisualForNode(nodeId);
                TranslateTransform transform = visual.Transform as TranslateTransform;
                transform.X         = (int)(this.nodePosition.X - this.Width / 2);
                transform.Y         = (int)(this.nodePosition.Y - this.Height / 2);
                this.nodePosition.X = transform.X;
                this.nodePosition.Y = transform.Y;

                if (this.errorBubble != null)
                {
                    DrawingVisual      errorVisual    = visualHost.GetDrawingVisualForBubble(this.errorBubble.BubbleId);
                    TranslateTransform errorTransform = errorVisual.Transform as TranslateTransform;
                    errorTransform.X = (int)(this.nodePosition.X);
                    errorTransform.Y = (int)(this.nodePosition.Y);
                }

                if (this.previewBubble != null)
                {
                    DrawingVisual      previewVisual    = visualHost.GetDrawingVisualForBubble(this.previewBubble.BubbleId);
                    TranslateTransform previewTransform = previewVisual.Transform as TranslateTransform;
                    previewTransform.X = (int)(this.nodePosition.X);
                    previewTransform.Y = (int)(this.nodePosition.Y);
                }
            }
        }
Exemplo n.º 2
0
        internal void Compose()
        {
            if (false == this.Dirty)
            {
                return;
            }

            if (IsRunningHeadless)
            {
                return;
            }

            GraphController  controller = graphController as GraphController;
            IGraphVisualHost visualHost = controller.GetVisualHost();

            DrawingVisual visual = visualHost.GetDrawingVisualForNode(this.NodeId);
            //TextOptions.SetTextFormattingMode(visual, TextFormattingMode.Display);
            //TextOptions.SetTextRenderingMode(visual, TextRenderingMode.Aliased);
            DrawingContext drawingContext = visual.RenderOpen();
            CultureInfo    cultureInfo    = new CultureInfo("en-us"); //@TODO(Ben) Move this into a single place and reuse it

            //RenderOptions.SetEdgeMode(visual, EdgeMode.Aliased);
            if (!dotsFlag.HasFlag(MenuDots.DotsFlag))
            {
                this.CheckDots();
            }

            this.ComposeCore(drawingContext, visual);
            drawingContext.Close();

            if (errorBubble != null)
            {
                errorBubble.Compose();
            }

            TranslateTransform nodeTransform = visual.Transform as TranslateTransform;

            nodeTransform.X = this.nodePosition.X;
            nodeTransform.Y = this.nodePosition.Y;

            this.Dirty = false;
        }