internal GeographicCoordinateSystem(
            IAngularUnit angularUnit,
            IHorizontalDatum horizontalDatum,
            IPrimeMeridian primeMeridian,
            IAxisInfo axis0,
            IAxisInfo axis1,
            string remarks, string authority, string authorityCode, string name, string alias, string abbreviation)
            : base(remarks, authority, authorityCode, name, alias, abbreviation)
        {
            _angularUnit     = angularUnit;
            _horizontalDatum = horizontalDatum;
            _primeMeridian   = primeMeridian;
            _axisInfo        = new IAxisInfo[] { axis0, axis1 };


            CoordinatePoint minPt = new CoordinatePoint();

            minPt.Ord = new Double[2];
            minPt.Ord.SetValue(-180, 0);
            minPt.Ord.SetValue(-90, 1);

            CoordinatePoint maxPt = new CoordinatePoint();

            maxPt.Ord = new Double[2];
            maxPt.Ord.SetValue(-180, 0);
            maxPt.Ord.SetValue(-90, 1);

            // define the envelope.
            _defaultEnvelope       = new Positioning.Envelope();
            _defaultEnvelope.MinCP = minPt;
            _defaultEnvelope.MaxCP = maxPt;
        }
		internal GeographicCoordinateSystem( 
			IAngularUnit angularUnit, 
			IHorizontalDatum horizontalDatum, 
			IPrimeMeridian primeMeridian, 
			IAxisInfo axis0, 
			IAxisInfo axis1,
			string remarks, string authority, string authorityCode, string name, string alias, string abbreviation)
			: base(remarks, authority, authorityCode, name, alias, abbreviation)
		{
			_angularUnit = angularUnit;
			_horizontalDatum = horizontalDatum;
			_primeMeridian = primeMeridian;
			_axisInfo = new IAxisInfo[]{axis0,axis1};

			
			CoordinatePoint minPt = new CoordinatePoint();
			minPt.Ord= new Double[2];
			minPt.Ord.SetValue(-180,0);
			minPt.Ord.SetValue(-90,1);

			CoordinatePoint maxPt = new CoordinatePoint();
			maxPt.Ord= new Double[2];
			maxPt.Ord.SetValue(-180,0);
			maxPt.Ord.SetValue(-90,1);

			// define the envelope.
			_defaultEnvelope = new Positioning.Envelope();
			_defaultEnvelope.MinCP = minPt;
			_defaultEnvelope.MaxCP = maxPt;
		

	
		}
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the ProjectedCoordinateSystem class.
        /// </summary>
        /// <param name="horizontalDatum">The horizontal datum to use.</param>
        /// <param name="axisInfoArray">An array of IAxisInfo representing the axis information.</param>
        /// <param name="geographicCoordSystem">The geographic coordinate system.</param>
        /// <param name="linearUnit">The linear units to use.</param>
        /// <param name="projection">The projection to use.</param>
        /// <param name="remarks">Remarks about this object.</param>
        /// <param name="authority">The name of the authority.</param>
        /// <param name="authorityCode">The code the authority uses to identidy this object.</param>
        /// <param name="name">The name of the object.</param>
        /// <param name="alias">The alias of the object.</param>
        /// <param name="abbreviation">The abbreviated name of this object.</param>
        internal ProjectedCoordinateSystem(
			IHorizontalDatum horizontalDatum,
			IAxisInfo[] axisInfoArray,
			IGeographicCoordinateSystem geographicCoordSystem,
			ILinearUnit linearUnit,
			IProjection projection,
			string remarks, string authority, string authorityCode, string name, string alias, string abbreviation)
            : base(remarks, authority, authorityCode, name, alias, abbreviation)
        {
            if (axisInfoArray==null)
            {
                throw new ArgumentNullException("axisInfoArray");
            }
            if (geographicCoordSystem==null)
            {
                throw new ArgumentNullException("geographicCoordSystem");
            }
            if (projection==null)
            {
                throw new ArgumentNullException("projection");
            }
            if (linearUnit==null)
            {
                throw new ArgumentNullException("linearUnit");
            }
            _horizontalDatum=horizontalDatum;
            _axisInfoArray=  axisInfoArray;
            _geographicCoordSystem = geographicCoordSystem;
            _projection=	 projection;
            _linearUnit = linearUnit;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a projected coordinate system using a projection object.
        /// </summary>
        /// <param name="name">The name of the projected coordinate system.</param>
        /// <param name="geographicCoordinateSystem">The geographic coordinate system to base this coordinate system on.</param>
        /// <param name="projection">The projection details.</param>
        /// <param name="linearUnit">The linear units to use.</param>
        /// <param name="axis0">The X axis.</param>
        /// <param name="axis1">The Y aixs.</param>
        /// <returns>An object the implements the IProjectedCoordinateSystem interface.</returns>
        public IProjectedCoordinateSystem CreateProjectedCoordinateSystem(string name, IGeographicCoordinateSystem geographicCoordinateSystem, IProjection projection, ILinearUnit linearUnit, IAxisInfo axis0, IAxisInfo axis1)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (geographicCoordinateSystem == null)
            {
                throw new ArgumentNullException("geographicCoordinateSystem");
            }
            if (projection == null)
            {
                throw new ArgumentNullException("projection");
            }
            if (linearUnit == null)
            {
                throw new ArgumentNullException("linearUnit");
            }
            IAxisInfo[] axisInfo = new IAxisInfo[2];
            axisInfo[0] = axis0;
            axisInfo[1] = axis1;
            ProjectedCoordinateSystem projectedCS = new ProjectedCoordinateSystem(null, axisInfo, geographicCoordinateSystem, linearUnit, projection);

            return(projectedCS);
        }
Exemplo n.º 5
0
    public IAxisInfo viewIAxisInfo()
    {
        global::System.IntPtr cPtr = yarpPINVOKE.PolyDriver_viewIAxisInfo(swigCPtr);
        IAxisInfo             ret  = (cPtr == global::System.IntPtr.Zero) ? null : new IAxisInfo(cPtr, false);

        return(ret);
    }
