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); }
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; }
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; }
public override void LoadSettings(CompendiumNodeSettings settings) { base.LoadSettings(settings); }