Beispiel #1
0
 public LinearAccessRefExpr(ParserRuleContext sourceLocation, Variable variable, LinearType linearType)
 {
     SourceLocation = sourceLocation;
     Variable       = variable;
     LinearType     = linearType;
     Type           = variable.Type;
 }
Beispiel #2
0
 /// <summary>
 /// The constructor of the LinearEquation class.
 /// </summary>
 /// <param name="pt">The specified point.</param>
 /// <param name="type">The type of the special line.</param>
 public LinearEquation(Point pt, LinearType type)
 {
     if (LinearType.ParallelXAxis == type)
     {
         this.slope = 0.0;
         this.bias  = pt.Y;
     }
     else
     {
         this.slope = Double.PositiveInfinity;
         this.bias  = pt.X;
     }
 }
 /// <summary>
 /// The constructor of the LinearEquation class.
 /// </summary>
 /// <param name="pt">The specified point.</param>
 /// <param name="type">The type of the special line.</param>
 public LinearEquation(Point pt, LinearType type)
 {
     if (LinearType.ParallelXAxis == type)
     {
         this.slope = 0.0;
         this.bias = pt.Y;
     }
     else
     {
         this.slope = Double.PositiveInfinity;
         this.bias = pt.X;
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="_bitmap"></param>
        /// <param name="_x"></param>
        /// <param name="_y"></param>
        /// <param name="_type"></param>
        /// <param name="_color"></param>
        /// <param name="_height"></param>
        /// <param name="_weight"></param>
        /// <returns></returns>
        private int GetValue(Bitmap _bitmap, int _x, int _y, LinearType _type, string _color, int _height, int _weight)
        {
            List <int> values = new List <int>();

            if (this.CheckValue(_x, _y, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x, _y, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }
            if (this.CheckValue(_x - 1, _y - 1, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x - 1, _y - 1, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }
            if (this.CheckValue(_x - 1, _y, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x - 1, _y, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }
            if (this.CheckValue(_x - 1, _y + 1, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x - 1, _y + 1, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }


            if (this.CheckValue(_x, _y - 1, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x, _y - 1, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }

            if (this.CheckValue(_x, _y, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x, _y, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }

            if (this.CheckValue(_x, _y + 1, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x, _y + 1, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }

            if (this.CheckValue(_x + 1, _y - 1, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x + 1, _y - 1, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }


            if (this.CheckValue(_x + 1, _y, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x + 1, _y, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }

            if (this.CheckValue(_x + 1, _y + 1, _height, _weight) == true)
            {
                int valueColor = this.GetColor(_bitmap, _x + 1, _y + 1, _color);
                values.Add(valueColor);
            }
            else
            {
                values.Add(0);
            }


            if (_type == LinearType.Max)
            {
                return(values.Max());
            }
            if (_type == LinearType.Min)
            {
                return(values.Min());
            }
            return(0);
        }
 public LinearFilter(LinearType _type)
 {
     this.type = _type;
 }