Exemplo n.º 6
0
        private static IGeographicCoordinateSystem ReadGeographicCoordinateSystem(XmlTextReader reader)
        {
            if (!(reader.NodeType == XmlNodeType.Element && reader.Name == "CS_GeographicCoordinateSystem"))
            {
                throw new ParseException(String.Format("Expected a IGeographicCoordinateSystem but got a {0} at line {1} col {2}", reader.Name, reader.LineNumber, reader.LinePosition));
            }
            string authority = "", authorityCode = "", abbreviation = "", name = "";

            reader.Read();
            ReadInfo(reader, ref authority, ref authorityCode, ref abbreviation, ref name);
            //reader.Read();
            ArrayList list = new ArrayList();

            while (reader.NodeType == XmlNodeType.Element && reader.Name == "CS_AxisInfo")
            {
                IAxisInfo axis = ReadAxisInfo(reader);
                list.Add(axis);
                reader.Read();
            }
            IAxisInfo[] axisInfos = new IAxisInfo[list.Count];
            axisInfos = (IAxisInfo[])list.ToArray(typeof(IAxisInfo));
            IHorizontalDatum horizontalDatum = ReadHorizontalDatum(reader);
            //reader.Read();
            IAngularUnit angularUnit = ReadAngularUnit(reader);
            //reader.Read();
            IPrimeMeridian primeMeridian = ReadPrimeMeridian(reader);

            reader.Read();
            IGeographicCoordinateSystem geographicCoordinateSystem = new GeographicCoordinateSystem(angularUnit, horizontalDatum,
                                                                                                    primeMeridian, axisInfos[0], axisInfos[1], "",
                                                                                                    authority, authorityCode, name, "", abbreviation);

            return(geographicCoordinateSystem);
        }
Exemplo n.º 7
0
        private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(XmlTextReader reader)
        {
            if (!(reader.NodeType == XmlNodeType.Element && reader.Name == "CS_ProjectedCoordinateSystem"))
            {
                throw new ParseException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Expected a IProjectedCoordinateSystem but got a {0} at line {1} col {2}", reader.Name, reader.LineNumber, reader.LinePosition));
            }
            string authority = "", authorityCode = "", abbreviation = "", name = "";

            reader.Read();
            ReadInfo(reader, ref authority, ref authorityCode, ref abbreviation, ref name);
            ArrayList list = new ArrayList();

            while (reader.NodeType == XmlNodeType.Element && reader.Name == "CS_AxisInfo")
            {
                IAxisInfo axis = ReadAxisInfo(reader);
                list.Add(axis);
                reader.Read();
            }
            IAxisInfo[] axisInfos = new IAxisInfo[list.Count];
            axisInfos = (IAxisInfo[])list.ToArray(typeof(IAxisInfo));
            IGeographicCoordinateSystem geographicCoordinateSystem = ReadGeographicCoordinateSystem(reader);
            ILinearUnit linearUnit = ReadLinearUnit(reader);
            IProjection projection = ReadProjection(reader);

            reader.Read();
            //IPrimeMeridian primeMeridian = null;
            IHorizontalDatum          horizontalDatum = null;
            ProjectedCoordinateSystem projectedCS     = new ProjectedCoordinateSystem(horizontalDatum,
                                                                                      axisInfos, geographicCoordinateSystem, linearUnit, projection, "", authority, authorityCode,
                                                                                      name, "", abbreviation);

            return(projectedCS);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the ProjectedCoordinateSystem class.
        /// </summary>
        /// <param name="horizontalDatum">The horizontal datum to use.</param>
        /// <param name="axisInfoArray">An array of IAxisInfo representing the axis information.</param>
        /// <param name="geographicCoordSystem">The geographic coordinate system.</param>
        /// <param name="linearUnit">The linear units to use.</param>
        /// <param name="projection">The projection to use.</param>
        internal ProjectedCoordinateSystem(
			IHorizontalDatum horizontalDatum,
			IAxisInfo[] axisInfoArray,
			IGeographicCoordinateSystem geographicCoordSystem,
			ILinearUnit linearUnit,
			IProjection projection)
            : this(horizontalDatum, axisInfoArray, geographicCoordSystem, linearUnit, projection, "", "", "", "", "", "")
        {
        }
Exemplo n.º 9
0
        internal GeographicCoordinateSystem(string name,
			IAngularUnit angularUnit, 
			IHorizontalDatum horizontalDatum, 
			IPrimeMeridian primeMeridian, 
			IAxisInfo axis0, 
			IAxisInfo axis1)
            : this(angularUnit,horizontalDatum,primeMeridian, axis0,  axis1,"","","",name,"","")
        {
        }
 internal GeographicCoordinateSystem(string name,
                                     IAngularUnit angularUnit,
                                     IHorizontalDatum horizontalDatum,
                                     IPrimeMeridian primeMeridian,
                                     IAxisInfo axis0,
                                     IAxisInfo axis1) :
     this(angularUnit, horizontalDatum, primeMeridian, axis0, axis1, "", "", "", name, "", "")
 {
 }
Exemplo n.º 11
0
        public void TestCreateVerticalCoordinateSystem1()
        {
            IAxisInfo                 axis          = AxisInfo.Altitude;
            ILinearUnit               unit          = LinearUnit.Meters;
            IVerticalDatum            verticalDatum = _csFactory.CreateVerticalDatum("vertdatum", DatumType.IVD_Ellipsoidal);
            IVerticalCoordinateSystem verticalCS    = _csFactory.CreateVerticalCoordinateSystem("test", verticalDatum, unit, axis);

            Assertion.AssertEquals("ctor. 1", "test", verticalCS.Name);
            Assertion.AssertEquals("ctor. 2", verticalDatum, verticalCS.VerticalDatum);
            Assertion.AssertEquals("ctor. 3", unit, verticalCS.VerticalUnit);
            Assertion.AssertEquals("ctor. 4", axis, verticalCS.GetAxis(0));
        }
        private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(WktStreamTokenizer tokenizer)
        {
            /*			PROJCS[
             *      "OSGB 1936 / British National Grid",
             *      GEOGCS[
             *              "OSGB 1936",
             *              DATUM[...]
             *              PRIMEM[...]
             *              AXIS["Geodetic latitude","NORTH"]
             *              AXIS["Geodetic longitude","EAST"]
             *              AUTHORITY["EPSG","4277"]
             *      ],
             *      PROJECTION["Transverse Mercator"],
             *      PARAMETER["latitude_of_natural_origin",49],
             *      PARAMETER["longitude_of_natural_origin",-2],
             *      PARAMETER["scale_factor_at_natural_origin",0.999601272],
             *      PARAMETER["false_easting",400000],
             *      PARAMETER["false_northing",-100000],
             *      AXIS["Easting","EAST"],
             *      AXIS["Northing","NORTH"],
             *      AUTHORITY["EPSG","27700"]
             * ]
             */
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("GEOGCS");
            IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer);

            tokenizer.ReadToken(",");
            IProjection projection = ReadProjection(tokenizer);
            IAxisInfo   axis0      = ReadAxisInfo(tokenizer);

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("AXIS");
            IAxisInfo axis1 = ReadAxisInfo(tokenizer);

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

            tokenizer.ReadAuthority(ref authority, ref authorityCode);
            tokenizer.ReadToken("]");
            IAxisInfo[] axisArray = new IAxisInfo[2];
            axisArray[0] = axis0;
            axisArray[1] = axis1;
            ILinearUnit linearUnit = LinearUnit.Meters;
            IProjectedCoordinateSystem projectedCS = new ProjectedCoordinateSystem(null, axisArray, geographicCS, linearUnit, projection, "", authority, authorityCode, name, "", "");

            return(projectedCS);
        }
        public void Test_Constructor()
        {
            VerticalDatum datum = VerticalDatum.Ellipsoidal;
            IAxisInfo     axis  = AxisInfo.Altitude;
            ILinearUnit   unit  = LinearUnit.Meters;

            VerticalCoordinateSystem vcs = new VerticalCoordinateSystem("test1", datum, axis, unit);

            Assertion.AssertEquals("Test1", datum, vcs.VerticalDatum);
            Assertion.AssertEquals("Test2", 1.0, vcs.VerticalUnit.MetersPerUnit);
            Assertion.AssertEquals("ctor. 3", unit, vcs.VerticalUnit);
            Assertion.AssertEquals("ctor. 4", axis, vcs.GetAxis(0));
        }
