Ejemplo n.º 1
0
		// TODO: Move this to FigureCollection
		private RectangleD GetBounds (FigureCollection figures) {
			RectangleD rectangle = new RectangleD (0, 0, 0, 0);
			foreach (IFigure figure in figures) {
				rectangle.Add (figure.DisplayBox);
			}
			return rectangle;
		}
Ejemplo n.º 2
0
        // TODO: Move this to FigureCollection
        private RectangleD GetBounds(FigureCollection figures)
        {
            RectangleD rectangle = new RectangleD(0, 0, 0, 0);

            foreach (IFigure figure in figures)
            {
                rectangle.Add(figure.DisplayBox);
            }
            return(rectangle);
        }
Ejemplo n.º 3
0
        private void UpdateAdjustments()
        {
            RectangleD drawing_box = Drawing.DisplayBox;

            drawing_box.Add(VisibleArea);

            Hadjustment.PageSize      = Allocation.Width;
            Hadjustment.PageIncrement = Allocation.Width * 0.9;
            Hadjustment.StepIncrement = 1.0;
            Hadjustment.Lower         = drawing_box.X;
            Hadjustment.Upper         = drawing_box.X2;
            Hadjustment.Change();

            Vadjustment.PageSize      = Allocation.Height;
            Vadjustment.PageIncrement = Allocation.Height * 0.9;
            Vadjustment.StepIncrement = 1.0;
            Vadjustment.Lower         = drawing_box.Y;
            Vadjustment.Upper         = drawing_box.Y2;
            Vadjustment.Change();
        }
Ejemplo n.º 4
0
        public void RecalculateDisplayBox()
        {
            _displayBox = new RectangleD(0.0, 0.0);
            bool first_flag = true;

            foreach (IFigure figure in FiguresEnumerator)
            {
                if (first_flag)
                {
                    _displayBox = figure.DisplayBox;
                    first_flag  = false;
                }
                else
                {
                    _displayBox.Add(figure.DisplayBox);
                }
            }

            OnSizeAllocated();
        }
Ejemplo n.º 5
0
		public static bool LineContainsPoint (double x1, double y1, double x2, double y2, double px, double py) {
			RectangleD r = new RectangleD (new PointD (x1, y1));
			r.Add (x2, y2);
			r.Inflate (2.0, 2.0);
			if (!r.Contains (px, py)) {
				return false;
			}

			double a, b, x, y;

			if (x1 == x2) {
				return (Math.Abs (px - x1) < 3.0);
			}

			if (y1 == y2) {
				return (Math.Abs (py - y1) < 3.0);
			}
			a = (y1 - y2) / (x1 - x2);
			b = y1 - a * x1;
			x = (py - b) / a;
			y = a * px + b;

			return (Math.Min (Math.Abs (x - px), Math.Abs (y - py)) < 4.0);
		}
		public void RecalculateDisplayBox ()
		{
			_displayBox = new RectangleD (0.0, 0.0);
			bool first_flag = true;
			foreach (IFigure figure in FiguresEnumerator) {
				if (first_flag) {
					_displayBox = figure.DisplayBox;
					first_flag = false;
				} 
				else {
					_displayBox.Add (figure.DisplayBox);
				}
			}
			
			OnSizeAllocated ();
		}