Example #1
0
 private static bool FindAllU12(ZedGraph.GraphObj gObj)
 {
     if (gObj.Tag.ToString().Contains("U12"))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #2
0
 // Explicit predicate delegate.
 private static bool FindAllFp02(ZedGraph.GraphObj lo)
 {
     if (lo.Tag.ToString() == "Fp02")
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #3
0
        public void Reset()
        {
            if (_obj != null)
            {
                _obj.IsSelected = false;
                _obj.IsMoving = false;
            }

            _obj = null;
            _state = DragState.None;
            _pane = null;
        }
Example #4
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The <see cref="GraphObj"/> object from which to copy</param>
        public GraphObj(GraphObj rhs)
        {
            // Copy value types
            _isVisible            = rhs.IsVisible;
            _isClippedToChartRect = rhs._isClippedToChartRect;
            _zOrder = rhs.ZOrder;

            // copy reference types by cloning
            if (rhs.Tag is ICloneable)
            {
                this.Tag = ((ICloneable)rhs.Tag).Clone();
            }
            else
            {
                this.Tag = rhs.Tag;
            }

            _location = rhs.Location.Clone();
            _link     = rhs._link.Clone();
        }
Example #5
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The <see cref="GraphObj"/> object from which to copy</param>
        protected GraphObj(GraphObj rhs)
        {
            // Copy value types
            _isVisible            = rhs.IsVisible;
            _isClippedToChartRect = rhs._isClippedToChartRect;
            _zOrder = rhs.ZOrder;

            // copy moving, selected property ?
            IsMoving     = rhs.IsMoving;
            IsSelected   = rhs.IsSelected;
            IsSelectable = rhs.IsSelectable;

            // copy reference types by cloning
            this.Tag = (rhs.Tag is ICloneable) ? ((ICloneable)rhs.Tag).Clone() : rhs.Tag;

            _location = rhs.Location.Clone();
            _link     = rhs._link.Clone();

            IsX2Axis    = rhs.IsX2Axis;
            IsY2Axis    = rhs.IsY2Axis;
            _yAxisIndex = rhs._yAxisIndex;
        }
Example #6
0
        /// <summary>
        /// Move the position of the object at the specified index
        /// to the new relative position in the list.</summary>
        /// <remarks>For Graphic type objects, this method controls the
        /// Z-Order of the items.  Objects at the beginning of the list
        /// appear in front of objects at the end of the list.</remarks>
        /// <param name="index">The zero-based index of the object
        /// to be moved.</param>
        /// <param name="relativePos">The relative number of TradeSignal.Positions to move
        /// the object.  A value of -1 will move the
        /// object one position earlier in the list, a value
        /// of 1 will move it one position later.  To move an item to the
        /// beginning of the list, use a large negative value (such as -999).
        /// To move it to the end of the list, use a large positive value.
        /// </param>
        /// <returns>The new position for the object, or -1 if the object
        /// was not found.</returns>
        public int Move(int index, int relativePos)
        {
            if (index < 0 || index >= list.Count)
            {
                return(-1);
            }

            GraphObj graphObj = this[index];

            list.RemoveAt(index);

            index += relativePos;
            if (index < 0)
            {
                index = 0;
            }
            if (index > list.Count)
            {
                index = list.Count;
            }

            list.Insert(index, graphObj);
            return(index);
        }
 private void checkGaps(GraphObj current,GraphObj next)
 {
     if (current.Location.X2 < next.Location.X1)
     {
         double gapWidth = next.Location.X1 - current.Location.X2;
         BoxObj gapBox1 = new BoxObj(current.Location.X2, Math.Floor(current.Location.Y), gapWidth, 1, _gapColor, _gapColor)
         {
             IsClippedToChartRect = true
         };
         zgIsolationGraph.GraphPane.GraphObjList.Add(gapBox1);
         _gapBoxes.Add(gapBox1);
     }
 }
Example #8
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The <see cref="GraphObj"/> object from which to copy</param>
        public GraphObj( GraphObj rhs )
        {
            // Copy value types
            _isVisible = rhs.IsVisible;
            _isClippedToChartRect = rhs._isClippedToChartRect;
            _zOrder = rhs.ZOrder;

            // copy reference types by cloning
            if ( rhs.Tag is ICloneable )
                this.Tag = ((ICloneable) rhs.Tag).Clone();
            else
                this.Tag = rhs.Tag;

            _location = rhs.Location.Clone();
            _link = rhs._link.Clone();
        }
Example #9
0
 /// <summary>
 /// Insert a <see cref="GraphObj"/> object into the collection
 /// at the specified zero-based index location.
 /// </summary>
 /// <param name="index">The zero-based index location for insertion.</param>
 /// <param name="item">The <see cref="GraphObj"/> object that is to be
 /// inserted.</param>
 /// <seealso cref="IList.Insert"/>
 public void Insert(int index, GraphObj item)
 {
     List.Insert(index, item);
 }
Example #10
0
 /// <summary>
 /// Add a <see cref="GraphObj"/> object to the <see cref="GraphObjList"/>
 /// collection at the end of the list.
 /// </summary>
 /// <param name="item">A reference to the <see cref="GraphObj"/> object to
 /// be added</param>
 /// <seealso cref="IList.Add"/>
 public GraphObj Add(GraphObj item)
 {
     List.Add(item);
     return(item);
 }
Example #11
0
 public ScaledRetentionTime FindSpectrumRetentionTime(GraphObj graphObj)
 {
     var tag = graphObj.Tag as GraphObjTag;
     if (null == tag || !ReferenceEquals(this, tag.ChromGraphItem))
     {
         return ScaledRetentionTime.ZERO;
     }
     if (GraphObjType.ms_ms_id != tag.GraphObjType)
     {
         return ScaledRetentionTime.ZERO;
     }
     return tag.RetentionTime;
 }
Example #12
0
 /// <summary>
 /// Insert a <see cref="GraphObj"/> object into the collection
 /// at the specified zero-based index location.
 /// </summary>
 /// <param name="index">The zero-based index location for insertion.</param>
 /// <param name="item">The <see cref="GraphObj"/> object that is to be
 /// inserted.</param>
 /// <seealso cref="IList.Insert"/>
 public void Insert( int index, GraphObj item )
 {
     List.Insert( index, item );
 }
 private void checkOverlaps(GraphObj current, GraphObj next)
 {
     if (current.Location.X2 > next.Location.X1)
     {
         double overlapWidth = current.Location.X2 - next.Location.X1;
         BoxObj overlapBox1 = new BoxObj(next.Location.X1, Math.Floor(current.Location.Y), overlapWidth, 1, _overlapColor, _overlapColor)
         {
             IsClippedToChartRect = true
         };
         zgIsolationGraph.GraphPane.GraphObjList.Add(overlapBox1);
         _overlapBoxes.Add(overlapBox1);
     }
 }
Example #14
0
 public void Add(GraphObj value)
 {
     list.Add(value);
 }
Example #15
0
        /// <summary>
        /// Render text to the specified <see cref="Graphics"/> device
        /// by calling the Draw method of each <see cref="GraphObj"/> object in
        /// the collection.
        /// </summary>
        /// <remarks>This method is normally only called by the Draw method
        /// of the parent <see cref="GraphPane"/> object.
        /// </remarks>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="PaneBase"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="zOrder">A <see cref="ZOrder"/> enumeration that controls
        /// the placement of this <see cref="GraphObj"/> relative to other
        /// graphic objects.  The order of <see cref="GraphObj"/>'s with the
        /// same <see cref="ZOrder"/> value is control by their order in
        /// this <see cref="GraphObjList"/>.</param>
        public void Draw(Graphics g, PaneBase pane, float scaleFactor,
                         ZOrder zOrder)
        {
            GraphPane graphPane = pane as GraphPane;
            int       minX      = int.MinValue;
            int       maxX      = int.MaxValue;
            int       minY      = int.MinValue;
            int       maxY      = int.MaxValue;
            bool      isOptDraw = false;

            if (graphPane != null)
            {
                isOptDraw = true;
                minX      = (int)graphPane.Chart.Rect.Left;
                maxX      = (int)graphPane.Chart.Rect.Right;
                minY      = (int)graphPane.Chart.Rect.Top;
                maxY      = (int)graphPane.Chart.Rect.Bottom;
                if (isOptDraw)
                {
                    if (isPixelDrawn == null)
                    {
                        isPixelDrawn = new MultiDimBitArray(maxX, maxY);
                    }
                    else
                    {
                        isPixelDrawn.TryResize(maxX, maxY);
                    }
                }
            }



            // Draw the items in reverse order, so the last items in the
            // list appear behind the first items (consistent with
            // CurveList)
            List <GraphObj> graphObjs = zOrderList[(int)zOrder];

            for (int i = graphObjs.Count - 1; i >= 0; i--)
            {
                GraphObj item = graphObjs[i];
                PointF   pix  = item.Location.Transform(pane);
                if (item.ZOrder == zOrder && item.IsVisible &&
                    pix.X >= minX && pix.X <= maxX &&
                    pix.Y >= minY && pix.Y <= maxY)
                {
                    // Don't try to draw where we already drew.
                    // This is a huge optimization when there are
                    // many more draw items than pixels in the rectangle.
                    if (isPixelDrawn[(int)pix.X, (int)pix.Y])
                    {
                        continue;
                    }
                    isPixelDrawn[(int)pix.X, (int)pix.Y] = true;

                    Region region = null;
                    if (item.IsClippedToChartRect && pane is GraphPane)
                    {
                        region = g.Clip.Clone();
                        g.SetClip(((GraphPane)pane).Chart._rect);
                    }

                    item.Draw(g, pane, scaleFactor);

                    if (item.IsClippedToChartRect && pane is GraphPane)
                    {
                        g.Clip = region;
                    }
                }
            }
        }
Example #16
0
 private bool IsYChartFractionObject(GraphObj obj)
 {
     return obj.Location.CoordinateFrame == CoordType.XPaneFractionYChartFraction ||
            obj.Location.CoordinateFrame == CoordType.ChartFraction ||
            obj.Location.CoordinateFrame == CoordType.XScaleYChartFraction;
 }
Example #17
0
 private bool isXChartFractionObject(GraphObj obj)
 {
     return obj.Location.CoordinateFrame == CoordType.XChartFractionYPaneFraction ||
            obj.Location.CoordinateFrame == CoordType.ChartFraction ||
            obj.Location.CoordinateFrame == CoordType.XChartFractionYScale ||
            obj.Location.CoordinateFrame == CoordType.XChartFractionY2Scale;
 }
        private BoxObj GetOverLapRay(GraphObj top, GraphObj bottom)
        {
            if (bottom.Location.X2 > top.Location.X1 &&
                bottom.Location.X2 <= top.Location.X2)
            {
                double x1 = Math.Max(top.Location.X1, bottom.Location.X1);
                double y1 = top.Location.Y1;
                double width = bottom.Location.X2 - x1;
                double height = bottom.Location.Y1 - top.Location.Y1;
                return new BoxObj(x1,y1,width,height,
                    Color.FromArgb(0,0,0,0),_overlapRayColor)
                {
                    IsClippedToChartRect = true
                };
            }
            else if (bottom.Location.X1 < top.Location.X2 &&
                     bottom.Location.X1 >= top.Location.X1)
            {
                double x1 = bottom.Location.X1;
                double y1 = top.Location.Y1;
                double height = bottom.Location.Y1 - top.Location.Y1;
                double width = Math.Min(bottom.Location.X2, top.Location.X2) - x1;
                return new BoxObj(x1, y1, width, height,
                    Color.FromArgb(0, 0, 0, 0), _overlapRayColor)
                {
                    IsClippedToChartRect = true

                };
            }
            else if (top.Location.X1 > bottom.Location.X1 && top.Location.X2 < bottom.Location.X2)
            {
                double x1 = top.Location.X1;
                double y1 = top.Location.Y1;
                double width = top.Location.Width;
                double height = bottom.Location.Y1 - top.Location.Y1;
                return new BoxObj(x1, y1, width, height,
                    Color.FromArgb(0, 0, 0, 0), _overlapRayColor)
                {
                    IsClippedToChartRect = true
                };
            }
            else
            {
                return null;
            }
        }
Example #19
0
 /// <summary>
 /// Add a <see cref="GraphObj"/> object to the <see cref="GraphObjList"/>
 /// collection at the end of the list.
 /// </summary>
 /// <param name="item">A reference to the <see cref="GraphObj"/> object to
 /// be added</param>
 /// <seealso cref="IList.Add"/>
 public GraphObj Add( GraphObj item )
 {
     List.Add( item );
     return item;
 }