Exemplo n.º 14
0
 public void TestCreateLocalCoordinateSystem2()
 {
     try
     {
         IAxisInfo[] axis = new IAxisInfo[1];
         axis[0] = AxisInfo.X;
         _csFactory.CreateLocalCoordinateSystem("name", null, null, axis);
         Assertion.Fail("Should throw a not implemented exception.");
     }
     catch (NotImplementedException)
     {
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the HorizontalCoordinateSystem class with the specified parameters.
        /// </summary>
        /// <param name="horizontalDatum">The horizontal datum to use.</param>
        /// <param name="axisInfoArray">Array of axis information.</param>
        /// <param name="remarks">Remarks about this object.</param>
        /// <param name="authority">The name of the authority.</param>
        /// <param name="authorityCode">The code the authority uses to identidy this object.</param>
        /// <param name="name">The name of the object.</param>
        /// <param name="alias">The alias of the object.</param>
        /// <param name="abbreviation">The abbreviated name of this object.</param>
        public HorizontalCoordinateSystem(IHorizontalDatum horizontalDatum,IAxisInfo[] axisInfoArray,
			string remarks, string authority, string authorityCode, string name, string alias, string abbreviation)
            : base(remarks, authority, authorityCode, name, alias, abbreviation)
        {
            if (horizontalDatum==null)
            {
                throw new ArgumentNullException("horizontalDatum");
            }
            if (axisInfoArray==null)
            {
                throw new ArgumentNullException("axisInfoArray");
            }
            _horizontalDatum = horizontalDatum;
            _axisInfoArray = axisInfoArray;
        }
Exemplo n.º 16
0
        /// <summary>
        /// Initializes a new instance of the Projection class.
        /// </summary>
        /// <param name="verticaldatum">The vertical datum the coordiniate system is to use.</param>
        /// <param name="axisinfo">Axis information.</param>
        /// <param name="linearUnit">The units this coordinate system uses.</param>
        /// <param name="remarks">Remarks about this object.</param>
        /// <param name="authority">The name of the authority.</param>
        /// <param name="authorityCode">The code the authority uses to identidy this object.</param>
        /// <param name="name">The name of the object.</param>
        /// <param name="alias">The alias of the object.</param>
        /// <param name="abbreviation">The abbreviated name of this object.</param>
        public VerticalCoordinateSystem(	string name,
			IVerticalDatum verticaldatum,
			IAxisInfo axisinfo,
			ILinearUnit linearUnit,
			string remarks, string authority, string authorityCode, string alias, string abbreviation)
            : base(remarks, authority,  authorityCode,name, alias, abbreviation)
        {
            if (verticaldatum==null)
            {
                throw new ArgumentNullException("verticaldatum");
            }

            _verticaldatum = verticaldatum;
            _axisinfo = new IAxisInfo[1]{axisinfo};
            _units = linearUnit;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the Projection class.
        /// </summary>
        /// <param name="name">The name of the coordinate system.</param>
        /// <param name="verticaldatum">The vertical datum the coordiniate system is to use.</param>
        /// <param name="axisinfo">Axis information.</param>
        /// <param name="units">The units this coordinae system uses.</param>
        internal VerticalCoordinateSystem(string name, IVerticalDatum verticaldatum, IAxisInfo axisinfo, ILinearUnit units)
            : base(name,"","","","","")
        {
            if (verticaldatum==null)
            {
                throw new ArgumentNullException("verticaldatum");
            }
            if (units==null)
            {
                throw new ArgumentNullException("units");
            }

            _name = name;
            _verticaldatum = verticaldatum;
            _axisinfo= new IAxisInfo[1]{axisinfo};
            _units = units;
        }
Exemplo n.º 18
0
        /// <summary>
        /// Initializes a new instance of the Projection class.
        /// </summary>
        /// <param name="verticaldatum">The vertical datum the coordiniate system is to use.</param>
        /// <param name="axisinfo">Axis information.</param>
        /// <param name="linearUnit">The units this coordinate system uses.</param>
        /// <param name="remarks">Remarks about this object.</param>
        /// <param name="authority">The name of the authority.</param>
        /// <param name="authorityCode">The code the authority uses to identidy this object.</param>
        /// <param name="name">The name of the object.</param>
        /// <param name="alias">The alias of the object.</param>
        /// <param name="abbreviation">The abbreviated name of this object.</param>
        public VerticalCoordinateSystem(string name,
                                        IVerticalDatum verticaldatum,
                                        IAxisInfo axisinfo,
                                        ILinearUnit linearUnit,
                                        string remarks, string authority, string authorityCode, string alias, string abbreviation)
            : base(remarks, authority, authorityCode, name, alias, abbreviation)
        {
            if (verticaldatum == null)
            {
                throw new ArgumentNullException("verticaldatum");
            }

            _verticaldatum = verticaldatum;
            _axisinfo      = new IAxisInfo[1] {
                axisinfo
            };
            _units = linearUnit;
        }
        private static void WriteAxis(IAxisInfo axis, XmlTextWriter writer)
        {
            string axisOrientation = "";

            switch (axis.Orientation)
            {
            case AxisOrientation.Down:
                axisOrientation = "DOWN";
                break;

            case AxisOrientation.East:
                axisOrientation = "EAST";
                break;

            case AxisOrientation.North:
                axisOrientation = "NORTH";
                break;

            case AxisOrientation.Other:
                axisOrientation = "OTHER";
                break;

            case AxisOrientation.South:
                axisOrientation = "SOUTH";
                break;

            case AxisOrientation.Up:
                axisOrientation = "UP";
                break;

            case AxisOrientation.West:
                axisOrientation = "WEST";
                break;

            default:
                throw new InvalidOperationException("This enum should not exist");
            }
            //writer.WriteLine(String.Format("AXIS[\"{0}\",\"{1}\"],", axis.Name, axisOrientation));
            writer.WriteStartElement("CS_AxisInfo");
            writer.WriteAttributeString("Name", axis.Name);
            writer.WriteAttributeString("Orientation", axisOrientation);
            writer.WriteEndElement();
        }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the Projection class.
        /// </summary>
        /// <param name="name">The name of the coordinate system.</param>
        /// <param name="verticaldatum">The vertical datum the coordiniate system is to use.</param>
        /// <param name="axisinfo">Axis information.</param>
        /// <param name="units">The units this coordinae system uses.</param>
        internal VerticalCoordinateSystem(string name, IVerticalDatum verticaldatum, IAxisInfo axisinfo, ILinearUnit units)
            : base(name, "", "", "", "", "")
        {
            if (verticaldatum == null)
            {
                throw new ArgumentNullException("verticaldatum");
            }
            if (units == null)
            {
                throw new ArgumentNullException("units");
            }

            _name          = name;
            _verticaldatum = verticaldatum;
            _axisinfo      = new IAxisInfo[1] {
                axisinfo
            };
            _units = units;
        }
Exemplo n.º 21
0
        private static IVerticalCoordinateSystem ReadVerticalCoordinateSystem(XmlTextReader reader)
        {
            /*
             * <?xml version="1.0"?>
             *      <IVerticalCoordinateSystem>
             * <IInfo AuthorityCode="5701" Abbreviation="ODN" Authority="EPSG" Name="Newlyn"/>
             * <IAxisInfo Name="Up" Orientation="UP"/>
             * <IVerticalDatum DatumType="2005">
             * <IInfo AuthorityCode="5101" Abbreviation="ODN" Authority="EPSG" Name="Ordnance Datum Newlyn"/>
             * </IVerticalDatum>
             * <ILinearUnit MetersPerUnit="1">
             * <IInfo AuthorityCode="9001" Abbreviation="m" Authority="EPSG" Name="metre"/>
             * </ILinearUnit>
             * </IVerticalCoordinateSystem>
             */
            if (!(reader.NodeType == XmlNodeType.Element && reader.Name == "CS_VerticalCoordinateSystem"))
            {
                throw new ParseException(String.Format("Expected a IVerticalCoordinateSystem but got a {0} at line {1} col {2}", reader.Name, reader.LineNumber, reader.LinePosition));
            }
            string authority = "", authorityCode = "", abbreviation = "", name = "";

            reader.Read();
            ReadInfo(reader, ref authority, ref authorityCode, ref abbreviation, ref name);
            //reader.Read();
            ArrayList list = new ArrayList();

            while (reader.NodeType == XmlNodeType.Element && reader.Name == "CS_AxisInfo")
            {
                IAxisInfo axis = ReadAxisInfo(reader);
                list.Add(axis);
                reader.Read();
            }
            IAxisInfo[] axisInfos = new IAxisInfo[list.Count];
            axisInfos = (IAxisInfo[])list.ToArray(typeof(IAxisInfo));
            IVerticalDatum verticalDatum = ReadVerticalDatum(reader);
            ILinearUnit    linearUnit    = ReadLinearUnit(reader);

            reader.Read();
            reader.Read();
            VerticalCoordinateSystem verticalCoordinateSystem = new VerticalCoordinateSystem(name, verticalDatum, axisInfos[0], linearUnit, "", authority, authorityCode, "", abbreviation);

            return(verticalCoordinateSystem);
        }
        private static IGeographicCoordinateSystem ReadGeographicCoordinateSystem(WktStreamTokenizer tokenizer)
        {
            /*
             * GEOGCS["OSGB 1936",
             * DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]]TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6277"]]
             * PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]]
             * AXIS["Geodetic latitude","NORTH"]
             * AXIS["Geodetic longitude","EAST"]
             * AUTHORITY["EPSG","4277"]
             * ]
             */

            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("DATUM");
            IHorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer);

            tokenizer.ReadToken("PRIMEM");
            IPrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer);

            tokenizer.ReadToken("AXIS");
            IAxisInfo axis0 = ReadAxisInfo(tokenizer);

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("AXIS");
            IAxisInfo axis1 = ReadAxisInfo(tokenizer);

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

            tokenizer.ReadAuthority(ref authority, ref authorityCode);
            tokenizer.ReadToken("]");
            // ?? assume angular unit is degrees.
            IAngularUnit angularUnit = new AngularUnit(180 / Math.PI);
            IGeographicCoordinateSystem geographicCS = new GeographicCoordinateSystem(angularUnit, horizontalDatum,
                                                                                      primeMeridian, axis0, axis1, "", authority, authorityCode, name, "", "");

            return(geographicCS);
        }
Exemplo n.º 23
0
        public void Test_Constructor()
        {
            ICoordinateSystemFactory csFactory   = new CoordinateSystemFactory();
            IAngularUnit             angularUnit = new AngularUnit(1);
            ILinearUnit         linearUnit       = new LinearUnit(1);
            IEllipsoid          ellipsoid        = csFactory.CreateFlattenedSphere("test", 1, 2, linearUnit);
            IAxisInfo           axis0            = new AxisInfo("axis0name", AxisOrientation.Up);
            IAxisInfo           axis1            = new AxisInfo("axis1name", AxisOrientation.Up);
            WGS84ConversionInfo wgs = new WGS84ConversionInfo();

            IPrimeMeridian              primeMeridian   = csFactory.CreatePrimeMeridian("name", angularUnit, 2.0);
            IHorizontalDatum            horizontalDatum = csFactory.CreateHorizontalDatum("datum", DatumType.IHD_Geocentric, ellipsoid, wgs);
            IGeographicCoordinateSystem gcs             = csFactory.CreateGeographicCoordinateSystem("name", angularUnit, horizontalDatum, primeMeridian, axis0, axis1);

            //PrimeMeridian primeMeridian = new PrimeMeridian("name", angularUnit, 0.5);
            IAxisInfo[] axisArray = new IAxisInfo[2];
            axisArray[0] = axis0;
            axisArray[1] = axis1;

            ProjectionParameter[] paramList = new ProjectionParameter[1];
            paramList[0].Name  = "test";
            paramList[0].Value = 2.2;

            Projection projection = new Projection("mercator", paramList, "class", "remarks", "authority", "authoritycode");

            ProjectedCoordinateSystem pjc = new ProjectedCoordinateSystem(horizontalDatum,
                                                                          axisArray, gcs, linearUnit, projection,
                                                                          "remarks", "authority", "authorityCode", "name", "alias", "abbreviation");

            Assertion.AssertEquals("Test 1", linearUnit, pjc.LinearUnit);
            Assertion.AssertEquals("Test 2", horizontalDatum, pjc.HorizontalDatum);
            Assertion.AssertEquals("Test 3", axis0, pjc.GetAxis(0));
            Assertion.AssertEquals("Test 4", axis1, pjc.GetAxis(1));
            Assertion.AssertEquals("Test 5", gcs, pjc.GeographicCoordinateSystem);

            Assertion.AssertEquals("Test 6", "abbreviation", pjc.Abbreviation);
            Assertion.AssertEquals("Test 7", "alias", pjc.Alias);
            Assertion.AssertEquals("Test 8", "authority", pjc.Authority);
            Assertion.AssertEquals("Test 9", "authorityCode", pjc.AuthorityCode);
            Assertion.AssertEquals("Test 10", "name", pjc.Name);
            Assertion.AssertEquals("Test 11", "remarks", pjc.Remarks);
        }
 /// <summary>
 /// Converts a given coordinate system object to a IndentedTextWriter.
 /// </summary>
 /// <param name="obj">The coordinate system to convert.</param>
 /// <param name="writer"></param>
 /// <remarks>
 /// <list type="bullet">
 /// <listheader><term>Items</term><description>Descriptions</description></listheader>
 /// <item><term>ICoordinateSystem</term><description>Your Description</description></item>
 /// <item><term>IDatum</term><description>Your Description</description></item>
 /// <item><term>IEllipsoid</term><description>Your Description</description></item>
 /// <item><term>IAxisInfo</term><description>Your Description</description></item>
 /// <item><term>IWGS84ConversionInfo</term><description>Your Description</description></item>
 /// <item><term>IUnit</term><description>Your Description</description></item>
 /// <item><term>IPrimeMeridian</term><description>Your Description</description></item>
 /// <item><term>ICompoundCoordinateSystem</term><description>Your Description</description></item>
 /// <item><term>IGeographicCoordinateSystem</term><description>Your Description</description></item>
 /// <item><term>IProjectedCoordinateSystem</term><description>Your Description</description></item>
 /// <item><term>IVerticalCoordinateSystem</term><description>Your Description</description></item>
 /// </list>
 /// </remarks>
 public static void Write(object obj, XmlTextWriter writer)
 {
     if (obj is ICoordinateSystem)
     {
         WriteCoordinateSystem(obj as ICoordinateSystem, writer);
     }
     else if (obj is IDatum)
     {
         WriteDatum(obj as IDatum, writer);
     }
     else if (obj is IEllipsoid)
     {
         WriteEllipsoid(obj as IEllipsoid, writer);
     }
     else if (obj is IAxisInfo)
     {
         IAxisInfo info = (IAxisInfo)obj;
         WriteAxis(info, writer);
     }
     else if (obj is WGS84ConversionInfo)
     {
         WGS84ConversionInfo info = (WGS84ConversionInfo)obj;
         WriteWGS84ConversionInfo(info, writer);
     }
     else if (obj is IUnit)
     {
         WriteUnit(obj as IUnit, writer);
     }
     else if (obj is IPrimeMeridian)
     {
         WritePrimeMeridian(obj as IPrimeMeridian, writer);
     }
     else if (obj is IProjection)
     {
         WriteProjection(obj as IProjection, writer);
     }
     else
     {
         throw new NotImplementedException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Cannot convert {0} to XML.", obj.GetType().FullName));
     }
 }
Exemplo n.º 25
0
        private static void WriteAxis(IAxisInfo axis, IndentedTextWriter writer)
        {
            string axisOrientation = "";

            switch (axis.Orientation)
            {
            case AxisOrientation.Down:
                axisOrientation = "DOWN";
                break;

            case AxisOrientation.East:
                axisOrientation = "EAST";
                break;

            case AxisOrientation.North:
                axisOrientation = "NORTH";
                break;

            case AxisOrientation.Other:
                axisOrientation = "OTHER";
                break;

            case AxisOrientation.South:
                axisOrientation = "SOUTH";
                break;

            case AxisOrientation.Up:
                axisOrientation = "UP";
                break;

            case AxisOrientation.West:
                axisOrientation = "WEST";
                break;

            default:
                throw new InvalidOperationException("This  should not exist");
            }
            writer.WriteLine(String.Format("AXIS[\"{0}\",\"{1}\"],", axis.Name, axisOrientation));
        }
        public void Test_Constructor()
        {
            IEllipsoid ellipsoid = new Ellipsoid(20926348,-1.0,294.26068, true,new LinearUnit(1));
            WGS84ConversionInfo wgsInfo = new WGS84ConversionInfo();
            wgsInfo.Dx=1.0;
            HorizontalDatum horizontalDatum = new HorizontalDatum("name",DatumType.IHD_Geocentric,ellipsoid, wgsInfo);

            IAxisInfo[] axisInfos = new IAxisInfo[2];
            axisInfos[0] = AxisInfo.Latitude;
            axisInfos[1] = AxisInfo.Longitude;
            HorizontalCoordinateSystem horzCS = new HorizontalCoordinateSystem(horizontalDatum,axisInfos,"remarks","authority","code","name","alias","abbreviation");

            Assertion.AssertEquals("ctor1.","remarks",horzCS.Remarks);
            Assertion.AssertEquals("ctor2.","authority",horzCS.Authority);
            Assertion.AssertEquals("ctor3.","code",horzCS.AuthorityCode);
            Assertion.AssertEquals("ctor4.","name",horzCS.Name);
            Assertion.AssertEquals("ctor5.","alias",horzCS.Alias);
            Assertion.AssertEquals("ctor6.","abbreviation",horzCS.Abbreviation);

            Assertion.AssertEquals("test 7",horizontalDatum,horzCS.HorizontalDatum);
            //Assertion.AssertEquals("test 8",axisInfos[0],horzCS.GetAxis(0));
            //Assertion.AssertEquals("test 9",axisInfos[1],horzCS.GetAxis(1));
        }
        public void Test_Constructor()
        {
            IEllipsoid          ellipsoid = new Ellipsoid(20926348, -1.0, 294.26068, true, new LinearUnit(1));
            WGS84ConversionInfo wgsInfo   = new WGS84ConversionInfo();

            wgsInfo.Dx = 1.0;
            HorizontalDatum horizontalDatum = new HorizontalDatum("name", DatumType.IHD_Geocentric, ellipsoid, wgsInfo);

            IAxisInfo[] axisInfos = new IAxisInfo[2];
            axisInfos[0] = AxisInfo.Latitude;
            axisInfos[1] = AxisInfo.Longitude;
            HorizontalCoordinateSystem horzCS = new HorizontalCoordinateSystem(horizontalDatum, axisInfos, "remarks", "authority", "code", "name", "alias", "abbreviation");

            Assertion.AssertEquals("ctor1.", "remarks", horzCS.Remarks);
            Assertion.AssertEquals("ctor2.", "authority", horzCS.Authority);
            Assertion.AssertEquals("ctor3.", "code", horzCS.AuthorityCode);
            Assertion.AssertEquals("ctor4.", "name", horzCS.Name);
            Assertion.AssertEquals("ctor5.", "alias", horzCS.Alias);
            Assertion.AssertEquals("ctor6.", "abbreviation", horzCS.Abbreviation);

            Assertion.AssertEquals("test 7", horizontalDatum, horzCS.HorizontalDatum);
            //Assertion.AssertEquals("test 8",axisInfos[0],horzCS.GetAxis(0));
            //Assertion.AssertEquals("test 9",axisInfos[1],horzCS.GetAxis(1));
        }
Exemplo n.º 28
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IAxisInfo obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 29
0
 private static IVerticalCoordinateSystem ReadVerticalCoordinateSystem(XmlTextReader reader)
 {
     /*
      * <?xml version="1.0"?>
         <IVerticalCoordinateSystem>
         <IInfo AuthorityCode="5701" Abbreviation="ODN" Authority="EPSG" Name="Newlyn"/>
         <IAxisInfo Name="Up" Orientation="UP"/>
         <IVerticalDatum DatumType="2005">
             <IInfo AuthorityCode="5101" Abbreviation="ODN" Authority="EPSG" Name="Ordnance Datum Newlyn"/>
         </IVerticalDatum>
         <ILinearUnit MetersPerUnit="1">
             <IInfo AuthorityCode="9001" Abbreviation="m" Authority="EPSG" Name="metre"/>
         </ILinearUnit>
     </IVerticalCoordinateSystem>
     */
     if (!(reader.NodeType==XmlNodeType.Element &&  reader.Name=="CS_VerticalCoordinateSystem"))
     {
         throw new ParseException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Expected a IVerticalCoordinateSystem but got a {0} at line {1} col {2}",reader.Name,reader.LineNumber,reader.LinePosition));
     }
     string authority="",authorityCode="",abbreviation="",name="";
     reader.Read();
     ReadInfo(reader, ref authority,ref authorityCode, ref abbreviation, ref name);
     //reader.Read();
     ArrayList list = new ArrayList();
     while (reader.NodeType==XmlNodeType.Element && reader.Name=="CS_AxisInfo")
     {
         IAxisInfo axis = ReadAxisInfo( reader );
         list.Add(axis);
         reader.Read();
     }
     IAxisInfo[] axisInfos = new IAxisInfo[list.Count];
     axisInfos = (IAxisInfo[])list.ToArray(typeof(IAxisInfo));
     IVerticalDatum verticalDatum = ReadVerticalDatum( reader );
     ILinearUnit linearUnit = ReadLinearUnit( reader );
     reader.Read();
     reader.Read();
     VerticalCoordinateSystem verticalCoordinateSystem = new VerticalCoordinateSystem(name, verticalDatum, axisInfos[0],linearUnit, "", authority, authorityCode,"",abbreviation);
     return verticalCoordinateSystem;
 }
Exemplo n.º 30
0
 private static void WriteAxis(IAxisInfo axis, IndentedTextWriter writer)
 {
     string axisOrientation="";
     switch(axis.Orientation)
     {
         case AxisOrientation.Down:
             axisOrientation="DOWN";
             break;
         case AxisOrientation.East:
             axisOrientation="EAST";
             break;
         case AxisOrientation.North:
             axisOrientation="NORTH";
             break;
         case AxisOrientation.Other:
             axisOrientation="OTHER";
             break;
         case AxisOrientation.South:
             axisOrientation="SOUTH";
             break;
         case AxisOrientation.Up:
             axisOrientation="UP";
             break;
         case AxisOrientation.West:
             axisOrientation="WEST";
             break;
         default:
             throw new InvalidOperationException("This  should not exist");
     }
     writer.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "AXIS[\"{0}\",\"{1}\"],", axis.Name, axisOrientation));
 }
