示例#1
0
 private void fillRtxt()
 {
     rTextPrj.Clear();
     if (pSR is IProjectedCoordinateSystem)
     {
         IProjectedCoordinateSystem5 iPCS = pSR as IProjectedCoordinateSystem5;
         rTextPrj.AppendText("投影:" + iPCS.Projection.Name + "\r\n");
         rTextPrj.AppendText("东偏:" + iPCS.FalseEasting.ToString("f6") + "\r\n");
         rTextPrj.AppendText("北偏:" + iPCS.FalseNorthing.ToString("f6") + "\r\n");
         rTextPrj.AppendText("中央经线:" + iPCS.get_CentralMeridian(true).ToString("f6") + "\r\n");
         try
         {
             rTextPrj.AppendText("比例因子:" + iPCS.ScaleFactor.ToString("f6") + "\r\n");
             rTextPrj.AppendText("纬线原点:" + iPCS.LatitudeOfOrigin.ToString("f6") + "\r\n");
         }
         catch { }
         rTextPrj.AppendText("单位:" + iPCS.CoordinateUnit.Name.ToString() + "\r\n\r\n");
         IGeographicCoordinateSystem iGCS = iPCS.GeographicCoordinateSystem;
         rTextPrj.AppendText("大地坐标系:" + iGCS.Name.ToString() + "\r\n");
         rTextPrj.AppendText("角度单位:" + iGCS.CoordinateUnit.Name.ToString() + "\r\n");
         rTextPrj.AppendText("本初子午线:" + iGCS.PrimeMeridian.Name.ToString() + "\r\n");
         rTextPrj.AppendText("水准面:" + iGCS.Datum.Name.ToString() + "\r\n");
         rTextPrj.AppendText(" 椭球:" + iGCS.Datum.Spheroid.Name.ToString() + "\r\n");
         rTextPrj.AppendText("  长轴:" + iGCS.Datum.Spheroid.SemiMajorAxis.ToString("F18") + "\r\n");
         rTextPrj.AppendText("  短轴:" + iGCS.Datum.Spheroid.SemiMinorAxis.ToString("F18") + "\r\n");
         rTextPrj.AppendText("  扁率倒数:" + (1 / iGCS.Datum.Spheroid.Flattening).ToString("F18") + "\r\n");
     }
     else if (pSR is IGeographicCoordinateSystem)
     {
         IGeographicCoordinateSystem iGCS = pSR as IGeographicCoordinateSystem;
         rTextPrj.AppendText("大地坐标系:" + iGCS.Name.ToString() + "\r\n");
         rTextPrj.AppendText("角度单位:" + iGCS.CoordinateUnit.Name.ToString() + "\r\n");
         rTextPrj.AppendText("本初子午线:" + iGCS.PrimeMeridian.Name.ToString() + "\r\n");
         rTextPrj.AppendText("水准面:" + iGCS.Datum.Name.ToString() + "\r\n");
         rTextPrj.AppendText(" 椭球:" + iGCS.Datum.Spheroid.Name.ToString() + "\r\n");
         rTextPrj.AppendText("  长轴:" + iGCS.Datum.Spheroid.SemiMajorAxis.ToString("F18") + "\r\n");
         rTextPrj.AppendText("  短轴:" + iGCS.Datum.Spheroid.SemiMinorAxis.ToString("F18") + "\r\n");
         rTextPrj.AppendText("  扁率倒数:" + (1 / iGCS.Datum.Spheroid.Flattening).ToString("F18") + "\r\n");
     }
     else
     {
         rTextPrj.AppendText("未知投影\r\n");
     }
 }
示例#2
0
        private void loadSourceTab()
        {
            //Extent
            IEnvelope pEnvelope = ((IGeoDataset)((IFeatureLayer)pLayer).FeatureClass).Extent;

            this.txtExtentTop.Text    = pEnvelope.YMax.ToString();
            this.txtExtentButtom.Text = pEnvelope.YMin.ToString();
            this.txtExtentLeft.Text   = pEnvelope.XMin.ToString();
            this.txtExtentRight.Text  = pEnvelope.XMax.ToString();
            //DataSource
            StringBuilder strDataSource = new StringBuilder();

            strDataSource.Append("DataType:");
            IFeatureLayer pFeatureLayer = (IFeatureLayer)this.pLayer;

            strDataSource.Append(pFeatureLayer.DataSourceType);
            IDataLayer2 pDataLayer2 = (IDataLayer2)this.pLayer;

            strDataSource.Append(":\n");
            strDataSource.Append(pDataLayer2.DataSourceName.NameString);

            IGeoDataset                 pGeoDataset       = (IGeoDataset)this.pLayer;
            ISpatialReference           pSpatialReference = pGeoDataset.SpatialReference;
            IProjectedCoordinateSystem5 pProCoorSys       = pSpatialReference as IProjectedCoordinateSystem5;

            if (pProCoorSys != null)
            {
                strDataSource.Append("\nProjected Corrdinate System:");
                strDataSource.Append(pProCoorSys.Name);
                strDataSource.Append("\nProjection:");
                strDataSource.Append(pProCoorSys.Projection.Name);
                strDataSource.Append("\nFalse_Easting:");
                strDataSource.Append(pProCoorSys.FalseEasting);
                //strDataSource.AppendFormat("F8", pProCoorSys.FalseEasting);
                strDataSource.Append("\nFalse_Northing:");
                strDataSource.Append(pProCoorSys.FalseNorthing);
                strDataSource.Append("\nCentral_Meridian:");
                strDataSource.Append(pProCoorSys.get_CentralMeridian(true));
                strDataSource.Append("\nStandard)Parallel_1:");
                strDataSource.Append(pProCoorSys.StandardParallel1);
                strDataSource.Append("\nStandard_Parallel_2:");
                strDataSource.Append(pProCoorSys.StandardParallel2);
                strDataSource.Append("\nLatitude_Of_Origin:");
                strDataSource.Append(pProCoorSys.LatitudeOfOrigin);
                strDataSource.Append("\nLinear_Unit:");
                strDataSource.Append(pProCoorSys.CoordinateUnit.Name);
                strDataSource.Append("\n");
            }

            //IGeographicCoordinateSystem pGeoCoorSys = pProCoorSys.GeographicCoordinateSystem;
            IGeographicCoordinateSystem pGeoCoorSys = pSpatialReference as IGeographicCoordinateSystem;

            if (pGeoCoorSys != null)
            {
                strDataSource.Append("\nGeographic Coordinate System:");
                strDataSource.Append(pGeoCoorSys.Name);
                strDataSource.Append("\nDatum:");
                strDataSource.Append(pGeoCoorSys.Datum.Name);
                strDataSource.Append("\nPrime_Meridian:");
                strDataSource.Append(pGeoCoorSys.PrimeMeridian.Longitude);
                strDataSource.Append("\nAangular_Unit:");
                strDataSource.Append(pGeoCoorSys.CoordinateUnit.Name);
            }

            this.txtDataSource.Text = strDataSource.ToString();
        }