예제 #1
0
        public void MapButtonClick(object sender, EventArgs e)
        {
            GISMapActions action = GISMapActions.zoomin;

            if ((Button)sender == button3)
            {
                action = GISMapActions.zoomin;
            }
            else if ((Button)sender == button4)
            {
                action = GISMapActions.zoomout;
            }
            else if ((Button)sender == button5)
            {
                action = GISMapActions.moveup;
            }
            else if ((Button)sender == button6)
            {
                action = GISMapActions.movedown;
            }
            else if ((Button)sender == button7)
            {
                action = GISMapActions.moveleft;
            }
            else if ((Button)sender == button8)
            {
                action = GISMapActions.moveright;
            }
            view.ChangeView(action);
            UpdateMap();
        }
예제 #2
0
        double MovingFactor  = 0.25; //移动因子

        public void ChangeExtent(GISMapActions action)
        {
            double newminx = bottomleft.x, newminy = bottomleft.y,
                   newmaxx = upright.x, newmaxy = upright.y;

            switch (action)
            {
            case GISMapActions.zoomin:
                newminx = ((getMinX() + getMaxX()) - getWidth() / ZoomingFactor) / 2;
                newminy = ((getMinY() + getMaxY()) - getHeight() / ZoomingFactor) / 2;
                newmaxx = ((getMinX() + getMaxX()) + getWidth() / ZoomingFactor) / 2;
                newmaxy = ((getMinY() + getMaxY()) + getHeight() / ZoomingFactor) / 2;
                break;

            case GISMapActions.zoomout:
                newminx = ((getMinX() + getMaxX()) - getWidth() * ZoomingFactor) / 2;
                newminy = ((getMinY() + getMaxY()) - getHeight() * ZoomingFactor) / 2;
                newmaxx = ((getMinX() + getMaxX()) + getWidth() * ZoomingFactor) / 2;
                newmaxy = ((getMinY() + getMaxY()) + getHeight() * ZoomingFactor) / 2;
                break;

            case GISMapActions.moveup:
                newminy = getMinY() - getHeight() * MovingFactor;
                newmaxy = getMaxY() - getHeight() * MovingFactor;
                break;

            case GISMapActions.movedown:
                newminy = getMinY() + getHeight() * MovingFactor;
                newmaxy = getMaxY() + getHeight() * MovingFactor;
                break;

            case GISMapActions.moveleft:
                newminx = getMinX() + getWidth() * MovingFactor;
                newmaxx = getMaxX() + getWidth() * MovingFactor;
                break;

            case GISMapActions.moveright:
                newminx = getMinX() - getWidth() * MovingFactor;
                newmaxx = getMaxX() - getWidth() * MovingFactor;
                break;
            }
            upright.x    = newmaxx;
            upright.y    = newmaxy;
            bottomleft.x = newminx;
            bottomleft.y = newminy;
        }
예제 #3
0
 public void ChangeView(GISMapActions action)
 {
     CurrentMapExtent.ChangeExtent(action);
     Update(CurrentMapExtent, MapWindowsSize);
 }