Exemplo n.º 31
0
 /// <summary>
 ///  Initializes a new instance of the HorizontalCoordinateSystem class with the specified parameters.
 /// </summary>
 /// <param name="horizontalDatum">The horizontal datum to use.</param>
 /// <param name="axisInfoArray">Array of axis information.</param>
 public HorizontalCoordinateSystem(IHorizontalDatum horizontalDatum,IAxisInfo[] axisInfoArray)
     : this(horizontalDatum,axisInfoArray, "","","","","","")
 {
 }
Exemplo n.º 32
0
 internal static HandleRef getCPtr(IAxisInfo obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
		private static IGeographicCoordinateSystem ReadGeographicCoordinateSystem(XmlTextReader reader)
		{
			if (!(reader.NodeType==XmlNodeType.Element &&  reader.Name=="CS_GeographicCoordinateSystem"))
			{
				throw new ParseException(String.Format("Expected a IGeographicCoordinateSystem but got a {0} at line {1} col {2}",reader.Name,reader.LineNumber,reader.LinePosition));
			}
			string authority="",authorityCode="",abbreviation="",name="";
			reader.Read();
			ReadInfo(reader, ref authority,ref authorityCode, ref abbreviation, ref name);
			//reader.Read();
			ArrayList list = new ArrayList();
			while (reader.NodeType==XmlNodeType.Element && reader.Name=="CS_AxisInfo")
			{
				IAxisInfo axis = ReadAxisInfo( reader );
				list.Add(axis);
				reader.Read();
			}
			IAxisInfo[] axisInfos = new IAxisInfo[list.Count];
			axisInfos = (IAxisInfo[])list.ToArray(typeof(IAxisInfo));
			IHorizontalDatum horizontalDatum = ReadHorizontalDatum( reader );
			//reader.Read();
			IAngularUnit angularUnit = ReadAngularUnit( reader );
			//reader.Read();
			IPrimeMeridian primeMeridian = ReadPrimeMeridian( reader );
		
			reader.Read();
			IGeographicCoordinateSystem geographicCoordinateSystem = new GeographicCoordinateSystem(angularUnit,horizontalDatum,
				primeMeridian, axisInfos[0], axisInfos[1],"",
				authority,authorityCode,name,"",abbreviation);
			return geographicCoordinateSystem;
		}
		/// <summary>
		/// Creates a fitted coordinate system (not implemented). 
		/// </summary>
		/// <remarks>
		/// The units of the axes in the fitted coordinate system will be
		/// inferred from the units of the base coordinate system. If the affine map performs a rotation, then
		/// any mixed axes must have identical units. For example, a (lat_deg,lon_deg,height_feet) system
		/// can be rotated in the (lat,lon) plane, since both affected axes are in degrees. But you should not
		/// rotate this coordinate system in any other plane.
		/// </remarks>
		/// <param name="name"></param>
		/// <param name="baseCS"></param>
		/// <param name="toBaseWKT"></param>
		/// <param name="arAxes"></param>
		/// <returns></returns>
		public IFittedCoordinateSystem CreateFittedCoordinateSystem(string name, ICoordinateSystem baseCS, string toBaseWKT, IAxisInfo[] arAxes)
		{
			throw new NotImplementedException("FittedCoordinateSystem has not been implemented.");
		}
Exemplo n.º 35
0
 private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(WktStreamTokenizer tokenizer)
 {
     /*			PROJCS[
             "OSGB 1936 / British National Grid",
             GEOGCS[
                 "OSGB 1936",
                 DATUM[...]
                 PRIMEM[...]
                 AXIS["Geodetic latitude","NORTH"]
                 AXIS["Geodetic longitude","EAST"]
                 AUTHORITY["EPSG","4277"]
             ],
             PROJECTION["Transverse Mercator"],
             PARAMETER["latitude_of_natural_origin",49],
             PARAMETER["longitude_of_natural_origin",-2],
             PARAMETER["scale_factor_at_natural_origin",0.999601272],
             PARAMETER["false_easting",400000],
             PARAMETER["false_northing",-100000],
             AXIS["Easting","EAST"],
             AXIS["Northing","NORTH"],
             AUTHORITY["EPSG","27700"]
         ]
         */
     tokenizer.ReadToken("[");
     string name=tokenizer.ReadDoubleQuotedWord();
     tokenizer.ReadToken(",");
     tokenizer.ReadToken("GEOGCS");
     IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer);
     tokenizer.ReadToken(",");
     IProjection projection = ReadProjection(tokenizer);
     IAxisInfo axis0 = ReadAxisInfo(tokenizer);
     tokenizer.ReadToken(",");
     tokenizer.ReadToken("AXIS");
     IAxisInfo axis1 = ReadAxisInfo(tokenizer);
     tokenizer.ReadToken(",");
     string authority="";
     string authorityCode="";
     tokenizer.ReadAuthority(ref authority, ref authorityCode);
     tokenizer.ReadToken("]");
     IAxisInfo[] axisArray = new IAxisInfo[2];
     axisArray[0]=axis0;
     axisArray[1]=axis1;
     ILinearUnit linearUnit = LinearUnit.Meters;
     IProjectedCoordinateSystem projectedCS = new ProjectedCoordinateSystem(null,axisArray,geographicCS,linearUnit, projection,"",authority,authorityCode,name,"","");
     return projectedCS;
 }
		/// <summary>
		/// Creates a local coordinate system (not implemented).
		/// </summary>
		/// <param name="name"></param>
		/// <param name="Datum"></param>
		/// <param name="Unit"></param>
		/// <param name="ArAxes"></param>
		/// <returns></returns>
		public ILocalCoordinateSystem CreateLocalCoordinateSystem(string name, ILocalDatum Datum, IUnit Unit,  IAxisInfo[] ArAxes)
		{
			throw new NotImplementedException();
		}
        /// <summary>
        /// Returns a GeographicCoordinateSystem object from a code.
        /// </summary>
        /// <param name="code">The EPSG code.</param>
        /// <returns>An object that implements the IGeographicCoordinateSystem interface.</returns>
        public IGeographicCoordinateSystem CreateGeographicCoordinateSystem(string code)
        {
            if (code == null)
            {
                throw new ArgumentNullException("code");
            }
            string sqlQuery = "SELECT COORD_REF_SYS_NAME, COORD_REF_SYS_CODE, AREA_OF_USE_CODE, " +
                              "	COORD_REF_SYS_KIND, DATUM_CODE, COORD_SYS_CODE, " +
                              "	SOURCE_GEOGCRS_CODE, PROJECTION_CONV_CODE, CMPD_VERTCRS_CODE, CRS_SCOPE, CMPD_HORIZCRS_CODE, REMARKS, DATA_SOURCE " +
                              "FROM  [Coordinate Reference System] " +
                              "WHERE COORD_REF_SYS_CODE = {0}";


            sqlQuery = String.Format(System.Globalization.CultureInfo.InvariantCulture, sqlQuery, code);
            IDataReader reader = Database.ExecuteQuery(_databaseConnection, sqlQuery);

            if (!reader.Read())
            {
                throw new ArgumentException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Geographic Coordinate System with a code {0} not found in the CRS table in the EPSG database.", code));
            }
            ;

            string coordSysCode        = reader["COORD_SYS_CODE"].ToString().ToLower();
            string coordSysName        = reader["COORD_REF_SYS_NAME"].ToString();
            string name                = reader["COORD_REF_SYS_NAME"].ToString();
            string horizontalDatumCode = reader["DATUM_CODE"].ToString();
            string coordRefKind        = reader["COORD_REF_SYS_KIND"].ToString();
            string datasource          = reader["DATA_SOURCE"].ToString();    // should always be EPSG??
            string remarks             = reader["REMARKS"].ToString();

            if (coordRefKind.ToLower() != "geographic 2d")
            {
                throw new ArgumentException(String.Format("CRS code {0} is not a geographic coordinate system but a {1}.", code, coordRefKind));
            }

            Database.CheckOneRow(reader, code, "Geographic CRC code");

            string           primeMeridianCode = "";
            IPrimeMeridian   primeMeridian     = null;
            IHorizontalDatum horizontalDatum   = null;

            if (horizontalDatumCode == "")
            {
                horizontalDatum   = HorizontalDatum.WGS84;              //this.CreateHorizontalDatum( horizontalDatumCode );
                primeMeridianCode = this.CreatePrimeMeridianCodeFromDatum(horizontalDatumCode);
                primeMeridian     = this.CreatePrimeMeridian(primeMeridianCode);
            }
            else
            {
                horizontalDatum   = this.CreateHorizontalDatum(horizontalDatumCode);
                primeMeridianCode = this.CreatePrimeMeridianCodeFromDatum(horizontalDatumCode);
                primeMeridian     = this.CreatePrimeMeridian(primeMeridianCode);
            }

            // we get the information for the axis
            IAxisInfo[]  axisInfos   = GetAxisInfo(coordSysCode);
            IAngularUnit angularUnit = new AngularUnit(1);


            IAxisInfo axisInfo1 = axisInfos[0];
            IAxisInfo axisInfo2 = axisInfos[1];
            IGeographicCoordinateSystem geographicCoordSys = new GeographicCoordinateSystem(angularUnit, horizontalDatum, primeMeridian, axisInfo1, axisInfo2, remarks, datasource, code, name, "", "");

            return(geographicCoordSys);
        }
		/// <summary>
		/// Creates a GCS, which could be Lat/Lon or Lon/Lat.
		/// </summary>
		/// <param name="name">The name of the coordinae system.</param>
		/// <param name="angularUnit">The angular units to use.</param>
		/// <param name="horizontalDatum">Ghe horizontal datum to use.</param>
		/// <param name="primeMeridian">The prime meridian to use.</param>
		/// <param name="axis0">Information about the x axis.</param>
		/// <param name="axis1">Information about the y axis.</param>
		/// <returns>an object that implements the IGeographicCoordinateSystem interface.</returns>
		public IGeographicCoordinateSystem CreateGeographicCoordinateSystem(string name, IAngularUnit angularUnit, IHorizontalDatum horizontalDatum, IPrimeMeridian primeMeridian,  IAxisInfo axis0, IAxisInfo axis1)
		{
			return new GeographicCoordinateSystem(name, angularUnit, horizontalDatum, primeMeridian, axis0, axis1);
		}
		public void TestCreateLocalCoordinateSystem2()
		{
			try
			{
				IAxisInfo[] axis = new IAxisInfo[1];
				axis[0] = AxisInfo.X;
				_csFactory.CreateLocalCoordinateSystem("name",null,null,axis);
				Assertion.Fail("Should throw a not implemented exception.");
			}
			catch(NotImplementedException)
			{
			}
		}
