public override GeoPoint Parse(String input, Ellipsoid ellipsoid) { Match match = coordinatePattern.Match(input); Double latitude = Double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture) % 90; Double longitude = Double.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture) % 180; return GeoPoint.Parse(latitude, longitude, ellipsoid); }
private GeoPoint(Double latitude, Double longitude, Ellipsoid referenceEllipsoid) { this.Latitude = latitude; this.LatitudeRadians = MathUtilities.ToRadians(latitude); this.Longitude = longitude; this.LongitudeRadians = MathUtilities.ToRadians(longitude); this.ReferenceEllipsoid = referenceEllipsoid; }
/// <summary> /// 构造函数 /// </summary> /// <param name="elp">椭球类型</param> /// <param name="a">椭球参数a(如果为自定义的椭球)</param> /// <param name="b">椭球参数b(如果为自定义的椭球)</param> public CoordinateTrans(Ellipse elp,double a=0,double b=0) { ep = new Ellipsoid(); switch (elp) { case Ellipse.International1975: ep.International_ellipsoid1975(); break; case Ellipse.WGS84: ep.WGS84_ellipsoid(); break; case Ellipse.CGCS2000: ep.CGCS2000_ellipsoid(); break; case Ellipse.Other: ep = new Ellipsoid(a, b); break; } }
public override Ellipsoid getEllipsoid() { if (cs is IHorizontalCoordinateSystem) { Ellipsoid result; IHorizontalCoordinateSystem hs = (IHorizontalCoordinateSystem)cs; result = new Ellipsoid(hs.HorizontalDatum.Ellipsoid.SemiMajorAxis, hs.HorizontalDatum.Ellipsoid.SemiMinorAxis); return result; } return null; }
public static Datum CreateDatum(Ellipsoid ellipsoid, double shiftX, double shiftY, double shiftZ, double rotateX, double rotateY, double rotateZ, double scaleAdjust, double primeMeridian) { return new Datum(ellipsoid, shiftX, shiftY, shiftZ, rotateX, rotateY, rotateZ, scaleAdjust, primeMeridian); }
public EllipsoidPanel() { InitializeComponent(); m_ell = new Ellipsoid(); m_majorRadiusTextBox.Text = m_ell.MajorRadius.ToString(); m_flatteningTextBox.Text = m_ell.Flattening.ToString(); m_minorRadiusTextBox.Text = m_ell.MinorRadius.ToString(); m_quarterMeridianTextBox.Text = m_ell.QuarterMeridian.ToString(); m_areaTextBox.Text = m_ell.Area.ToString(); m_volumeTextBox.Text = m_ell.Volume.ToString(); m_2ndFlatTextBox.Text = m_ell.SecondFlattening.ToString(); m_3rdFlatTextBox.Text = m_ell.ThirdFlattening.ToString(); m_ecc2TextBox.Text = m_ell.EccentricitySq.ToString(); m_2ecc2TextBox.Text = m_ell.SecondEccentricitySq.ToString(); }
static void Main(string[] args) { try { Ellipsoid wgs84 = new Ellipsoid( Constants.WGS84.MajorRadius, Constants.WGS84.Flattening); // Alternatively: Ellipsoid wgs84 = new Ellipsoid(); Console.WriteLine( String.Format( "The latitude half way between the equator and the pole is {0}", wgs84.InverseRectifyingLatitude(45)) ); Console.WriteLine( String.Format( "Half the area of the ellipsoid lies between latitudes +/- {0}", wgs84.InverseAuthalicLatitude(30))); ; Console.WriteLine( String.Format( "The northernmost edge of a square Mercator map is at latitude {0}", wgs84.InverseIsometricLatitude(180))); } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } }
internal Datum(Ellipsoid ellipsoid, double shiftX, double shiftY, double shiftZ, double rotateX, double rotateY, double rotateZ, double scaleAdjust, double primeMeridian) { SetEllipsoid(ellipsoid); this.adjustScale = scaleAdjust; this.primeMeridian = primeMeridian; this.shiftX = shiftX; this.shiftY = shiftY; this.shiftZ = shiftZ; this.rotateX = rotateX; this.rotateY = rotateY; this.rotateZ = rotateZ; }
private void OnSet(object sender, EventArgs e) { try { double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); m_ell = new Ellipsoid(a, f); m_minorRadiusTextBox.Text = m_ell.MinorRadius.ToString(); m_quarterMeridianTextBox.Text = m_ell.QuarterMeridian.ToString(); m_areaTextBox.Text = m_ell.Area.ToString(); m_volumeTextBox.Text = m_ell.Volume.ToString(); m_2ndFlatTextBox.Text = m_ell.SecondFlattening.ToString(); m_3rdFlatTextBox.Text = m_ell.ThirdFlattening.ToString(); m_ecc2TextBox.Text = m_ell.EccentricitySq.ToString(); m_2ecc2TextBox.Text = m_ell.SecondEccentricitySq.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public abstract GeoPoint Parse(String input, Ellipsoid referenceEllipsoid);
/// <summary> /// Initializes a new instance of the <see cref="LabordeObliqueMercatorProjection" /> class. /// </summary> /// <param name="identifier">The identifier of the operation.</param> /// <param name="name">The name of the operation.</param> /// <param name="method">The coordinate operation method.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The method is null. /// or /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> /// <exception cref="System.ArgumentException"> /// The parameters do not contain a required parameter value. /// or /// The parameter is not an angular value as required by the method. /// or /// The parameter is not a length value as required by the method. /// or /// The parameter is not a double precision floating-point number as required by the method. /// or /// The parameter does not have the same measurement unit as the ellipsoid. /// </exception> public LabordeObliqueMercatorProjection(String identifier, String name, Dictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, CoordinateOperationMethods.LabordeObliqueMercatorProjection, parameters, ellipsoid, areaOfUse) { // source: EPSG Guidance Note number 7, part 2, page 59 _falseEasting = ((Length)_parameters[CoordinateOperationParameters.FalseEasting]).Value; _falseNorthing = ((Length)_parameters[CoordinateOperationParameters.FalseNorthing]).Value; _fiS = Math.Asin(Math.Sin(_latitudeOfProjectionCentre) / _b); _r = ellipsoid.SemiMajorAxis.BaseValue * _scaleFactorOnInitialLine * (Math.Sqrt(1 - ellipsoid.EccentricitySquare) / (1 - ellipsoid.EccentricitySquare * Numerics.Calculator.Sin2(_latitudeOfProjectionCentre))); _c = Math.Log(Math.Tan(Constants.PI / 4 + _fiS / 2)) - _b * Math.Log(Math.Tan(Constants.PI / 4 + _latitudeOfProjectionCentre / 2) * Math.Pow((1 - ellipsoid.Eccentricity * Math.Sin(_latitudeOfProjectionCentre)) / (1 + ellipsoid.Eccentricity * Math.Sin(_latitudeOfProjectionCentre)), ellipsoid.Eccentricity / 2)); }
/// <summary> /// Initializes a new instance of the <see cref="MolodenskyTransformation" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="source">The source coordinate reference system.</param> /// <param name="target">The target coordinate reference system.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use.</param> /// <exception cref="System.ArgumentNullException"> /// The source coordinate reference system is null. /// or /// The target coordinate reference system is null. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> protected MolodenskyTransformation(String identifier, String name, String remarks, String[] aliases, IDictionary <CoordinateOperationParameter, Object> parameters, CoordinateReferenceSystem source, CoordinateReferenceSystem target, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, remarks, aliases, CoordinateOperationMethods.MolodenskyTransformation, parameters, source, target, areaOfUse) { this.Ellipsoid = ellipsoid ?? throw new ArgumentNullException(nameof(ellipsoid)); this.xAxisTranslation = this.GetParameterValue(CoordinateOperationParameters.XAxisTranslation); this.yAxisTranslation = this.GetParameterValue(CoordinateOperationParameters.YAxisTranslation); this.zAxisTranslation = this.GetParameterValue(CoordinateOperationParameters.ZAxisTranslation); this.semiMajorAxisLengthDifference = this.GetParameterValue(CoordinateOperationParameters.SemiMajorAxisLengthDifference); this.flatteningDifference = this.GetParameterValue(CoordinateOperationParameters.FlatteningDifference); }
/// <summary> /// Kalman Filter with parameters /// </summary> /// <param name="initialObservation">The initial observation.</param> /// <param name="deviceError">The device error.</param> /// <param name="horizontalDOP">The horizontal DOP.</param> /// <param name="verticalDOP">The vertical DOP.</param> /// <param name="ellipsoid">The ellipsoid.</param> public KalmanFilter( Position3D initialObservation, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Ellipsoid ellipsoid) { _currentState = new KalmanSystemState( initialObservation, deviceError, horizontalDOP, verticalDOP, ellipsoid); }
/// <summary> /// Initializes a new instance of the <see cref="TransverseMercatorZonedProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> public TransverseMercatorZonedProjection(String identifier, String name, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : this(identifier, name, null, null, parameters, ellipsoid, areaOfUse) { }
/// <summary> /// Initializes a new instance of the <see cref="GeographicToTopocentricConversion" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The ellipsoid is null. /// </exception> public GeographicToTopocentricConversion(String identifier, String name, String remarks, String[] aliases, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid) : base(identifier, name, remarks, aliases, CoordinateOperationMethods.GeographicToTopocentricConversion, parameters) { this.latitudeOfTopocentricOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfTopocentricOrigin); this.longitudeOfTopocentricOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfTopocentricOrigin); this.ellipsoidalHeightOfTopocentricOrigin = this.GetParameterValue(CoordinateOperationParameters.EllipsoidalHeightOfTopocentricOrigin); this.Ellipsoid = ellipsoid ?? throw new ArgumentNullException(nameof(ellipsoid)); this.originRadiousOfPrimeVerticalCurvature = this.Ellipsoid.RadiusOfPrimeVerticalCurvature(this.latitudeOfTopocentricOrigin); this.conversion = new GeographicToGeocentricConversion(identifier, name, this.Ellipsoid); this.originGeocentricCoordinate = this.conversion.Forward(new GeoCoordinate(this.latitudeOfTopocentricOrigin, this.longitudeOfTopocentricOrigin, this.ellipsoidalHeightOfTopocentricOrigin)); this.sinLamda0 = Math.Sin(this.longitudeOfTopocentricOrigin); this.cosLamda0 = Math.Cos(this.longitudeOfTopocentricOrigin); this.sinFi0 = Math.Sin(this.latitudeOfTopocentricOrigin); this.cosFi0 = Math.Cos(this.latitudeOfTopocentricOrigin); }
public PolylineShapefile( Shapefile shapefile, Context context, Ellipsoid globeShape, ShapefileAppearance appearance) { Verify.ThrowIfNull(shapefile); Verify.ThrowIfNull(context); Verify.ThrowIfNull(globeShape); Verify.ThrowIfNull(appearance); _polyline = new OutlinedPolylineTexture(); int positionsCount = 0; int indicesCount = 0; PolylineCapacities(shapefile, out positionsCount, out indicesCount); VertexAttributeDoubleVector3 positionAttribute = new VertexAttributeDoubleVector3("position", positionsCount); VertexAttributeRGBA colorAttribute = new VertexAttributeRGBA("color", positionsCount); VertexAttributeRGBA outlineColorAttribute = new VertexAttributeRGBA("outlineColor", positionsCount); IndicesUnsignedInt indices = new IndicesUnsignedInt(indicesCount); foreach (Shape shape in shapefile) { if (shape.ShapeType != ShapeType.Polyline) { throw new NotSupportedException("The type of an individual shape does not match the Shapefile type."); } PolylineShape polylineShape = (PolylineShape)shape; for (int j = 0; j < polylineShape.Count; ++j) { ShapePart part = polylineShape[j]; for (int i = 0; i < part.Count; ++i) { Vector2D point = part[i]; positionAttribute.Values.Add(globeShape.ToVector3D(Trig.ToRadians(new Geodetic3D(point.X, point.Y)))); colorAttribute.AddColor(appearance.PolylineColor); outlineColorAttribute.AddColor(appearance.PolylineOutlineColor); if (i != 0) { indices.Values.Add((uint)positionAttribute.Values.Count - 2); indices.Values.Add((uint)positionAttribute.Values.Count - 1); } } } } Mesh mesh = new Mesh(); mesh.PrimitiveType = PrimitiveType.Lines; mesh.Attributes.Add(positionAttribute); mesh.Attributes.Add(colorAttribute); mesh.Attributes.Add(outlineColorAttribute); mesh.Indices = indices; _polyline.Set(context, mesh); _polyline.Width = appearance.PolylineWidth; _polyline.OutlineWidth = appearance.PolylineOutlineWidth; }
/// <summary> /// Initializes a new instance of the <see cref="KrovakProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="method">The coordinate operation method.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The method is null. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> protected KrovakProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse) { this.latitudeOfProjectionCentre = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfProjectionCentre); this.longitudeOfOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfOrigin); this.coLatitudeOfConeAxis = this.GetParameterBaseValue(CoordinateOperationParameters.CoLatitudeOfConeAxis); this.latitudeOfPseudoStandardParallel = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfPseudoStandardParallel); this.scaleFactorOnPseudoStandardParallel = this.GetParameterValue(CoordinateOperationParameters.ScaleFactorOnPseudoStandardParallel); this.falseEasting = this.GetParameterValue(CoordinateOperationParameters.FalseEasting); this.falseNorthing = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing); this.A = this.Ellipsoid.SemiMajorAxis.BaseValue * Math.Pow(1 - this.Ellipsoid.EccentricitySquare, 0.5) / (1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOfProjectionCentre)); this.B = Math.Pow(1 + ((this.Ellipsoid.EccentricitySquare * Calculator.Cos4(this.latitudeOfProjectionCentre)) / (1 - this.Ellipsoid.EccentricitySquare)), 0.5); this.gammaO = Math.Asin(Math.Sin(this.latitudeOfProjectionCentre) / this.B); this.tO = Math.Tan(Math.PI / 4 + this.gammaO / 2) * Math.Pow((1 + this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfProjectionCentre)) / (1 - this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfProjectionCentre)), this.Ellipsoid.Eccentricity * this.B / 2) / Math.Pow(Math.Tan(Math.PI / 4 + this.latitudeOfProjectionCentre / 2), this.B); this.n = Math.Sin(this.latitudeOfPseudoStandardParallel); this.rO = this.scaleFactorOnPseudoStandardParallel * this.A / Math.Tan(this.latitudeOfPseudoStandardParallel); }
/// <summary> /// Initializes a new instance of the <see cref="KrovakProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> public KrovakProjection(String identifier, String name, String remarks, String[] aliases, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : this(identifier, name, remarks, aliases, CoordinateOperationMethods.KrovakProjection, parameters, ellipsoid, areaOfUse) { }
public LatitudeLongitudeGrid() { Ellipsoid globeShape = Ellipsoid.Wgs84; _window = Device.CreateWindow(800, 600, "Chapter 4: Latitude Longitude Grid"); _window.Resize += OnResize; _window.RenderFrame += OnRenderFrame; _sceneState = new SceneState(); _camera = new CameraLookAtPoint(_sceneState.Camera, _window, globeShape); _clearState = new ClearState(); _sceneState.Camera.PerspectiveNearPlaneDistance = 0.01 * globeShape.MaximumRadius; _sceneState.Camera.PerspectiveFarPlaneDistance = 10.0 * globeShape.MaximumRadius; _sceneState.Camera.ZoomToTarget(globeShape.MaximumRadius); /////////////////////////////////////////////////////////////////// IList <GridResolution> gridResolutions = new List <GridResolution>(); gridResolutions.Add(new GridResolution( new Interval(0, 1000000, IntervalEndpoint.Closed, IntervalEndpoint.Open), new Vector2D(0.005, 0.005))); gridResolutions.Add(new GridResolution( new Interval(1000000, 2000000, IntervalEndpoint.Closed, IntervalEndpoint.Open), new Vector2D(0.01, 0.01))); gridResolutions.Add(new GridResolution( new Interval(2000000, 20000000, IntervalEndpoint.Closed, IntervalEndpoint.Open), new Vector2D(0.05, 0.05))); gridResolutions.Add(new GridResolution( new Interval(20000000, double.MaxValue, IntervalEndpoint.Closed, IntervalEndpoint.Open), new Vector2D(0.1, 0.1))); _globe = new LatitudeLongitudeGridGlobe(_window.Context); _globe.Texture = Device.CreateTexture2D(new Bitmap("NE2_50M_SR_W_4096.jpg"), TextureFormat.RedGreenBlue8, false); _globe.Shape = globeShape; _globe.GridResolutions = new GridResolutionCollection(gridResolutions); /////////////////////////////////////////////////////////////////// Vector3D vancouver = globeShape.ToVector3D(new Geodetic3D(Trig.ToRadians(-123.06), Trig.ToRadians(49.13), 0)); TextureAtlas atlas = new TextureAtlas(new Bitmap[] { new Bitmap("building.png"), Device.CreateBitmapFromText("Vancouver", new Font("Arial", 24)) }); _vancouverLabel = new BillboardCollection(_window.Context); _vancouverLabel.Texture = Device.CreateTexture2D(atlas.Bitmap, TextureFormat.RedGreenBlueAlpha8, false); _vancouverLabel.DepthTestEnabled = false; _vancouverLabel.Add(new Billboard() { Position = vancouver, TextureCoordinates = atlas.TextureCoordinates[0] }); _vancouverLabel.Add(new Billboard() { Position = vancouver, TextureCoordinates = atlas.TextureCoordinates[1], HorizontalOrigin = HorizontalOrigin.Left }); atlas.Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="LambertConicConformal2SPProjection" /> class. /// </summary> /// <param name="identifier">The identifier of the operation.</param> /// <param name="name">The name of the operation.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The method is null. /// or /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> /// <exception cref="System.ArgumentException"> /// The parameters do not contain a required parameter value. /// or /// The parameter is not an angular value as required by the method. /// or /// The parameter is not a length value as required by the method. /// or /// The parameter is not a double precision floating-point number as required by the method. /// or /// The parameter does not have the same measurement unit as the ellipsoid. /// </exception> public LambertConicConformal2SPProjection(String identifier, String name, Dictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, CoordinateOperationMethods.LambertConicConformal2SPProjection, parameters, ellipsoid, areaOfUse) { // source: EPSG Guidance Note number 7, part 2, page 18 _latitudeOfFalseOrigin = ((Angle)_parameters[CoordinateOperationParameters.LatitudeOfFalseOrigin]).BaseValue; _longitudeOfFalseOrigin = ((Angle)_parameters[CoordinateOperationParameters.LongitudeOfFalseOrigin]).BaseValue; _latitudeOf1stStandardParallel = ((Angle)_parameters[CoordinateOperationParameters.LatitudeOf1stStandardParallel]).BaseValue; _latitudeOf2ndStandardParallel = ((Angle)_parameters[CoordinateOperationParameters.LatitudeOf2ndStandardParallel]).BaseValue; _eastingAtFalseOrigin = ((Length)_parameters[CoordinateOperationParameters.EastingAtFalseOrigin]).Value; _northingAtFalseOrigin = ((Length)_parameters[CoordinateOperationParameters.NorthingAtFalseOrigin]).Value; Double m1 = Math.Cos(_latitudeOf1stStandardParallel) / Math.Sqrt(1 - _ellipsoid.EccentricitySquare * Calculator.Sin2(_latitudeOf1stStandardParallel)); Double m2 = Math.Cos(_latitudeOf2ndStandardParallel) / Math.Sqrt(1 - _ellipsoid.EccentricitySquare * Calculator.Sin2(_latitudeOf2ndStandardParallel)); Double t1 = ComputeTValue(_latitudeOf1stStandardParallel); Double t2 = ComputeTValue(_latitudeOf2ndStandardParallel); Double tF = ComputeTValue(_latitudeOfFalseOrigin); _n = (Math.Log(m1) - Math.Log(m2)) / (Math.Log(t1) - Math.Log(t2)); _f = m1 / (_n * Math.Pow(t1, _n)); _rF = _ellipsoid.SemiMajorAxis.Value * _f * Math.Pow(tF, _n); }
/// <summary> /// Initializes a new instance of the <see cref="LambertCylindricalEqualAreaEllipsoidalProjection"/> class. /// </summary> /// <param name="identifier">The identifier of the operation.</param> /// <param name="name">The name of the operation.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The method requires parameters which are not specified. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> /// <exception cref="System.ArgumentException"> /// The parameters do not contain a required parameter value. /// or /// The parameter is not an angular value as required by the method. /// or /// The parameter is not a length value as required by the method. /// or /// The parameter is not a double precision floating-point number as required by the method. /// or /// The parameter does not have the same measurement unit as the ellipsoid. /// </exception> public LambertCylindricalEqualAreaEllipsoidalProjection(String identifier, String name, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : this(identifier, name, CoordinateOperationMethods.LambertCylindricalEqualAreaEllipsoidalProjection, parameters, ellipsoid, areaOfUse) { }
private Cartesian3 scaleToGeodeticSurface(Cartesian3 cartesian3, Ellipsoid ellipsoid, Cartesian3Service cartesian3Service) { Cartesian3 oneOverRadii = ellipsoid.OneOverRadii; Cartesian3 oneOverRadiiSquared = ellipsoid.OneOverRadiiSquared; double centerToleranceSquared = ellipsoid.CenterToleranceSquared; var positionX = cartesian3.X; var positionY = cartesian3.Y; var positionZ = cartesian3.Z; var oneOverRadiiX = oneOverRadii.X; var oneOverRadiiY = oneOverRadii.Y; var oneOverRadiiZ = oneOverRadii.Z; var x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX; var y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY; var z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ; // Compute the squared ellipsoid norm. var squaredNorm = x2 + y2 + z2; var ratio = Math.Sqrt(1.0 / squaredNorm); // As an initial approximation, assume that the radial intersection is the projection point. var intersection = cartesian3Service.MultiplyByScalar(cartesian3, ratio); // If the position is near the center, the iteration will not converge. if (squaredNorm < centerToleranceSquared) { return(double.IsInfinity(ratio) ? null : intersection); } var oneOverRadiiSquaredX = oneOverRadiiSquared.X; var oneOverRadiiSquaredY = oneOverRadiiSquared.Y; var oneOverRadiiSquaredZ = oneOverRadiiSquared.Z; // Use the gradient at the intersection point in place of the true unit normal. // The difference in magnitude will be absorbed in the multiplier. var gradient = new Cartesian3(); gradient.X = intersection.X * oneOverRadiiSquaredX * 2.0; gradient.Y = intersection.Y * oneOverRadiiSquaredY * 2.0; gradient.Z = intersection.Z * oneOverRadiiSquaredZ * 2.0; // Compute the initial guess at the normal vector multiplier, lambda. var lambda = (1.0 - ratio) * cartesian3Service.Magnitude(cartesian3) / (0.5 * cartesian3Service.Magnitude(gradient)); var correction = 0.0; double func; double denominator; double xMultiplier; double yMultiplier; double zMultiplier; double xMultiplier2; double yMultiplier2; double zMultiplier2; double xMultiplier3; double yMultiplier3; double zMultiplier3; do { lambda -= correction; xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX); yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY); zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ); xMultiplier2 = xMultiplier * xMultiplier; yMultiplier2 = yMultiplier * yMultiplier; zMultiplier2 = zMultiplier * zMultiplier; xMultiplier3 = xMultiplier2 * xMultiplier; yMultiplier3 = yMultiplier2 * yMultiplier; zMultiplier3 = zMultiplier2 * zMultiplier; func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0; // "denominator" here refers to the use of this expression in the velocity and acceleration // computations in the sections to follow. denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ; var derivative = -2.0 * denominator; correction = func / derivative; } while (Math.Abs(func) > 0.000000000001); Cartesian3 result = new Cartesian3(); result.X = positionX * xMultiplier; result.Y = positionY * yMultiplier; result.Z = positionZ * zMultiplier; return(result); }
/// <summary> /// Initializes a new instance of the <see cref="GeographicToTopocentricConversion" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The ellipsoid is null. /// </exception> public GeographicToTopocentricConversion(String identifier, String name, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid) : this(identifier, name, null, null, parameters, ellipsoid) { }
private HorizontalDatum DatumFromWKT(string wkt) { // DATUM["Bessel 1841", // SPHEROID["Bessel 1841", 6377397.15508, 299.1528128, AUTHORITY["EPSG", "7004"]], // TOWGS84[582, 105, 414, 1.04, 0.35, -3.08, 8.3], // ABBREVIATION["BES"]] try { System.Globalization.CultureInfo CI = new System.Globalization.CultureInfo(""); NumberFormatInfo style = (NumberFormatInfo)System.Globalization.CultureInfo.CurrentCulture.NumberFormat.Clone(); style.NumberDecimalSeparator = "."; string name; Match match = Regex.Match(wkt, "DATUM\\[\"(.+?)\""); if (match.Success) name = match.Value.Split('"')[1]; else throw new Exception(); StringBuilder spheroid = new StringBuilder(); ; match = Regex.Match(wkt, "SPHEROID\\[\"(.+?)\\]\\],"); if (match.Success) spheroid.Append(match.Value); else throw new Exception(); StringBuilder toWGS84 = new StringBuilder(); match = Regex.Match(wkt, "TOWGS84\\[(.+?)\\],"); if (match.Success) toWGS84.Append(match.Value); else throw new Exception(); string abrev; match = Regex.Match(wkt, "ABBREVIATION\\[\"(.+?)\\]\\]"); if (match.Success) abrev = match.Value.Split('"')[1]; else throw new Exception(); // Build the WGS-Info toWGS84.Remove(0, 8); toWGS84.Remove(toWGS84.Length - 2, 2); toWGS84.Replace(" ", ""); string[] wgs = toWGS84.ToString().Split(','); Wgs84ConversionInfo wgsInfo = new Wgs84ConversionInfo(double.Parse(wgs[0], style), double.Parse(wgs[1], style), double.Parse(wgs[2], style), double.Parse(wgs[3], style), double.Parse(wgs[4], style), double.Parse(wgs[5], style), double.Parse(wgs[6], style)); // Build the Ellipsoid spheroid.Remove(0, 10); spheroid.Remove(spheroid.Length - 3, 3); spheroid.Replace("AUTHORITY[", ""); spheroid.Replace(" ", ""); spheroid.Replace("\"", ""); string[] elData = spheroid.ToString().Split(','); string auth = String.Empty; long authcode = 0; if (elData.Length > 4) { auth = elData[3]; authcode = long.Parse(elData[4]); } Ellipsoid el = new Ellipsoid(double.Parse(elData[1], CI), 0, double.Parse(elData[2], style), true, LinearUnit.Metre, elData[0], auth, authcode, String.Empty, abrev, String.Empty); return new HorizontalDatum( el, wgsInfo, DatumType.HD_Geocentric, name, String.Empty, 0, String.Empty, abrev, String.Empty); } catch (Exception) { return HorizontalDatum.Bessel1841; } }
/// <summary> /// Initializes a new instance of the <see cref="ColombiaUrbanProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> public ColombiaUrbanProjection(String identifier, String name, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : this(identifier, name, null, null, parameters, ellipsoid, areaOfUse) { }
/// <summary> /// Initializes the Kalman Filter using an initial observation (position) /// </summary> /// <param name="gpsPosition">The position at which tfilter is to begin opperating.</param> /// <param name="deviceError">A distance measure of device error</param> /// <param name="meanDOP">The mean dilution of precision</param> /// <param name="ellipsoid">The ellipsoid</param> public void Initialize(Position3D gpsPosition, Distance deviceError, DilutionOfPrecision meanDOP, Ellipsoid ellipsoid) { Initialize(gpsPosition, deviceError, meanDOP, meanDOP, ellipsoid); }
/// <summary> /// Initializes a new instance of the <see cref="ColombiaUrbanProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> public ColombiaUrbanProjection(String identifier, String name, String remarks, String[] aliases, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, remarks, aliases, CoordinateOperationMethods.ColombiaUrbanProjection, parameters, ellipsoid, areaOfUse) { this.latitudeOfNaturalOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfNaturalOrigin); this.longitudeOfNaturalOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin); this.falseEasting = this.GetParameterValue(CoordinateOperationParameters.FalseEasting); this.falseNorthing = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing); this.projectionPlaneOriginHeight = this.GetParameterValue(CoordinateOperationParameters.ProjectionPlaneOriginHeight); Double sinLatitude = Math.Sin(this.latitudeOfNaturalOrigin); this.rho0 = this.Ellipsoid.SemiMajorAxis.Value * (1 - this.Ellipsoid.EccentricitySquare / Math.Pow(1 - this.Ellipsoid.EccentricitySquare * sinLatitude * sinLatitude, 1.5)); this.nu0 = this.Ellipsoid.SemiMajorAxis.Value / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Math.Sqrt(this.latitudeOfNaturalOrigin) * Math.Sin(this.latitudeOfNaturalOrigin)); }
private void OnValidate(object sender, EventArgs e) { try { Ellipsoid ee = new Ellipsoid(50000.0, .003); ee = new Ellipsoid(); ee.AuthalicLatitude(30.0); ee.CircleHeight(30.0); ee.CircleRadius(30.0); ee.ConformalLatitude(30.0); ee.GeocentricLatitude(30.0); ee.InverseAuthalicLatitude(30.0); ee.InverseConformalLatitude(30.0); ee.InverseGeocentricLatitude(30.0); ee.InverseIsometricLatitude(30.0); ee.InverseParametricLatitude(30.0); ee.InverseRectifyingLatitude(30.0); ee.IsometricLatitude(30.0); ee.MeridianDistance(30.0); ee.MeridionalCurvatureRadius(30.0); ee.NormalCurvatureRadius(30.0, 60.0); ee.ParametricLatitude(30.0); ee.RectifyingLatitude(30.0); ee.TransverseCurvatureRadius(30.0); MessageBox.Show("no errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Instantiate an UTM projection with this reference Ellipsoid /// </summary> /// <param name="referenceGlobe">The reference Ellipsoid</param> public UtmProjection(Ellipsoid referenceGlobe) : base(referenceGlobe) { _m = new MathConsts(referenceGlobe); }
private void SetEllipsoid(Ellipsoid ellipsoid) { if (ellipsoid == Ellipsoid.GRS80) { semiMajorAxis = 6378137; semiMinorAxis = 6356752.314; } else if (ellipsoid == Ellipsoid.Sphere) { semiMajorAxis = 6378137; semiMinorAxis = 6378137; } else { Debug.Assert(false); } this.ellipsoid = ellipsoid; this.flattening = (semiMajorAxis - semiMinorAxis) / semiMajorAxis; // e.g. = 0.0033528107031880554 this.eccentricity = Math.Sqrt(flattening * (2.0 - flattening)); // e.g. = 0.081819191310869718 }
public virtual GeoPoint ConvertTo(Ellipsoid referenceEllipsoid) { if (this.ReferenceEllipsoid == referenceEllipsoid) { return this; } throw new NotImplementedException("Conversion between different reference ellipsoids is not yet implemented"); }
/// <summary> /// Initializes a new instance of the <see cref="MolodenskyTransformation" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="source">The source coordinate reference system.</param> /// <param name="target">The target coordinate reference system.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use.</param> /// <exception cref="System.ArgumentNullException"> /// The source coordinate reference system is null. /// or /// The target coordinate reference system is null. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> protected MolodenskyTransformation(String identifier, String name, IDictionary <CoordinateOperationParameter, Object> parameters, CoordinateReferenceSystem source, CoordinateReferenceSystem target, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : this(identifier, name, null, null, parameters, source, target, ellipsoid, areaOfUse) { }
public virtual int GetHashCode(Double latitude, Double longitude, Ellipsoid ellipsoid = GeoConstants.DEFAULT_ELLIPSOID) { return FNVHasher.CreateHash(latitude, longitude, ellipsoid); }
/// <summary> /// Initializes a new instance of the <see cref="HotineObliqueMercatorAProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The method is null. /// or /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> public HotineObliqueMercatorAProjection(String identifier, String name, String remarks, String[] aliases, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, remarks, aliases, CoordinateOperationMethods.HotineObliqueMercatorAProjection, parameters, ellipsoid, areaOfUse) { this.falseEasting = this.GetParameterValue(CoordinateOperationParameters.FalseEasting); this.falseNorthing = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing); }
/// <summary> /// Initializes a new instance of the <see cref="HotineObliqueMercatorProjection" /> class. /// </summary> /// <param name="identifier">The identifier of the operation.</param> /// <param name="name">The name of the operation.</param> /// <param name="method">The coordinate operation method.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The method is null. /// or /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> /// <exception cref="System.ArgumentException"> /// The parameters do not contain a required parameter value. /// or /// The parameter is not an angular value as required by the method. /// or /// The parameter is not a double precision floating-point number as required by the method. /// or /// The parameter does not have the same measurement unit as the ellipsoid. /// </exception> protected HotineObliqueMercatorProjection(String identifier, String name, CoordinateOperationMethod method, Dictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, method, parameters, ellipsoid, areaOfUse) { // source: EPSG Guidance Note number 7, part 2, page 56 _angleFromRectifiedToSkewGrid = ((Angle)_parameters[CoordinateOperationParameters.AngleFromRectifiedToSkewGrid]).BaseValue; _a = _ellipsoid.SemiMajorAxis.Value * _b * _scaleFactorOnInitialLine * Math.Sqrt(1 - _ellipsoid.EccentricitySquare) / (1 - _ellipsoid.EccentricitySquare * Calculator.Sin2(_latitudeOfProjectionCentre)); Double tO = Math.Tan(Constants.PI / 4 - _latitudeOfProjectionCentre / 2) / Math.Pow((1 - _ellipsoid.Eccentricity * Math.Sin(_latitudeOfProjectionCentre)) / (1 + _ellipsoid.Eccentricity * Math.Sin(_latitudeOfProjectionCentre)), _ellipsoid.Eccentricity / 2); Double d = _b * Math.Sqrt(1 - _ellipsoid.EccentricitySquare) / Math.Cos(_latitudeOfProjectionCentre) / Math.Sqrt(1 - _ellipsoid.EccentricitySquare * Calculator.Sin2(_latitudeOfProjectionCentre)); Double f = d + Math.Sqrt(Math.Max(d * d, 1) - 1) * Math.Sign(_latitudeOfProjectionCentre) * Math.Sign(_latitudeOfProjectionCentre); _h = f * Math.Pow(tO, _b); Double g = (f - 1 / f) / 2; _gammaO = Math.Asin(Math.Sin(_azimuthOfInitialLine) / d); _lambdaO = _longitudeOfProjectionCentre - Math.Asin(g * Math.Tan(_gammaO)) / _b; if (_azimuthOfInitialLine == Math.PI) { _uC = _ellipsoid.SemiMajorAxis.Value * (_longitudeOfProjectionCentre - _lambdaO); } else { _uC = (Math.Abs(_azimuthOfInitialLine - Constants.PI / 2) <= Calculator.Tolerance) ? _a * (_longitudeOfProjectionCentre - _lambdaO) : (_a / _b) * Math.Atan(Math.Sqrt(Math.Max(d * d, 1) - 1) / Math.Cos(_azimuthOfInitialLine)) * Math.Sign(_latitudeOfProjectionCentre); } _inverseParams = new Double[] { _ellipsoid.EccentricitySquare / 2 + 5 * Calculator.Pow(_ellipsoid.Eccentricity, 4) / 24 + Calculator.Pow(_ellipsoid.Eccentricity, 6) / 12 + 13 * Calculator.Pow(_ellipsoid.Eccentricity, 8) / 360, 7 * Calculator.Pow(_ellipsoid.Eccentricity, 4) / 48 + 29 * Calculator.Pow(_ellipsoid.Eccentricity, 6) / 240 + 811 * Calculator.Pow(_ellipsoid.Eccentricity, 8) / 11520, 7 * Calculator.Pow(_ellipsoid.Eccentricity, 6) / 120 + 81 * Calculator.Pow(_ellipsoid.Eccentricity, 8) / 1120, 4279 * Calculator.Pow(_ellipsoid.Eccentricity, 8) / 161280 }; }
/// <summary> /// Initializes a new instance of the <see cref="LambertCylindricalEqualAreaEllipsoidalProjection"/> class. /// </summary> /// <param name="identifier">The identifier of the operation.</param> /// <param name="name">The name of the operation.</param> /// <param name="method">The coordinate operation method.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The method is null. /// or /// The method requires parameters which are not specified. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> /// <exception cref="System.ArgumentException"> /// The parameters do not contain a required parameter value. /// or /// The parameter is not an angular value as required by the method. /// or /// The parameter is not a length value as required by the method. /// or /// The parameter is not a double precision floating-point number as required by the method. /// or /// The parameter does not have the same measurement unit as the ellipsoid. /// </exception> protected LambertCylindricalEqualAreaEllipsoidalProjection(String identifier, String name, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, method, parameters, ellipsoid, areaOfUse) { _falseEasting = ((Length)(parameters[CoordinateOperationParameters.FalseEasting])).BaseValue; _falseNorthing = ((Length)(parameters[CoordinateOperationParameters.FalseNorthing])).BaseValue; _longitudeOfNaturalOrigin = ((Angle)(parameters[CoordinateOperationParameters.LongitudeOfNaturalOrigin])).BaseValue; _latitudeOf1stStandardParallel = ((Angle)parameters[CoordinateOperationParameters.LatitudeOf1stStandardParallel]).BaseValue; }
/// <summary> /// Conversion of space rectangular coordinate to topocentric rectangular coordinate. /// </summary> /// <param name="ellipsoid">ellipsoid</param> /// <param name="XYZ">space rectangular coordinate</param> /// <param name="site">geodetic coordinate of station</param> /// <returns>topocentric rectangular coordinate</returns> public static TopocentricRectCoord XYZ_NEU(Ellipsoid ellipsoid, SpaceRectangularCoord XYZ, GeodeticCoord site) { XYZ_NEU(ellipsoid, site.Latitude, site.Longitude, site.Height, XYZ.X, XYZ.Y, XYZ.Z, out double N, out double E, out double U); return(new TopocentricRectCoord(N, E, U)); }
/// <summary> /// Initializes a new instance of the <see cref="KrovakNorthOrientedProjection" /> class. /// </summary> /// <param name="identifier">The identifier of the operation.</param> /// <param name="name">The name of the operation.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The method is null. /// or /// The method requires parameters which are not specified. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> /// <exception cref="System.ArgumentException"> /// The parameters do not contain a required parameter value. /// or /// The parameter is not an angular value as required by the method. /// or /// The parameter is not a length value as required by the method. /// or /// The parameter is not a double precision floating-point number as required by the method. /// or /// The parameter does not have the same measurement unit as the ellipsoid. /// </exception> public KrovakNorthOrientedProjection(String identifier, String name, Dictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, CoordinateOperationMethods.KrovakNorthOrientedProjection, parameters, ellipsoid, areaOfUse) { }
/// <summary> /// Conversion of space rectangular coordinate to geodetic coordinate. /// </summary> /// <param name="ellipsoid">ellipsoid</param> /// <param name="xyz">space rectangular coordinate</param> /// <returns>geodetic coordinate</returns> public static GeodeticCoord XYZ_BLH(Ellipsoid ellipsoid, SpaceRectangularCoord xyz) { XYZ_BLH(ellipsoid, xyz.X, xyz.Y, xyz.Z, out Latitude lat, out Longitude lng, out double H); return(new GeodeticCoord(lat, lng, H)); }
/// <summary> /// Initializes a new instance of the <see cref="TransverseMercatorZonedProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The defined operation method requires parameters. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> public TransverseMercatorZonedProjection(String identifier, String name, String remarks, String[] aliases, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, remarks, aliases, CoordinateOperationMethods.TransverseMercatorZonedProjection, parameters, ellipsoid, areaOfUse) { this.latitudeOfNaturalOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfNaturalOrigin); this.initialLongitude = this.GetParameterBaseValue(CoordinateOperationParameters.InitialLongitude); this.zoneWidth = this.GetParameterBaseValue(CoordinateOperationParameters.ZoneWidth); this.falseEasting = this.GetParameterValue(CoordinateOperationParameters.FalseEasting); this.falseNorthing = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing); this.scaleFactorAtNaturalOrigin = this.GetParameterValue(CoordinateOperationParameters.ScaleFactorAtNaturalOrigin); this.e2 = this.Ellipsoid.EccentricitySquare; this.e4 = Math.Pow(this.Ellipsoid.Eccentricity, 4); this.e6 = Math.Pow(this.Ellipsoid.Eccentricity, 6); this.e8 = Math.Pow(this.Ellipsoid.Eccentricity, 8); this.bM0 = this.ComputeM(this.latitudeOfNaturalOrigin); }
/// <summary> /// Initializes a new instance of the <see cref="KalmanSystemState"/> struct. /// </summary> /// <param name="gpsPosition">The GPS position.</param> /// <param name="deviceError">The device error.</param> /// <param name="horizontalDOP">The horizontal DOP.</param> /// <param name="verticalDOP">The vertical DOP.</param> /// <param name="ellipsoid">The ellipsoid.</param> internal KalmanSystemState( Position3D gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Ellipsoid ellipsoid) : this( gpsPosition, deviceError, verticalDOP, horizontalDOP, ellipsoid, CartesianPoint.Empty, CartesianPoint.Invalid, gpsPosition.ToCartesianPoint(), null, null, null, null, null, null) { }
private static extern void Coordinate_getOrientationMatrix_CartPos(IntPtr nativeReference, ref CartPos pos, Ellipsoid ellipsoid, ref Matrix3 matrix);
public CartesianProjector(Ellipsoid ellipsoid) { this.ellipsoid = ellipsoid; }
/// <summary> /// Conversion of topocentric rectangular coordinate to space rectangular coordinate /// </summary> /// <param name="ellipsoid">ellipsoid</param> /// <param name="neu">topocentric rectangular coordinate</param> /// <param name="site">geodetic coordinate of station</param> /// <returns>space rectangular coordinate</returns> public static SpaceRectangularCoord NEU_XYZ(Ellipsoid ellipsoid, TopocentricRectCoord neu, GeodeticCoord site) { NEU_XYZ(ellipsoid, site.Latitude, site.Longitude, site.Height, neu.Northing, neu.Easting, neu.Upping, out double X, out double Y, out double Z); return(new SpaceRectangularCoord(X, Y, Z)); }
public static GeoPoint Parse(Double latitude, Double longitude, Ellipsoid referenceEllipsoid) { return new GeoPoint(latitude, longitude, referenceEllipsoid); }
/// <summary> /// Conversion of geodetic coordinate space rectangular coordinate. /// </summary> /// <param name="ellipsoid">ellipsoid</param> /// <param name="blh">geodetic coordinate</param> /// <returns>space rectangular coordinate</returns> public static SpaceRectangularCoord BLH_XYZ(Ellipsoid ellipsoid, GeodeticCoord blh) { BLH_XYZ(ellipsoid, blh.Latitude, blh.Longitude, blh.Height, out double X, out double Y, out double Z); return(new SpaceRectangularCoord(X, Y, Z)); }
public static GeoPoint Parse(String coordinates, Ellipsoid referenceEllipsoid) { GeoPointParser parser = GeoPointParser.getParserFor(coordinates); return parser.Parse(coordinates, referenceEllipsoid); }
internal KalmanSystemState( Position3D gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Ellipsoid ellipsoid, CartesianPoint u, CartesianPoint x, CartesianPoint z, SquareMatrix3D A, SquareMatrix3D B, SquareMatrix3D H, SquareMatrix3D P, SquareMatrix3D Q, SquareMatrix3D R) { this._deviceError = deviceError.IsEmpty ? DilutionOfPrecision.CurrentAverageDevicePrecision.Value : deviceError.Value; this._horizontalDOP = horizontalDOP.IsEmpty ? DilutionOfPrecision.Good.Value : horizontalDOP.Value; this._verticalDOP = verticalDOP.IsEmpty ? DilutionOfPrecision.Good.Value : verticalDOP.Value; this._ellipsoid = ellipsoid == null ? Ellipsoid.Default : ellipsoid; double hCovariance = this._deviceError * this._horizontalDOP; double vCovariance = this._deviceError * this._verticalDOP; this.u = u.IsInvalid ? CartesianPoint.Empty : u; this.x = x; this.z = z.IsInvalid ? CartesianPoint.Empty : z; this.A = A == null ? new SquareMatrix3D() : A; this.B = B == null ? new SquareMatrix3D() : B; this.H = H == null ? new SquareMatrix3D() : H; this.P = P == null ? new SquareMatrix3D() : P; this.Q = Q == null ? SquareMatrix3D.Default(0) : Q; this.R = R == null ? new SquareMatrix3D( hCovariance, 0, 0, 0, hCovariance, 0, 0, 0, vCovariance) : R; this._interval = 0; this._errorState = Math.Sqrt(Math.Pow(hCovariance, 2) + Math.Pow(vCovariance, 2)); this._delay = TimeSpan.MaxValue; this._lastObservation = DateTime.MinValue; if (!gpsPosition.IsEmpty) Initialize(gpsPosition); }
/// <summary> /// Initializes a new instance of the <see cref="PolarStereographicProjection" /> class. /// </summary> /// <param name="identifier">The identifier.</param> /// <param name="name">The name.</param> /// <param name="remarks">The remarks.</param> /// <param name="aliases">The aliases.</param> /// <param name="method">The coordinate operation method.</param> /// <param name="parameters">The parameters of the operation.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="areaOfUse">The area of use where the operation is applicable.</param> /// <exception cref="System.ArgumentNullException"> /// The identifier is null. /// or /// The method is null. /// or /// The ellipsoid is null. /// or /// The area of use is null. /// </exception> protected PolarStereographicProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse) : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse) { }
/// <summary> /// Initializes a new instance of the <see cref="KalmanSystemState"/> struct. /// </summary> /// <param name="gpsPosition">The GPS position.</param> /// <param name="deviceError">The device error.</param> /// <param name="horizontalDOP">The horizontal DOP.</param> /// <param name="verticalDOP">The vertical DOP.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="u">The u.</param> /// <param name="x">The x.</param> /// <param name="z">The z.</param> /// <param name="a">A.</param> /// <param name="b">The b.</param> /// <param name="h">The h.</param> /// <param name="p">The p.</param> /// <param name="q">The q.</param> /// <param name="r">The r.</param> internal KalmanSystemState( Position3D gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Ellipsoid ellipsoid, CartesianPoint u, CartesianPoint x, CartesianPoint z, SquareMatrix3D a, SquareMatrix3D b, SquareMatrix3D h, SquareMatrix3D p, SquareMatrix3D q, SquareMatrix3D r) { _deviceError = deviceError.IsEmpty ? DilutionOfPrecision.CurrentAverageDevicePrecision.Value : deviceError.Value; _horizontalDOP = horizontalDOP.IsEmpty ? DilutionOfPrecision.Good.Value : horizontalDOP.Value; _verticalDOP = verticalDOP.IsEmpty ? DilutionOfPrecision.Good.Value : verticalDOP.Value; _ellipsoid = ellipsoid ?? Ellipsoid.Default; double hCovariance = _deviceError * _horizontalDOP; double vCovariance = _deviceError * _verticalDOP; _u = u.IsInvalid ? CartesianPoint.Empty : u; _x = x; _z = z.IsInvalid ? CartesianPoint.Empty : z; _a = a ?? new SquareMatrix3D(); _b = b ?? new SquareMatrix3D(); _h = h ?? new SquareMatrix3D(); _p = p ?? new SquareMatrix3D(); _q = q ?? SquareMatrix3D.Default(0); _r = r ?? new SquareMatrix3D( hCovariance, 0, 0, 0, hCovariance, 0, 0, 0, vCovariance); _interval = 0; _errorState = Math.Sqrt(Math.Pow(hCovariance, 2) + Math.Pow(vCovariance, 2)); _delay = TimeSpan.MaxValue; _lastObservation = DateTime.MinValue; if (!gpsPosition.IsEmpty) Initialize(gpsPosition); }
static void Main(string[] args) { #region all banks of Armenia var b1 = new Bank("Ameria", "Grigor Lusavoritch str. 9", 32087360000, 286143000000, 399744000000) { branchCount = 37, totalClients = 22000, totalEmployeeCount = 1356 }; var b2 = new Bank("ACBA", "Bayron str. 1", 30000000001, 272853238000, 219141110000) { branchCount = 44, totalClients = 188000, totalEmployeeCount = 2014 }; var b3 = new Bank("Biblos", "18/3 Amiryan St", 6576460000, 39738302000, 34329963000); b3.branchCount = 2; b3.totalClients = 1020; b3.totalEmployeeCount = 198; #endregion var cba = new List <Bank> { b1, b2, b3 }; #region all credit organizations of Armenia var co1 = new CreditOrganization("Finca", "Agatangeghos str. 2a", 4905960000) { CreditPortfolio = 253941709000, branchCount = 22, totalClients = 14000, totalEmployeeCount = 187 }; var co2 = new CreditOrganization("Kamurj", "123 Sebastia", 2044760000) { CreditPortfolio = 10645552000, branchCount = 8, totalClients = 970, totalEmployeeCount = 35 }; var co3 = new CreditOrganization("Credo Finance Armenia", "", 1114092000); co3.CreditPortfolio = 50925000; co3.branchCount = 4; co3.totalClients = 2300; co3.totalEmployeeCount = 304; #endregion var uvk = new List <CreditOrganization> { co1, co2, co3 }; #region insurance companies of Armenia var ic1 = new InsuranceCompany("RosGosStrakhArmenia", "Hanrapetutyan str. 22", 2983000000, 6006054000, "Vahagn Aghavelyan"); ic1.branchCount = 23; ic1.totalClients = 288000; ic1.totalEmployeeCount = 3000; var ic2 = new InsuranceCompany("Ingo Armenia", "Hanrapetutyan str. 51, 53 area", 3103941000, 9611895000, "Levon Altunyan"); ic2.branchCount = 14; ic2.totalClients = 99233; ic2.totalEmployeeCount = 856; var ic3 = new InsuranceCompany("Nairi Insurance", "Vazgen Sargsyan str. 10", 1290000000, 4049877000, "Hovhannes Gevorgyan"); ic3.branchCount = 29; ic3.totalClients = 55340; ic3.totalEmployeeCount = 1983; #endregion var appa = new List <InsuranceCompany> { ic1, ic2, ic3 }; #region Queries var whichBankDoesnotMatchNewLaw = from bank in cba where bank.statutoryCapital < (long)Bank.StatutoryCapitalMinimum.StatutoryCapitalMinimumForArmeniaFrom010117 select bank; foreach (var bank in whichBankDoesnotMatchNewLaw) { Console.WriteLine($"{bank.name} doesn't match new armenian law about banks and has to increase its statutory capital"); } var howMuchPeopleAreEmployedInInsuranceCompanies = appa.Select(x => x.totalEmployeeCount).Sum(); Console.WriteLine($"\nInsurance sector provides {howMuchPeopleAreEmployedInInsuranceCompanies} working places in Armenia"); var whichCOcouldBeBankByAncientLaw = uvk.Where(u => u.statutoryCapital >= (long)Bank.StatutoryCapitalMinimum.StatutroyCapitalMinimumOldVersion); if (whichCOcouldBeBankByAncientLaw.ToList().Count == 0) { Console.WriteLine("\nThere is no such credit organization"); } else { foreach (var creditOrganization in whichCOcouldBeBankByAncientLaw) { Console.WriteLine($"\n{creditOrganization.name} could be bank if not this new shitty law"); } } #endregion var piped = new Parallelepiped(5.5, 10, 3.2, 45, 45); Console.WriteLine($"Parapippo volume: {piped.Volume}"); Console.WriteLine($"Paraesiminch surface: {piped.Surface}"); Console.WriteLine(new string('*', 50)); var ellispe = new Ellipsoid(1.5, 10, 3.6); Console.WriteLine($"Ellipsoid volume: {ellispe.Volume}"); Console.WriteLine($"Ellipsoid surface: {ellispe.Surface}"); //Delay Console.ReadKey(); }
/// <summary> /// Initializes the Kalman Filter using an initial observation (position) /// </summary> /// <param name="gpsPosition">The position at which tfilter is to begin opperating.</param> /// <param name="deviceError">Distance of the error</param> /// <param name="horizontalDOP">The horizontal dilution of precision</param> /// <param name="verticalDOP">The vertical dilution of precision</param> /// <param name="ellipsoid">The ellipsoid</param> public void Initialize(Position gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Ellipsoid ellipsoid) { _currentState = new KalmanSystemState(new Position3D(gpsPosition), deviceError, horizontalDOP, verticalDOP, ellipsoid); }
private static MathTransform CreateCoordinateOperation(IProjection projection, Ellipsoid ellipsoid, LinearUnit unit) { var parameterList = new List <ProjectionParameter>(projection.NumParameters); for (int i = 0; i < projection.NumParameters; i++) { parameterList.Add(projection.GetParameter(i)); } //var toMeter = 1d/ellipsoid.AxisUnit.MetersPerUnit; if (parameterList.Find((p) => p.Name.ToLowerInvariant().Replace(' ', '_').Equals("semi_major")) == null) { parameterList.Add(new ProjectionParameter("semi_major", /*toMeter * */ ellipsoid.SemiMajorAxis)); } if (parameterList.Find((p) => p.Name.ToLowerInvariant().Replace(' ', '_').Equals("semi_minor")) == null) { parameterList.Add(new ProjectionParameter("semi_minor", /*toMeter * */ ellipsoid.SemiMinorAxis)); } if (parameterList.Find((p) => p.Name.ToLowerInvariant().Replace(' ', '_').Equals("unit")) == null) { parameterList.Add(new ProjectionParameter("unit", unit.MetersPerUnit)); } var operation = ProjectionsRegistry.CreateProjection(projection.ClassName, parameterList); /* * var mpOperation = operation as MapProjection; * if (mpOperation != null && projection.AuthorityCode !=-1) * { * mpOperation.Authority = projection.Authority; * mpOperation.AuthorityCode = projection.AuthorityCode; * } */ return(operation); /* * switch (projection.ClassName.ToLower(CultureInfo.InvariantCulture).Replace(' ', '_')) * { * case "mercator": * case "mercator_1sp": * case "mercator_2sp": * //1SP * transform = new Mercator(parameterList); * break; * case "transverse_mercator": * transform = new TransverseMercator(parameterList); * break; * case "albers": * case "albers_conic_equal_area": * transform = new AlbersProjection(parameterList); * break; * case "krovak": * transform = new KrovakProjection(parameterList); * break; * case "polyconic": * transform = new PolyconicProjection(parameterList); * break; * case "lambert_conformal_conic": * case "lambert_conformal_conic_2sp": * case "lambert_conic_conformal_(2sp)": * transform = new LambertConformalConic2SP(parameterList); * break; * default: * throw new NotSupportedException(String.Format("Projection {0} is not supported.", projection.ClassName)); * } * return transform; */ }
/// <summary> /// Initializes the Kalman Filter using an initial observation (position) /// </summary> /// <param name="gpsPosition">The position at which tfilter is to begin opperating.</param> /// <param name="deviceError">A distance measure of device error</param> /// <param name="horizontalDOP">The horizontal dilution of precision</param> /// <param name="verticalDOP">The vertical dilution of precision</param> /// <param name="ellipsoid">The ellipsoid</param> public void Initialize(Position3D gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Ellipsoid ellipsoid) { double fail = horizontalDOP.Value * verticalDOP.Value * deviceError.Value; if (fail == 0 || double.IsNaN(fail) || double.IsInfinity(fail)) { throw new ArgumentException( "Parameters deviceError, horizontalDOP and verticalDOP must be greater than zero."); } _currentState = new KalmanSystemState(gpsPosition, deviceError, horizontalDOP, verticalDOP, ellipsoid); }
public abstract GeoPoint Parse(String input, Ellipsoid referenceEllipsoid);