/// <summary> /// Add a new results page with a view of the specified type /// </summary> /// <param name="query"></param> /// <param name="viewType"></param> /// <returns></returns> public static void AddNewPageAndView( Query query, ResultsViewType viewType, string viewSubtype, out ResultsPage page, out ResultsViewProps view) { page = AddNewPage(query); view = ResultsViewProps.NewResultsView(query, page, viewType, viewSubtype); // create the view & add to page return; }
/**************************************************************************/ /******************************* Methods **********************************/ /**************************************************************************/ /// <summary> /// Basic constructor /// </summary> public SpotfireViewProps(ResultsViewProps rvp) { ResultsViewProps = rvp; // link to parent ResultsViewProps if (rvp != null) { rvp.SpotfireViewProps = this; // link rvp to us } DataTableMaps = new DataTableMapsMsx(this); // allocate maps and point back up to us return; }
/// <summary> /// Deserialize into an existing view /// </summary> /// <param name="serializedPropString"></param> /// <param name="q"></param> /// <param name="view"></param> public static void Deserialize( string serializedPropString, Query q, ResultsViewProps view) { XmlMemoryStreamTextReader mstr = new XmlMemoryStreamTextReader(serializedPropString); XmlTextReader tr = mstr.Reader; tr.MoveToContent(); Deserialize(q, tr, view); tr.Close(); return; }
/// <summary> /// Deserialize an axis definition /// </summary> /// <param name="name"></param> /// <param name="q"></param> /// <param name="tr"></param> /// <returns></returns> internal static AxisMx DeserializeAxis( string axisName, Query q, XmlTextReader tr) { Enum iEnum = null; AxisMx axis = new AxisMx(); XmlUtil.GetStringAttribute(tr, "ShortName", ref axis.ShortName); XmlUtil.GetStringAttribute(tr, "RangeMin", ref axis.RangeMin); XmlUtil.GetStringAttribute(tr, "RangeMax", ref axis.RangeMax); XmlUtil.GetBoolAttribute(tr, "IncludeOrigin", ref axis.IncludeOrigin); XmlUtil.GetBoolAttribute(tr, "SideMarginsEnabled", ref axis.SideMarginsEnabled); XmlUtil.GetBoolAttribute(tr, "ShowLabels", ref axis.ShowLabels); XmlUtil.GetIntAttribute(tr, "LabelAngle", ref axis.LabelAngle); XmlUtil.GetBoolAttribute(tr, "LabelsStaggered", ref axis.LabelsStaggered); if (XmlUtil.GetEnumAttribute(tr, "LabelResolveOverlappingMode", typeof(AxisLabelResolveOverlappingMode), ref iEnum)) { axis.LabelResolveOverlappingMode = (AxisLabelResolveOverlappingMode)iEnum; } XmlUtil.GetBoolAttribute(tr, "ShowZoomSlider", ref axis.ShowZoomSlider); XmlUtil.GetBoolAttribute(tr, "ShowGridLines", ref axis.ShowGridLines); XmlUtil.GetBoolAttribute(tr, "ShowGridStrips", ref axis.ShowGridStrips); XmlUtil.GetBoolAttribute(tr, "LogScale", ref axis.LogScale); XmlUtil.GetBoolAttribute(tr, "ReverseScale", ref axis.ReverseScale); tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, axisName + "Column")) { axis.QueryColumn = ResultsViewProps.DeserializeQueryColumnRef(q, tr); tr.Read(); tr.MoveToContent(); } if (!Lex.Eq(tr.Name, axisName)) { throw new Exception("Expected " + axisName + " end element"); } return(axis); }
/// <summary> /// Serialize vertex /// </summary> /// <param name="name"></param> /// <param name="tw"></param> public void Serialize(string name, XmlTextWriter tw) { if (QueryColumn == null) { return; } tw.WriteStartElement(name); tw.WriteAttributeString("ShowLabels", ShowLabels.ToString()); ResultsViewProps.SerializeQueryColumn(QueryColumn, name + "Column", tw); Color.Serialize("Color", tw); Size.Serialize("Size", tw); Shape.Serialize("Shape", tw); TooltipFields.Serialize("ToolTipFields", tw); tw.WriteEndElement(); return; }
/// <summary> /// Serialize edge /// </summary> /// <param name="name"></param> /// <param name="tw"></param> public void Serialize(string name, XmlTextWriter tw) { if (QueryColumn == null) { return; } tw.WriteStartElement(name); tw.WriteAttributeString("ShowLabels", ShowLabels.ToString()); tw.WriteAttributeString("SummarizationType", SummarizationType.ToString()); tw.WriteAttributeString("IncludeEdgeVertex", IncludeEdgeVertex.ToString()); ResultsViewProps.SerializeQueryColumn(QueryColumn, name + "Column", tw); Color.Serialize("Color", tw); Width.Serialize("Width", tw); TooltipFields.Serialize("ToolTipFields", tw); tw.WriteEndElement(); return; }
/// <summary> /// Deserialize SpotfireViewProp /// </summary> /// <param name="q"></param> /// <param name="tr"></param> /// <param name="view"></param> /// <returns></returns> public static SpotfireViewProps DeserializeSpotfireProperties( Query q, XmlTextReader tr, ResultsViewProps view) { Enum iEnum = null; SpotfireViewProps svp = new SpotfireViewProps(view); XmlUtil.GetStringAttribute(tr, "WebPlayerUrl", ref svp.WebplayerUrl); XmlUtil.GetStringAttribute(tr, "AnalysisPath", ref svp.AnalysisPath); XmlUtil.GetStringAttribute(tr, "Description", ref svp.Description); XmlUtil.GetStringAttribute(tr, "ParameterString", ref svp.ParameterString); while (true) { if (!XmlUtil.MoreSubElements(tr, "SpotfireViewProps")) { break; } else if (Lex.Eq(tr.Name, "DataTableMaps")) { DataTableMapsMsx.Deserialize(view.BaseQuery, tr, svp); } else if (Lex.Eq(tr.Name, "SpotfireLinkParameter")) { DeserializeSpotfireLinkParameter(tr, svp); } else { throw new Exception("Unexpected element: " + tr.Name); } } return(svp); }
/// <summary> /// Serialize Network View Properties /// </summary> /// <param name="tw"></param> public void Serialize(XmlTextWriter tw) { if (!NetworkPropertiesEnabled) { return; } tw.WriteStartElement("NetworkProperties"); //tw.WriteAttributeString("GraphDirectedness", GraphDirectedness.ToString()); LayoutSettingsMx s = LayoutSettings; // layout settings //tw.WriteAttributeString("LayoutType", s.LayoutType.ToString()); //tw.WriteAttributeString("LayoutStyle", s.LayoutStyle.ToString()); //tw.WriteAttributeString("GroupRectanglePenWidth", s.GroupRectanglePenWidth.ToString()); //tw.WriteAttributeString("IntergroupEdgeStyle", s.IntergroupEdgeStyle.ToString()); //tw.WriteAttributeString("ImproveLayoutOfGroups", s.ImproveLayoutOfGroups.ToString()); //tw.WriteAttributeString("MaximumVerticesPerBin", s.MaximumVerticesPerBin.ToString()); //tw.WriteAttributeString("BinLength", s.BinLength.ToString()); //tw.WriteAttributeString("FruchtermanReingoldC", s.FruchtermanReingoldC.ToString()); //tw.WriteAttributeString("FruchtermanReingoldIterations", s.FruchtermanReingoldIterations.ToString()); //tw.WriteAttributeString("Margin", s.Margin.ToString()); //tw.WriteAttributeString("VertexGroupMethod", VertexGroupMethod.ToString()); //tw.WriteAttributeString("GroupingDisabled", GroupingDisabled.ToString()); //tw.WriteAttributeString("GraphScale", GraphScale.ToString()); Vertex1.Serialize("Vertex1", tw); Vertex2.Serialize("Vertex1", tw); Edge.Serialize("Edge", tw); ResultsViewProps.SerializeQueryColumn(GroupByQc, "GroupByQc", tw); tw.WriteEndElement(); // NetworkProperties return; }
/// <summary> /// Deserialize /// </summary> /// <param name="name"></param> /// <param name="q"></param> /// <param name="tr"></param> /// <returns></returns> internal static EdgeMx Deserialize( string name, Query q, XmlTextReader tr) { Enum iEnum = null; EdgeMx e = new EdgeMx(); if (XmlUtil.GetEnumAttribute(tr, "ShowLabels", typeof(ShowLabels), ref iEnum)) { e.ShowLabels = (ShowLabels)iEnum; } if (XmlUtil.GetEnumAttribute(tr, "SummarizationType", typeof(SummarizationType), ref iEnum)) { e.SummarizationType = (SummarizationType)iEnum; } XmlUtil.GetBoolAttribute(tr, "IncludeEdgeVertex", ref e.IncludeEdgeVertex); while (true) // loop through elements of network { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, name + "Column")) { e.QueryColumn = ResultsViewProps.DeserializeQueryColumn(q, tr); tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Color")) { e.Color = ColorDimension.Deserialize("Color", q, tr); tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Width")) { e.Width = SizeDimension.Deserialize("Width", q, tr); tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "TooltipFields")) { e.TooltipFields = TooltipDimensionDef.Deserialize("TooltipFields", q, tr); //tr.Read(); tr.MoveToContent(); } else if (tr.NodeType == XmlNodeType.EndElement && // end of props Lex.Eq(tr.Name, name)) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } return(e); }
/// <summary> /// Deserialize /// </summary> /// <param name="vertexName"></param> /// <param name="q"></param> /// <param name="tr"></param> /// <returns></returns> internal static VertexMx Deserialize( string name, Query q, XmlTextReader tr) { Enum iEnum = null; VertexMx v = new VertexMx(); if (XmlUtil.GetEnumAttribute(tr, "ShowLabels", typeof(ShowLabels), ref iEnum)) { v.ShowLabels = (ShowLabels)iEnum; } while (true) // loop through elements of network { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, name + "Column")) { v.QueryColumn = ResultsViewProps.DeserializeQueryColumn(q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Color")) { v.Color = ColorDimension.Deserialize("Color", q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Size")) { v.Size = SizeDimension.Deserialize("Size", q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Shape")) { v.Shape = ShapeDimension.Deserialize("Shape", q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "TooltipFields")) { v.TooltipFields = TooltipDimensionDef.Deserialize("TooltipFields", q, tr); //tr.Read(); tr.MoveToContent(); } else if (tr.NodeType == XmlNodeType.EndElement && // end of props Lex.Eq(tr.Name, name)) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } return(v); }
/// <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); }
public bool ShowScaleLabels(ResultsViewProps view) // see if we should show scale labels { return(view.ShowAxesTitles && ShowLabels); }
/// <summary> /// Deserialize Chart Properties /// </summary> /// <param name="q"></param> /// <param name="tr"></param> /// <param name="view"></param> public static bool DeserializeChartProperties( Query q, XmlTextReader tr, ResultsViewProps view) { AxisMx ax; Enum iEnum = null; string txt; if (!Lex.Eq(tr.Name, "ChartProperties")) { return(false); } if (XmlUtil.GetEnumAttribute(tr, "ShapeRenderingMode", typeof(ShapeRenderingMode), ref iEnum)) { view.ShapeRenderingMode = (ShapeRenderingMode)iEnum; } //XmlUtil.GetStringAttribute(tr, "BackgroundImageFile", ref view.BackgroundImageFile); XmlUtil.GetIntAttribute(tr, "Jitter", ref view.JitterX); XmlUtil.GetBoolAttribute(tr, "ChartStretch", ref view.JitterTheSameForXandY); XmlUtil.GetBoolAttribute(tr, "ShowLegend", ref view.ShowLegend); if (tr.GetAttribute("LegendAlignmentHorizontal") != null) { view.LegendAlignmentHorizontal = (LegendAlignmentHorizontal)EnumUtil.Parse(typeof(LegendAlignmentHorizontal), tr.GetAttribute("LegendAlignmentHorizontal")); } if (tr.GetAttribute("LegendAlignmentVertical") != null) { view.LegendAlignmentVertical = (LegendAlignmentVertical)EnumUtil.Parse(typeof(LegendAlignmentVertical), tr.GetAttribute("LegendAlignmentVertical")); } XmlUtil.GetIntAttribute(tr, "LegendMaxHorizontalPercentage", ref view.LegendMaxHorizontalPercentage); XmlUtil.GetIntAttribute(tr, "LegendMaxVerticalPercentage", ref view.LegendMaxVerticalPercentage); if (tr.GetAttribute("LegendItemOrder") != null) { view.LegendItemOrder = (LegendDirection)EnumUtil.Parse(typeof(LegendDirection), tr.GetAttribute("LegendItemOrder")); } XmlUtil.GetBoolAttribute(tr, "MainChartAreaMaximized", ref view.MainViewPanelMaximized); XmlUtil.GetBoolAttribute(tr, "ShowFilters", ref view.ShowFilters); XmlUtil.GetBoolAttribute(tr, "ShowSelectedDataRows", ref view.ShowSelectedDataRows); XmlUtil.GetBoolAttribute(tr, "ShowAxesTitles", ref view.ShowAxesTitles); XmlUtil.GetBoolAttribute(tr, "ShowAxesScaleLabels", ref view.ShowAxesScaleLabels); XmlUtil.GetBoolAttribute(tr, "RotateAxes", ref view.RotateAxes); XmlUtil.GetBoolAttribute(tr, "UseExistingCondFormatting", ref view.UseExistingCondFormatting); XmlUtil.GetBoolAttribute(tr, "PivotedData", ref view.PivotedData); while (true) // loop through elements of chart { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, "XAxis")) { view.XAxisMx = AxisMx.DeserializeAxis("XAxis", q, tr); } else if (Lex.Eq(tr.Name, "YAxis")) { view.YAxisMx = AxisMx.DeserializeAxis("YAxis", q, tr); } else if (Lex.Eq(tr.Name, "ZAxis")) { view.ZAxisMx = AxisMx.DeserializeAxis("ZAxis", q, tr); } else if (Lex.Eq(tr.Name, "Axis")) { ax = AxisMx.DeserializeAxis("Axis", q, tr); view.AxesMx.Add(ax); } else if (Lex.Eq(tr.Name, "MarkerColor")) { view.MarkerColor = ColorDimension.Deserialize("MarkerColor", q, tr); } else if (Lex.Eq(tr.Name, "MarkerSize")) { view.MarkerSize = SizeDimension.Deserialize("MarkerSize", q, tr); } else if (Lex.Eq(tr.Name, "MarkerShape")) { view.MarkerShape = ShapeDimension.Deserialize("MarkerShape", q, tr); } else if (Lex.Eq(tr.Name, "MarkerLabel")) { view.MarkerLabel = LabelDimensionDef.Deserialize("MarkerLabel", q, tr); } else if (Lex.Eq(tr.Name, "Labels")) // obsolete label tag { view.MarkerLabel = LabelDimensionDef.Deserialize("Labels", q, tr); } else if (Lex.Eq(tr.Name, "TooltipFields")) { view.MarkerTooltip = TooltipDimensionDef.Deserialize("TooltipFields", q, tr); } else if (Lex.Eq(tr.Name, "Surface")) { txt = tr.GetAttribute("FillMode"); if (txt != null) { view.SurfaceFillMode = (SurfaceFillMode)EnumUtil.Parse(typeof(SurfaceFillMode), txt); } XmlUtil.GetBoolAttribute(tr, "SmoothPalette", ref view.SmoothPalette); XmlUtil.GetBoolAttribute(tr, "SmoothShading", ref view.SmoothShading); XmlUtil.GetBoolAttribute(tr, "SemiTransparent", ref view.SemiTransparent); XmlUtil.GetBoolAttribute(tr, "DrawFlat", ref view.DrawFlat); txt = tr.GetAttribute("FrameMode"); if (txt != null) { view.SurfaceFrameMode = (SurfaceFrameMode)EnumUtil.Parse(typeof(SurfaceFrameMode), txt); } if (tr.IsEmptyElement) { continue; // may be just attributes } tr.Read(); tr.MoveToContent(); if (!Lex.Eq(tr.Name, "Surface")) { throw new Exception("Expected Surface end element"); } } else if (Lex.Eq(tr.Name, "Trellis")) { if (tr.IsEmptyElement) { continue; // may be just attributes } XmlUtil.GetBoolAttribute(tr, "ByRowCol", ref view.TrellisByRowCol); XmlUtil.GetBoolAttribute(tr, "Manual", ref view.TrellisManual); XmlUtil.GetIntAttribute(tr, "MaxRows", ref view.TrellisMaxRows); XmlUtil.GetIntAttribute(tr, "MaxCols", ref view.TrellisMaxCols); while (true) { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, "ColumnQc")) { view.TrellisColQc = DeserializeQueryColumnRef(q, tr); } else if (Lex.Eq(tr.Name, "RowQc")) { view.TrellisRowQc = DeserializeQueryColumnRef(q, tr); } else if (Lex.Eq(tr.Name, "PageQc")) { view.TrellisPageQc = DeserializeQueryColumnRef(q, tr); } else if (Lex.Eq(tr.Name, "FlowQc")) { view.TrellisFlowQc = DeserializeQueryColumnRef(q, tr); } else if (tr.NodeType == XmlNodeType.EndElement && // end of trellis definition Lex.Eq(tr.Name, "Trellis")) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } } else if (tr.NodeType == XmlNodeType.EndElement && // end of chart props Lex.Eq(tr.Name, "ChartProperties")) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } return(true); }