コード例 #1
0
ファイル: SamplePointList.cs プロジェクト: CareyGit/jx
		/// <summary>
		/// Append a sample to the collection
		/// </summary>
		/// <param name="sample">The sample to append</param>
		/// <returns>The ordinal position at which the sample was added</returns>
		public int Add( Sample sample )
		{
			return list.Add( sample );
		}
コード例 #2
0
ファイル: SamplePointList.cs プロジェクト: CareyGit/jx
		/// <summary>
		/// Get the specified data type from the specified sample
		/// </summary>
		/// <param name="sample">The sample instance of interest</param>
		/// <param name="type">The data type to be extracted from the sample</param>
		/// <returns>A double value representing the requested data</returns>
		public double GetValue( Sample sample, SampleType type )
		{
			switch ( type )
			{
				case SampleType.Position:
					return sample.Position;
				case SampleType.Time:
					return sample.Time.ToOADate();
				case SampleType.TimeDiff:
					return sample.Time.ToOADate() - ( (Sample)list[0] ).Time.ToOADate();
				case SampleType.VelocityAvg:
					double timeDiff = sample.Time.ToOADate() - ( (Sample)list[0] ).Time.ToOADate();
					if ( timeDiff <= 0 )
						return PointPair.Missing;
			        return ( sample.Position - ( (Sample)list[0] ).Position ) / timeDiff;
			    case SampleType.VelocityInst:
					return sample.Velocity;
				default:
					return PointPair.Missing;
			}
		}