Exemplo n.º 1
0
        /// <summary>
        /// Deserialize a visual returning the appropriate visual object that is derived from
        /// the base VisualMsx object.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>

        public static VisualMsx Deserialize(
            string data,
            AnalysisApplicationMsx app)
        {
            Type visType = null;

            if (data.IndexOf("<TablePlotMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TablePlotMsx);
            }

            else if (data.IndexOf("<BarChartMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(BarChartMsx);
            }

            else if (data.IndexOf("<ScatterPlotMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(ScatterPlotMsx);
            }

            else if (data.IndexOf("<TreemapMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TreemapMsx);
            }

            else if (data.IndexOf("<HeatMapMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(HeatMapMsx);
            }

            else if (data.IndexOf("<TrellisCardvisualMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TrellisCardVisualMsx);
            }

            else
            {
                visType = typeof(VisualMsx);              // shouldn't happen
            }
            XmlSerializer xmlSer = new XmlSerializer(visType);
            StringReader  reader = new StringReader(data);

            VisualMsx visMsx = (VisualMsx)(xmlSer.Deserialize(reader));

            visMsx.SetApp(app);

            visMsx.UpdatePostDeserializationSecondaryReferences();

            return(visMsx);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Try to get Visual by Guid Id across all pages
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <param name="visual"></param>
        /// <returns></returns>

        public bool TryGetVisual(
            string id,
            out VisualMsx visual)
        {
            foreach (PageMsx p in Pages.PageList)
            {
                if (p.Visuals.TryGetVisual(id, out visual))
                {
                    return(true);
                }
            }

            visual = null;
            return(false);
        }
Exemplo n.º 3
0
        //public VisualNavigationMode NavigationMode { get; set; }
        //public VisualizationAreaSize VisualizationAreaSize { get; }

        public bool TryGetVisual(
            string id,
            out VisualMsx visual)
        {
            foreach (VisualMsx vis in VisualList)
            {
                if (vis.Id == id)
                {
                    visual = vis;
                    return(true);
                }
            }
            visual = null;
            return(false);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Deserialize a visual returning the appropriate visual object that is derived from
        /// the base VisualMsx object.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>

        public static VisualMsx DeserializeVisual(string data)
        {
            Type visType = null;

            if (data.IndexOf("<TablePlotMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TablePlotMsx);
            }

            else if (data.IndexOf("<BarChartMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(BarChartMsx);
            }

            else if (data.IndexOf("<ScatterPlotMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(ScatterPlotMsx);
            }

            else if (data.IndexOf("<TreemapMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TreemapMsx);
            }

            else if (data.IndexOf("<HeatMapMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(HeatMapMsx);
            }

            else if (data.IndexOf("<TrellisCardvisualMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TrellisCardVisualMsx);
            }

            else
            {
                visType = typeof(VisualMsx);              // shouldn't happen
            }
            XmlSerializer xmlSer = new XmlSerializer(visType);
            StringReader  reader = new StringReader(data);

            VisualMsx visMsx = (VisualMsx)(xmlSer.Deserialize(reader));

            return(visMsx);
        }