예제 #1
0
        //
        // "where mass between '0.1' and '1.0'" or "where mass between 0.1 and 1.0"
        //

        private bool ParseBetweenQuery(string [] strings, ref PlotTypes plotType, ref double value1, ref double value2)
        {
            if (strings [0] == "where")
            {
                if ((plotType = GetPlotType(strings [1])) != PlotTypes.Default)
                {
                    if (strings [2] == "between")
                    {
                        if (strings [4] == "and")
                        {
                            string string3 = strings [3].Replace("'", " ");
                            string string5 = strings [5].Replace("'", " ");

                            if (double.TryParse(string3.Trim(), out value1))
                            {
                                if (double.TryParse(string5.Trim(), out value2))
                                {
                                    if (value1 > value2)
                                    {
                                        double temp = value1;
                                        value1 = value2;
                                        value2 = temp;
                                    }

                                    return(true);
                                }
                            }
                        }
                    }
                }
            }

            return(false);
        }
예제 #2
0
파일: GnuPlot.cs 프로젝트: mlnethub/ML.Net
 public StoredPlot(double[] x, double[] y, string options = "")
 {
     X        = x;
     Y        = y;
     Options  = options;
     PlotType = PlotTypes.PlotXY;
 }
예제 #3
0
파일: GnuPlot.cs 프로젝트: mlnethub/ML.Net
 //3D data
 public StoredPlot(int sizeY, double[] z, string options = "", PlotTypes plotType = PlotTypes.SplotZ)
 {
     YSize    = sizeY;
     Z        = z;
     Options  = options;
     PlotType = plotType;
 }
예제 #4
0
파일: GnuPlot.cs 프로젝트: mlnethub/ML.Net
 public StoredPlot(string functionOrfilename, string options = "", PlotTypes plotType = PlotTypes.PlotFileOrFunction)
 {
     if (IsFile(functionOrfilename))
     {
         File = functionOrfilename;
     }
     else
     {
         Function = functionOrfilename;
     }
     Options  = options;
     PlotType = plotType;
 }
예제 #5
0
        private bool Parse(Exoplanet exoplanet, PlotTypes plotType, out double value)
        {
            bool isValid = false;

            value = 0.0;

            switch (plotType)
            {
            case PlotTypes.Mass:
                isValid = double.TryParse(exoplanet.Mass, out value);
                break;

            case PlotTypes.Radius:
                isValid = double.TryParse(exoplanet.Radius, out value);
                break;

            case PlotTypes.OrbitalPeriod:
                isValid = double.TryParse(exoplanet.OrbitalPeriod, out value);
                break;

            case PlotTypes.SemiMajorAxis:
                isValid = double.TryParse(exoplanet.SemiMajorAxis, out value);
                break;

            case PlotTypes.Eccentricity:
                isValid = double.TryParse(exoplanet.Eccentricity, out value);
                break;

            case PlotTypes.AngularDistance:
                isValid = double.TryParse(exoplanet.AngularDistance, out value);
                break;

            case PlotTypes.Inclination:
                isValid = double.TryParse(exoplanet.Inclination, out value);
                break;

            case PlotTypes.TemperatureCalculated:
                isValid = double.TryParse(exoplanet.TemperatureCalculated, out value);
                break;

            case PlotTypes.Omega:
                isValid = double.TryParse(exoplanet.Omega, out value);
                break;

            case PlotTypes.VelocitySemiamplitude:
                isValid = double.TryParse(exoplanet.VelocitySemiamplitude, out value);
                break;
            }

            return(isValid);
        }
