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

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

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

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

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

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

            absoluteSize.Width  -= 1f;
            absoluteSize.Height -= 1f;
            SizeF  sizeF = new SizeF((absoluteSize.Width - num) / 2f, (absoluteSize.Height - num) / 2f);
            float  num2  = num / 3f;
            PointF empty = PointF.Empty;

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

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

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

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

            case PanelButtonType.NaviagateCenter:
                empty = new PointF(num / 2f, num / 2f);
                break;

            default:
                throw new ArgumentException(SR.invalid_button_type);
            }
            num2 -= 4f;
            RectangleF absolute = new RectangleF(sizeF.Width + empty.X - num2 / 2f, sizeF.Height + empty.Y - num2 / 2f, num2, num2);

            button.Bounds = g.GetRelativeRectangle(absolute);
            button.Render(g);
        }
 internal NavigationPanel(CommonElements common)
     : base(common)
 {
     Name         = "NavigationPanel";
     buttonNorth  = new PanelButton(this, PanelButtonType.NavigationButton, NavigationButtonClickHandler);
     buttonSouth  = new PanelButton(this, PanelButtonType.NaviagateSouth, NavigationButtonClickHandler);
     buttonEast   = new PanelButton(this, PanelButtonType.NaviagateEast, NavigationButtonClickHandler);
     buttonWest   = new PanelButton(this, PanelButtonType.NaviagateWest, NavigationButtonClickHandler);
     buttonCenter = new PanelButton(this, PanelButtonType.NaviagateCenter, NavigationButtonClickHandler);
     ApplyStyle();
     ApplyColors();
 }
Exemple #4
0
        private void RenderButton(MapGraphics g, PanelButton button)
        {
            float markerLength = Pointer.MarkerLength;

            markerLength += 5f;
            float  num  = 0f;
            float  num2 = 0f;
            float  num3;
            PointF relative;

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

            absolute.Inflate(num3 / 2f, num3 / 2f);
            button.Bounds = g.GetRelativeRectangle(absolute);
            button.Render(g);
        }
Exemple #5
0
        internal ZoomPanel(CommonElements common)
            : base(common)
        {
            Name    = "ZoomPanel";
            scale   = new LinearScale(this);
            pointer = new LinearPointer(this);
            MapCore mapCore = GetMapCore();

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

            Scale.MinorTickMark.Interval = tickMarksInterval;
            Pointer.Placement            = Placement.Cross;
            if (mapCore != null && mapCore.Viewport != null)
            {
                Pointer.Position = mapCore.Viewport.Zoom;
            }
            Pointer.SnappingEnabled  = true;
            Pointer.SnappingInterval = tickMarksInterval;
            Pointer.FillGradientType = GradientType.None;
            Pointer.FillHatchStyle   = MapHatchStyle.None;
            Pointer.ShadowOffset     = 0f;
            if (mapCore != null && mapCore.Viewport != null)
            {
                ZoomLevel = mapCore.Viewport.Zoom;
            }
            zoomInButton  = new PanelButton(this, PanelButtonType.ZoomButton, PanelButtonStyle.RoundedRectangle, zoomButtonClickHandler);
            zoomOutButton = new PanelButton(this, PanelButtonType.ZoomOut, PanelButtonStyle.RoundedRectangle, zoomButtonClickHandler);
            ApplyStyle();
            ApplyColors();
        }