public static Color DefaultSelectedColor = Color.Red; // default color for drawing selected vertices & edges /// <summary> /// Constructor /// </summary> public NetworkProperties() { Vertex1.Size.FixedSize = NetworkProperties.GraphScaleToPctScale(GraphScale); Vertex1.Shape.FixedShape = (int)VertexShape.Circle; Vertex2.Size.FixedSize = NetworkProperties.GraphScaleToPctScale(GraphScale); Vertex2.Shape.FixedShape = (int)VertexShape.Diamond; Edge.Width.FixedSize = NetworkProperties.GraphScaleToPctScale(GraphScale); return; }
/// <summary> /// Deserialize /// </summary> /// <param name="q"></param> /// <param name="tr"></param> /// <param name="view"></param> /// <returns></returns> public static bool Deserialize( Query q, XmlTextReader tr, ResultsViewProps view) { Enum iEnum = null; bool b1 = false; string txt = ""; int i1 = -1; double d1 = -1; if (!Lex.Eq(tr.Name, "NetworkProperties")) { return(false); } if (view.NetworkProperties == null) { view.NetworkProperties = new NetworkProperties(); } NetworkProperties p = view.NetworkProperties; //if (XmlUtil.GetEnumAttribute(tr, "GraphDirectedness", typeof(GraphDirectedness), ref iEnum)) // p.GraphDirectedness = (GraphDirectedness)iEnum; //LayoutSettingsMx s = p.LayoutSettings; // layout settings //if (XmlUtil.GetEnumAttribute(tr, "LayoutType", typeof(LayoutType), ref iEnum)) // s.LayoutType = (LayoutType)iEnum; //if (XmlUtil.GetEnumAttribute(tr, "LayoutStyle", typeof(LayoutStyle), ref iEnum)) // s.LayoutStyle = (LayoutStyle)iEnum; //XmlUtil.GetDoubleAttribute(tr, "GroupRectanglePenWidth", ref s.GroupRectanglePenWidth); //if (XmlUtil.GetEnumAttribute(tr, "IntergroupEdgeStyle", typeof(IntergroupEdgeStyle), ref iEnum)) // s.IntergroupEdgeStyle = (IntergroupEdgeStyle)iEnum; //XmlUtil.GetBoolAttribute(tr, "ImproveLayoutOfGroups", ref s.ImproveLayoutOfGroups); //XmlUtil.GetIntAttribute(tr, "MaximumVerticesPerBin", ref s.MaximumVerticesPerBin); //XmlUtil.GetIntAttribute(tr, "BinLength", ref s.BinLength); //XmlUtil.GetFloatAttribute(tr, "FruchtermanReingoldC", ref s.FruchtermanReingoldC); //XmlUtil.GetIntAttribute(tr, "FruchtermanReingoldIterations", ref s.FruchtermanReingoldIterations); //XmlUtil.GetIntAttribute(tr, "Margin", ref s.Margin); //if (XmlUtil.GetEnumAttribute(tr, "VertexGroupMethod", typeof(VertexGroupMethodMx), ref iEnum)) // p.VertexGroupMethod = (VertexGroupMethodMx)iEnum; //XmlUtil.GetBoolAttribute(tr, "GroupingDisabled", ref p.GroupingDisabled); //XmlUtil.GetDoubleAttribute(tr, "GraphScale", ref p.GraphScale); if (tr.IsEmptyElement) { return(true); // return if no elements } while (true) // loop through elements of network { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, "Vertex1")) { p.Vertex1 = VertexMx.Deserialize("Vertex1", q, tr); } else if (Lex.Eq(tr.Name, "Vertex2")) { p.Vertex2 = VertexMx.Deserialize("Vertex2", q, tr); } else if (Lex.Eq(tr.Name, "Edge")) { p.Edge = EdgeMx.Deserialize("Edge", q, tr); } else if (Lex.Eq(tr.Name, "GroupByQc")) { p.GroupByQc = ResultsViewProps.DeserializeQueryColumn(q, tr); tr.Read(); tr.MoveToContent(); } else if (tr.NodeType == XmlNodeType.EndElement && // end of props Lex.Eq(tr.Name, "NetworkProperties")) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } return(true); }