/// <summary>
        /// 计算IGeometry的椭球面的面积
        /// 虚态
        /// </summary>
        /// <param name="geo">要计算的IGeometry几何对象</param>
        /// <returns>(IGeometry as IArea).Area</returns>
        public virtual decimal Compute(IGeometry geo)
        {
            decimal rbc = 0.0M;

            if (geo is IArea)
            {
                rbc = Maths.Todecimal((geo as IArea).Area);
            }
            return(rbc);
        }
        /// <summary>
        ///  计算IGeometry的椭球面的 理论面积
        /// </summary>
        /// <param name="geo">输入的分幅图的几何对象IGeometry(矩形状)</param>
        /// <returns>(单位:平方米)</returns>
        public override decimal Compute(IGeometry geo)
        {
            decimal P = 0.0M;
            //(1)最大最小角计算出WGS84大地经纬度坐标(四个点) 经差/纬差
            decimal xmin = Maths.Todecimal(geo.Envelope.XMin);
            decimal ymin = Maths.Todecimal(geo.Envelope.YMin);

            decimal xmax = Maths.Todecimal(geo.Envelope.XMax);
            decimal ymax = Maths.Todecimal(geo.Envelope.YMax);

            //(2)转为经纬度坐标
            decimal Bmin = 0.0M;//ToWGS84(xmin,ymin)
            decimal Lmin = 0.0M;

            decimal BMax = 0.0M;//ToWGS84(xmax,ymax)
            decimal Lmax = 0.0M;

            //double dL = Lmax - Lmin; //经差△L
            //double dB = BMax - Bmin; //纬差(B2-B1)

            //比例尺 5千
            IMapScale scale = new MapScale_5000();
            decimal   dL    = scale.L2_L1; //(单位:弧度)
            decimal   dB    = scale.B2_B1; //(单位:弧度)

            //default=西安椭球体参数
            decimal b = this.EllipseParameter.b;
            decimal a = this.EllipseParameter.a;
            decimal A = this.EllipseParameter.A;
            decimal B = this.EllipseParameter.B;
            decimal C = this.EllipseParameter.C;
            decimal D = this.EllipseParameter.D;
            decimal E = this.EllipseParameter.E;

            decimal Bm     = (Bmin + BMax) / 2;
            decimal CosBm  = Maths.Cos(Bm);
            decimal Cos3Bm = Maths.Cos(3 * Bm);
            decimal Cos5Bm = Maths.Cos(5 * Bm);
            decimal Cos7Bm = Maths.Cos(7 * Bm);
            decimal Cos9Bm = Maths.Cos(9 * Bm);

            P = ((4 * PI * b * b * dL) / (360 * 60)) * (A * Maths.Sin(dB * 1 / 2) * CosBm
                                                        - B * Maths.Sin(dB * 3 / 2) * Cos3Bm
                                                        + C * Maths.Sin(dB * 5 / 2) * Cos5Bm
                                                        - D * Maths.Sin(dB * 7 / 2) * Cos7Bm
                                                        + E * Maths.Sin(dB * 9 / 2) * Cos9Bm);



            return(P); //(单位:平方米)
        }
        public SpatialReference_EllipseParameter(ISpatialReference sr)
        {
            if (sr is IGeographicCoordinateSystem)
            {
                IGeographicCoordinateSystem system = sr as IGeographicCoordinateSystem;

                this.m_a     = Maths.Todecimal(system.Datum.Spheroid.SemiMajorAxis); //长半轴
                this.m_b     = Maths.Todecimal(system.Datum.Spheroid.SemiMinorAxis); //短半轴
                this.m_alphi = Maths.Todecimal(system.Datum.Spheroid.Flattening);    //扁率
            }


            //计算A-E参数
            this.ComputerAE_Parameter();
        }
        public decimal GetRingEllipse(IGeometry geo)
        {
            IPointCollection pointColl = geo as IPointCollection;
            IPoint           point = null;
            decimal          x = 0, y = 0;

            decimal[] B = new decimal[pointColl.PointCount];
            decimal[] L = new decimal[pointColl.PointCount];

            for (int i = 0; i < pointColl.PointCount; i++)
            {
                point = pointColl.get_Point(i);
                x     = Maths.Todecimal(point.X); y = Maths.Todecimal(point.Y);
                B[i]  = y;
                L[i]  = x;
            }
            decimal sum = 0;

            for (int i = 0; i < B.Length; i++)
            {
                if (i < B.Length - 1)
                {
                    //double n = GetSign(L[i], L[i + 1]) * (Math.Abs(B[i] + B[i + 1]) * Math.Abs(L[i + 1] - L[i])) / 2;
                    decimal n = this.Compute(B[i + 1], L[i + 1], B[i], L[i]);
                    //System.Diagnostics.Debug.WriteLine(n.ToString());
                    sum += n;
                }
                else
                {
                    //double r = GetSign(L[B.Length - 1], L[0]) * (Math.Abs(B[0] + B[B.Length - 1]) * Math.Abs(L[0] - L[B.Length - 1])) / 2;
                    decimal r = this.Compute(B[0], L[0], B[B.Length - 1], L[L.Length - 1]);
                    //System.Diagnostics.Debug.WriteLine(r.ToString());
                    sum += r;
                }
            }
            sum = Math.Abs(sum);

            return(sum);
        }
        public decimal GetRingEllipse(IGeometry geo)
        {
            IPointCollection pointColl = geo as IPointCollection;
            IPoint           point     = null;
            decimal          x         = 0;
            decimal          y         = 0;

            decimal[] B       = new decimal[pointColl.PointCount];
            decimal[] L       = new decimal[pointColl.PointCount];
            int       intPart = 0;

            if (this.Datum == EnumProjectionDatum.Xian80)
            {   //西安80系
                for (int i = 0; i < pointColl.PointCount; i++)
                {
                    point   = pointColl.get_Point(i);
                    x       = Maths.Todecimal(point.X); y = Maths.Todecimal(point.Y);
                    intPart = (int)x;
                    if (intPart.ToString().Length == 6)
                    {   //x坐标实质是小数坐标
                        this.IsBigNumber = false;
                    }
                    if (intPart.ToString().Length == 8)
                    {   //x坐标实质是小数坐标
                        this.IsBigNumber = true;
                    }
                    //高斯反算
                    if (this.gassConv is GSCoordConVertionClass_Xian80_Call2)
                    {
                        (this.gassConv as GSCoordConVertionClass_Xian80_Call2).IsBigNumber = this.IsBigNumber;
                        (this.gassConv as GSCoordConVertionClass_Xian80_Call2).Strip       = this.Strip;
                        (this.gassConv as GSCoordConVertionClass_Xian80_Call2).L0          = this.L0;
                        (this.gassConv as GSCoordConVertionClass_Xian80_Call2).GetBLFromXY(y, x, ref B[i], ref L[i]);
                    }
                    else
                    {
                        this.gassConv.GetBLFromXY(y, x, ref B[i], ref L[i], 1, this.Datum, this.Strip, this.L0, this.IsBigNumber);
                    }
                }
            }
            else if (this.Datum == EnumProjectionDatum.CGCS2000)
            {   //2000坐标系
                for (int i = 0; i < pointColl.PointCount; i++)
                {
                    point   = pointColl.get_Point(i);
                    x       = Maths.Todecimal(point.X); y = Maths.Todecimal(point.Y);
                    intPart = (int)x;
                    if (intPart.ToString().Length == 6)
                    {   //x坐标实质是小数坐标
                        this.IsBigNumber = false;
                    }
                    if (intPart.ToString().Length == 8)
                    {   //x坐标实质是小数坐标
                        this.IsBigNumber = true;
                    }
                    //高斯反算
                    if (this.gassConv is GSCoordConvertionClass_CGCS_2000)
                    {
                        (this.gassConv as GSCoordConvertionClass_CGCS_2000).IsBigNumber = this.IsBigNumber;
                        (this.gassConv as GSCoordConvertionClass_CGCS_2000).Strip       = this.Strip;
                        (this.gassConv as GSCoordConvertionClass_CGCS_2000).L0          = this.L0;
                        (this.gassConv as GSCoordConvertionClass_CGCS_2000).GetBLFromXY(y, x, ref B[i], ref L[i]);
                    }
                    else
                    {
                        this.gassConv.GetBLFromXY(y, x, ref B[i], ref L[i], 1, this.Datum, this.Strip, this.L0, this.IsBigNumber);
                    }
                }
            }
            else
            {   //北京54
                for (int i = 0; i < pointColl.PointCount; i++)
                {
                    point = pointColl.get_Point(i);
                    x     = Maths.Todecimal(point.X); y = Maths.Todecimal(point.Y);
                    //高斯反算
                    this.gassConv.GetBLFromXY(y, x, ref B[i], ref L[i], 1, this.Datum, this.Strip, this.L0, this.IsBigNumber);
                }
            }
            decimal sum = 0;

            for (int i = 0; i < B.Length; i++)
            {
                if (i < B.Length - 1)
                {
                    //double n = GetSign(L[i], L[i + 1]) * (Math.Abs(B[i] + B[i + 1]) * Math.Abs(L[i + 1] - L[i])) / 2;
                    decimal n = this.Compute(B[i + 1], L[i + 1], B[i], L[i]);
                    //System.Diagnostics.Debug.WriteLine(n.ToString());
                    sum += n;
                }
                else
                {
                    //double r = GetSign(L[B.Length - 1], L[0]) * (Math.Abs(B[0] + B[B.Length - 1]) * Math.Abs(L[0] - L[B.Length - 1])) / 2;
                    decimal r = this.Compute(B[0], L[0], B[B.Length - 1], L[L.Length - 1]);
                    //System.Diagnostics.Debug.WriteLine(r.ToString());
                    sum += r;
                }
            }
            sum = Math.Abs(sum);

            return(sum);
        }
        /// <summary>
        ///  计算IGeometry的椭球面的 理论面积
        /// </summary>
        /// <param name="geo">输入的分幅图的几何对象IGeometry(矩形状)</param>
        /// <returns>(单位:平方米)</returns>
        public override decimal Compute(IGeometry geo)
        {
            decimal P         = 0.0M;
            decimal Lany      = 60.0M;
            decimal ShapeArea = 0;
            //(1)最大最小角计算出WGS84大地经纬度坐标(四个点) 经差/纬差
            decimal xmin = Maths.Todecimal(geo.Envelope.XMin);
            decimal ymin = Maths.Todecimal(geo.Envelope.YMin);

            decimal xmax = Maths.Todecimal(geo.Envelope.XMax);
            decimal ymax = Maths.Todecimal(geo.Envelope.YMax);

            ShapeArea = Maths.Todecimal((geo as IArea).Area);
            //double blxs = (geo as IArea).Area / (geo.Envelope as IArea).Area;

            //(2)转为经纬度坐标   //ToWGS84(xmax,ymax)
            decimal Bmin = 0, Lmin = 0, Bmax = 0, Lmax = 0;

            this.gassConv.GetBLFromXY(ymin, xmin, ref Bmin, ref Lmin, 0, this.Datum, this.Strip, this.L0, this.IsBigNumber); //ToWGS84(xmin,ymin)
            this.gassConv.GetBLFromXY(ymax, xmax, ref Bmax, ref Lmax, 0, this.Datum, this.Strip, this.L0, this.IsBigNumber); //ToWGS84(xmin,ymin)


            decimal dL = (Lmax + Lmin) / 2 - Lany; //经差△L
            decimal dB = Bmax - Bmin;              //纬差(B2-B1)

            dL = dL * PI / 180;                    //(单位:弧度)
            dB = dB * PI / 180;                    //(单位:弧度)

            //default=西安椭球体参数
            decimal b = this.EllipseParameter.b;
            decimal a = this.EllipseParameter.a;
            decimal A = this.EllipseParameter.A;
            decimal B = this.EllipseParameter.B;
            decimal C = this.EllipseParameter.C;
            decimal D = this.EllipseParameter.D;
            decimal E = this.EllipseParameter.E;

            decimal Bm = (Bmin + Bmax) / 2;

            Bm = Bm * PI / 180;  //(单位:弧度)
            decimal CosBm  = Maths.Cos(Bm);
            decimal Cos3Bm = Maths.Cos(3 * Bm);
            decimal Cos5Bm = Maths.Cos(5 * Bm);
            decimal Cos7Bm = Maths.Cos(7 * Bm);
            decimal Cos9Bm = Maths.Cos(9 * Bm);

            //求geo几何体的包络矩形的椭球面积
            P = (2 * b * b * dL) * (A * Maths.Sin(dB * 1 / 2) * CosBm
                                    - B * Maths.Sin(dB * 3 / 2) * Cos3Bm
                                    + C * Maths.Sin(dB * 5 / 2) * Cos5Bm
                                    - D * Maths.Sin(dB * 7 / 2) * Cos7Bm
                                    + E * Maths.Sin(dB * 9 / 2) * Cos9Bm);

            //正算经纬度矩形的另外两个点的投影坐标值
            decimal x2 = 0, y2 = 0, x4 = 0, y4 = 0;

            this.gassConv.GetXYFromBL(Bmin, Lmax, ref y2, ref x2, 0, this.Datum, EnumStrip.Strip3, this.IsBigNumber);
            this.gassConv.GetXYFromBL(Bmax, Lmin, ref y4, ref x4, 0, this.Datum, EnumStrip.Strip3, this.IsBigNumber);
            //求经纬度矩形的投影梯形面积(上底+下底)*高/2
            decimal BLTrapeziaArea = ((x2 - xmin) + (xmax - x4)) * (ymax - ymin) / 2;

            decimal LLmj = P * ShapeArea / BLTrapeziaArea;

            return(LLmj); //(单位:平方米)
        }