地图分幅算法实现

关于地图分幅算法的AE实现,下面是C#代码~

 public enum ScaleMark { A, B, C, D, E, F, G, H };//不同比例尺的号码
        private int m_1s1000000_row;//1:100万图幅行
        private int m_1s1000000_list;//1:100万图幅列
        private int m_assign_row;//指定比例尺图幅行
        private int m_assign_list;//指定比例尺图幅列
        private int m_scale;//指定比例尺;

        private FrmGeocodingExport pFGE;
        private esriUnits m_CurMapUnits;


 

        #region 图幅号计算函数
        private IEnvelope FromGeocodingDawn()
        {

            //计算要素的值
            int h = this.m_1s1000000_row ;//1:100万行号
            int l = this.m_1s1000000_list ;//1:100万列号

            ScaleMark ScaleMark_1s1000000 = new ScaleMark();
            IPoint scaleDelta_1s1000000 = new PointClass();
            ScaleMark_1s1000000 = 0;
            this.initialScaleMark(ScaleMark_1s1000000, scaleDelta_1s1000000);

            double delta_x = scaleDelta_1s1000000.X;//1:100万经差(度)
            double delta_y = scaleDelta_1s1000000.Y;//1:100万纬差(度)

            ScaleMark pScaleMark = new ScaleMark();
            IPoint scaleDelta = new PointClass();
            pScaleMark = (ScaleMark )m_scale ;
            this.initialScaleMark(pScaleMark , scaleDelta);

            double delta_xp = scaleDelta.X;//1:10万经差(度)
            double delta_yp = scaleDelta.Y;//1:10万纬差(度)

            int hp = m_assign_row;
            int lp = m_assign_list;

            IEnvelope pEnvelope = new EnvelopeClass();

            if (m_assign_list != 0 && m_assign_row != 0)
            {
                //进行指定图幅号左上角点经纬度计算
                double ymax = h * delta_y - (hp - 1) * delta_yp; //纬度
                double xmin = (l - 31) * delta_x + (lp - 1) * delta_xp;//经度

                //推算指定图幅号右下角点坐标
                double ymin = ymax - delta_yp;
                double xmax = xmin + delta_xp;

                //将点转换成地图存储单位Map(Metres)  convertUnits
                //esriUnits CurMapUnits = this.axMapControl1.Map.MapUnits;
                IUnitConverter UC_map = new UnitConverterClass();

                double yMax = UC_map.ConvertUnits(ymax, esriUnits.esriDecimalDegrees, m_CurMapUnits);
                double yMin = UC_map.ConvertUnits(ymin, esriUnits.esriDecimalDegrees, m_CurMapUnits);

                double xMax = UC_map.ConvertUnits(xmax, esriUnits.esriDecimalDegrees, m_CurMapUnits);
                double xMin = UC_map.ConvertUnits(xmin, esriUnits.esriDecimalDegrees, m_CurMapUnits);

                pEnvelope.PutCoords(xMin, yMin, xMax, yMax);

                return pEnvelope;
            }
            else
            {             
                return null;
            }

        }
        #endregion

 

        #region 各比例尺经纬度差

        private void initialScaleMark(ScaleMark pScaleMark, IPoint scaleDelta)
        {
            //IPoint[] scaleArr = new IPoint[8];
            //IPoint scaleDelta = new PointClass();

            switch (pScaleMark)
            {
                case ScaleMark.A:
                    scaleDelta.X = 6;//1:100万经差(度)
                    scaleDelta.Y = 4;//1:100万纬差(度)
                    break;
                case ScaleMark.B:
                    scaleDelta.X = 3;//1:50万经差(度)
                    scaleDelta.Y = 2;//1:50万纬差(度)  
                    break;
                case ScaleMark.C:
                    scaleDelta.X = 1.5;//1:25万经差(度)
                    scaleDelta.Y = 1;//1:25万纬差(度)
                    break;
      

转载于:https://www.cnblogs.com/j3eee/archive/2009/02/24/1396901.html

你可能感兴趣的:(python,c#,java)