private void NavigationButtonClickHandler(object sender, EventArgs e)
        {
            PanelButton panelButton = (PanelButton)sender;
            MapCore     mapCore     = base.GetMapCore();

            if (mapCore != null)
            {
                switch (panelButton.Type)
                {
                case (PanelButtonType)35:
                    break;

                case PanelButtonType.NavigationButton:
                    mapCore.Scroll(ScrollDirection.North, this.ScrollStep);
                    break;

                case PanelButtonType.NaviagateSouth:
                    mapCore.Scroll(ScrollDirection.South, this.ScrollStep);
                    break;

                case PanelButtonType.NaviagateEast:
                    mapCore.Scroll(ScrollDirection.East, this.ScrollStep);
                    break;

                case PanelButtonType.NaviagateWest:
                    mapCore.Scroll(ScrollDirection.West, this.ScrollStep);
                    break;
                }
            }
        }
        private void RenderButton(MapGraphics g, PanelButton button)
        {
            float num          = (float)(g.GetAbsoluteDimension(100f) - 1.0);
            SizeF absoluteSize = g.GetAbsoluteSize(new SizeF(100f, 100f));

            absoluteSize.Width  -= 1f;
            absoluteSize.Height -= 1f;
            SizeF  sizeF  = new SizeF((float)((absoluteSize.Width - num) / 2.0), (float)((absoluteSize.Height - num) / 2.0));
            float  num2   = (float)(num / 3.0);
            PointF pointF = PointF.Empty;

            switch (button.Type)
            {
            case PanelButtonType.NavigationButton:
                pointF = new PointF((float)(num / 2.0), (float)(num2 / 2.0));
                if (!this.CenterButtonVisible)
                {
                    pointF.Y += 2f;
                }
                break;

            case PanelButtonType.NaviagateSouth:
                pointF = new PointF((float)(num / 2.0), (float)(num - num2 / 2.0));
                if (!this.CenterButtonVisible)
                {
                    pointF.Y -= 2f;
                }
                break;

            case PanelButtonType.NaviagateEast:
                pointF = new PointF((float)(num - num2 / 2.0), (float)(num / 2.0));
                if (!this.CenterButtonVisible)
                {
                    pointF.X -= 2f;
                }
                break;

            case PanelButtonType.NaviagateWest:
                pointF = new PointF((float)(num2 / 2.0), (float)(num / 2.0));
                if (!this.CenterButtonVisible)
                {
                    pointF.X += 2f;
                }
                break;

            case PanelButtonType.NaviagateCenter:
                pointF = new PointF((float)(num / 2.0), (float)(num / 2.0));
                break;

            default:
                throw new ArgumentException(SR.invalid_button_type);
            }
            num2 = (float)(num2 - 4.0);
            RectangleF absolute = new RectangleF((float)(sizeF.Width + pointF.X - num2 / 2.0), (float)(sizeF.Height + pointF.Y - num2 / 2.0), num2, num2);

            button.Bounds = g.GetRelativeRectangle(absolute);
            button.Render(g);
        }
 public NavigationPanel(CommonElements common)
     : base(common)
 {
     this.Name         = "NavigationPanel";
     this.buttonNorth  = new PanelButton(this, PanelButtonType.NavigationButton, this.NavigationButtonClickHandler);
     this.buttonSouth  = new PanelButton(this, PanelButtonType.NaviagateSouth, this.NavigationButtonClickHandler);
     this.buttonEast   = new PanelButton(this, PanelButtonType.NaviagateEast, this.NavigationButtonClickHandler);
     this.buttonWest   = new PanelButton(this, PanelButtonType.NaviagateWest, this.NavigationButtonClickHandler);
     this.buttonCenter = new PanelButton(this, PanelButtonType.NaviagateCenter, this.NavigationButtonClickHandler);
     this.ApplyStyle();
     this.ApplyColors();
 }
