public static void UpdateArcShape(arc a) { string strShape; var shapeData = new List <string>(); if (a.DisplayShape != null) { shapeData = new List <string>(a.DisplayShape.ToString().Split(new[] { ',', '.' })); } if (shapeData.Count == 0) { strShape = updateArcShapeKeyString(""); } else { strShape = updateArcShapeKeyString(shapeData[0]); } if (shapeData.Count > 1) { MyXamlHelpers.SetValue(ref strShape, "Stroke", BrushSelector.GetColorFromString(shapeData[1]).ToString()); MyXamlHelpers.SetValue(ref strShape, "StrokeThickness", shapeData[2]); } MyXamlHelpers.SetValue(ref strShape, "Tag", a.name); a.DisplayShape = new DisplayShape(strShape, ShapeRepresents.Arc, a); }
public static void UpdateNodeShape(node n) { string strShape; List <string> shapeData; if (n.DisplayShape == null) { shapeData = new List <string>(); } else { shapeData = new List <string>(n.DisplayShape.ToString().Split(new[] { ',', '.' })); } if (shapeData.Count == 0) { strShape = updateNodeShapeKeyString(""); } else { strShape = updateNodeShapeKeyString(shapeData[0]); } if (shapeData.Count > 1) { MyXamlHelpers.SetValue(ref strShape, "Fill", BrushSelector.GetColorFromString(shapeData[1]).ToString()); MyXamlHelpers.SetValue(ref strShape, "Width", shapeData[2]); MyXamlHelpers.SetValue(ref strShape, "Height", shapeData[3]); } MyXamlHelpers.SetValue(ref strShape, "Tag", n.name); n.DisplayShape = new DisplayShape(strShape, ShapeRepresents.Node, n); }
private void Update() { var allSame = true; var stroke = (Brush)hyperarcs[0].DisplayShape.Stroke; for (var i = 1; i < hyperarcs.Count; i++) { if (!BrushSelector.EqualBrushes(stroke, (Brush)hyperarcs[i].DisplayShape.Stroke)) { allSame = false; break; } } if (allSame) { StrokeColorSelector.ReadInBrushValue((Brush)hyperarcs[0].DisplayShape.Stroke); } else { StrokeColorSelector.ReadInBrushValue(null); } allSame = true; var thick = hyperarcs[0].DisplayShape.StrokeThickness; for (var i = 1; i < hyperarcs.Count; i++) { if (!thick.Equals(hyperarcs[i].DisplayShape.StrokeThickness)) { allSame = false; break; } } sldStrokeThickness.UpdateValue(allSame ? hyperarcs[0].DisplayShape.StrokeThickness : double.NaN); if (hyperarcs.Count == 1) { expArcController.Content = ((HyperArcShape)hyperarcs[0].DisplayShape.Shape).Controller; expArcController.IsExpanded = true; } else if ((hyperarcs.Count > 1) && (sameController(hyperarcs))) { expArcController.Content = ((HyperArcShape)hyperarcs[0].DisplayShape.Shape).Controller; expArcController.IsExpanded = true; multiControllerList.Clear(); for (var i = 1; i < hyperarcs.Count; i++) { multiControllerList.Add(((HyperArcShape)hyperarcs[i].DisplayShape.Shape).Controller); } } else { expArcController.Content = "No common arc controller to the selection."; expArcController.IsExpanded = false; multiControllerList.Clear(); } }
private void Update() { /*************Fill Color*************/ var allSame = true; var fill = (Brush)nodes[0].DisplayShape.Fill; for (var i = 1; i < nodes.Count; i++) { if (!BrushSelector.EqualBrushes(fill, (Brush)nodes[i].DisplayShape.Fill)) { allSame = false; break; } } if (allSame) { FillColorSelector.ReadInBrushValue(fill); } else { FillColorSelector.ReadInBrushValue(null); } /*************Stroke Color*************/ allSame = true; var stroke = (Brush)nodes[0].DisplayShape.Stroke; for (var i = 1; i < nodes.Count; i++) { if (!BrushSelector.EqualBrushes(stroke, (Brush)nodes[i].DisplayShape.Stroke)) { allSame = false; break; } } if (allSame) { if (stroke != null) { StrokeColorSelector.ReadInBrushValue(stroke); } else { StrokeColorSelector.ReadInBrushValue(Brushes.Transparent); } } else { StrokeColorSelector.ReadInBrushValue(null); } /*************Stroke Thickness*************/ allSame = true; var thick = nodes[0].DisplayShape.StrokeThickness; for (var i = 1; i < nodes.Count; i++) { if (!thick.Equals(nodes[i].DisplayShape.StrokeThickness)) { allSame = false; break; } } if (allSame) { sldStrokeThickness.UpdateValue(nodes[0].DisplayShape.StrokeThickness); } else { sldStrokeThickness.UpdateValue(double.NaN); } /*************Rotataion*************/ allSame = true; var rotat = Math.Atan2(nodes[0].DisplayShape.TransformMatrix[0, 1], nodes[0].DisplayShape.TransformMatrix[0, 0]); for (var i = 1; i < nodes.Count; i++) { if (rotat != Math.Atan2(nodes[i].DisplayShape.TransformMatrix[0, 1], nodes[i].DisplayShape.TransformMatrix[0, 0])) { allSame = false; break; } } if (allSame) { sldRotation.UpdateValue(180 * rotat / Math.PI); } else { sldRotation.UpdateValue(double.NaN); } /*************Width*************/ allSame = true; var w = nodes[0].DisplayShape.Width; for (var i = 1; i < nodes.Count; i++) { if (!w.Equals(nodes[i].DisplayShape.Width)) { allSame = false; break; } } if (allSame) { txtBxWidth.Foreground = Brushes.Black; txtBxWidth.Text = w.ToString(); } else { txtBxWidth.Foreground = Brushes.Gray; txtBxWidth.Text = "diff"; } /*************Height*************/ allSame = true; var h = nodes[0].DisplayShape.Height; for (var i = 1; i < nodes.Count; i++) { if (!h.Equals(nodes[i].DisplayShape.Height)) { allSame = false; break; } } if (allSame) { txtBxHeight.Foreground = Brushes.Black; txtBxHeight.Text = h.ToString(); } else { txtBxHeight.Foreground = Brushes.Gray; txtBxHeight.Text = "diff"; } }
private void Update() { var allSame = true; var stroke = (Brush)arcs[0].DisplayShape.Stroke; for (var i = 1; i < arcs.Count; i++) { if (!BrushSelector.EqualBrushes(stroke, (Brush)arcs[i].DisplayShape.Stroke)) { allSame = false; break; } } if (allSame) { StrokeColorSelector.ReadInBrushValue((Brush)arcs[0].DisplayShape.Stroke); } else { StrokeColorSelector.ReadInBrushValue(null); } allSame = true; var thick = arcs[0].DisplayShape.StrokeThickness; for (var i = 1; i < arcs.Count; i++) { if (!thick.Equals(arcs[i].DisplayShape.StrokeThickness)) { allSame = false; break; } } if (allSame) { sldStrokeThickness.UpdateValue(arcs[0].DisplayShape.StrokeThickness); } else { sldStrokeThickness.UpdateValue(double.NaN); } allSame = true; var aBool = ((ArcShape)arcs[0].DisplayShape.Shape).ShowArrowHeads; for (var i = 1; i < arcs.Count; i++) { if (aBool != ((ArcShape)arcs[i].DisplayShape.Shape).ShowArrowHeads) { allSame = false; break; } } if (allSame) { chkShowArrowHeads.IsChecked = ((ArcShape)arcs[0].DisplayShape.Shape).ShowArrowHeads; } else { chkShowArrowHeads.IsChecked = null; } if (arcs.Count == 1) { expArcController.Content = ((ArcShape)arcs[0].DisplayShape.Shape).Controller; expArcController.IsExpanded = true; } else if ((arcs.Count > 1) && (sameController(arcs))) { expArcController.Content = ((ArcShape)arcs[0].DisplayShape.Shape).Controller; expArcController.IsExpanded = true; multiControllerList.Clear(); for (var i = 1; i < arcs.Count; i++) { multiControllerList.Add(((ArcShape)arcs[i].DisplayShape.Shape).Controller); } } else { expArcController.Content = "No common arc controller to the selection."; expArcController.IsExpanded = false; multiControllerList.Clear(); } }