Exemplo n.º 40
0
 private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(XmlTextReader reader)
 {
     if (!(reader.NodeType==XmlNodeType.Element &&  reader.Name=="CS_ProjectedCoordinateSystem"))
     {
         throw new ParseException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Expected a IProjectedCoordinateSystem but got a {0} at line {1} col {2}",reader.Name,reader.LineNumber,reader.LinePosition));
     }
     string authority="",authorityCode="",abbreviation="",name="";
     reader.Read();
     ReadInfo(reader, ref authority,ref authorityCode, ref abbreviation, ref name);
     ArrayList list = new ArrayList();
     while (reader.NodeType==XmlNodeType.Element && reader.Name=="CS_AxisInfo")
     {
         IAxisInfo axis = ReadAxisInfo( reader );
         list.Add(axis);
         reader.Read();
     }
     IAxisInfo[] axisInfos = new IAxisInfo[list.Count];
     axisInfos = (IAxisInfo[])list.ToArray(typeof(IAxisInfo));
     IGeographicCoordinateSystem geographicCoordinateSystem = ReadGeographicCoordinateSystem( reader );
     ILinearUnit linearUnit = ReadLinearUnit( reader );
     IProjection projection = ReadProjection( reader );
     reader.Read();
     //IPrimeMeridian primeMeridian = null;
     IHorizontalDatum horizontalDatum = null;
     ProjectedCoordinateSystem projectedCS = new ProjectedCoordinateSystem(horizontalDatum,
         axisInfos,geographicCoordinateSystem,linearUnit, projection,"",authority,authorityCode,
         name,"",abbreviation);
     return projectedCS;
 }