Exemplo n.º 4
0
        public ZoomPanel(CommonElements common)
            : base(common)
        {
            this.Name    = "ZoomPanel";
            this.scale   = new LinearScale(this);
            this.pointer = new LinearPointer(this);
            MapCore mapCore = base.GetMapCore();

            this.Scale.LabelStyle.Visible           = false;
            this.Scale.MajorTickMark.Visible        = false;
            this.Scale.MinorTickMark.Length         = 30f;
            this.Scale.MinorTickMark.Width          = 10f;
            this.Scale.MinorTickMark.EnableGradient = false;
            this.Scale.FillGradientType             = GradientType.None;
            this.Scale.FillHatchStyle = MapHatchStyle.None;
            this.Scale.ShadowOffset   = 0f;
            this.Scale.BorderWidth    = 1;
            this.Scale.Width          = 15f;
            this.Scale.Minimum        = 0.0;
            this.Scale.Maximum        = 100.00000000001;
            double tickMarksInterval = this.GetTickMarksInterval(this.TickCount);

            this.Scale.MinorTickMark.Interval = tickMarksInterval;
            this.Pointer.Placement            = Placement.Cross;
            if (mapCore != null && mapCore.Viewport != null)
            {
                this.Pointer.Position = (double)mapCore.Viewport.Zoom;
            }
            this.Pointer.SnappingEnabled  = true;
            this.Pointer.SnappingInterval = tickMarksInterval;
            this.Pointer.FillGradientType = GradientType.None;
            this.Pointer.FillHatchStyle   = MapHatchStyle.None;
            this.Pointer.ShadowOffset     = 0f;
            if (mapCore != null && mapCore.Viewport != null)
            {
                this.ZoomLevel = (double)mapCore.Viewport.Zoom;
            }
            this.zoomInButton  = new PanelButton(this, PanelButtonType.ZoomButton, PanelButtonStyle.RoundedRectangle, this.zoomButtonClickHandler);
            this.zoomOutButton = new PanelButton(this, PanelButtonType.ZoomOut, PanelButtonStyle.RoundedRectangle, this.zoomButtonClickHandler);
            this.ApplyStyle();
            this.ApplyColors();
        }
Exemplo n.º 5
0
        private void RenderButton(MapGraphics g, PanelButton button)
        {
            float markerLength = this.Pointer.MarkerLength;

            markerLength = (float)(markerLength + 5.0);
            float  num  = 0f;
            float  num2 = 0f;
            float  relativeY;
            float  num3;
            PointF relative;
            float  relativeX;

            if (this.GetOrientation() == Orientation.Horizontal)
            {
                relativeY    = (float)((100.0 - markerLength) / 2.0);
                relativeY    = g.GetRelativeX(g.GetAbsoluteY(relativeY));
                markerLength = g.GetRelativeX(g.GetAbsoluteY(markerLength));
                num3         = g.GetAbsoluteX(markerLength);
                relative     = new PointF((float)(markerLength / 2.0 + relativeY), 50f);
                if (button.Type == PanelButtonType.ZoomOut && this.GetReversed())
                {
                    goto IL_00a1;
                }
                if (button.Type == PanelButtonType.ZoomButton && !this.GetReversed())
                {
                    goto IL_00a1;
                }
            }
            else
            {
                relativeX    = (float)((100.0 - markerLength) / 2.0);
                relativeX    = g.GetRelativeY(g.GetAbsoluteX(relativeX));
                markerLength = g.GetRelativeY(g.GetAbsoluteX(markerLength));
                num3         = g.GetAbsoluteY(markerLength);
                relative     = new PointF(50f, (float)(markerLength / 2.0 + relativeX));
                if (button.Type == PanelButtonType.ZoomOut && !this.GetReversed())
                {
                    goto IL_0126;
                }
                if (button.Type == PanelButtonType.ZoomButton && this.GetReversed())
                {
                    goto IL_0126;
                }
            }
            goto IL_0138;
IL_00a1:
            num = (float)(100.0 - markerLength - 2.0 * relativeY);
            goto IL_0138;
IL_0126:
            num2 = (float)(100.0 - markerLength - 2.0 * relativeX);
            goto IL_0138;
IL_0138:
            relative.X += num;
            relative.Y += num2;
            relative    = g.GetAbsolutePoint(relative);
            RectangleF absolute = new RectangleF(relative.X, relative.Y, 0f, 0f);

            absolute.Inflate((float)(num3 / 2.0), (float)(num3 / 2.0));
            button.Bounds = g.GetRelativeRectangle(absolute);
            button.Render(g);
        }