Exemplo n.º 1
0
        //private void backgroundWorkerCalcs_ProgressChanged(object sender, ProgressChangedEventArgs e)
        //{
        //    // Use this method to report progress to GUI
        //}

        /// <summary>
        /// Adds the Form's MainBmp and associated dispMandImage.MandRect.X, dispMandImage.MandRect.Right, dispMandImage.MandRect.Y and dispMandImage.MandRect.Bottom values to a stack implemented as ArrayList mainBmpImageList.
        /// </summary>
        private void pushBitmap()
        {
            // If adding an element back to the middle of the stack then clear all remaining elemments.
            if (imageListDisplayedElCount < mainBmpImageList.Count)
            {
                // Remove any trailing elements.
                mainBmpImageList.RemoveRange(imageListDisplayedElCount, mainBmpImageList.Count - imageListDisplayedElCount);
            }

            // If too many elements then remove one from the stack bottom and continue.
            if (mainBmpImageList.Count >= maxImages)
            {
                // Remove bottom element
                mainBmpImageList.RemoveAt(0);

                // Decrement count to adjust "top" element in stack for removed element.
                imageListDisplayedElCount--;
            }

            // Now create another element for the current bitmap at the end.
            MandImage i = new MandImage();

            i.CopyFrom(dispMandImage);
            mainBmpImageList.Add(i);

            // Update the count of the last element in the stack.
            imageListDisplayedElCount++;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update MainBmp and associated dispMandImage.MandRect.X, dispMandImage.MandRect.Right, dispMandImage.MandRect.Y and dispMandImage.MandRect.Bottom values from the "stack top" in ArrayList mainBmpImageList.
        /// Note that the count of elemetns to the current stack top is imageListDisplayedElCount.  Returns true for success.
        /// </summary>
        private bool popBitmap()
        {
            if (imageListDisplayedElCount <= 1)
            {
                // There is no element to pop off so indicate that pop failed. (we always leave the top element on the stack).
                return(false);
            }

            // Decrement count in line with count of new "top" element in stack.
            imageListDisplayedElCount--;

            // There is an element to pop so pop it.
            //Tuple<Bitmap, FloatType, FloatType, FloatType, FloatType> t = (Tuple<Bitmap, FloatType, FloatType, FloatType, FloatType>)mainBmpImageList[imageListDisplayedElCount-1];
            MandImage i = (MandImage)mainBmpImageList[imageListDisplayedElCount - 1];

            dispMandImage.CopyFrom(i);

            // Indicate that pop succeeded.
            return(true);
        }