Exemplo n.º 41
0
        /// <summary>
        /// Creates a vertical coordinate system from a datum and linear units
        /// </summary>
        /// <param name="name">The name of the vertical coordinate system.</param>
        /// <param name="verticalDatum">The vertical datum to use.</param>
        /// <param name="verticalUnit">The units to use.</param>
        /// <param name="axis">The axis to use.</param>
        /// <returns>An an object that implements the IVerticalCoordinateSystem interface.</returns>
        public IVerticalCoordinateSystem CreateVerticalCoordinateSystem(string name, IVerticalDatum verticalDatum, ILinearUnit verticalUnit, IAxisInfo axis)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (verticalDatum == null)
            {
                throw new ArgumentNullException("verticalDatum");
            }
            if (verticalUnit == null)
            {
                throw new ArgumentNullException("verticalUnit");
            }
            VerticalCoordinateSystem verticalCS = new VerticalCoordinateSystem(name, verticalDatum, axis, verticalUnit);

            return(verticalCS);
        }
		/// <summary>
		/// Creates a vertical coordinate system from a datum and linear units
		/// </summary>
		/// <param name="name">The name of the vertical coordinate system.</param>
		/// <param name="verticalDatum">The vertical datum to use.</param>
		/// <param name="verticalUnit">The units to use.</param>
		/// <param name="axis">The axis to use.</param>
		/// <returns>An an object that implements the IVerticalCoordinateSystem interface.</returns>
		public IVerticalCoordinateSystem CreateVerticalCoordinateSystem(string name, IVerticalDatum verticalDatum, ILinearUnit verticalUnit, IAxisInfo axis)
		{
			if (name==null)
			{
				throw new ArgumentNullException("name");
			}
			if (verticalDatum==null)
			{
				throw new ArgumentNullException("verticalDatum");
			}
			if (verticalUnit==null)
			{
				throw new ArgumentNullException("verticalUnit");
			}
			VerticalCoordinateSystem verticalCS = new VerticalCoordinateSystem(name, verticalDatum, axis, verticalUnit);
			return verticalCS; 
		}
