Пример #1
0
        public static double PixelToProj(this AxMap map, int pixel)
        {
            double h1, w1, h2, w2;

            h1 = h2 = w1 = w2 = 0.0;
            map.PixelToProj(0, 0, ref w1, ref h1);
            map.PixelToProj(0, -pixel, ref w2, ref h2);
            return(Math.Abs(h1 - h2));
        }
Пример #2
0
        /// <summary>
        /// processes selection made using a mouse drag selection box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMapSelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e)
        {
            if (EnableMapInteraction && _axMap.CursorMode == tkCursorMode.cmSelection)
            {
                var     extL = 0D;
                var     extR = 0D;
                var     extT = 0D;
                var     extB = 0D;
                Extents selectionBoxExtent = new Extents();

                _axMap.PixelToProj(e.left, e.top, ref extL, ref extT);
                _axMap.PixelToProj(e.right, e.bottom, ref extR, ref extB);
                selectionBoxExtent.SetBounds(extL, extB, 0, extR, extT, 0);
                Select(selectionBoxExtent, selectionFromSelectBox: true);
            }
        }
Пример #3
0
        public static double PointTolerance(this AxMap map, ShapeDrawingOptions opt, ShpfileType shpType)
        {
            switch (shpType)
            {
            case ShpfileType.SHP_POINT:
                double w = 0.0, h = 0.0, w1 = 0.0, h1 = 0.0;
                var    img = opt.Picture;
                map.PixelToProj(0, 0, ref w, ref h);
                map.PixelToProj(img != null ? img.Width : opt.PointSize, img != null ? img.Height : opt.PointSize,
                                ref w1, ref h1);
                return((Math.Abs(w1 - w) + Math.Abs(h1 - h)) / 2.0);

            default:
                return(0.0);
            }
        }
        private void OnMapMouseMove(object sender, _DMapEvents_MouseMoveEvent e)
        {
            double utmX = 0, utmY = 0;

            _mapControl.PixelToProj(e.x, e.y, ref utmX, ref utmY);
            var g25Coord = FishingGrid.utmCoordinatesToGrid25(utmX, utmY, _majorGrid.UTMZone);

            txtCoord.Text = $"UTM: {_utmZone} {utmX.ToString("N0")}, {utmY.ToString("N0")}\r\nGrid25: {g25Coord.grid25Name}";
        }
Пример #5
0
        /// <summary>
        ///  define the extent of the template shapedfile and pass the extent to the function
        ///  that will create the individual tiles (polygon shapes) comprising the template
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMapSelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e)
        {
            if (_axMap.CursorMode == tkCursorMode.cmSelection && _axMap.UDCursorHandle == _hCursorDefineLayout)
            {
                var extL = 0D;
                var extR = 0D;
                var extT = 0D;
                var extB = 0D;

                _axMap.PixelToProj(e.left, e.top, ref extL, ref extT);
                _axMap.PixelToProj(e.right, e.bottom, ref extR, ref extB);

                _layoutExtents = new Extents();
                _layoutExtents.SetBounds(
                    (int)(extL / 2000) * 2000,
                    (int)(extB / 2000) * 2000,
                    0,
                    (int)(extR / 2000) * 2000,
                    (int)(extT / 2000) * 2000,
                    0);

                //modify layout extents using the function called
                _layoutExtents = IntersectSelectionBoxWithMajorGridSelection();

                if (_layoutExtents != null && LayerCreated != null)
                {
                    Grid25LayoutHelperEventArgs lhe = new Grid25LayoutHelperEventArgs(_layoutExtents);
                    LayerCreated(this, lhe);
                    SetupLayout(lhe.Rows, lhe.Columns, lhe.Overlap);
                }
                else if (_layoutExtents == null)
                {
                    if (LayerCreated != null)
                    {
                        Grid25LayoutHelperEventArgs gle = new Grid25LayoutHelperEventArgs(nullLayout: true);
                        LayerCreated(this, gle);
                    }
                }
                LayoutTemplateFromFile = false;
            }
        }