Example #1
0
        /// <summary>
        /// Gets the item with the specified properties.
        /// </summary>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="areaOfUse">The area of use.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <returns>The instance with the specified identifier.</returns>
        public CoordinateProjection this[CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, AreaOfUse areaOfUse, Ellipsoid ellipsoid]
        {
            get
            {
                if (method == null)
                {
                    return(null);
                }
                if (areaOfUse == null)
                {
                    return(null);
                }
                if (ellipsoid == null)
                {
                    return(null);
                }

                CoordinateProjectionData matchingData = this.dataCollection.Where(data => data != null && this.projectionTypes.ContainsKey(data.Method.Code)).FirstOrDefault(data => data.Method.Equals(method) && (areaOfUse.Equals(AreaOfUse.Undefined) || data.AreaOfUse.Equals(areaOfUse)) && this.IsMatching(data.Parameters, parameters));

                // no matching projection is available
                if (matchingData == null)
                {
                    return(null);
                }

                return(this.CreateProjection(matchingData, ellipsoid));
            }
        }
Example #2
0
        /// <summary>
        /// Gets the item with the specified identifier.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <returns>The instance with the specified identifier.</returns>
        public CoordinateProjection this[String identifier, Ellipsoid ellipsoid]
        {
            get
            {
                if (identifier == null || ellipsoid == null)
                {
                    return(null);
                }

                CoordinateProjectionData data = this.dataCollection[identifier];

                this.EnsureOperationTypes();

                // TODO: remove condition, once all projections are implemented
                if (data == null || !this.projectionTypes.ContainsKey(data.Method.Code))
                {
                    return(null);
                }

                return(this.CreateProjection(data, ellipsoid));
            }
        }
Example #3
0
        /// <summary>
        /// Creates a coordinate projection.
        /// </summary>
        /// <param name="data">The raw coordinate projection data.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <returns>The produced coordinate projection.</returns>
        private CoordinateProjection CreateProjection(CoordinateProjectionData data, Ellipsoid ellipsoid)
        {
            Object[] arguments = new Object[] { data.Identifier, data.Name, data.Remarks, data.Aliases, data.Parameters, ellipsoid, data.AreaOfUse };

            return(Activator.CreateInstance(this.projectionTypes[data.Method.Code], arguments) as CoordinateProjection);
        }