/// <summary> /// Method to get the scaling factor from Rhino document units to meter /// /// If Rhino units is meter then factor is 1. /// /// This method can handle all documented Rhino units, so this method can be used to convert into a known GSA unit /// </summary> /// <param name="rhinoUnits"></param> /// <returns></returns> private static double Rhino2meter(UnitSystem rhinoUnits) { List <int> id = new List <int>(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); List <double> convertFact = new List <double>(new double[] { 1, 0.000001, 0.001, 0.01, 1.0, 1000.0, 0.0000000254, 0.0000254, 0.0254, 0.305, 1610.0, 0, 0.0000000001, 0.000000001, 0.1, 10.0, 100.0, 1000000.0, 1000000000.0, 0.914 }); for (int i = 0; i < id.Count; i++) { if (rhinoUnits.GetHashCode() == id[i]) { return(convertFact[i]); } } return(0); }
/// <summary> /// Method to retrieve current Rhino document unit name. /// /// Note that names have been changed to suit GSA unit naming convetion. /// - Rhino unit "Meters" -> GSA unit "m" /// /// Method will return GSA readable unit if of know type /// (mm, cm, m, in or ft) /// </summary> /// <param name="rhinoUnits"></param> /// <returns></returns> private static string RhinoUnitName(UnitSystem rhinoUnits) { List <int> id = new List <int>(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); List <string> name = new List <string>(new string[] { "None", "Microns", "mm", "cm", "m", "km", "Microinches", "Mils", "in", "ft", "Miles", " ", "Angstroms", "Nanometers", "Decimeters", "Dekameters", "Hectometers", "Megameters", "Gigameters", "Yards" }); for (int i = 0; i < id.Count; i++) { if (rhinoUnits.GetHashCode() == id[i]) { return(name[i]); } } return(""); }
/// <summary> /// Gets a hash code for this file binary header /// </summary> /// <returns></returns> public override int GetHashCode() { unchecked { var hashCode = JobId; hashCode = (hashCode * 397) ^ LineNum; hashCode = (hashCode * 397) ^ Reelnum; hashCode = (hashCode * 397) ^ DataTracesPerRecord.GetHashCode(); hashCode = (hashCode * 397) ^ AuxTracesPerRecord.GetHashCode(); hashCode = (hashCode * 397) ^ SampleIntervalOfFileMicrosec.GetHashCode(); hashCode = (hashCode * 397) ^ SampleIntervalOrigRecordingMicrosec.GetHashCode(); hashCode = (hashCode * 397) ^ SamplesPerTraceOfFile.GetHashCode(); hashCode = (hashCode * 397) ^ SamplesPerTraceOrigRecording.GetHashCode(); hashCode = (hashCode * 397) ^ DataSampleFormatCode.GetHashCode(); hashCode = (hashCode * 397) ^ CdpFold.GetHashCode(); hashCode = (hashCode * 397) ^ TraceSortingCode.GetHashCode(); hashCode = (hashCode * 397) ^ VerticalSumCode.GetHashCode(); hashCode = (hashCode * 397) ^ SweepFrequencyStart.GetHashCode(); hashCode = (hashCode * 397) ^ SweepFrequencyEnd.GetHashCode(); hashCode = (hashCode * 397) ^ SweepLengthMs.GetHashCode(); hashCode = (hashCode * 397) ^ SweepType.GetHashCode(); hashCode = (hashCode * 397) ^ TraceNumSweepChannel.GetHashCode(); hashCode = (hashCode * 397) ^ SweepTraceTaperLengthStartMs.GetHashCode(); hashCode = (hashCode * 397) ^ SweepTraceTaperLengthEndMs.GetHashCode(); hashCode = (hashCode * 397) ^ SweepTaperType.GetHashCode(); hashCode = (hashCode * 397) ^ CorrelatedDataTraces.GetHashCode(); hashCode = (hashCode * 397) ^ BinaryGainRecovered.GetHashCode(); hashCode = (hashCode * 397) ^ AplitudeRecovery.GetHashCode(); hashCode = (hashCode * 397) ^ UnitSystem.GetHashCode(); hashCode = (hashCode * 397) ^ ImpulseSignal.GetHashCode(); hashCode = (hashCode * 397) ^ VibratoryPolarityCode.GetHashCode(); hashCode = (hashCode * 397) ^ SegyFormatRevisionNum.GetHashCode(); hashCode = (hashCode * 397) ^ FixedLengthTraceFlag.GetHashCode(); hashCode = (hashCode * 397) ^ ExtendedTextHeadersCount.GetHashCode(); return(hashCode); } }