Exemple #1
0
 public static String EnumToString(ESpectralInterpolation interpolation)
 {
     switch (interpolation)
     {
         case ESpectralInterpolation.Linear:
             return "Linear";
         case ESpectralInterpolation.Peak:
             return "Peak";
         default:
             return "";
     }
 }
 private void SetInterpolation(ESpectralInterpolation value)
 {
     if (specInt == ESpectralInterpolation.Linear)
         if (value == ESpectralInterpolation.Peak)
             if (lambdaMax == lambdaMin)
                 if (HasSpectralPoints)
                 {
                     lambdaMin = GetLambdaMin();
                     lambdaMax = GetLambdaMax();
                 }
     if (specInt == ESpectralInterpolation.Peak)
     {
         SpectralPoint sp = Points[0];
         if (sp.Lambda != lambdaMin)
             points.Insert(0, new SpectralPoint(lambdaMin, baseIntensity));
         sp = Points[PointsCount - 1];
         if (sp.Lambda != lambdaMax)
             points.Add(new SpectralPoint(lambdaMax, baseIntensity));
     }
     specInt = value;
     CallSpectrumChanged();
 }
        public void Clone(Spectrum spec)
        {
            category = spec.Category;
            name = spec.Name;
            specInt = spec.Interpolation;
            lambdaMin = spec.LambdaMin;
            lambdaMax = spec.LambdaMax;
            imageIndex = spec.ImageIndex;
            baseIntensity = spec.BaseIntensity;

            points.Clear();
            foreach (SpectralPoint sp in spec.Points)
                points.Add(new SpectralPoint(sp));

            CallSpectrumChanged();
        }
 public Spectrum(SerializationInfo info, StreamingContext ctxt)
 {
     this.name = (String)info.GetValue("SpectrumName", typeof(String));
     this.category = (String)info.GetValue("CategoryName", typeof(String));
     this.specInt = (ESpectralInterpolation)info.GetValue("SpectralInterpolation", typeof(ESpectralInterpolation));
     this.points = (SpectralPointCollection)info.GetValue("SpectralPoints", typeof(SpectralPointCollection));
     this.baseIntensity = (double)info.GetValue("BaseIntensity", typeof(double));
     this.imageIndex = (int)info.GetValue("ImageIndex", typeof(Int32));
     this.lambdaMin = (double)info.GetValue("LambdaMin", typeof(double));
     this.lambdaMax = (double)info.GetValue("LambdaMax", typeof(double));
 }
        public Spectrum(Spectrum sp)
        {
            //properties kopieren
            name = sp.Name;
            category = sp.Category;
            specInt = sp.Interpolation;
            points = new SpectralPointCollection(sp.Points);
            baseIntensity = sp.BaseIntensity;
            imageIndex = sp.ImageIndex;
            lambdaMin = sp.LambdaMin;
            lambdaMax = sp.LambdaMax;

            CallSpectrumChanged();
        }
        public Spectrum(ESpectrumTemplate eSpTemplate, ESpectralInterpolation eSpInterpolation)
        {
            category = "uncategorized";
            points = new SpectralPointCollection();
            name = "Spectrum";
            specInt = eSpInterpolation;

            switch (eSpTemplate)
            {
                case ESpectrumTemplate.Empty:
                    break;
                case ESpectrumTemplate.Visible:
                    name = "Visible Spectrum";
                    AddSpectralPoint(380, 1);
                    AddSpectralPoint(780, 1);
                    break;
                case ESpectrumTemplate.ExtendedVisible:
                    name = "Extended Visible Spectrum";
                    AddSpectralPoint(324, 1);
                    AddSpectralPoint(836, 1);
                    break;
                default:
                    break;
            }
            Clear();
        }