3 using System.Collections.Generic;
7 namespace SiliconStudio.Presentation.Controls
14 public static readonly DependencyProperty SymbolProperty = DependencyProperty.Register(
"Symbol", typeof(
string), typeof(
UnitSystem));
21 public string Symbol {
get {
return (
string)GetValue(SymbolProperty); } set { SetValue(SymbolProperty, value); } }
39 GroupingValues.GetAllGroupingValues(ref values, 1.0);
40 Conversions.GetAllGroupingValues(ref values);
49 public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
"Value", typeof(
double), typeof(
UnitConversion));
50 public static readonly DependencyProperty SymbolProperty = DependencyProperty.Register(
"Symbol", typeof(
string), typeof(
UnitConversion));
52 public static readonly DependencyProperty IsMultipliableProperty = DependencyProperty.Register(
"IsMultipliable", typeof(
bool), typeof(
UnitConversion));
57 public double Value {
get {
return (
double)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } }
61 public string Symbol {
get {
return (
string)GetValue(SymbolProperty); } set { SetValue(SymbolProperty, value); } }
69 public bool IsMultipliable {
get {
return (
bool)GetValue(IsMultipliableProperty); } set { SetValue(IsMultipliableProperty, value); } }
82 public static readonly DependencyProperty LargeIntervalSizeProperty = DependencyProperty.Register(
"LargeIntervalSize", typeof(
double), typeof(
UnitGrouping));
83 public static readonly DependencyProperty SmallIntervalCountProperty = DependencyProperty.Register(
"SmallIntervalCount", typeof(
int), typeof(
UnitGrouping),
new FrameworkPropertyMetadata(10));
84 public static readonly DependencyProperty IsMultipliableProperty = DependencyProperty.Register(
"IsMultipliable", typeof(
bool), typeof(
UnitGrouping));
89 public double LargeIntervalSize {
get {
return (
double)GetValue(LargeIntervalSizeProperty); } set { SetValue(LargeIntervalSizeProperty, value); } }
93 public int SmallIntervalCount {
get {
return (
int)GetValue(SmallIntervalCountProperty); } set { SetValue(SmallIntervalCountProperty, value); } }
97 public bool IsMultipliable {
get {
return (
bool)GetValue(IsMultipliableProperty); } set { SetValue(IsMultipliableProperty, value); } }
103 LargeIntervalSize = largeIntervalSize;
104 SmallIntervalCount = smallIntervalCount;
117 conversion.GroupingValues.GetAllGroupingValues(ref values, conversion.Value);
129 foreach (var value
in this.Select(grouping => grouping.LargeIntervalSize * multiplier))
131 if (!values.Contains(value))
136 if (!values.Contains(multiplier))
137 values.Add(multiplier);
void GetAllGroupingValues(ref List< double > values)
UnitGrouping(double largeIntervalSize, int smallIntervalCount)
void GetAllGroupingValues(ref List< double > values, double multiplier)
Represent an unit system that can be used with a ScaleBar
Represent an unit conversion for an UnitSystem used for grouping large or small values (such as nano ...
A collection of UnitConversion. Note that when two multipliable UnitConversion conflict (eg...
A collection of UnitGrouping.Note that when two multipliable UnitGrouping conflict, the last one has priority.
void GetAllGroupingValues(ref List< double > values)
Represent an acceptable value for grouping units