// // "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); }
public StoredPlot(double[] x, double[] y, string options = "") { X = x; Y = y; Options = options; PlotType = PlotTypes.PlotXY; }
//3D data public StoredPlot(int sizeY, double[] z, string options = "", PlotTypes plotType = PlotTypes.SplotZ) { YSize = sizeY; Z = z; Options = options; PlotType = plotType; }
public StoredPlot(string functionOrfilename, string options = "", PlotTypes plotType = PlotTypes.PlotFileOrFunction) { if (IsFile(functionOrfilename)) { File = functionOrfilename; } else { Function = functionOrfilename; } Options = options; PlotType = plotType; }
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); }
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); } } }
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); } }
// // "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); }
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; } }
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; }
public StoredPlot(double[] y, string options = "") { Y = y; Options = options; PlotType = PlotTypes.PlotY; }
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); }
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(); }
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); }
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(); }
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(); }
private void visualizeInclination_Click(object sender, EventArgs e) { PlotType = PlotTypes.Inclination; RefreshGraphics(); }
private void visualizeSemiMajorAxis_Click(object sender, EventArgs e) { PlotType = PlotTypes.SemiMajorAxis; RefreshGraphics(); }
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(); }
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(); }
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(); }
private void visualizeRadiusVersusOmega_Click(object sender, EventArgs e) { PlotType = PlotTypes.RadiusAndOmega; RefreshGraphics(); }