Esempio n. 1
0
        private double CalculateXOffset(CompendiumNodeSettings settings)
        {
            double distanceMultiplier;
            double distanceBetweenNodes;

            if (settings.NodeIndex < (settings.NodeCount / 2))
            {
                distanceMultiplier   = settings.NodeIndex;
                distanceBetweenNodes = (4 * settings.Radius) / (settings.NodeCount - 1);
            }
            else
            {
                distanceMultiplier   = settings.NodeIndex - (settings.NodeCount / 2);
                distanceBetweenNodes = (4 * settings.Radius) / (settings.NodeCount + 1);
            }

            double heightOffset = distanceMultiplier * distanceBetweenNodes;
            double heightRemainder;

            if (heightOffset < settings.Radius)
            {
                heightRemainder = settings.Radius - heightOffset;
            }
            else
            {
                heightRemainder = heightOffset - settings.Radius;
            }

            double xOffset = Math.Sqrt((settings.Radius * settings.Radius) - (heightRemainder * heightRemainder));

            return(xOffset);
        }
Esempio n. 2
0
        public virtual void LoadSettings(CompendiumNodeSettings settings)
        {
            NodeSettings = settings;

            NodeLabelUIElement              = new TextBlock();
            NodeLabelUIElement.Text         = NodeSettings.NodeDetails.Name;
            NodeLabelUIElement.FontSize     = NodeFontSize;
            NodeLabelUIElement.TextWrapping = TextWrapping.Wrap;
            NodeLabelUIElement.SetValue(Canvas.LeftProperty, TextLocation.X);
            NodeLabelUIElement.SetValue(Canvas.TopProperty, TextLocation.Y);
            NodeLabelUIElement.Width  = TextLocation.Width;
            NodeLabelUIElement.Height = TextLocation.Height;

            RectangleGeometry nodeClippingRect = new RectangleGeometry();

            nodeClippingRect.Rect = new Rect(0, 0, TextLocation.Width, TextLocation.Height);
            NodeClippingGeometry  = nodeClippingRect;

            Rectangle nodeUIElement = new Rectangle();

            nodeUIElement.Tag  = this;
            nodeUIElement.Fill = NodeImage;
            nodeUIElement.SetValue(Canvas.LeftProperty, NodeUIElementLocation.X);
            nodeUIElement.SetValue(Canvas.TopProperty, NodeUIElementLocation.Y);
            nodeUIElement.Width  = NodeUIElementLocation.Width;
            nodeUIElement.Height = NodeUIElementLocation.Height;
            NodeUIElement        = nodeUIElement;
        }
Esempio n. 3
0
        private double CalculateYOffset(CompendiumNodeSettings settings)
        {
            double distanceMultiplier;
            double distanceBetweenNodes;

            if (settings.NodeIndex < (settings.NodeCount / 2))
            {
                distanceMultiplier = settings.NodeIndex;
                distanceBetweenNodes = (4 * settings.Radius) / (settings.NodeCount - 1);
            }
            else
            {
                distanceMultiplier = settings.NodeIndex - (settings.NodeCount / 2);
                distanceBetweenNodes = (4 * settings.Radius) / (settings.NodeCount + 1);
            }

            double heightOffset = distanceMultiplier * distanceBetweenNodes;
            double heightRemainder;

            if (heightOffset < settings.Radius)
            {
                heightRemainder = settings.Radius - heightOffset;
            }
            else
            {
                heightRemainder = heightOffset - settings.Radius;
            }

            return heightRemainder;
        }
Esempio n. 4
0
 public override void LoadSettings(CompendiumNodeSettings settings)
 {
     base.LoadSettings(settings);
 }
Esempio n. 5
0
 public override void LoadSettings(CompendiumNodeSettings settings)
 {
     base.LoadSettings(settings);
 }
Esempio n. 6
0
        public virtual void LoadSettings(CompendiumNodeSettings settings)
        {
            NodeSettings = settings;

            NodeLabelUIElement = new TextBlock();
            NodeLabelUIElement.Text = NodeSettings.NodeDetails.Name;
            NodeLabelUIElement.FontSize = NodeFontSize;
            NodeLabelUIElement.TextWrapping = TextWrapping.Wrap;
            NodeLabelUIElement.SetValue(Canvas.LeftProperty, TextLocation.X);
            NodeLabelUIElement.SetValue(Canvas.TopProperty, TextLocation.Y);
            NodeLabelUIElement.Width = TextLocation.Width;
            NodeLabelUIElement.Height = TextLocation.Height;

            RectangleGeometry nodeClippingRect = new RectangleGeometry();
            nodeClippingRect.Rect = new Rect(0, 0, TextLocation.Width, TextLocation.Height);
            NodeClippingGeometry = nodeClippingRect;

            Rectangle nodeUIElement = new Rectangle();
            nodeUIElement.Tag = this;
            nodeUIElement.Fill = NodeImage;
            nodeUIElement.SetValue(Canvas.LeftProperty, NodeUIElementLocation.X);
            nodeUIElement.SetValue(Canvas.TopProperty, NodeUIElementLocation.Y);
            nodeUIElement.Width = NodeUIElementLocation.Width;
            nodeUIElement.Height = NodeUIElementLocation.Height;
            NodeUIElement = nodeUIElement;
        }