private SpheroidProjectionBase CreatePolarStereographic(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var latParam = new MultiParameterSelector( new LatitudeOfNaturalOriginParameterSelector(), new LatitudeOfTrueScaleParameterSelector()); var originLonParam = new MultiParameterSelector( new LongitudeOfNaturalOriginParameterSelector(), new FullMatchParameterSelector("LONDOWNFROMPOLE"));// new KeywordNamedParameterSelector("LON", "ORIGIN"); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var standardParallelParam = new StandardParallelParameterSelector(); var scaleFactorParam = new ScaleFactorParameterSelector(); opData.ParameterLookup.Assign(latParam, originLonParam, offsetXParam, offsetYParam, standardParallelParam, scaleFactorParam); var linearUnit = opData.StepParams.RelatedOutputCrsUnit; var fromSpheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(linearUnit); if (null == fromSpheroid) return null; double latitude, longitude; if (!latParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out latitude)) latitude = 0; if (!originLonParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out longitude)) longitude = 0; double xOffset, yOffset; var offset = (offsetXParam.TryGetValueAsDouble(linearUnit, out xOffset) && offsetYParam.TryGetValueAsDouble(linearUnit, out yOffset)) ? new Vector2(xOffset, yOffset) : Vector2.Zero; double scaleFactor; if (scaleFactorParam.TryGetValueAsDouble(ScaleUnitUnity.Value, out scaleFactor)) return new PolarStereographic(new GeographicCoordinate(latitude,longitude), scaleFactor, offset, fromSpheroid); double standardParallel; if (standardParallelParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out standardParallel)) { if ( (offsetXParam.IsSelected && opData.ParameterLookup.ParameterNameNormalizedComparer.Normalize(offsetXParam.Selection.Name).Contains("ORIGIN")) || (offsetYParam.IsSelected && opData.ParameterLookup.ParameterNameNormalizedComparer.Normalize(offsetYParam.Selection.Name).Contains("ORIGIN")) ) { return PolarStereographic.CreateFromStandardParallelAndFalseOffsetAtOrigin(longitude, standardParallel, offset, fromSpheroid); } return PolarStereographic.CreateFromStandardParallel(longitude, standardParallel, offset, fromSpheroid); } throw new InvalidOperationException(); }
private ITransformation<GeographicCoordinate, Point2> CreateMercator(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new MultiParameterSelector( new LatitudeOfNaturalOriginParameterSelector(), new LatitudeOfTrueScaleParameterSelector(), new StandardParallelParameterSelector()); var originLonParam = new MultiParameterSelector( new CentralMeridianParameterSelector(), new LongitudeOfNaturalOriginParameterSelector()); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var scaleFactorParam = new ScaleFactorParameterSelector(); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset)) offset = Vector2.Zero; // ReSharper disable CompareOfFloatsByEqualityOperator double scaleFactor; if (scaleFactorParam.IsSelected && TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor)) { if (1 == scaleFactor && 0 == spheroid.E) return new MercatorSpherical(offset, origin.Longitude, spheroid.A); return new Mercator(origin.Longitude, scaleFactor, offset, spheroid); } if (0 == spheroid.E) return new MercatorSpherical(offset, origin.Longitude, spheroid.A); return new Mercator(origin, offset, spheroid); // ReSharper restore CompareOfFloatsByEqualityOperator }
private SpheroidProjectionBase CreateObliqueStereographic(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new LatitudeOfNaturalOriginParameterSelector(); var originLonParam = new LongitudeOfNaturalOriginParameterSelector(); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var scaleFactorParam = new ScaleFactorParameterSelector(); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset)) offset = Vector2.Zero; double scaleFactor; if (scaleFactorParam.IsSelected && TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor)) return new ObliqueStereographic(origin, scaleFactor, offset, spheroid); return null; }
private SpheroidProjectionBase CreateLambertAzimuthalEqualArea(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new LatitudeOfNaturalOriginParameterSelector(); var originLonParam = new LongitudeOfNaturalOriginParameterSelector(); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!originLatParam.IsSelected || !originLonParam.IsSelected || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!offsetXParam.IsSelected || !offsetYParam.IsSelected || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset)) offset = Vector2.Zero; var spherical = _coordinateOperationNameComparer.Normalize(opData.OperationName).EndsWith("SPHERICAL"); if (spherical) return new LambertAzimuthalEqualAreaSpherical(origin, offset, spheroid); if (Math.Abs(origin.Latitude - (Math.PI / 2.0)) < 0.00000001) return new LambertAzimuthalEqualAreaPolar(origin, offset, spheroid); // N if (Math.Abs(origin.Latitude - (Math.PI / -2.0)) < 0.00000001) return new LambertAzimuthalEqualAreaPolar(origin, offset, spheroid); // S return new LambertAzimuthalEqualAreaOblique(origin, offset, spheroid); }
private ITransformation<GeographicCoordinate, Point2> CreateLambertConicConformal(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new KeywordNamedParameterSelector("LAT", "ORIGIN"); var originLonParam = new KeywordNamedParameterSelector("LON", "ORIGIN", "CENTRAL", "MERIDIAN"); var parallel1Param = new KeywordNamedParameterSelector("LAT", "1", "PARALLEL"); var parallel2Param = new KeywordNamedParameterSelector("LAT", "2", "PARALLEL"); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var scaleFactorParam = new ScaleFactorParameterSelector(); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam, parallel1Param, parallel2Param); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset)) offset = Vector2.Zero; double parallel1, parallel2; if (parallel1Param.IsSelected && parallel2Param.IsSelected && TryGetDouble(parallel1Param.Selection, OgcAngularUnit.DefaultRadians, out parallel1) && TryGetDouble(parallel2Param.Selection, OgcAngularUnit.DefaultRadians, out parallel2)) { if (_coordinateOperationNameComparer.Normalize(opData.OperationName).EndsWith("BELGIUM")) return new LambertConicConformalBelgium(origin, parallel1, parallel2, offset, spheroid); return new LambertConicConformal2Sp(origin, parallel1, parallel2, offset, spheroid); } if (scaleFactorParam.IsSelected){ double scaleFactor; if(TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor)) return new LambertConicConformal1Sp(origin, scaleFactor, offset, spheroid); } return null; }
private ITransformation<GeographicCoordinate, Point2> CreateKrovak(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var latConeAxisParam = new KeywordNamedParameterSelector("CO", "LAT", "CONE", "AXIS"); // Co-latitude of cone axis var latProjectionCenterParam = new KeywordNamedParameterSelector("LAT", "CENTER"); // Latitude of projection centre var latPseudoParallelParam = new KeywordNamedParameterSelector("LAT", "PSEUDO", "PARALLEL"); // Latitude of pseudo standard parallel var scaleFactorParallelParam = new KeywordNamedParameterSelector("SCALE", "PARALLEL"); // Scale factor on pseudo standard parallel var originLonParam = new KeywordNamedParameterSelector("LON", "ORIGIN"); // Longitude of origin var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var evalXParam = new KeywordNamedParameterSelector("ORDINATE1", "EVALUATION", "POINT"); var evalYParam = new KeywordNamedParameterSelector("ORDINATE2", "EVALUATION", "POINT"); opData.ParameterLookup.Assign(latConeAxisParam, latProjectionCenterParam, latPseudoParallelParam, scaleFactorParallelParam, originLonParam, offsetXParam, offsetYParam, evalXParam, evalYParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!latProjectionCenterParam.IsSelected || !originLonParam.IsSelected || !TryCreateGeographicCoordinate(latProjectionCenterParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!offsetXParam.IsSelected || !offsetYParam.IsSelected || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset)) offset = Vector2.Zero; Point2 evalPoint; if (!evalXParam.IsSelected || !evalYParam.IsSelected || !TryCreatePoint2(evalXParam.Selection, evalYParam.Selection, out evalPoint)) evalPoint = Point2.Zero; double azimuthOfInitialLine; if (!latConeAxisParam.IsSelected || !TryGetDouble(latConeAxisParam.Selection, OgcAngularUnit.DefaultRadians, out azimuthOfInitialLine)) azimuthOfInitialLine = Double.NaN; double latitudeOfPseudoStandardParallel; if (!latPseudoParallelParam.IsSelected || !TryGetDouble(latPseudoParallelParam.Selection, OgcAngularUnit.DefaultRadians, out latitudeOfPseudoStandardParallel)) latitudeOfPseudoStandardParallel = Double.NaN; double scaleFactor; if (!scaleFactorParallelParam.IsSelected || !TryGetDouble(scaleFactorParallelParam.Selection, ScaleUnitUnity.Value, out scaleFactor)) scaleFactor = Double.NaN; var normalizedName = _coordinateOperationNameComparer.Normalize(opData.OperationName); double[] constants = null; if (normalizedName.StartsWith("KROVAKMODIFIED")) { var constantParams = new NamedParameterSelector[] { new FullMatchParameterSelector("C1"), new FullMatchParameterSelector("C2"), new FullMatchParameterSelector("C3"), new FullMatchParameterSelector("C4"), new FullMatchParameterSelector("C5"), new FullMatchParameterSelector("C6"), new FullMatchParameterSelector("C7"), new FullMatchParameterSelector("C8"), new FullMatchParameterSelector("C9"), new FullMatchParameterSelector("C10") }; if (opData.ParameterLookup.Assign(constantParams)) { constants = constantParams .OrderBy(x => Int32.Parse(x.Selection.Name.Substring(1))) .Select(p => { double value; TryGetDouble(p.Selection, ScaleUnitUnity.Value, out value); return value; }) .ToArray(); Contract.Assume(constants.Length == constantParams.Length); } } if (normalizedName.Equals("KROVAKNORTH")) { return new KrovakNorth(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid); } if (null != constants) { if (normalizedName.Equals("KROVAKMODIFIED")) { return new KrovakModified(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid, evalPoint, constants); } if (normalizedName.Equals("KROVAKMODIFIEDNORTH")) { return new KrovakModifiedNorth(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid, evalPoint, constants); } } return new Krovak(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid); }
private SpheroidProjectionBase CreateLabordeObliqueMercator(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new KeywordNamedParameterSelector("LAT", "CENTER"); var originLonParam = new KeywordNamedParameterSelector("LON", "CENTER"); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var scaleFactorParam = new ScaleFactorParameterSelector(); var azimuthParam = new KeywordNamedParameterSelector("AZIMUTH"); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam, azimuthParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset)) offset = Vector2.Zero; double scaleFactor; if (!scaleFactorParam.IsSelected || !TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor)) scaleFactor = 1.0; double azimuth; if (!azimuthParam.IsSelected || !TryGetDouble(azimuthParam.Selection, OgcAngularUnit.DefaultRadians, out azimuth)) azimuth = 0; return new LabordeObliqueMercator(origin, azimuth, scaleFactor, spheroid, offset); }
private SpheroidProjectionBase CreateEquidistantCylindrical(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new KeywordNamedParameterSelector("LAT", "PARALLEL"); var originLonParam = new LongitudeOfNaturalOriginParameterSelector(); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!originLatParam.IsSelected || !originLonParam.IsSelected || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!offsetXParam.IsSelected || !offsetYParam.IsSelected || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset)) offset = Vector2.Zero; // ReSharper disable CompareOfFloatsByEqualityOperator var spherical = _coordinateOperationNameComparer.Normalize(opData.OperationName).EndsWith("SPHERICAL") || spheroid.E == 0; // ReSharper restore CompareOfFloatsByEqualityOperator return spherical ? (SpheroidProjectionBase)new EquidistantCylindricalSpherical(origin, offset, spheroid) : new EquidistantCylindrical(origin, offset, spheroid); }
private SpheroidProjectionBase CreateHotineObliqueMercator(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var latParam = new MultiParameterSelector( new LatitudeOfCenterParameterSelector(), new LatitudeOfNaturalOriginParameterSelector()); var lonParam = new MultiParameterSelector( new LongitudeOfCenterParameterSelector(), new LongitudeOfNaturalOriginParameterSelector()); var scaleFactorParam = new ScaleFactorParameterSelector(); var azimuthParam = new KeywordNamedParameterSelector("AZIMUTH"); var angleSkewParam = new KeywordNamedParameterSelector("ANGLE", "SKEW"); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var xAtOriginParam = new EastingAtCenterParameterSelector(); var yAtOriginParam = new NorthingAtCenterParameterSelector(); opData.ParameterLookup.Assign(latParam, lonParam, offsetXParam, offsetYParam, xAtOriginParam, yAtOriginParam, scaleFactorParam, azimuthParam, angleSkewParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; double lat, lon; if(!latParam.IsSelected || !latParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out lat)) lat = 0; if(!lonParam.IsSelected || !lonParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out lon)) lon = 0; var origin = new GeographicCoordinate(lat, lon); double scaleFactor; if (!scaleFactorParam.IsSelected || !TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor)) scaleFactor = 1.0; double azimuth; if (!azimuthParam.IsSelected || !TryGetDouble(azimuthParam.Selection, OgcAngularUnit.DefaultRadians, out azimuth)) azimuth = 0; double angleSkew; if (!angleSkewParam.IsSelected || !TryGetDouble(angleSkewParam.Selection, OgcAngularUnit.DefaultRadians, out angleSkew)) angleSkew = 0; var outputUnit = opData.StepParams.RelatedOutputCrsUnit; double x,y; if(xAtOriginParam.IsSelected || yAtOriginParam.IsSelected){ if (!xAtOriginParam.IsSelected || !xAtOriginParam.TryGetValueAsDouble(outputUnit, out x)) x = 0; if (!yAtOriginParam.IsSelected || !yAtOriginParam.TryGetValueAsDouble(outputUnit, out y)) y = 0; return new HotineObliqueMercator.VariantB(new GeographicCoordinate(lat, lon), azimuth, angleSkew, scaleFactor, new Vector2(x,y), spheroid); } else { if (!offsetXParam.IsSelected || !offsetXParam.TryGetValueAsDouble(outputUnit, out x)) x = 0; if (!offsetYParam.IsSelected || !offsetYParam.TryGetValueAsDouble(outputUnit, out y)) y = 0; return new HotineObliqueMercator.VariantA(new GeographicCoordinate(lat, lon), azimuth, angleSkew, scaleFactor, new Vector2(x,y), spheroid); } }
private ITransformation<GeographicCoordinate, Point2> CreateCassiniSoldner(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new LatitudeOfNaturalOriginParameterSelector(); var originLonParam = new LongitudeOfNaturalOriginParameterSelector(); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset)) offset = Vector2.Zero; return new CassiniSoldner(origin, offset, spheroid); }
private AlbersEqualArea CreateAlbersEqualArea(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new MultiParameterSelector( new LatitudeOfFalseOrigin(), new LatitudeOfNaturalOriginParameterSelector()); var originLonParam = new MultiParameterSelector( new LongitudeOfFalseOrigin(), new CentralMeridianParameterSelector(), new LongitudeOfNaturalOriginParameterSelector(), new LongitudeOfCenterParameterSelector()); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); var lat1SpParam = new StandardParallelParameterSelector(1); var lat2SpParam = new StandardParallelParameterSelector(2); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, lat1SpParam, lat2SpParam); var fromSpheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == fromSpheroid) return null; GeographicCoordinate origin; if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset)) offset = Vector2.Zero; double parallel1; if (!lat1SpParam.IsSelected || !TryGetDouble(lat1SpParam.Selection, OgcAngularUnit.DefaultRadians, out parallel1)) parallel1 = 0; double parallel2; if (!lat2SpParam.IsSelected || !TryGetDouble(lat2SpParam.Selection, OgcAngularUnit.DefaultRadians, out parallel2)) parallel2 = 0; return new AlbersEqualArea(origin, parallel1, parallel2, offset, fromSpheroid); }
private ITransformation<GeographicCoordinate, Point2> CompileForwardToTransform(StaticCoordinateOperationCompiler.StepCompilationParameters stepParameters) { Contract.Requires(stepParameters != null); string operationName = null; IEnumerable<INamedParameter> parameters = null; var parameterizedOperation = stepParameters.CoordinateOperationInfo as IParameterizedCoordinateOperationInfo; if (null != parameterizedOperation) { if (null != parameterizedOperation.Method) operationName = parameterizedOperation.Method.Name; parameters = parameterizedOperation.Parameters; } if (null == operationName) operationName = stepParameters.CoordinateOperationInfo.Name; Func<ProjectionCompilationParams, ITransformation<GeographicCoordinate, Point2>> projectionCompiler; if (String.IsNullOrEmpty(operationName) || !_transformationCreatorLookup.TryGetValue(operationName, out projectionCompiler) || null == projectionCompiler) return null; var parameterLookup = new NamedParameterLookup(parameters ?? Enumerable.Empty<INamedParameter>()); var projectionCompilationParams = new ProjectionCompilationParams(stepParameters, parameterLookup, operationName); return projectionCompiler(projectionCompilationParams); }
private static PopularVisualizationPseudoMercator CreatePopularVisualisationPseudoMercator(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new LatitudeOfNaturalOriginParameterSelector(); var originLonParam = new LongitudeOfNaturalOriginParameterSelector(); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); if (!opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam)) return null; var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; Vector2 offset; TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin); TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset); return new PopularVisualizationPseudoMercator(origin, offset, spheroid); }
private static SpheroidProjectionBase CreateLambertCylindricalEqualAreaSpherical(ProjectionCompilationParams opData) { Contract.Requires(opData != null); var originLatParam = new MultiParameterSelector( new LatitudeOfNaturalOriginParameterSelector(), new StandardParallelParameterSelector()); var originLonParam = new LongitudeOfNaturalOriginParameterSelector(); var offsetXParam = new FalseEastingParameterSelector(); var offsetYParam = new FalseNorthingParameterSelector(); opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam); var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit); if (null == spheroid) return null; GeographicCoordinate origin; if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin)) origin = GeographicCoordinate.Zero; Vector2 offset; if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset)) offset = Vector2.Zero; return new LambertCylindricalEqualAreaSpherical(origin, offset, spheroid); }