public static ConfigurationSurface Deserialize(IEnumerable <XElement> elms)
        {
            ConfigurationSurface surface = new ConfigurationSurface();

            XElement elm = SerializeToXml.GetElement(elms, "Surface");

            surface.m_clrBack          = SerializeToXml.LoadColor(elm, "BackColor").Value;
            surface.m_bEnableSmoothing = SerializeToXml.LoadBool(elm, "EnableSmoothing").Value;

            return(surface);
        }
Exemple #2
0
        public void Update(ConfigurationSurface c)
        {
            m_config = c;

            if (m_brBack != null)
            {
                m_brBack.Dispose();
            }

            m_brBack = new SolidBrush(m_config.BackColor);
        }
Exemple #3
0
        public Configuration(SerializationInfo info, StreamingContext context)
        {
            m_configSurface = (ConfigurationSurface)info.GetValue("configSurface", typeof(ConfigurationSurface));
            int nCount = info.GetInt32("frameCount");

            m_rgFrameConfig = new List <ConfigurationFrame>();

            for (int i = 0; i < nCount; i++)
            {
                ConfigurationFrame frame = (ConfigurationFrame)info.GetValue("frame_" + i.ToString(), typeof(ConfigurationFrame));
                m_rgFrameConfig.Add(frame);
            }
        }
        public bool Compare(ConfigurationSurface c)
        {
            if (m_clrBack != c.m_clrBack)
            {
                return(false);
            }

            if (m_bEnableSmoothing != c.m_bEnableSmoothing)
            {
                return(false);
            }

            return(true);
        }
Exemple #5
0
        private SurfaceStyle createStyle(ConfigurationSurface c)
        {
            if (m_style != null && m_config != null && m_config.Compare(c))
            {
                return(m_style);
            }

            if (m_style != null)
            {
                m_style.Dispose();
            }

            m_config = c;
            return(new SimpleGraphing.SurfaceStyle(m_config));
        }
Exemple #6
0
        public static Configuration LoadFromFile(string strFile)
        {
            Configuration config = new Configuration();
            string        strXml;

            using (FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (StreamReader sr = new StreamReader(fs))
                {
                    strXml = sr.ReadToEnd();
                }

            if ((int)strXml[0] == 65533 && (int)strXml[1] == 65533)
            {
                strXml = strXml.Substring(3);
            }

            XDocument doc = XDocument.Parse(strXml);

            config.Surface = ConfigurationSurface.Deserialize(doc.Descendants());
            config.Frames  = ConfigurationFrame.Deserialize(doc.Descendants());

            return(config);
        }
Exemple #7
0
        public List <PlotCollectionSet> BuildGraph(Configuration config, List <PlotCollectionSet> rgData, bool bAddToParams = false)
        {
            List <PlotCollectionSet> rgOutputData = new List <PlotCollectionSet>();

            m_config = config.Surface;

            if (m_frames == null)
            {
                m_frames = new SimpleGraphing.GraphFrameCollection();
            }

            if (rgData == null)
            {
                if (m_frames.Count > 0)
                {
                    m_frames.Dispose();
                    m_frames = new GraphFrameCollection();
                }

                return(rgOutputData);
            }

            int nMaxIdx = config.Frames.Max(p => p.DataIndex);

            if (nMaxIdx >= rgData.Count)
            {
                throw new Exception("The plot collection set count is less than the max data index of '" + nMaxIdx.ToString() + "'!");
            }

            if (!m_frames.Compare(config.Frames))
            {
                if (m_frames.Count > 0)
                {
                    m_frames.Dispose();
                    m_frames = new GraphFrameCollection();
                }
            }

            int nFrameIdx   = 0;
            int nFrameCount = m_frames.Count;

            for (int i = 0; i < config.Frames.Count && i < rgData.Count; i++)
            {
                PlotCollectionSet dataOutput = null;

                if (config.Frames[i].Visible)
                {
                    GraphFrame frame = null;

                    if (nFrameIdx >= nFrameCount)
                    {
                        frame = new GraphFrame(m_cache);
                    }
                    else
                    {
                        frame = m_frames[nFrameIdx];
                    }

                    if (frame.Configuration.Visible)
                    {
                        dataOutput = frame.BuildGraph(config.Frames[i], rgData[i], bAddToParams);
                    }

                    if (nFrameIdx >= nFrameCount)
                    {
                        m_frames.Add(frame);
                    }

                    nFrameIdx++;
                }

                rgOutputData.Add(dataOutput);
            }

            return(rgOutputData);
        }
Exemple #8
0
 public SurfaceStyle(ConfigurationSurface c)
 {
     m_config = c;
     m_brBack = new SolidBrush(c.BackColor);
 }