예제 #6
0
        public Queries(string text) : this()
        {
            char [] delimiterChars = { '\r' };
            string  query          = text.Replace('\n', ' ');

            query = query.ToLower();
            string [] queries = query.Split(delimiterChars);

            for (int index = 0; index < queries.Length; ++index)
            {
                char []   delimiter2Chars = { ' ' };
                string [] strings         = queries [index].Trim().Split(delimiter2Chars);

                PlotTypes  plotType = PlotTypes.Default;
                double     value = 0.0, value1 = 0.0, value2 = 0.0;
                string     name         = string.Empty;
                string     detection    = string.Empty;
                string     spectral     = string.Empty;
                string     habitability = string.Empty;
                QueryTypes queryType    = QueryTypes.StartsWith;

                if (ParseName(strings, ref name, ref queryType) == true)
                {
                    AddName(name, queryType);
                }
                else if (ParseDetection(strings, ref detection, ref queryType) == true)
                {
                    AddDetection(detection, queryType);
                }
                else if (ParseSpectral(strings, ref spectral, ref queryType) == true)
                {
                    AddSpectral(spectral, queryType);
                }
                else if (ParseHabitability(strings, ref habitability, ref queryType) == true)
                {
                    AddHabitability(habitability, queryType);
                }
                else if (ParseBetweenQuery(strings, ref plotType, ref value1, ref value2) == true)
                {
                    AddBetween(plotType, value1, value2);
                }
                else if (ParseLessThanQuery(strings, ref plotType, ref value) == true)
                {
                    AddLessThan(plotType, value);
                }
                else if (ParseGreaterThanQuery(strings, ref plotType, ref value) == true)
                {
                    AddGreaterThan(plotType, value);
                }
            }
        }
