Beispiel #1
0
        public void Clear()
        {
            CurveData cdDefault = new CurveData();

            name_      = cdDefault.name_;
            curveType_ = cdDefault.curveType_;

            equation1_ = cdDefault.equation1_;
            equation2_ = cdDefault.equation2_;

            Isometric = cdDefault.Isometric;

            XVmin = cdDefault.XVmin;
            XVmax = cdDefault.XVmax;
            YVmin = cdDefault.YVmin;
            YVmax = cdDefault.YVmax;

            Pmin  = cdDefault.Pmin;
            Pmax  = cdDefault.Pmax;
            Pstep = cdDefault.Pstep;

            Thickness = cdDefault.Thickness;
        }
Beispiel #2
0
        public CurveData Copy()
        {
            CurveData cdCopy = new CurveData();

            cdCopy.Name = this.Name;
            cdCopy.Type = this.Type;

            cdCopy.Equation1 = this.Equation1;
            cdCopy.Equation2 = this.Equation2;

            cdCopy.Isometric = this.Isometric;
            cdCopy.XVmin     = this.XVmin;
            cdCopy.XVmax     = this.XVmax;
            cdCopy.YVmin     = this.YVmin;
            cdCopy.YVmax     = this.YVmax;

            cdCopy.Pmin  = this.Pmin;
            cdCopy.Pmax  = this.Pmax;
            cdCopy.Pstep = this.Pstep;

            cdCopy.Thickness = this.Thickness;

            return(cdCopy);
        }
Beispiel #3
0
        public string GetDescription()
        {
            string    desc      = "";
            CurveData cdDefault = new CurveData();

            // name mandatory
            if (String.IsNullOrEmpty(name_))
            {
                return("");
            }
            desc += "[" + name_ + "]" + Environment.NewLine;

            desc += "type=" + curveType_.ToString().ToLower() + Environment.NewLine;

            // equations
            switch (curveType_)
            {
            case CurveType.PARAMETRIC:
                desc += "x(t)=" + equation1_ + Environment.NewLine;
                desc += "y(t)=" + equation2_ + Environment.NewLine;
                break;

            case CurveType.POLAR:
                desc += "r(t)=" + equation1_ + Environment.NewLine;
                break;

            case CurveType.CARTESIAN:
                desc += "y(x)=" + equation1_ + Environment.NewLine;
                break;

            case CurveType.EQUALITY:
                desc += "0=" + equation1_ + Environment.NewLine;
                break;

            case CurveType.INEQUALITY:
                desc += "0<" + equation1_ + Environment.NewLine;
                break;
            }

            // write parameters values if different from default values

            CultureInfo culture = new CultureInfo("en-US");

            if (!Isometric)
            {
                desc += "isometric=" + Isometric.ToString(culture) + Environment.NewLine;
            }

            // if isometric, do not save x min and max
            if (!Isometric)
            {
                if (XVmin != cdDefault.XVmin)
                {
                    desc += "xv_min=" + XVmin.ToString(culture) + Environment.NewLine;
                }
                if (XVmax != cdDefault.XVmax)
                {
                    desc += "xv_max=" + XVmax.ToString(culture) + Environment.NewLine;
                }
            }

            if (YVmin != cdDefault.YVmin)
            {
                desc += "yv_min=" + YVmin.ToString(culture) + Environment.NewLine;
            }
            if (YVmax != cdDefault.YVmax)
            {
                desc += "yv_max=" + YVmax.ToString(culture) + Environment.NewLine;
            }

            switch (curveType_)
            {
            case CurveType.PARAMETRIC:
            case CurveType.POLAR:
                if (Pmin != cdDefault.Pmin)
                {
                    desc += "t_min=" + Pmin.ToString(culture) + Environment.NewLine;
                }
                if (Pmax != cdDefault.Pmax)
                {
                    desc += "t_max=" + Pmax.ToString(culture) + Environment.NewLine;
                }
                if (Pstep != cdDefault.Pstep)
                {
                    desc += "t_step=" + Pstep.ToString(culture) + Environment.NewLine;
                }
                break;

            case CurveType.CARTESIAN:
            case CurveType.EQUALITY:
            case CurveType.INEQUALITY:
                if (Pmin != cdDefault.Pmin)
                {
                    desc += "x_min=" + Pmin.ToString(culture) + Environment.NewLine;
                }
                if (Pmax != cdDefault.Pmax)
                {
                    desc += "x_max=" + Pmax.ToString(culture) + Environment.NewLine;
                }
                if (Pstep != cdDefault.Pstep)
                {
                    desc += "x_step=" + Pstep.ToString(culture) + Environment.NewLine;
                }
                break;
            }

            if (Thickness != cdDefault.Thickness)
            {
                desc += "thickness=" + Thickness + Environment.NewLine;
            }

            desc += Environment.NewLine;

            return(desc);
        }