예제 #1
0
        /// <summary>
        /// <see cref="Object.Equals(object)"/>
        /// </summary>
        public override bool Equals(object obj)
        {
            Graph2D G = obj as Graph2D;

            if (G == null)
            {
                return(false);
            }

            return(
                this.minX.Equals(G.minX) &&
                this.maxX.Equals(G.maxX) &&
                this.minY.Equals(G.minY) &&
                this.maxY.Equals(G.maxY) &&
                this.axisTypeX.Equals(G.axisTypeX) &&
                this.axisTypeY.Equals(G.axisTypeY) &&
                this.labelX.Equals(G.labelX) &&
                this.labelY.Equals(G.labelY) &&
                this.showXAxis.Equals(G.showXAxis) &&
                this.showYAxis.Equals(G.showYAxis) &&
                this.showGrid.Equals(G.showGrid) &&
                this.Equals(this.x.GetEnumerator(), G.x.GetEnumerator()) &&
                this.Equals(this.y.GetEnumerator(), G.y.GetEnumerator()) &&
                this.Equals(this.parameters.GetEnumerator(), G.parameters.GetEnumerator()) &&
                this.Equals(this.callbacks.GetEnumerator(), G.callbacks.GetEnumerator()));
        }
예제 #2
0
        /// <summary>
        /// Tries to add an element to the current element, from the right.
        /// </summary>
        /// <param name="Element">Element to add.</param>
        /// <returns>Result, if understood, null otherwise.</returns>
        public override ISemiGroupElement AddRight(ISemiGroupElement Element)
        {
            if (this.x.First == null)
            {
                return(Element);
            }

            Graph2D G = Element as Graph2D;

            if (G == null)
            {
                return(null);
            }

            if (G.x.First == null)
            {
                return(this);
            }

            Graph2D Result = new Graph2D()
            {
                axisTypeX = this.axisTypeX,
                axisTypeY = this.axisTypeY
            };

            foreach (IVector v in this.x)
            {
                Result.x.AddLast(v);
            }

            foreach (IVector v in this.y)
            {
                Result.y.AddLast(v);
            }

            foreach (DrawCallback Callback in this.callbacks)
            {
                Result.callbacks.AddLast(Callback);
            }

            foreach (object[] P in this.parameters)
            {
                Result.parameters.AddLast(P);
            }

            foreach (IVector v in G.x)
            {
                if (v.GetType() != this.axisTypeX)
                {
                    throw new ScriptException("Incompatible types of series.");
                }

                Result.x.AddLast(v);
            }

            foreach (IVector v in G.y)
            {
                if (v.GetType() != this.axisTypeY)
                {
                    throw new ScriptException("Incompatible types of series.");
                }

                Result.y.AddLast(v);
            }

            foreach (DrawCallback Callback in G.callbacks)
            {
                Result.callbacks.AddLast(Callback);
            }

            foreach (object[] P in G.parameters)
            {
                Result.parameters.AddLast(P);
            }

            Result.minX = Min.CalcMin((IVector)VectorDefinition.Encapsulate(new IElement[] { this.minX, G.minX }, false, null), null);
            Result.maxX = Max.CalcMax((IVector)VectorDefinition.Encapsulate(new IElement[] { this.maxX, G.maxX }, false, null), null);
            Result.minY = Min.CalcMin((IVector)VectorDefinition.Encapsulate(new IElement[] { this.minY, G.minY }, false, null), null);
            Result.maxY = Max.CalcMax((IVector)VectorDefinition.Encapsulate(new IElement[] { this.maxY, G.maxY }, false, null), null);

            Result.showXAxis |= G.showXAxis;
            Result.showYAxis |= G.showYAxis;

            return(Result);
        }