Example #1
0
        private static void ApplyParametersStere(ProjectionInfo result, IEnumerable <INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector(),
                new LongitudeOfCenterParameterSelector());
            var spParam = new MultiParameterSelector(
                new LatitudeOfTrueScaleParameterSelector(),
                new StandardParallelParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector(),
                new LatitudeOfCenterParameterSelector());
            var k0Param = new ScaleFactorParameterSelector();
            var x0Param = new FalseEastingParameterSelector();
            var y0Param = new FalseNorthingParameterSelector();

            var paramLookup = new NamedParameterLookup(parameters);

            paramLookup.Assign(lon0Param, spParam, k0Param, x0Param, y0Param);

            if (lon0Param.IsSelected)
            {
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (spParam.IsSelected)
            {
                result.StandardParallel1 = spParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (k0Param.IsSelected)
            {
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            }
            if (x0Param.IsSelected)
            {
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }
            if (y0Param.IsSelected)
            {
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }

            if (!result.LatitudeOfOrigin.HasValue && result.StandardParallel1.HasValue)
            {
                result.LatitudeOfOrigin = result.StandardParallel1.GetValueOrDefault() >= 0 ? 90.0 : -90.0;
            }
        }
Example #2
0
        private static void ApplyParametersStere(ProjectionInfo result, IEnumerable<INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector(),
                new LongitudeOfCenterParameterSelector());
            var spParam = new MultiParameterSelector(
                new LatitudeOfTrueScaleParameterSelector(),
                new StandardParallelParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector(),
                new LatitudeOfCenterParameterSelector());
            var k0Param = new ScaleFactorParameterSelector();
            var x0Param = new FalseEastingParameterSelector();
            var y0Param = new FalseNorthingParameterSelector();

            var paramLookup = new NamedParameterLookup(parameters);
            paramLookup.Assign(lon0Param, spParam, k0Param, x0Param, y0Param);

            if (lon0Param.IsSelected)
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (spParam.IsSelected)
                result.StandardParallel1 = spParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (k0Param.IsSelected)
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            if (x0Param.IsSelected)
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            if (y0Param.IsSelected)
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);

            if (!result.LatitudeOfOrigin.HasValue && result.StandardParallel1.HasValue)
                result.LatitudeOfOrigin = result.StandardParallel1.GetValueOrDefault() >= 0 ? 90.0 : -90.0;
        }
Example #3
0
        private static void ApplyParametersDefault(ProjectionInfo result, IEnumerable <INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector()
                );
            var loncParam = new LongitudeOfCenterParameterSelector();
            var lat0Param = new MultiParameterSelector(
                new LatitudeOfCenterParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector());
            var lat1Param              = new StandardParallelParameterSelector(1);
            var lat2Param              = new StandardParallelParameterSelector(2);
            var x0Param                = new FalseEastingParameterSelector();
            var y0Param                = new FalseNorthingParameterSelector();
            var k0Param                = new ScaleFactorParameterSelector();
            var alphaParam             = new KeywordNamedParameterSelector("ALPHA", "AZIMUTH");
            var angleSkewParam         = new KeywordNamedParameterSelector("SKEW", "GAMMA");
            var zoneParam              = new FullMatchParameterSelector("ZONE");
            var southParam             = new FullMatchParameterSelector("SOUTH");
            var standardParallel1Param = new MultiParameterSelector(
                new StandardParallelParameterSelector(),
                new StandardParallelParameterSelector(1));
            var standardParallel2Param = new StandardParallelParameterSelector(2);

            var paramLookup = new NamedParameterLookup(parameters);

            paramLookup.Assign(lon0Param, loncParam, lat0Param, lat1Param, lat2Param, x0Param, y0Param, k0Param, alphaParam, angleSkewParam, zoneParam, southParam, standardParallel1Param, standardParallel2Param);

            if (lon0Param.IsSelected)
            {
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (loncParam.IsSelected)
            {
                result.LongitudeOfCenter = loncParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (lat0Param.IsSelected)
            {
                result.LatitudeOfOrigin = lat0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (lat1Param.IsSelected)
            {
                result.StandardParallel1 = lat1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (lat2Param.IsSelected)
            {
                result.StandardParallel2 = lat2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (x0Param.IsSelected)
            {
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }
            if (y0Param.IsSelected)
            {
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }
            if (k0Param.IsSelected)
            {
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            }
            if (alphaParam.IsSelected)
            {
                result.alpha = alphaParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }

            /*if (angleSkewParam.IsSelected)
             *  result.gamma = angleSkewParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);*/
            if (southParam.IsSelected)
            {
                result.IsSouth = southParam.GetValueAsBoolean().GetValueOrDefault();
            }
            if (standardParallel1Param.IsSelected)
            {
                result.StandardParallel1 = standardParallel1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (standardParallel2Param.IsSelected)
            {
                result.StandardParallel2 = standardParallel2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (zoneParam.IsSelected)
            {
                result.Zone = zoneParam.GetValueAsInt32();
            }
        }
Example #4
0
        private static void ApplyParametersDefault(ProjectionInfo result, IEnumerable<INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector()
            );
            var loncParam = new LongitudeOfCenterParameterSelector();
            var lat0Param = new MultiParameterSelector(
                new LatitudeOfCenterParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector());
            var lat1Param = new StandardParallelParameterSelector(1);
            var lat2Param = new StandardParallelParameterSelector(2);
            var x0Param = new FalseEastingParameterSelector();
            var y0Param = new FalseNorthingParameterSelector();
            var k0Param = new ScaleFactorParameterSelector();
            var alphaParam = new KeywordNamedParameterSelector("ALPHA", "AZIMUTH");
            var angleSkewParam = new KeywordNamedParameterSelector("SKEW", "GAMMA");
            var zoneParam = new FullMatchParameterSelector("ZONE");
            var southParam = new FullMatchParameterSelector("SOUTH");
            var standardParallel1Param = new MultiParameterSelector(
                new StandardParallelParameterSelector(),
                new StandardParallelParameterSelector(1));
            var standardParallel2Param = new StandardParallelParameterSelector(2);

            var paramLookup = new NamedParameterLookup(parameters);
            paramLookup.Assign(lon0Param, loncParam, lat0Param, lat1Param, lat2Param, x0Param, y0Param, k0Param, alphaParam, angleSkewParam, zoneParam, southParam, standardParallel1Param, standardParallel2Param);

            if (lon0Param.IsSelected)
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (loncParam.IsSelected)
                result.LongitudeOfCenter = loncParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (lat0Param.IsSelected)
                result.LatitudeOfOrigin = lat0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (lat1Param.IsSelected)
                result.StandardParallel1 = lat1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (lat2Param.IsSelected)
                result.StandardParallel2 = lat2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (x0Param.IsSelected)
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            if (y0Param.IsSelected)
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            if (k0Param.IsSelected)
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            if (alphaParam.IsSelected)
                result.alpha = alphaParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            /*if (angleSkewParam.IsSelected)
                result.gamma = angleSkewParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);*/
            if (southParam.IsSelected)
                result.IsSouth = southParam.GetValueAsBoolean().GetValueOrDefault();
            if (standardParallel1Param.IsSelected)
                result.StandardParallel1 = standardParallel1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (standardParallel2Param.IsSelected)
                result.StandardParallel2 = standardParallel2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (zoneParam.IsSelected)
                result.Zone = zoneParam.GetValueAsInt32();
        }