Exemplo n.º 43
0
 /// <summary>
 /// Creates a GCS, which could be Lat/Lon or Lon/Lat.
 /// </summary>
 /// <param name="name">The name of the coordinae system.</param>
 /// <param name="angularUnit">The angular units to use.</param>
 /// <param name="horizontalDatum">Ghe horizontal datum to use.</param>
 /// <param name="primeMeridian">The prime meridian to use.</param>
 /// <param name="axis0">Information about the x axis.</param>
 /// <param name="axis1">Information about the y axis.</param>
 /// <returns>an object that implements the IGeographicCoordinateSystem interface.</returns>
 public IGeographicCoordinateSystem CreateGeographicCoordinateSystem(string name, IAngularUnit angularUnit, IHorizontalDatum horizontalDatum, IPrimeMeridian primeMeridian, IAxisInfo axis0, IAxisInfo axis1)
 {
     return(new GeographicCoordinateSystem(name, angularUnit, horizontalDatum, primeMeridian, axis0, axis1));
 }
		/// <summary>
		/// Creates a projected coordinate system using a projection object.
		/// </summary>
		/// <param name="name">The name of the projected coordinate system.</param>
		/// <param name="geographicCoordinateSystem">The geographic coordinate system to base this coordinate system on.</param>
		/// <param name="projection">The projection details.</param>
		/// <param name="linearUnit">The linear units to use.</param>
		/// <param name="axis0">The X axis.</param>
		/// <param name="axis1">The Y aixs.</param>
		/// <returns>An object the implements the IProjectedCoordinateSystem interface.</returns>
		public IProjectedCoordinateSystem CreateProjectedCoordinateSystem(string name, IGeographicCoordinateSystem geographicCoordinateSystem, IProjection projection, ILinearUnit linearUnit,  IAxisInfo axis0,  IAxisInfo axis1)
		{
			if (name==null)
			{
				throw new ArgumentNullException("name");
			}
			if (geographicCoordinateSystem==null)
			{
				throw new ArgumentNullException("geographicCoordinateSystem");
			}
			if (projection==null)
			{
				throw new ArgumentNullException("projection");
			}
			if (linearUnit==null)
			{
				throw new ArgumentNullException("linearUnit");
			}
			IAxisInfo[] axisInfo = new IAxisInfo[2];
			axisInfo[0]=axis0;
			axisInfo[1]=axis1;
			ProjectedCoordinateSystem projectedCS = new ProjectedCoordinateSystem(null,axisInfo,geographicCoordinateSystem,linearUnit, projection);
			return projectedCS;
		}