public NodeLayout ReadNodeLayout( string nodeId )
        {
            var layout = new NodeLayout( nodeId );

            layout.Center = ReadPoint();
            layout.Width = myReader.ReadDouble() / 2;
            layout.Height = myReader.ReadDouble() / 2;

            return layout;
        }
        // TODO: we should interpret the shape/style/color attributes ...
        public void Draw( NodeLayout layoutState )
        {
            var style = myPresentation.GetPropertySetFor<NodeStyle>().Get( Owner.Id );
            var label = myPresentation.GetPropertySetFor<Caption>().Get( Owner.Id );

            Visual = new DrawingVisual();
            var dc = Visual.RenderOpen();

            dc.DrawEllipse( style.FillColor, new Pen( style.BorderColor, 0.016 ), layoutState.Center, layoutState.Width, layoutState.Height );

            var tx = new FormattedText( label.DisplayText,
                  CultureInfo.InvariantCulture,
                  FlowDirection.LeftToRight,
                  myFont,
                  layoutState.Height * 0.7, Brushes.Black );

            dc.DrawText( tx, new Point( layoutState.Center.X - tx.Width / 2, layoutState.Center.Y - tx.Height / 2 ) );

            dc.Close();

            Visual.SetValue( GraphItemProperty, Owner );
        }
Esempio n. 3
0
        public void Add(NodeLayout layout)
        {
            myNodeLayouts.Add(layout.OwnerId, layout);

            OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, layout));
        }