/// <summary>
        /// Converts the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns>The converted reference.</returns>
        protected override ProjectedCoordinateReferenceSystem Convert(String[] content)
        {
            switch (content[3])
            {
            case "projected":
                AreaOfUse areaOfUse = this.areaOfUseCollection[Authority, Int32.Parse(content[2])];
                GeographicCoordinateReferenceSystem baseReferenceSystem = this.baseCoordinateReferenceSystemCollection[Authority, Int32.Parse(content[6])];
                CoordinateSystem coordinateSystem = this.coordinateSystemCollection[Authority, Int32.Parse(content[4])];

                // the projection should use the ellipsoid with the unit specified by the coordinate system
                CoordinateProjection projection = this.coordinateProjectionCollection[Authority, Int32.Parse(content[7]), baseReferenceSystem.Datum.Ellipsoid.ToUnit(coordinateSystem.GetAxis(0).Unit)];

                // TODO: remove condition, once all projections are implemented
                if (projection == null)
                {
                    return(null);
                }

                return(new ProjectedCoordinateReferenceSystem(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                              content[11], this.GetAliases(Int32.Parse(content[0])), content[10],
                                                              baseReferenceSystem, coordinateSystem, areaOfUse, projection));

            default:
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// Converts the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns>The converted reference.</returns>
        protected override CoordinateSystem Convert(String[] content)
        {
            CoordinateSystemType type = (CoordinateSystemType)Enum.Parse(typeof(CoordinateSystemType), content[2], true);

            return(new CoordinateSystem(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                        content[4], this.GetAliases(Int32.Parse(content[0])),
                                        type, this.GetAxes(content[0])));
        }
예제 #3
0
        /// <summary>
        /// Gets the instance with the specified authority and code.
        /// </summary>
        /// <param name="authority">The authority.</param>
        /// <param name="code">The code.</param>
        /// <returns>The instance with the specified authority and code.</returns>
        public CoordinateOperationParameter this[String authority, Int32 code]
        {
            get
            {
                if (authority == null)
                {
                    return(null);
                }

                return(this[IdentifiedObject.GetIdentifier(authority, code)]);
            }
        }
        /// <summary>
        /// Gets the instance with the specified authority and code.
        /// </summary>
        /// <param name="authority">The authority.</param>
        /// <param name="code">The code.</param>
        /// <returns>The instance with the specified authority and code.</returns>
        public UnitOfMeasurement this[String authority, Int32 code]
        {
            get
            {
                if (authority == null)
                {
                    return(null);
                }

                return(this[IdentifiedObject.GetIdentifier(authority, code)]);
            }
        }
예제 #5
0
        /// <summary>
        /// Converts the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns>The converted reference.</returns>
        protected override AreaOfUse Convert(String[] content)
        {
            Double south = Double.NaN, west = Double.NaN, north = Double.NaN, east = Double.NaN;

            Double.TryParse(content[3], out south);
            Double.TryParse(content[4], out west);
            Double.TryParse(content[5], out north);
            Double.TryParse(content[6], out east);

            return(AreaOfUse.FromDegrees(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                         content[2], null, this.GetAliases(Int32.Parse(content[0])),
                                         south, west, north, east));
        }
        /// <summary>
        /// Converts the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns>The converted reference.</returns>
        protected override VerticalDatum Convert(String[] content)
        {
            switch (content[2])
            {
            case "vertical":
                return(new VerticalDatum(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                         content[9], this.GetAliases(Int32.Parse(content[0])),
                                         content[3], content[4], content[8],
                                         this.areaOfUseCollection[Authority, Int32.Parse(content[7])]));

            default:
                return(null);
            }
        }
        /// <summary>
        /// Converts the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns>The converted reference.</returns>
        protected override CompoundReferenceSystem Convert(String[] content)
        {
            switch (content[3])
            {
            case "compound":
                return(new CompoundReferenceSystem(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                   content[11], this.GetAliases(Int32.Parse(content[0])), content[10],
                                                   this.areaOfUseCollection[Authority, Int32.Parse(content[2])],
                                                   this.referenceSystemCollection[Authority, Int32.Parse(content[8])],
                                                   this.referenceSystemCollection[Authority, Int32.Parse(content[9])]));

            default:
                return(null);
            }
        }
예제 #8
0
        /// <summary>
        /// Converts the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns>The converted reference.</returns>
        protected override GeocentricCoordinateReferenceSystem Convert(String[] content)
        {
            switch (content[3])
            {
            case "geocentric":
                return(new GeocentricCoordinateReferenceSystem(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                               content[11], this.GetAliases(Int32.Parse(content[0])), content[10],
                                                               this.coordinateSystemCollection[Authority, Int32.Parse(content[4])],
                                                               this.geodeticDatumCollection[Authority, Int32.Parse(content[5])],
                                                               this.areaOfUseCollection[Authority, Int32.Parse(content[2])]));

            default:
                return(null);
            }
        }
예제 #9
0
        /// <summary>
        /// Converts the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns>The converted reference.</returns>
        protected override GeodeticDatum Convert(String[] content)
        {
            switch (content[2])
            {
            case "geodetic":
                return(new GeodeticDatum(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                         content[9], this.GetAliases(Int32.Parse(content[0])),
                                         content[3], content[4], content[8],
                                         this.areaOfUseCollection[Authority, Int32.Parse(content[7])],
                                         this.ellipsoidCollection[Authority, Int32.Parse(content[5])],
                                         this.meridianCollection[Authority, Int32.Parse(content[6])]));

            default:
                return(null);
            }
        }
예제 #10
0
 /// <summary>
 /// Converts the specified content.
 /// </summary>
 /// <param name="content">The content.</param>
 /// <returns>The converted reference.</returns>
 protected override Ellipsoid Convert(String[] content)
 {
     if (!String.IsNullOrEmpty(content[4]))
     {
         // inverse flattening is available
         return(Ellipsoid.FromInverseFlattening(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                content[7], this.GetAliases(Int32.Parse(content[0])),
                                                new Length(Double.Parse(content[2]), this.unitCollection[Authority, Int32.Parse(content[3])]),
                                                Double.Parse(content[4])));
     }
     else
     {
         // semi-major axis is available
         return(Ellipsoid.FromSemiMinorAxis(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                            content[7], this.GetAliases(Int32.Parse(content[0])),
                                            new Length(Double.Parse(content[2]), this.unitCollection[Authority, Int32.Parse(content[3])]),
                                            new Length(Double.Parse(content[5]), this.unitCollection[Authority, Int32.Parse(content[3])])));
     }
 }
예제 #11
0
            /// <summary>
            /// Converts the specified content.
            /// </summary>
            /// <param name="content">The content.</param>
            /// <returns>The converted reference.</returns>
            protected override CoordinateProjectionData Convert(String[] content)
            {
                this.EnsureProjectionParameters();

                CoordinateOperationMethod method = !String.IsNullOrEmpty(content[10]) ? this.methodCollection.WithIdentifier(IdentifiedObject.GetIdentifier(Authority, content[10])).FirstOrDefault() : null;
                AreaOfUse areaOfUse = this.areaOfUseCollection.WithIdentifier(IdentifiedObject.GetIdentifier(Authority, content[7])).FirstOrDefault();

                // TODO: remove condition, once all projections are implemented
                if (method == null)
                {
                    return(null);
                }

                return(new CoordinateProjectionData(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                    content[13], this.GetAliases(Int32.Parse(content[0])),
                                                    method,
                                                    this.projectionParameters.ContainsKey(Int32.Parse(content[0])) ? this.projectionParameters[Int32.Parse(content[0])] : null,
                                                    areaOfUse));
            }
            /// <summary>
            /// Converts the specified content.
            /// </summary>
            /// <param name="content">The content.</param>
            /// <returns>The converted reference.</returns>
            protected override CoordinateTransformationData Convert(String[] content)
            {
                this.EnsureTransformationParameters();

                CoordinateOperationMethod method = !String.IsNullOrEmpty(content[10]) ? this.methodCollection[Authority, Int32.Parse(content[10])] : null;
                CoordinateReferenceSystem source = this.referenceSystemCollection[Authority, Int32.Parse(content[3])];
                CoordinateReferenceSystem target = this.referenceSystemCollection[Authority, Int32.Parse(content[4])];

                AreaOfUse areaOfUse = this.areaOfUseCollection[Authority, Int32.Parse(content[7])];

                // TODO: remove condition, once all operations are implemented
                if (method == null)
                {
                    return(null);
                }

                return(new CoordinateTransformationData(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                        content[13], this.GetAliases(Int32.Parse(content[0])),
                                                        method,
                                                        this.transformationParameters.ContainsKey(Int32.Parse(content[0])) ? this.transformationParameters[Int32.Parse(content[0])] : null,
                                                        source,
                                                        target,
                                                        areaOfUse));
            }
예제 #13
0
 /// <summary>
 /// Converts the specified content.
 /// </summary>
 /// <param name="content">The content.</param>
 /// <returns>The converted reference.</returns>
 protected override CoordinateSystemAxisData Convert(String[] content)
 {
     return(new CoordinateSystemAxisData(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                         content[2], this.GetAliases(Int32.Parse(content[0])),
                                         content[3]));
 }
예제 #14
0
 /// <summary>
 /// Converts the specified content.
 /// </summary>
 /// <param name="content">The content.</param>
 /// <returns>The converted reference.</returns>
 protected override Meridian Convert(String[] content)
 {
     return(new Meridian(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                         content[4], this.GetAliases(Int32.Parse(content[0])),
                         new Angle(Double.Parse(content[2]), this.unitCollection[Authority, Int32.Parse(content[3])])));
 }
예제 #15
0
            /// <summary>
            /// Ensures that all projection parameters are available.
            /// </summary>
            private void EnsureProjectionParameters()
            {
                if (this.projectionParameters != null)
                {
                    return;
                }

                this.projectionParameters = new Dictionary <Int32, Dictionary <CoordinateOperationParameter, Object> >();

                using (StreamReader reader = new StreamReader(this.OpenResource(ResourceNameParameterValue)))
                {
                    String line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        String[] content = line.Split(Divider);

                        Int32 code = Int32.Parse(content[0]);

                        if (!this.projectionParameters.ContainsKey(code))
                        {
                            this.projectionParameters.Add(code, new Dictionary <CoordinateOperationParameter, Object>());
                        }

                        CoordinateOperationParameter parameter = this.parameterCollection.WithIdentifier(IdentifiedObject.GetIdentifier(Authority, content[2])).FirstOrDefault();

                        // TODO: remove condition, once all parameters are implemented
                        if (parameter == null)
                        {
                            continue;
                        }

                        if (!String.IsNullOrEmpty(content[3]))
                        {
                            // the parameter is a value
                            if (!String.IsNullOrEmpty(content[5]))
                            {
                                // the parameter has a measurement unit

                                UnitOfMeasurement unit = this.unitCollection.WithIdentifier(IdentifiedObject.GetIdentifier(Authority, content[5])).FirstOrDefault();

                                switch (unit.Type)
                                {
                                case UnitQuantityType.Angle:
                                    this.projectionParameters[code].Add(parameter, new Angle(Double.Parse(content[3], CultureInfo.InvariantCulture.NumberFormat), unit));
                                    break;

                                case UnitQuantityType.Length:
                                    this.projectionParameters[code].Add(parameter, new Length(Double.Parse(content[3], CultureInfo.InvariantCulture.NumberFormat), unit));
                                    break;

                                case UnitQuantityType.Scale:
                                    this.projectionParameters[code].Add(parameter, Double.Parse(content[3], CultureInfo.InvariantCulture.NumberFormat));
                                    break;
                                }
                            }
                            else
                            {
                                // the parameter is scalar

                                this.projectionParameters[code].Add(parameter, Double.Parse(content[3], CultureInfo.InvariantCulture.NumberFormat));
                            }
                        }

                        if (!String.IsNullOrEmpty(content[4]))
                        {
                            // the parameter is a path
                            this.projectionParameters[code].Add(parameter, content[4]);
                        }
                    }
                }
            }