Example #1
0
        public void Dispose()
        {
            if (m_bmp != null)
            {
                m_bmp.Dispose();
                m_bmp = null;
            }

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

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

            if (m_graphics != null)
            {
                m_graphics.Dispose();
                m_graphics = null;
            }
        }
Example #2
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);
        }