private void indexItemControl_OnAdd() { var form = new ValueForm(); var value = new Value(); //--- Need to determine if it is a collection/indexed array/Datum DatumType datum = Datum.GetDatumFromType(cmbIndexType); datum.standardUnit = standardUnitControl.StandardUnit; datum.nonStandardUnit = edtNonStandardUnit.Text; datum.Confidence = edtConfidence.GetValue <double>(); datum.ConfidenceSpecified = chkConfidence.Checked; datum.Resolution = edtResolution.GetValue <double>(); datum.ResolutionSpecified = chkResolution.Checked; value.Item = datum; form.LockTypes = true; form.Value = value; form.DefaultDataType = cmbIndexType.SelectedIndex; if (DialogResult.OK == form.ShowDialog()) { value = form.Value; if (value != null) { var lvi = new ListViewItem(value.ToString()); lvi.Tag = value; indexItemControl.Items.Add(lvi); } } }
private XElement GetStateXElement() { XElement stateX = new XElement("state"); stateX.SetAttributeValue("key", Proj4ProjectionParameters); if (viewModel.SelectedViewModel is CommonProjectionViewModel) { CommonProjectionViewModel commonProjectionViewModel = (CommonProjectionViewModel)viewModel.SelectedViewModel; DatumType datumType = commonProjectionViewModel.SelectedDatumType; string selectedZone = commonProjectionViewModel.SelectedZone; UnitType unitType = commonProjectionViewModel.SelectedUnitType; ProjectionType projectionType = commonProjectionViewModel.SelectedProjectionType; //int index1 = commonProjectionViewModel.SupportedDatumTypes.IndexOf(datumType); //int index2 = commonProjectionViewModel.SupportedUnits.IndexOf(commonProjectionViewModel.SelectedUnitType); //int index3 = (int)commonProjectionViewModel.SelectedProjectionType; commonProjectionViewModel.SelectedDatumType = datumType; int index4 = commonProjectionViewModel.SupportedZones.IndexOf(selectedZone); string value = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", projectionType, datumType, index4, unitType); XElement commonProjectionsStateX = new XElement("common", value); stateX.Add(commonProjectionsStateX); } else if (viewModel.SelectedViewModel is OtherProjectionViewModel) { OtherProjectionViewModel otherProjectionViewModel = (OtherProjectionViewModel)viewModel.SelectedViewModel; int index1 = (int)otherProjectionViewModel.SelectedProjectionType; int index2 = otherProjectionViewModel.SearchedResult.IndexOf(otherProjectionViewModel.SelectedProj4Model); string value = string.Format(CultureInfo.InvariantCulture, "{0},{1}", index1, index2); XElement customProjectionsStateX = new XElement("custom", value); stateX.Add(customProjectionsStateX); } return(stateX); }
private static IHorizontalDatum ReadHorizontalDatum(WktStreamTokenizer tokenizer) { //DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]]TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6277"]] tokenizer.ReadToken("["); string name = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("SPHEROID"); IEllipsoid ellipsoid = ReadEllipsoid(tokenizer); tokenizer.ReadToken("TOWGS84"); WGS84ConversionInfo wgsInfo = ReadWGS84ConversionInfo(tokenizer); tokenizer.ReadToken(","); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); // make an assumption about the datum type. DatumType datumType = DatumType.IHD_Geocentric; IHorizontalDatum horizontalDatum = new HorizontalDatum(name, datumType, ellipsoid, wgsInfo, "", authority, authorityCode, "", ""); tokenizer.ReadToken("]"); return(horizontalDatum); }
protected void CheckUserHasPermissionToListDatum(DatumType dt, ProtoCmsRuntimeContext rctx) { if (!rctx.UserHasPermission(dt.ListPermissionBase.Id)) { throw new HttpException(403, $"ProtoCMS: user is forbidden to list datum type '{dt.Id}'."); } }
private static IHorizontalDatum ReadHorizontalDatum(XmlTextReader reader) { if (!(reader.NodeType == XmlNodeType.Element && reader.Name == "CS_HorizontalDatum")) { throw new ParseException(String.Format("Expected a IHorizontalDatum but got a {0} at line {1} col {2}", reader.Name, reader.LineNumber, reader.LinePosition)); } /* <IHorizontalDatum DatumType="1001"> * <IInfo AuthorityCode="6277" Authority="EPSG" Name="OSGB_1936"/> * <IEllipsoid SemiMajorAxis="6377563.396" SemiMinorAxis="6356256.90923729" InverseFlattening="299.3249646" IvfDefinitive="1"> * <IInfo AuthorityCode="7001" Authority="EPSG" Name="Airy 1830"/> * <ILinearUnit MetersPerUnit="1"> * <IInfo AuthorityCode="9001" Abbreviation="m" Authority="EPSG" Name="metre"/> * </ILinearUnit> * </IEllipsoid> * <IWGS84ConversionInfo Dx="375" Dy="-111" Dz="431" Ex="0" Ey="0" Ez="0" Ppm="0"/> * </IHorizontalDatum> */ string datumTypeString = reader.GetAttribute("DatumType"); DatumType datumType = (DatumType)Enum.Parse(typeof(DatumType), datumTypeString, true); string authority = "", authorityCode = "", abbreviation = "", name = ""; reader.Read(); ReadInfo(reader, ref authority, ref authorityCode, ref abbreviation, ref name); IEllipsoid ellipsoid = ReadEllipsoid(reader); WGS84ConversionInfo wgs84info = ReadWGS84ConversionInfo(reader); reader.Read(); HorizontalDatum horizontalDatum = new HorizontalDatum(name, datumType, ellipsoid, wgs84info, "", authority, authorityCode, "", abbreviation); return(horizontalDatum); }
/// <summary> /// Initializes a new instance of a Datum object /// </summary> /// <param name="type">Datum type</param> /// <param name="name">Name</param> /// <param name="authority">Authority name</param> /// <param name="code">Authority-specific identification code.</param> /// <param name="alias">Alias</param> /// <param name="abbreviation">Abbreviation</param> /// <param name="remarks">Provider-supplied remarks</param> internal Datum(DatumType type, string name, string authority, long code, string alias, string remarks, string abbreviation) : base(name, authority, code, alias, abbreviation, remarks) { _DatumType = type; }
public void ProcessSignal(SignalRequirementsSignalRequirement signalRequirement) { InstrumentDAO dao = new InstrumentDAO(); List <Tuple <string, object, string> > attributes = new List <Tuple <string, object, string> >(); foreach (SignalRequirementsSignalRequirementTsfClassAttribute attribute in signalRequirement.TsfClassAttribute) { TsfClassAttributeName name = attribute.Name; if (attribute.Value != null) { if (attribute.Value.Item is DatumType) { DatumType datum = attribute.Value.Item as DatumType; Object value = Datum.GetNominalDatumValue(datum); if (value != null) { attributes.Add(new Tuple <string, object, string>(name.Value, value, datum.unitQualifier)); } } } } lvInstruments.BeginUpdate(); try { foreach (ListViewItem lvi in lvInstruments.Items) { lvi.BackColor = Color.White; } ICollection <object> ids = dao.FindCapableEquipment(attributes); foreach (ListViewItem lvi in lvInstruments.Items) { var testStationInstrumentData = lvi.Tag as TestStationInstrumentData; if (testStationInstrumentData != null) { var instrument = testStationInstrumentData.InstrumentDescription; if (instrument != null) { foreach (var id in ids) { if (id.Equals(instrument.uuid)) { lvi.BackColor = Color.PaleGreen; } } } } } } catch (Exception e2) { LogManager.Debug("Error In TSF Class: {0}", signalRequirement.TsfClass.tsfClassName); foreach (Tuple <string, object, string> tuple in attributes) { LogManager.Debug(" {0} = {1} {2}", tuple.Item1, tuple.Item2, tuple.Item3); } } lvInstruments.EndUpdate(); }
protected void CheckModifyOperationAllowed(string operationName, DatumType ct) { if (!ct.IsModifyOperationAllowed(operationName)) { throw new HttpException(400, $"ProtoCMS: datum type '{ct.Id}' doesn't allow modify operation " + $"'{operationName}'."); } }
/// <summary> /// Initializes a new instance of a horizontal datum /// </summary> /// <param name="ellipsoid">Ellipsoid</param> /// <param name="toWgs84">Parameters for a Bursa Wolf transformation into WGS84</param> /// <param name="type">Datum type</param> /// <param name="name">Name</param> /// <param name="authority">Authority name</param> /// <param name="code">Authority-specific identification code.</param> /// <param name="alias">Alias</param> /// <param name="abbreviation">Abbreviation</param> /// <param name="remarks">Provider-supplied remarks</param> internal HorizontalDatum( IEllipsoid ellipsoid, Wgs84ConversionInfo toWgs84, DatumType type, string name, string authority, long code, string alias, string remarks, string abbreviation) : base(type, name, authority, code, alias, remarks, abbreviation) { _Ellipsoid = ellipsoid; _Wgs84ConversionInfo = toWgs84; }
/// <summary> /// Creates a local datum. /// </summary> /// <param name="name">The name of the datum.</param> /// <param name="localDatumType">The type of datum.</param> /// <returns>An object that implements the ILocalDatum interface.</returns> public ILocalDatum CreateLocalDatum(string name, DatumType localDatumType) { if (name == null) { throw new ArgumentNullException("name"); } return(new LocalDatum(name, localDatumType)); }
public static void WriteJson(this DatumType value, JsonWriter writer, JsonSerializer serializer) { switch (value) { case DatumType.Match: serializer.Serialize(writer, "match"); break; } }
private static DatumType ConvertBack(string datumTypeName) { DatumType result = DatumType.None; if (Enum.TryParse<DatumType>(datumTypeName, out result)) { return result; } else return result; }
/// <summary> /// Creates a vertical datum from an enumerated type value. /// </summary> /// <param name="name">The name of the datum to create.</param> /// <param name="verticalDatumType">The IDatumType type use when creating the datum.</param> /// <returns>An object that implements the IVerticalDatum interface.</returns> public IVerticalDatum CreateVerticalDatum(string name, DatumType verticalDatumType) { if (name == null) { throw new ArgumentNullException("name"); } // no need to check verticalDatumType because IDatumType is an enum and cannot null. return(new VerticalDatum(name, verticalDatumType)); }
public override DatumPermissionCustomProps ListPermissionCustomProps(DatumType <ApplicationUser> datumType) { return(new DatumPermissionCustomProps( "List User", "Allow listing user data.", "Account", "User" )); }
public override DatumPermissionCustomProps ViewPermissionCustomProps(DatumType <ApplicationUser> datumType) { return(new DatumPermissionCustomProps( "View User", "Allow viewing user data.", "Account", "User" )); }
private int GetEditStates() { int idx = -1; DatumType datumType = DatumType; if (datumType is binary) { idx = (int)Datum.DatumTypes.BINARY; } else if (datumType is boolean) { idx = (int)Datum.DatumTypes.BOOL; } else if (datumType is complex) { idx = (int)Datum.DatumTypes.COMPLEX; } else if (datumType is dateTime) { idx = (int)Datum.DatumTypes.DATETIME; } else if (datumType is @double) { idx = (int)Datum.DatumTypes.DOUBLE; } else if (datumType is hexadecimal) { idx = (int)Datum.DatumTypes.HEX; } else if (datumType is integer) { idx = (int)Datum.DatumTypes.INT; } else if (datumType is @long) { idx = (int)Datum.DatumTypes.LONG; } else if (datumType is octal) { idx = (int)Datum.DatumTypes.OCT; } else if (datumType is @string) { idx = (int)Datum.DatumTypes.STRING; } else if (datumType is unsignedInteger) { idx = (int)Datum.DatumTypes.UINT; } else if (datumType is unsignedLong) { idx = (int)Datum.DatumTypes.ULONG; } return(idx); }
public VerticalDatum(DatumType datumType, string remarks, string authorityCode, string authority, string name, string alias, string abbreviation) : base(datumType, remarks, authority, authorityCode, name, alias, abbreviation) { }
/// <summary> /// Initializes a new instance of the VerticalDatum class with the specified properties. /// </summary> /// <param name="datumType">The datum type.</param> /// <param name="remarks">The provider-supplied remarks.</param> /// <param name="authority">The authority-specific identification code.</param> /// <param name="authorityCode">The authority-specific identification code.</param> /// <param name="name">The name.</param> /// <param name="alias">The alias.</param> /// <param name="abbreviation">The abbreviation.</param> public VerticalDatum( DatumType datumType, string remarks, string authorityCode, string authority, string name, string alias, string abbreviation ) : base(datumType, remarks,authority,authorityCode, name, alias, abbreviation) { }
/// <summary> /// Initializes a new instance of the EventLog class with the specified properties. /// </summary> /// <param name="datumType"></param> /// <param name="remarks">The provider-supplied remarks.</param> /// <param name="authority">The authority-specific identification code.</param> /// <param name="authorityCode">The authority-specific identification code.</param> /// <param name="name">The name.</param> /// <param name="alias">The alias.</param> /// <param name="abbreviation">The abbreviation.</param> public Datum(DatumType datumType, string remarks, string authorityCode, string authority, string name, string alias, string abbreviation) : base(remarks, authorityCode, authority, name, alias, abbreviation) { _datumType = datumType; }
public static void WriteJson(this DatumType value, JsonWriter writer, JsonSerializer serializer) { switch (value) { case DatumType.Asset: serializer.Serialize(writer, "asset"); break; case DatumType.Participant: serializer.Serialize(writer, "participant"); break; case DatumType.Roster: serializer.Serialize(writer, "roster"); break; } }
/// <summary> /// Initializes a new instance of the HorizontalDatum class with the specififed properties. /// </summary> /// <param name="name">The name of the datum.</param> /// <param name="horizontalDatumType">The datum type.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="toWGS84">The WGS conversion parameters.</param> /// <param name="remarks">Remarks about this object.</param> /// <param name="authority">The name of the authority.</param> /// <param name="authorityCode">The code the authority uses to identidy this object.</param> /// <param name="alias">The alias of the object.</param> /// <param name="abbreviation">The abbreviated name of this object.</param> public HorizontalDatum(string name, DatumType horizontalDatumType, IEllipsoid ellipsoid, WGS84ConversionInfo toWGS84, string remarks, string authority, string authorityCode, string alias, string abbreviation) : base(horizontalDatumType, remarks, authority, authorityCode, name, alias, abbreviation) { if (ellipsoid==null) { throw new ArgumentNullException("ellipsoid"); } _ellipsoid = ellipsoid; _wgs84ConversionInfo = toWGS84; }
/// <summary> /// Initializes a new instance of a horizontal datum /// </summary> /// <param name="ellipsoid">Ellipsoid</param> /// <param name="toWgs84">Parameters for a Bursa Wolf transformation into WGS84</param> /// <param name="type">Datum type</param> /// <param name="name">Name</param> /// <param name="id">Authority-specific identification code.</param> public HorizontalDatum( Ellipsoid ellipsoid, BursaTransParams toWgs84, DatumType type, string name = null, string id = null) : base(type, name, id) { Ellipsoid = ellipsoid; Wgs84Parameters = toWgs84; }
/// <summary> /// Initializes a new instance of the EventLog class with the specified properties. /// </summary> /// <param name="datumType"></param> /// <param name="remarks">The provider-supplied remarks.</param> /// <param name="authority">The authority-specific identification code.</param> /// <param name="authorityCode">The authority-specific identification code.</param> /// <param name="name">The name.</param> /// <param name="alias">The alias.</param> /// <param name="abbreviation">The abbreviation.</param> public Datum( DatumType datumType, string remarks, string authorityCode, string authority, string name, string alias, string abbreviation ) : base(remarks,authorityCode, authority, name, alias, abbreviation) { _datumType = datumType; }
private static string Convert(DatumType datumType) { if (datumType != DatumType.None) { return datumType.ToString(); } else { return noSelect; } }
public HorizontalDatum(string name, DatumType horizontalDatumType, Ellipsoid ellipsoid, WGS84ConversionInfo toWGS84, string remarks, string authority, string authorityCode, string alias, string abbreviation) : base(horizontalDatumType, remarks, authority, authorityCode, name, alias, abbreviation) { if (ellipsoid == null) { throw new ArgumentNullException("ellipsoid"); } _ellipsoid = ellipsoid; _wgs84ConversionInfo = toWGS84; }
public Dictionary <SignalRequirementsSignalRequirement, ICollection <object> > Build(TestDescription testDescription) { var requiredSignals = new Dictionary <SignalRequirementsSignalRequirement, ICollection <object> >(); foreach (SignalRequirementsSignalRequirement signalRequirement in testDescription.SignalRequirements) { var attributes = new List <Tuple <string, object, string> >(); var dao = new InstrumentDAO(); TsfClass tsfClass = signalRequirement.TsfClass; if (tsfClass.tsfClassName.Equals("SHORT")) { continue; } if (string.IsNullOrWhiteSpace(tsfClass.tsfClassName)) { continue; } foreach (SignalRequirementsSignalRequirementTsfClassAttribute attribute in signalRequirement.TsfClassAttribute) { TsfClassAttributeName name = attribute.Name; if (attribute.Value != null) { if (attribute.Value.Item is DatumType) { DatumType datum = attribute.Value.Item as DatumType; Object value = Datum.GetNominalDatumValue(datum); if (value != null) { attributes.Add(new Tuple <string, object, string>(name.Value, value, datum.unitQualifier)); } } } } try { ICollection <object> capableEquipment = dao.FindCapableEquipment(attributes); requiredSignals.Add(signalRequirement, capableEquipment); } catch (Exception e2) { LogManager.SourceError(ATMLAllocator.SOURCE, "Error In TSF Class: {0} - ERROR: {1}", tsfClass.tsfClassName, e2.Message); LogManager.Debug(e2); foreach (var tuple in attributes) { LogManager.SourceError(ATMLAllocator.SOURCE, " {0} = {1}", tuple.Item1, tuple.Item2); } } } return(requiredSignals); }
/// <summary> /// Creates <see cref="T:Topology.CoordinateSystems.HorizontalDatum" /> from ellipsoid and Bursa-World parameters. /// </summary> /// <remarks> /// Since this method contains a set of Bursa-Wolf parameters, the created /// datum will always have a relationship to WGS84. If you wish to create a /// horizontal datum that has no relationship with WGS84, then you can /// either specify a <see cref="T:Topology.CoordinateSystems.DatumType">horizontalDatumType</see> of <see cref="F:Topology.CoordinateSystems.DatumType.HD_Other" />, or create it via WKT. /// </remarks> /// <param name="name">Name of ellipsoid</param> /// <param name="datumType">Type of datum</param> /// <param name="ellipsoid">Ellipsoid</param> /// <param name="toWgs84">Wgs84 conversion parameters</param> /// <returns>Horizontal datum</returns> public IHorizontalDatum CreateHorizontalDatum(string name, DatumType datumType, IEllipsoid ellipsoid, Wgs84ConversionInfo toWgs84) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Invalid name"); } if (ellipsoid == null) { throw new ArgumentException("Ellipsoid was null"); } return(new HorizontalDatum(ellipsoid, toWgs84, datumType, name, string.Empty, -1L, string.Empty, string.Empty, string.Empty)); }
private void cmbLimit1Type_SelectedIndexChanged(object sender, EventArgs e) { if (!Initializing) { datum = Datum.GetDatumFromType(cmbLimitType); edtDatumType.DatumType = datum; ControlsToData(); if (LimitChanged != null) { LimitChanged(_singleLimit); } } }
/// <summary> /// Creates <see cref="HorizontalDatum"/> from ellipsoid and Bursa-World parameters. /// </summary> /// <remarks> /// Since this method contains a set of Bursa-Wolf parameters, the created /// datum will always have a relationship to WGS84. If you wish to create a /// horizontal datum that has no relationship with WGS84, then you can /// either specify a <see cref="DatumType">horizontalDatumType</see> of <see cref="DatumType.HD_Other"/>, or create it via WKT. /// </remarks> /// <param name="name">Name of ellipsoid</param> /// <param name="datumType">Type of datum</param> /// <param name="ellipsoid">Ellipsoid</param> /// <param name="toWgs84">Wgs84 conversion parameters</param> /// <returns>Horizontal datum</returns> public HorizontalDatum CreateHorizontalDatum(string name, DatumType datumType, Ellipsoid ellipsoid, BursaTransParams toWgs84) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Invalid name"); } if (ellipsoid == null) { throw new ArgumentException("Ellipsoid was null"); } return(new HorizontalDatum(ellipsoid, toWgs84, datumType, name)); }
/// <summary> /// Creates horizontal datum from ellipsoid and Bursa-World parameters. Since this method /// contains a set of Bursa-Wolf parameters, the created datum will always have a relationship to /// WGS84. If you wish to create a horizontal datum that has no relationship with WGS84, then you /// can either specify a horizontalDatumType of IHD_Other, or create it via WKT. /// </summary> /// <param name="name">The name of the datum to create.</param> /// <param name="horizontalDatumType">The IDatumType type use when creating the datum.</param> /// <param name="ellipsoid">The ellipsoid to use then creating the datum.</param> /// <param name="toWGS84">WKGS conversion parameters.</param> /// <returns>An object that implements the IHorizontalDatum interface.</returns> public IHorizontalDatum CreateHorizontalDatum(string name, DatumType horizontalDatumType, IEllipsoid ellipsoid, WGS84ConversionInfo toWGS84) { if (name == null) { throw new ArgumentNullException("name"); } if (ellipsoid == null) { throw new ArgumentNullException("ellipsoid"); } // no need to check horizontalDatumType and toWGS84 because they are value types. return(new HorizontalDatum(name, horizontalDatumType, ellipsoid, toWGS84)); }
public override void FromWgs84(Models.LatLng wgs84Position) { var latitude = wgs84Position.Latitude * Math.PI / 180.0; var longitude = wgs84Position.Longitude * Math.PI / 180.0; double a = 6377563.396, b = 6356256.910; // Airy 1830 major & minor semi-axes double F0 = 0.9996012717; // NatGrid scale factor on central meridian double lat0 = 49.0 * Math.PI / 180.0; double lon0 = -2.0 * Math.PI / 180.0; // NatGrid true origin double N0 = -100000.0, E0 = 400000.0; // northing & easting of true origin, metres double e2 = 1 - (b * b) / (a * a); // eccentricity squared double n = (a - b) / (a + b), n2 = n * n, n3 = n * n * n; double cosLat = Math.Cos(latitude), sinLat = Math.Sin(latitude); double nu = a * F0 / Math.Sqrt(1.0 - e2 * sinLat * sinLat); // transverse radius of curvature double rho = a * F0 * (1.0 - e2) / Math.Pow(1.0 - e2 * sinLat * sinLat, 1.5); // meridional radius of curvature double eta2 = nu / rho - 1.0; double Ma = (1.0 + n + (5.0 / 4.0) * n2 + (5.0 / 4.0) * n3) * (latitude - lat0); double Mb = (3.0 * n + 3.0 * n * n + (21.0 / 8.0) * n3) * Math.Sin(latitude - lat0) * Math.Cos(latitude + lat0); double Mc = ((15.0 / 8.0) * n2 + (15.0 / 8.0) * n3) * Math.Sin(2.0 * (latitude - lat0)) * Math.Cos(2.0 * (latitude + lat0)); double Md = (35.0 / 24.0) * n3 * Math.Sin(3.0 * (latitude - lat0)) * Math.Cos(3.0 * (latitude + lat0)); double M = b * F0 * (Ma - Mb + Mc - Md); // meridional arc double cos3lat = cosLat * cosLat * cosLat; double cos5lat = cos3lat * cosLat * cosLat; double tan2lat = Math.Tan(latitude) * Math.Tan(latitude); double tan4lat = tan2lat * tan2lat; double I = M + N0; double II = (nu / 2.0) * sinLat * cosLat; double III = (nu / 24.0) * sinLat * cos3lat * (5.0 - tan2lat + 9.0 * eta2); double IIIA = (nu / 720.0) * sinLat * cos5lat * (61.0 - 58.0 * tan2lat + tan4lat); double IV = nu * cosLat; double V = (nu / 6.0) * cos3lat * (nu / rho - tan2lat); double VI = (nu / 120.0) * cos5lat * (5.0 - 18.0 * tan2lat + tan4lat + 14.0 * eta2 - 58.0 * tan2lat * eta2); double dLon = longitude - lon0; double dLon2 = dLon * dLon, dLon3 = dLon2 * dLon, dLon4 = dLon3 * dLon, dLon5 = dLon4 * dLon, dLon6 = dLon5 * dLon; double N = Math.Round(I + II * dLon2 + III * dLon4 + IIIA * dLon6, 0); double E = Math.Round(E0 + IV * dLon + V * dLon3 + VI * dLon5, 0); Datum = new DatumType { Northing = (int)N, Easting = (int)E }; }
private void otherAttributes_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { var form = new DatumForm(); if (DialogResult.OK == form.ShowDialog()) { DatumType value = form.Datum; senderGrid.Rows[e.RowIndex].Cells[1].Value = value.ToString(); } } }
public override Models.LatLng ToWgs84() { DatumType datum = Datum; var initDelta = 0.01; var threshold = 0.000000001; var dLat = initDelta; var dLon = initDelta; var mLat = datum.Latitude - dLat; var mLon = datum.Longitude - dLon; var pLat = datum.Latitude + dLat; var pLon = datum.Longitude + dLon; double wgsLat = 0.0, wgsLon = 0.0; for (var i = 0; i != 10000; i++) { wgsLat = (mLat + pLat) / 2.0; wgsLon = (mLon + pLon) / 2.0; var tmp = gcj_encrypt(wgsLat, wgsLon); dLat = tmp.Latitude - datum.Latitude; dLon = tmp.Longitude - datum.Longitude; if ((Math.Abs(dLat) < threshold) && (Math.Abs(dLon) < threshold)) { break; } if (dLat > 0.0) { pLat = wgsLat; } else { mLat = wgsLat; } if (dLon > 0.0) { pLon = wgsLon; } else { mLon = wgsLon; } } return(new Models.LatLng() { Latitude = wgsLat, Longitude = wgsLon }); }
/// <summary> /// Creates a <see cref="IVerticalDatum"/> from an enumerated type value. /// </summary> /// <param name="name">Name of datum</param> /// <param name="datumType">Type of datum</param> /// <returns>Vertical datum</returns> public IVerticalDatum CreateVerticalDatum(string name, DatumType datumType) { throw new NotImplementedException(); }
/// <summary> /// Creates <see cref="HorizontalDatum"/> from ellipsoid and Bursa-World parameters. /// </summary> /// <remarks> /// Since this method contains a set of Bursa-Wolf parameters, the created /// datum will always have a relationship to WGS84. If you wish to create a /// horizontal datum that has no relationship with WGS84, then you can /// either specify a <see cref="DatumType">horizontalDatumType</see> of <see cref="DatumType.HD_Other"/>, or create it via WKT. /// </remarks> /// <param name="name">Name of ellipsoid</param> /// <param name="datumType">Type of datum</param> /// <param name="ellipsoid">Ellipsoid</param> /// <param name="toWgs84">Wgs84 conversion parameters</param> /// <returns>Horizontal datum</returns> public IHorizontalDatum CreateHorizontalDatum(string name, DatumType datumType, IEllipsoid ellipsoid, Wgs84ConversionInfo toWgs84) { if (string.IsNullOrEmpty(name)) throw new ArgumentException("Invalid name"); if (ellipsoid == null) throw new ArgumentException("Ellipsoid was null"); return new HorizontalDatum(ellipsoid, toWgs84, datumType, name, String.Empty, -1, String.Empty, String.Empty, String.Empty); }
/// <summary> /// Creates a local datum. /// </summary> /// <param name="name">The name of the datum.</param> /// <param name="localDatumType">The type of datum.</param> /// <returns>An object that implements the ILocalDatum interface.</returns> public ILocalDatum CreateLocalDatum(string name, DatumType localDatumType) { if (name==null) { throw new ArgumentNullException("name"); } return new LocalDatum(name, localDatumType); }
/// <summary> /// Initializes to WGS84. /// </summary> /// <param name="values">The values.</param> public void InitializeToWgs84(string[] values) { _toWgs84 = new double[values.Length]; for (int i = 0; i < values.Length; i++) { _toWgs84[i] = double.Parse(values[i], CultureInfo.InvariantCulture); } if (_toWgs84.Length != 3 && _toWgs84.Length != 7) throw new ArgumentOutOfRangeException("Unrecognized ToWgs84 array length. The number of elements in the array should be 3 or 7"); if (_toWgs84.Length == 3) { _datumtype = DatumType.Param3; } else { // checking to see if several blank values were included. if (_toWgs84[3] == 0.0 && _toWgs84[4] == 0.0 && _toWgs84[5] == 0.0 && _toWgs84[6] == 0.0) { _datumtype = DatumType.Param3; } else { _datumtype = DatumType.Param7; // Transform from arc seconds to radians _toWgs84[3] *= SEC_TO_RAD; _toWgs84[4] *= SEC_TO_RAD; _toWgs84[5] *= SEC_TO_RAD; // transform from parts per millon to scaling factor _toWgs84[6] = (_toWgs84[6] / 1000000.0) + 1; } } }
/// <summary> /// Initializes a new instance of the HorizontalDatum class with the specififed properties. /// </summary> /// <param name="name">The name of the datum.</param> /// <param name="horizontalDatumType">The datum type.</param> /// <param name="ellipsoid">The ellipsoid.</param> /// <param name="toWGS84">The WGS conversion parameters.</param> internal HorizontalDatum(string name, DatumType horizontalDatumType, IEllipsoid ellipsoid, WGS84ConversionInfo toWGS84) : this(name, horizontalDatumType, ellipsoid, toWGS84,"", "", "", "", "") { }
private Datum(SerializationInfo info, StreamingContext context) { this.Name = info.GetString("Name"); this.Spheroid = (Spheroid)info.GetValue("Spheroid", typeof(Spheroid)); this.Type = (DatumType)info.GetValue("Type", typeof(DatumType)); }
/// <summary> /// Initializes a new instane of Datun. /// </summary> /// <param name="name">The name of the datum.</param> /// <param name="datumType">The type of the datum.</param> internal Datum(string name, DatumType datumType) : this(datumType, "", "", "", name, "","") { }
/// <summary> /// Initializes a new instance of the LocalDatum class with the specified propeties. /// </summary> /// <param name="name">The name of the datum.</param> /// <param name="datumType">The Datum type.</param> internal LocalDatum(string name, DatumType datumType) : base(name, datumType) { }
/// <summary> /// Initializes a new instance of the VerticalDatum class with the specified properties. /// </summary> /// <param name="name">The name of the vertical datum.</param> /// <param name="verticalDatumType">The datum type.</param> internal VerticalDatum(string name, DatumType verticalDatumType) : this(verticalDatumType,"","","",name,"","") { }
public static string DatumTypeAsCode(DatumType datumtype) { string datumCode = Enum.Format(typeof(DatumType),datumtype, "d"); return datumCode; }
/// <summary> /// Initializes a new instance of the Datum class with the specified properties. /// </summary> /// <param name="datumType">The datum type.</param> internal Datum(DatumType datumType) : this(datumType, "", "", "", "", "","") { }
public IHorizontalDatum CreateHorizontalDatum(string name, DatumType datumType, IEllipsoid ellipsoid, Wgs84ConversionInfo toWgs84) { throw new NotImplementedException(); }
/// <summary> /// Creates horizontal datum from ellipsoid and Bursa-World parameters. Since this method /// contains a set of Bursa-Wolf parameters, the created datum will always have a relationship to /// WGS84. If you wish to create a horizontal datum that has no relationship with WGS84, then you /// can either specify a horizontalDatumType of IHD_Other, or create it via WKT. /// </summary> /// <param name="name">The name of the datum to create.</param> /// <param name="horizontalDatumType">The IDatumType type use when creating the datum.</param> /// <param name="ellipsoid">The ellipsoid to use then creating the datum.</param> /// <param name="toWGS84">WKGS conversion parameters.</param> /// <returns>An object that implements the IHorizontalDatum interface.</returns> public IHorizontalDatum CreateHorizontalDatum(string name, DatumType horizontalDatumType, IEllipsoid ellipsoid, WGS84ConversionInfo toWGS84) { if (name==null) { throw new ArgumentNullException("name"); } if (ellipsoid==null) { throw new ArgumentNullException("ellipsoid"); } // no need to check horizontalDatumType and toWGS84 because they are value types. return new HorizontalDatum(name, horizontalDatumType, ellipsoid, toWGS84); }
/// <summary> /// Creates a vertical datum from an enumerated type value. /// </summary> /// <param name="name">The name of the datum to create.</param> /// <param name="verticalDatumType">The IDatumType type use when creating the datum.</param> /// <returns>An object that implements the IVerticalDatum interface.</returns> public IVerticalDatum CreateVerticalDatum(string name, DatumType verticalDatumType) { if (name==null) { throw new ArgumentNullException("name"); } // no need to check verticalDatumType because IDatumType is an enum and cannot null. return new VerticalDatum(name, verticalDatumType); }