VOID_DataValue: New VOID_Vector3dValue class with special format handling.
[VOID.git] / VOID_DataValue.cs
blob:a/VOID_DataValue.cs -> blob:b/VOID_DataValue.cs
--- a/VOID_DataValue.cs
+++ b/VOID_DataValue.cs
@@ -103,7 +103,7 @@
 			return (T)this.cache;
 		}
 
-		public string ValueUnitString() {
+		public virtual string ValueUnitString() {
 			return this.Value.ToString() + this.Units;
 		}
 
@@ -145,7 +145,6 @@
 		{
 			return v.ToSingle();
 		}
-
 
 		protected IFormatProvider formatProvider;
 
@@ -325,6 +324,26 @@
 	{
 		public VOID_StrValue(string Label, Func<string> ValueFunc) : base(Label, ValueFunc, "") {}
 	}
+
+	public class VOID_Vector3dValue : VOID_DataValue<Vector3d>
+	{
+		public VOID_Vector3dValue(string Label, Func<Vector3d> ValueFunc, string Units)
+			: base(Label, ValueFunc, Units)
+		{}
+
+		public string ToString(string format)
+		{
+			return string.Format("{0}: {1}{2}",
+				this.Label,
+				this.Value.ToString(format),
+				this.Units
+			);
+		}
+
+		public string ValueUnitString(string format) {
+			return this.Value.ToString(format) + this.Units;
+		}
+	}
 }