Пример #1
0
 /// <summary>
 /// 拷贝构造函数。
 /// </summary>
 /// <param name="primeMeridian">中央子午线对象。</param>
 /// <exception cref="ArgumentNullException">当中央子午线对象为 Null 时抛出异常。</exception>
 public PrimeMeridian(PrimeMeridian primeMeridian)
 {
     if (primeMeridian == null) throw new ArgumentNullException();
     this.LongitudeValue = primeMeridian.LongitudeValue;
     this.Name = primeMeridian.Name;
     this.Type = primeMeridian.Type;
 }
Пример #2
0
 private bool CheckPrimem(PrimeMeridian primeMeridian, string name, double?longitude, string authority, long?code)
 {
     Assert.That(primeMeridian, Is.Not.Null);
     Assert.That(CheckInfo(primeMeridian, name, authority, code));
     Assert.That(primeMeridian.Longitude, Is.EqualTo(longitude));
     return(true);
 }
 /// <summary>
 /// Creates instance prime meridian transform
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public PrimeMeridianTransform(PrimeMeridian source, PrimeMeridian target)
 {
     if (!source.AngularUnit.EqualParams(target.AngularUnit))
     {
         throw new NotImplementedException("The method or operation is not implemented.");
     }
     _source = source;
     _target = target;
 }
Пример #4
0
        private void CreatGeoReference()
        {
            AngularUnit   geoAngularUnit   = new AngularUnit(angularUnit.AngularUnitName, angularUnit.AngularUnitValue);
            Datum         geoDatum         = new Datum(datum.DatumName, datum.DatumSpheroid);
            PrimeMeridian geoPrimeMeridian = new PrimeMeridian(primeMeridian.PrimeMeridianName, primeMeridian.PrimeMeridianValue);

            _geographicCoordSystem = new GeographicCoordSystem(_geoSystemName, geoAngularUnit, geoPrimeMeridian, geoDatum);
            _spatialReference      = new SpatialReference(_geographicCoordSystem);
        }
Пример #5
0
 private string GetPrjInfo()
 {
     try
     {
         ISpatialReference prjInfo         = SpatialReference.GetDefault();
         PrimeMeridian     centerLongitude = prjInfo.GeographicsCoordSystem.PrimeMeridian;
         centerLongitude.Value = 150d;
         return(prjInfo.ToProj4String());
     }
     catch
     {
         return(null);
     }
 }
Пример #6
0
        public void Test_Test1()
        {
            AngularUnit   angularUnit   = new AngularUnit(0.5);
            PrimeMeridian primeMeridian = new PrimeMeridian("name", angularUnit, 5.0, "remarks",
                                                            "authority", "authorityCode", "alias", "abbreviation");

            Assertion.AssertEquals("Test 1", "abbreviation", primeMeridian.Abbreviation);
            Assertion.AssertEquals("Test 2", "alias", primeMeridian.Alias);
            Assertion.AssertEquals("Test 3", "authority", primeMeridian.Authority);
            Assertion.AssertEquals("Test 4", "authorityCode", primeMeridian.AuthorityCode);
            Assertion.AssertEquals("Test 5", "name", primeMeridian.Name);
            Assertion.AssertEquals("Test 6", "remarks", primeMeridian.Remarks);

            Assertion.AssertEquals("Test 7", angularUnit, primeMeridian.AngularUnit);
            Assertion.AssertEquals("Test 8", 2.5, primeMeridian.Longitude);
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static GeoAPI.CoordinateSystems.IPrimeMeridian ReadPrimeMeridian(GisSharpBlog.NetTopologySuite.IO.WktStreamTokenizer tokenizer)
        {
            //PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]]
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            double longitude = tokenizer.GetNumericValue();

            tokenizer.ReadToken(",");
            string authority     = String.Empty;
            long   authorityCode = -1;

            tokenizer.ReadAuthority(ref authority, ref authorityCode);
            // make an assumption about the Angular units - degrees.
            GeoAPI.CoordinateSystems.IPrimeMeridian primeMeridian = new PrimeMeridian(longitude, new AngularUnit(180 / Math.PI), name, authority, authorityCode, String.Empty, String.Empty, String.Empty);
            tokenizer.ReadToken("]");
            return(primeMeridian);
        }
        private static IPrimeMeridian ReadPrimeMeridian(WktStreamTokenizer tokenizer)
        {
            //PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]]
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            double longitude = tokenizer.GetNumericValue();

            tokenizer.ReadToken(",");
            string authority     = "";
            string authorityCode = "";

            tokenizer.ReadAuthority(ref authority, ref authorityCode);
            // make an assumption about the Angular units - degrees.
            IPrimeMeridian primeMeridian = new PrimeMeridian(name, new AngularUnit(180 / Math.PI), longitude, "", authority, authorityCode, "", "");

            tokenizer.ReadToken("]");
            return(primeMeridian);
        }
Пример #9
0
        private static IPrimeMeridian ReadPrimeMeridian(XmlTextReader reader)
        {
            /*
             * <?xml version="1.0"?>
             * <IPrimeMeridian Longitude="0">
             *                      <IInfo AuthorityCode="8901" Authority="EPSG" Name="Greenwich"/>
             *                      <IAngularUnit RadiansPerUnit="1.74532925199433E-02">
             *                              <IInfo AuthorityCode="9110" Authority="EPSG" Name="DDD.MMSSsss"/>
             *                      </IAngularUnit>
             *              </IPrimeMeridian>
             */
            double longitude = XmlConvert.ToDouble(reader.GetAttribute("Longitude"));
            string authority = "", authorityCode = "", abbreviation = "", name = "";

            reader.Read();
            ReadInfo(reader, ref authority, ref authorityCode, ref abbreviation, ref name);
            IAngularUnit angularUnit = ReadAngularUnit(reader);

            reader.Read();
            IPrimeMeridian primeMeridian = new PrimeMeridian(name, angularUnit, longitude, "", authority, authorityCode, "", abbreviation);

            return(primeMeridian);
        }
        /// <summary>
        /// Reads a prime meridian.
        /// </summary>
        private static IPrimeMeridian ReadPrimeMeridian(WktStreamTokenizer tokenizer)
        {
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            double longitude = tokenizer.GetNumericValue();

            tokenizer.NextToken();
            string authority     = String.Empty;
            long   authorityCode = -1;

            if (tokenizer.GetStringValue() == ",")
            {
                ReadAuthority(tokenizer, ref authority, ref authorityCode);
                tokenizer.ReadToken("]");
            }

            IPrimeMeridian primeMeridian = new PrimeMeridian(longitude, AngularUnit.Degrees, name, authority, authorityCode, String.Empty, String.Empty, String.Empty);

            return(primeMeridian);
        }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static IPrimeMeridian ReadPrimeMeridian(WktStreamTokenizer tokenizer)
        {
            //PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]]
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            double longitude = tokenizer.GetNumericValue();

            tokenizer.NextToken();
            string authority     = String.Empty;
            long   authorityCode = -1;

            if (tokenizer.GetStringValue() == ",")
            {
                tokenizer.ReadAuthority(ref authority, ref authorityCode);
                tokenizer.ReadToken("]");
            }
            // make an assumption about the Angular units - degrees.
            IPrimeMeridian primeMeridian = new PrimeMeridian(longitude, AngularUnit.Degrees, name, authority, authorityCode, String.Empty, String.Empty, String.Empty);

            return(primeMeridian);
        }