예제 #7
0
파일: Regulation.cs 프로젝트: 11o9/NG
        public static bool UseNorth(Plot plot)
        {
            List <double> roadwidths = plot.RoadWidths;
            PlotTypes     plotinfo   = plot.PlotType;

            if (roadwidths.Max() >= 20)
            {
                return(false);
            }
            else if ((int)plotinfo == 3)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #8
0
        //
        // "where eccentricity > '0.1'" or "where eccentricity > 0.1"
        //

        private bool ParseGreaterThanQuery(string [] strings, ref PlotTypes plotType, ref double value)
        {
            if (strings [0] == "where")
            {
                if ((plotType = GetPlotType(strings [1])) != PlotTypes.Default)
                {
                    if (strings [2] == ">" || strings [2] == ">=")
                    {
                        string string3 = strings [3].Replace("'", " ");

                        if (double.TryParse(string3.Trim(), out value))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
예제 #9
0
 public StoredPlot(string functionOrfilename, string options = "", string preptions = "", PlotTypes plotType = PlotTypes.PlotFileOrFunction)
 {
     if (IsFile(functionOrfilename))
     {
         File = functionOrfilename;
     }
     else
     {
         Function = functionOrfilename;
     }
     Options  = options;
     PlotType = plotType;
     if (preptions.Length > 1)
     {
         PreOptions = preptions + " ";
     }
     else
     {
         PreOptions = preptions;
     }
 }
예제 #10
0
파일: GnuPlot.cs 프로젝트: mlnethub/ML.Net
 public StoredPlot(double[] x, double[] y, double[] z, string options = "", PlotTypes plotType = PlotTypes.SplotXYZ)
 {
     if (x.Length < 2)
     {
         YSize = 1;
     }
     else
     {
         for (YSize = 1; YSize < x.Length; YSize++)
         {
             if (x[YSize] != x[YSize - 1])
             {
                 break;
             }
         }
     }
     Z        = z;
     Y        = y;
     X        = x;
     Options  = options;
     PlotType = plotType;
 }
예제 #11
0
 public StoredPlot(double[] y, string options = "")
 {
     Y = y;
     Options = options;
     PlotType = PlotTypes.PlotY;
 }
예제 #12
0
        static private ArrayList RemoveDuplicates(ArrayList exoplanets, bool includeDuplicates, PlotTypes plotType)
        {
            ArrayList array = new ArrayList();

            if (includeDuplicates == false)
            {
                Exoplanet previous = null;

                foreach (Exoplanet exoplanet in exoplanets)
                {
                    if (previous == null)
                    {
                        array.Add(exoplanet);
                    }
                    else
                    {
                        switch (plotType)
                        {
                        case PlotTypes.Mass:
                            if (previous.Eccentricity != exoplanet.Eccentricity)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.Radius:
                            if (previous.Radius != exoplanet.Radius)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.OrbitalPeriod:
                            if (previous.OrbitalPeriod != exoplanet.OrbitalPeriod)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.SemiMajorAxis:
                            if (previous.SemiMajorAxis != exoplanet.SemiMajorAxis)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.Eccentricity:
                            if (previous.Eccentricity != exoplanet.Eccentricity)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.AngularDistance:
                            if (previous.SemiMajorAxis != exoplanet.AngularDistance)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.Inclination:
                            if (previous.Inclination != exoplanet.Inclination)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.TemperatureCalculated:
                            if (previous.TemperatureCalculated != exoplanet.TemperatureCalculated)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.Omega:
                            if (previous.Omega != exoplanet.Omega)
                            {
                                array.Add(exoplanet);
                            }
                            break;

                        case PlotTypes.VelocitySemiamplitude:
                            if (previous.VelocitySemiamplitude != exoplanet.VelocitySemiamplitude)
                            {
                                array.Add(exoplanet);
                            }
                            break;
                        }
                    }

                    previous = exoplanet;
                }
            }
            else
            {
                array = exoplanets;
            }

            return(array);
        }
예제 #13
0
 public StoredPlot(string functionOrfilename, string options = "", PlotTypes plotType = PlotTypes.PlotFileOrFunction)
 {
     if (IsFile(functionOrfilename))
         File = functionOrfilename;
     else
         Function = functionOrfilename;
     Options = options;
     PlotType = plotType;
 }
 private void visualizeOrbitalPeriod_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.OrbitalPeriod;
     RefreshGraphics();
 }
예제 #15
0
        static public bool IsPlotable(ArrayList array, PlotTypes plotType)
        {
            foreach (Exoplanet exoplanet in array)
            {
                switch (plotType)
                {
                case PlotTypes.Mass:
                    if (Helper.IsDefined(exoplanet.Mass))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.Radius:
                    if (Helper.IsDefined(exoplanet.Radius))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.OrbitalPeriod:
                    if (Helper.IsDefined(exoplanet.OrbitalPeriod))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.SemiMajorAxis:
                    if (Helper.IsDefined(exoplanet.SemiMajorAxis))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.Eccentricity:
                    if (Helper.IsDefined(exoplanet.Eccentricity))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.AngularDistance:
                    if (Helper.IsDefined(exoplanet.AngularDistance))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.Inclination:
                    if (Helper.IsDefined(exoplanet.Inclination))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.Omega:
                    if (Helper.IsDefined(exoplanet.Omega))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.VelocitySemiamplitude:
                    if (Helper.IsDefined(exoplanet.VelocitySemiamplitude))
                    {
                        return(true);
                    }

                    break;

                case PlotTypes.TemperatureCalculated:
                    if (Helper.IsDefined(exoplanet.TemperatureCalculated))
                    {
                        return(true);
                    }

                    break;


                case PlotTypes.MassAndRadius:
                case PlotTypes.MassAndOrbitalPeriod:
                case PlotTypes.MassAndSemiMajorAxis:
                case PlotTypes.MassAndEccentricity:
                case PlotTypes.MassAndAngularDistance:
                case PlotTypes.MassAndInclination:
                case PlotTypes.MassAndOmega:
                case PlotTypes.MassAndVelocitySemiamplitude:

                case PlotTypes.RadiusAndMass:
                case PlotTypes.RadiusAndOrbitalPeriod:
                case PlotTypes.RadiusAndSemiMajorAxis:
                case PlotTypes.RadiusAndEccentricity:
                case PlotTypes.RadiusAndAngularDistance:
                case PlotTypes.RadiusAndInclination:
                case PlotTypes.RadiusAndOmega:
                case PlotTypes.RadiusAndVelocitySemiamplitude:
                    break;
                }
            }

            return(false);
        }
예제 #16
0
 public StoredPlot(double[] x, double[] y, double[] z, string options = "", PlotTypes plotType = PlotTypes.SplotXYZ)
 {
     if (x.Length < 2)
         YSize = 1;
     else
         for (YSize = 1; YSize < x.Length; YSize++)
             if (x[YSize] != x[YSize - 1])
                 break;
     Z = z;
     Y = y;
     X = x;
     Options = options;
     PlotType = plotType;
 }
 private void visualizeOmega_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.Omega;
     RefreshGraphics();
 }
 private void visualizeRadiusVersusEccentricity_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.RadiusAndEccentricity;
     RefreshGraphics();
 }
예제 #19
0
 private static Brush GetTerrainBrush(TerrainTypes terrainType, PlotTypes plotType, FeatureTypes featureType, bool isEmpty)
 {
     if (isEmpty) return new SolidColorBrush(Colors.Transparent);
     string key = GetTerrainImageKey(terrainType, plotType, featureType);
     Image img = App.Current.Resources[key] as Image;
     if (img != null) return new ImageBrush(img.Source);
     return new SolidColorBrush(Color.FromRgb(0, 0, 0));
 }
 private void visualizeRadiusVersusOrbitalPeriod_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.RadiusAndOrbitalPeriod;
     RefreshGraphics();
 }
 private void visualizeRadiusVersusSemiMajorAxis_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.RadiusAndSemiMajorAxis;
     RefreshGraphics();
 }
 private void visualizeEccentricityVersusMass_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.MassAndEccentricity;
     RefreshGraphics();
 }
 private void visualizeMassVersusRadius_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.MassAndRadius;
     RefreshGraphics();
 }
 private void visualizeStars_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.Stars;
     RefreshGraphics();
 }
