public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (value is Koord)
     {
         if (destinationType == typeof(string))
         {
             Koord Koord = (Koord)value;
             if (culture == null)
             {
                 culture = CultureInfo.CurrentCulture;
             }
             string        separator = culture.TextInfo.ListSeparator + " ";
             TypeConverter converter = TypeDescriptor.GetConverter(typeof(int));
             string[]      array     = new string[3];
             int           num       = 0;
             array[num++] = converter.ConvertToString(context, culture, Koord.X);
             array[num++] = converter.ConvertToString(context, culture, Koord.Y);
             array[num++] = converter.ConvertToString(context, culture, Koord.Z);
             return(string.Join(separator, array));
         }
         if (destinationType == typeof(InstanceDescriptor))
         {
             Koord           Koord2      = (Koord)value;
             ConstructorInfo constructor = typeof(Koord).GetConstructor(new Type[]
             {
                 typeof(double),
                 typeof(double),
                 typeof(double)
             });
             if (constructor != null)
             {
                 return(new InstanceDescriptor(constructor, new object[]
                 {
                     Koord2.X,
                     Koord2.Y,
                     Koord2.Z
                 }));
             }
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Ejemplo n.º 2
0
 public Vexel(Koord origin, double extent)
 {
     //TODO do some checking
     _origin = origin;
     _extent = extent;
 }
Ejemplo n.º 3
0
 public Vexel()
 {
     _origin = new Koord(0,0,0);
     Extent = 0;
 }