Beispiel #1
0
        internal void Compose()
        {
            GraphController  controller = graphController as GraphController;
            IGraphVisualHost visualHost = controller.GetVisualHost();

            if (null == visualHost)
            {
                return; // Running in headless mode, draw no further.
            }
            VisualNode node = graphController.GetVisualNode(nodeId);

            DrawingVisual  bubbleVisual   = visualHost.GetDrawingVisualForBubble(this.bubbleId);
            DrawingContext drawingContext = bubbleVisual.RenderOpen();

            if (content == null)
            {
                drawingContext.Close();
                return;
            }
            anchorPoint.X = node.GetBubbleXPosition();
            anchorPoint.Y = node.Height + Configurations.InfoBubbleTopMargin;
            anchorPoint   = new Point((int)anchorPoint.X, (int)anchorPoint.Y);
            arrowLeft     = new Point((int)(anchorPoint.X - Configurations.InfoBubbleArrowWidthHalf), (int)(anchorPoint.Y + Configurations.InfoBubbleArrowHeight));
            arrowRight    = new Point((int)(anchorPoint.X + Configurations.InfoBubbleArrowWidthHalf), (int)(anchorPoint.Y + Configurations.InfoBubbleArrowHeight));

            if (this.previewType.HasFlag(PreviewTypes.Collapsed))
            {
                arrowLeft.Y   = anchorPoint.Y;
                anchorPoint.Y = arrowRight.Y;
                arrowRight.Y  = arrowLeft.Y;
            }
            else
            {
                arrowLeft.Offset(-1, 2);
                arrowRight.Offset(1, 2);
            }

            if (this.previewType.HasFlag(PreviewTypes.String) ||
                this.previewType.HasFlag(PreviewTypes.Unknown))
            {
                this.ComposeValue(drawingContext);
            }
            else if (this.previewType.HasFlag(PreviewTypes.Bitmap))
            {
                this.ComposeGeo(drawingContext);
            }
            drawingContext.Close();

            TranslateTransform transform = bubbleVisual.Transform as TranslateTransform;

            transform.X = node.X;
            transform.Y = node.Y;
        }