예제 #25
0
 public StoredPlot(double[] x, double[] y, string options = "")
 {
     X = x;
     Y = y;
     Options = options;
     PlotType = PlotTypes.PlotXY;
 }
 private void visualizeInclination_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.Inclination;
     RefreshGraphics();
 }
예제 #27
0
 //3D data
 public StoredPlot(int sizeY, double[] z, string options = "", PlotTypes plotType = PlotTypes.SplotZ)
 {
     YSize = sizeY;
     Z = z;
     Options = options;
     PlotType = plotType;
 }
 private void visualizeSemiMajorAxis_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.SemiMajorAxis;
     RefreshGraphics();
 }
예제 #29
0
 public StoredPlot(double[,] zz, string options = "", PlotTypes plotType = PlotTypes.SplotZZ)
 {
     ZZ = zz;
     Options = options;
     PlotType = plotType;
 }
 private void visualizeTcalc_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.TemperatureCalculated;
     RefreshGraphics();
 }
예제 #31
0
 private static string GetTerrainImageKey(TerrainTypes terrainType, PlotTypes plotType, FeatureTypes featureType)
 {
     if (plotType == PlotTypes.PEAK)
         return "PEAK";
     else if (featureType == FeatureTypes.FEATURE_ICE)
         return "ICE";
     else if (featureType == FeatureTypes.FEATURE_OASIS)
         return "OASIS";
     string key = "";
     if (featureType == FeatureTypes.FEATURE_JUNGLE)
         key = "JUNGLE";
     else
         key = terrainType.ToString().Replace("TERRAIN_", "");
     if ((terrainType == TerrainTypes.TERRAIN_GRASS || terrainType == TerrainTypes.TERRAIN_PLAINS || terrainType == TerrainTypes.TERRAIN_TUNDRA) && featureType == FeatureTypes.FEATURE_FOREST)
         key += "_FOREST";
     if ((terrainType == TerrainTypes.TERRAIN_GRASS || terrainType == TerrainTypes.TERRAIN_PLAINS || terrainType == TerrainTypes.TERRAIN_TUNDRA || terrainType == TerrainTypes.TERRAIN_SNOW || terrainType == TerrainTypes.TERRAIN_DESERT) && plotType == PlotTypes.HILL)
         key += "_HILL";
     return key;
 }
 private void visualizeRadiusVersusInclination_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.RadiusAndInclination;
     RefreshGraphics();
 }
예제 #33
0
파일: GnuPlot.cs 프로젝트: mlnethub/ML.Net
 public StoredPlot(double[] y, string options = "")
 {
     Y        = y;
     Options  = options;
     PlotType = PlotTypes.PlotY;
 }
 private void visualizeRadiusVersusK_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.RadiusAndVelocitySemiamplitude;
     RefreshGraphics();
 }
 private void visualizeRadiusVersusAngularDistance_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.RadiusAndAngularDistance;
     RefreshGraphics();
 }
 private void visualizeRadii_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.Radius;
     RefreshGraphics();
 }
예제 #37
0
파일: GnuPlot.cs 프로젝트: mlnethub/ML.Net
 public StoredPlot(double[,] zz, string options = "", PlotTypes plotType = PlotTypes.SplotZZ)
 {
     ZZ       = zz;
     Options  = options;
     PlotType = plotType;
 }
 private void visualizeRadiusVersusOmega_Click(object sender, EventArgs e)
 {
     PlotType = PlotTypes.RadiusAndOmega;
     RefreshGraphics();
 }