public static void DumpEnvironmentalDataSet(EnvironmentalDataSet dataSet) { Console.WriteLine(" Data set file: {0} ({1} bytes)", dataSet.FileName, dataSet.FileSize); Console.WriteLine(" Resolution: {0} ({1} samples)", dataSet.Resolution, dataSet.SampleCount); if (dataSet.TimePeriod != TimePeriod.Invalid) Console.WriteLine(" Time period: {0}", dataSet.TimePeriod); }
public SedimentNode(EnvironmentalDataSet sediment) { Sediment = sediment; SedimentTypes.Add(new SedimentTypeNode { SedimentType = "Ooze" }); SedimentTypes.Add(new SedimentTypeNode { SedimentType = "Slime" }); SedimentTypes.Add(new SedimentTypeNode { SedimentType = "Atlantis" }); }
public BitmapNode(string layerName, EnvironmentalDataSet bitmapData) { LayerName = layerName; BitmapData = bitmapData; }
public BathymetryNode(EnvironmentalDataSet bathymetry) { Bathymetry = bathymetry; }
internal void Log(EnvironmentalDataSet dataSet, string message) { LogBase(new LogEntry(dataSet), message); }
//void Log(Location location, string message, params object[] args) { LogBase(new LogEntry(location) { Location = location }, message, args); } void Log(EnvironmentalDataSet dataSet, string message, params object[] args) { LogBase(new LogEntry(dataSet) { Location = dataSet.Location, EnvironmentalDataSet = dataSet }, message, args); }
public EnvironmentalDataSet LoadOrCreateEnvironmentalDataSet(Location location, float resolution, TimePeriod timePeriod, PluginIdentifier sourcePlugin) { var timePeriodAsByte = ((DbTimePeriod)timePeriod).TimePeriodAsByte; var existing = (from e in Context.EnvironmentalDataSets where e.Location.Guid == location.Guid && e.SourcePlugin.Type == sourcePlugin.Type && e.TimePeriod.TimePeriodAsByte == timePeriodAsByte && e.Resolution == resolution select e).FirstOrDefault(); if (existing != null) return existing; var environmentalDataSet = new EnvironmentalDataSet { FileName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()) + "." + sourcePlugin.PluginSubtype.ToString().ToLower(), Resolution = resolution, TimePeriod = timePeriod, Location = location, SourcePlugin = sourcePlugin, }; location.EnvironmentalDataSets.Add(environmentalDataSet); Context.EnvironmentalDataSets.Add(environmentalDataSet); Log(environmentalDataSet, "Added new data set to {0}. Data type: {1}, resolution: {2}{3}", location.Name, sourcePlugin.PluginSubtype, resolution, timePeriod != TimePeriod.Invalid ? String.Format(" TimePeriod: {0}", timePeriod) : ""); return environmentalDataSet; }
Scenario CreateScenario(Location location, string scenarioName, string comments, TimePeriod timePeriod, TimeSpan duration, EnvironmentalDataSet wind, EnvironmentalDataSet soundSpeed, EnvironmentalDataSet bathymetry, EnvironmentalDataSet sediment) { var scenario = new Scenario { Wind = Globals.MasterDatabaseService.LoadOrCreateEnvironmentalDataSet(location, wind.Resolution, timePeriod, wind.SourcePlugin), SoundSpeed = Globals.MasterDatabaseService.LoadOrCreateEnvironmentalDataSet(location, soundSpeed.Resolution, timePeriod, soundSpeed.SourcePlugin), Bathymetry = Globals.MasterDatabaseService.LoadOrCreateEnvironmentalDataSet(location, bathymetry.Resolution, TimePeriod.Invalid, bathymetry.SourcePlugin), Sediment = Globals.MasterDatabaseService.LoadOrCreateEnvironmentalDataSet(location, sediment.Resolution, TimePeriod.Invalid, sediment.SourcePlugin), Name = scenarioName, Location = location, Comments = comments, TimePeriod = timePeriod, Duration = duration, ShowAllPerimeters = true, ShowAllAnalysisPoints = true, ShowAllSpecies = false, }; scenario.SoundSpeed.LayerSettings.LineOrSymbolSize = 5; var existing = (from s in location.Scenarios where s.Name == scenario.Name && s.Location == scenario.Location select s).FirstOrDefault(); if (existing != null) throw new DuplicateNameException(String.Format("a Scenario named \"{0}\" already exists in the Location \"{1}\"; please select another name.", scenario.Name, scenario.Location.Name)); location.Scenarios.Add(scenario); Globals.MasterDatabaseService.Context.Scenarios.Add(scenario); return scenario; }