예제 #1
0
        protected void DrawUnits(Cairo.Context g, Cairo.Distance dimensions)
        {
            g.Save();

            g.MoveTo(105, 105);
            g.LineTo(105, 205);
            g.LineTo(205, 205);
            g.LineTo(205, 105);
            g.LineTo(105, 105);

            g.Restore();

            g.Color = MapWidget.convert_color(this.blue);
            g.FillPreserve();
            g.Color     = MapWidget.convert_color(this.black);
            g.LineWidth = 1;
            g.Stroke();
        }
예제 #2
0
        protected void DrawMouse(Cairo.Context g, Cairo.Distance dimensions)
        {
            if (this.drawmouse)
            {
                g.Save();

                g.MoveTo((double)this.mouse_loc.X, 0);
                g.LineTo((double)this.mouse_loc.X, dimensions.Dy);

                g.MoveTo(0, (double)this.mouse_loc.Y);
                g.LineTo(dimensions.Dx, (double)this.mouse_loc.Y);

                g.Restore();

                g.Color     = MapWidget.convert_color(this.red);
                g.LineWidth = 1;
                g.Stroke();
            }
        }
예제 #3
0
        protected void DrawMapGrid(Cairo.Context g, Cairo.Distance dimensions)
        {
            g.Save();

            double xspan = dimensions.Dx / MapWidget.xgridlines;
            double yspan = dimensions.Dy / MapWidget.ygridlines;

            xspan = yspan = 10.0;

            //Console.WriteLine ("dimensions={0}:{1}  span={2}:{3}", dimensions.Dx, dimensions.Dy, xspan, yspan);

            /*
             * dimensions=1000:1000  span=1000:10
             * dimensions=1000:1000  span=1000:10
             * dimensions=1428:1000  span=1000:14.28
             */

            Cairo.PointD location = new Cairo.PointD(0.0, 0.0);

            // move along x axis
            for (int i = 0; i < MapWidget.xgridlines; i++)
            {
                location.X += xspan;
                Cairo.PointD p = new Cairo.PointD(location.X, 0);
                g.MoveTo(p);
                g.LineTo(location.X, ysize);
            }
            // move along y axis
            for (int i = 0; i < MapWidget.ygridlines; i++)
            {
                location.Y += yspan;
                Cairo.PointD p = new Cairo.PointD(0, location.Y);
                g.MoveTo(p);
                g.LineTo(xsize, location.Y);
            }

            g.Restore();
            //g.Color = new Cairo.Color (86.0, 86.0, 86.0);
            g.Color     = MapWidget.convert_color(this.gray);
            g.LineWidth = 1;
            g.Stroke();
        }