public void Generate() { progressBar.Value = progressBar.MinValue; progress.Show(); if (generationThread != null) { generationThread.WaitToFinish(); } if (useEarth.Pressed) { Image map = IOManager.LoadImage(EARTH_IMAGE_PATH); config.map.latitude = map.GetHeight(); config.map.longitude = map.GetWidth(); ImageElevationGenerator generator = new ImageElevationGenerator(map, weltschmerz, config); weltschmerz.ElevationGenerator = generator; weltschmerz.Update(); } else { Elevation noise = new Elevation(weltschmerz, config); weltschmerz.ElevationGenerator = noise; weltschmerz.Update(); } map = new Image(); map.Create(config.map.longitude, config.map.latitude, false, biomMap.GetFormat()); map.Lock(); generationThread = new Thread(); generationThread.Start(this, nameof(InitThreads), 0); }
public void SavesTree() { var importedTrip = new ImportedTripStub { Date = DateTime.Now.AddDays(1) }; var importedSite = new ImportedSiteStub(importedTrip); var tree = Tree.Create(new ImportedTreeStub(importedSite) { CommonName = "CommonName", ScientificName = "ScientificName", Height = 1, HeightMeasurementMethod = TMD.Model.Imports.TreeHeightMeasurementMethod.ClinometerLaserRangefinderSine, Girth = 2, CrownSpread = 3, Coordinates = Coordinates.Create(4, 5), Elevation = Elevation.Create(6), GeneralComments = "GeneralComments" }); tree.Measurements[0].SetPrivatePropertyValue("ImportingTrip", null); using (var uow = UnitOfWork.Begin()) { Repositories.Trees.Save(tree); UnitOfWork.Flush(); UnitOfWork.Refresh(tree); Assert.IsNotNull(tree); Assert.IsNotNull(tree.Measurements); Assert.AreEqual(1, tree.Measurements.Count); Assert.IsNotNull(tree.Species); uow.Rollback(); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Elevation != null) { hashCode = hashCode * 59 + Elevation.GetHashCode(); } if (Latitude != null) { hashCode = hashCode * 59 + Latitude.GetHashCode(); } if (Longitude != null) { hashCode = hashCode * 59 + Longitude.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } return(hashCode); } }
public static void Initialize() { using (new Mutex(true, ProcessEx.CurrentName, out var newInstance)) { #if x86 if (Environment.Is64BitOperatingSystem) { var curPath64 = PathEx.Combine(PathEx.LocalDir, $"{ProcessEx.CurrentName}64.exe"); if (File.Exists(curPath64)) { ProcessEx.Start(curPath64, EnvironmentEx.CommandLine(false)); return; } } #endif if (!string.IsNullOrWhiteSpace(Attributes.DefIni) && !string.IsNullOrWhiteSpace(Attributes.ConfigPath) && !File.Exists(Attributes.ConfigPath)) { try { File.WriteAllText(Attributes.ConfigPath, Attributes.DefIni); } catch (UnauthorizedAccessException) { Elevation.RestartAsAdministrator(); } }
public override int GetHashCode() { return(Clsid.GetHashCode() ^ Name.GetSafeHashCode() ^ TreatAs.GetHashCode() ^ AppID.GetHashCode() ^ TypeLib.GetHashCode() ^ Servers.Values.GetEnumHashCode() ^ Elevation.GetSafeHashCode() ^ ActivatableFromApp.GetHashCode() ^ TrustedMarshaller.GetHashCode() ^ Source.GetHashCode() ^ PackageId.GetSafeHashCode()); }
protected override IEnumerator ProcessPayload(VisualPayload payload) { var memoryGraph = VisualizerFactory.InstantiateMemoryGraph(); memoryGraph.Initialize(this, payload); foreach (var entry in DashStartPosition.GetEntries(payload.Data)) { var startPosition = DashStartPosition.GetValue(entry); var dashWidth = DashWidth.GetValue(entry); var dashDepth = DashDepth.GetValue(entry); var elevation = Elevation.GetValue(entry); var dashColor = DashColor.GetValue(entry); memoryGraph.AddDash( startPosition, new Vector3(dashWidth, elevation, dashDepth), dashColor); yield return(null); } yield return(null); memoryGraph.ApplyPoints(); }
private static void Main() { Log.AllowLogging(); MessageBoxEx.TopMost = true; if (Process.GetProcessesByName(Resources.AppName).Length > 0) { MessageBoxEx.Show(Resources.Msg_Warn_00, Resources.WindowTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); Environment.Exit(1); } using (new Mutex(true, ProcessEx.CurrentName, out bool newInstance)) { if (!newInstance) { return; } if (!Elevation.WritableLocation()) { Elevation.RestartAsAdministrator(); } Ini.SetFile(Path.ChangeExtension(PathEx.LocalPath, ".ini")); if ((DateTime.Now - Ini.Read("History", "LastCheck", DateTime.MinValue)).Days < 7) { return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } }
public override int GetHashCode(SpatialEqualityOptions options) { unchecked { var latitude = Latitude; var longitude = Longitude; if (options.PoleCoordiantesAreEqual && (Latitude.Equals(90) || Latitude.Equals(-90))) { longitude = 0; } else if (options.AntiMeridianCoordinatesAreEqual && Longitude.Equals(-180)) { longitude = 180; } var hashCode = latitude.GetHashCode(); hashCode = (hashCode * 397) ^ longitude.GetHashCode(); if (options.UseElevation) { hashCode = (hashCode * 397) ^ Elevation.GetHashCode(); } if (options.UseM) { hashCode = (hashCode * 397) ^ Measure.GetHashCode(); } return(hashCode); } }
private static void Main() { Log.AllowLogging(); using (new Mutex(true, ProcessEx.CurrentName, out bool newInstance)) { if (!newInstance) { return; } if (!Elevation.WritableLocation()) { Elevation.RestartAsAdministrator(); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Application.Run(new MainForm()); } catch (Exception ex) { Log.Write(ex); } } }
/* * <vertical-datum-info unit="ft"> * <native-datum>NGVD-29</native-datum> * <elevation>615.2</elevation> * <offset estimate="false"> * <to-datum>NGVD-29</to-datum> * * <value>0.0</value></offset> * <offset estimate="true"> * <to-datum>NAVD-88</to-datum><value>0.5</value> * </offset></vertical-datum-info> */ public string ToXml(bool humanFriendly = false) { XmlDocument doc = new XmlDocument(); XmlElement vertical_datum = doc.CreateElement("vertical-datum-info"); var node = doc.AppendChild(vertical_datum); var a = doc.CreateAttribute("unit"); a.Value = Units; vertical_datum.Attributes.Append(a); var elev = doc.CreateElement("elevation"); elev.InnerText = Elevation.ToString(); vertical_datum.AppendChild(elev); var nativeDatum = doc.CreateElement("native-datum"); nativeDatum.InnerText = NativeDatum; vertical_datum.AppendChild(nativeDatum); AppendOffset(doc, "NGVD-29", NGVD29OffsetIsEstimate, NGVD29Offset); AppendOffset(doc, "NAVD-88", NAVD88OffsetIsEstimate, NAVD88Offset); if (humanFriendly) { XDocument xd = XDocument.Parse(ToXml()); return(xd.ToString()); } return(doc.OuterXml); }
public override void FromXml(XElement config, ObjectsMap map, bool invert) { base.FromXml(config, map, invert); Elevation.FromXml(config, DefaultElevation); CornerRadius.FromXml(config, DefaultCornerRadius); MedianCornerRadius.FromXml(config, DefaultCornerRadius); }
public void CreatesTree() { var importedTrip = new ImportedTripStub { Date = DateTime.Now }; var importedSite = new ImportedSiteStub(importedTrip); var importedTree = new ImportedTreeStub(importedSite) { CommonName = "CommonName", ScientificName = "ScientificName", Height = 1, HeightMeasurementMethod = TMD.Model.Imports.TreeHeightMeasurementMethod.ClinometerLaserRangefinderSine, Girth = 2, CrownSpread = 3, Coordinates = Coordinates.Create(4, 5), Elevation = Elevation.Create(6), GeneralComments = "GeneralComments" }; var tree = Tree.Create(importedTree); Assert.AreEqual(1, tree.Measurements.Count); Assert.AreEqual("Commonname", tree.CommonName); Assert.AreEqual("Scientificname", tree.ScientificName); Assert.AreEqual(1, tree.Height); Assert.AreEqual(TMD.Model.Imports.TreeHeightMeasurementMethod.ClinometerLaserRangefinderSine, tree.HeightMeasurementMethod); Assert.AreEqual(2, tree.Girth); Assert.AreEqual(3, tree.CrownSpread); Assert.AreEqual(Coordinates.Create(4, 5), tree.Coordinates); Assert.AreEqual(Elevation.Create(6), tree.Elevation); Assert.AreEqual(2f, tree.ENTSPTS); Assert.AreEqual(0.04f, tree.ENTSPTS2); Assert.AreEqual("GeneralComments", tree.Measurements[0].GeneralComments); }
public override bool Equals(object obj) { if (base.Equals(obj)) { return(true); } COMCLSIDEntry right = obj as COMCLSIDEntry; if (right == null) { return(false); } if (Elevation != null) { if (!Elevation.Equals(right.Elevation)) { return(false); } } else if (right.Elevation != null) { return(false); } // We don't consider the loaded interfaces. return(Clsid == right.Clsid && Name == right.Name && TreatAs == right.TreatAs && AppID == right.AppID && TypeLib == right.TypeLib && Servers.Values.SequenceEqual(right.Servers.Values)); }
public override bool Equals(object obj) { if (base.Equals(obj)) { return(true); } COMCLSIDEntry right = obj as COMCLSIDEntry; if (right == null) { return(false); } if (Elevation != null) { if (!Elevation.Equals(right.Elevation)) { return(false); } } else if (right.Elevation != null) { return(false); } // We don't consider the loaded interfaces. return(Clsid == right.Clsid && Name == right.Name && TreatAs == right.TreatAs && AppID == right.AppID && TypeLib == right.TypeLib && Servers.Values.SequenceEqual(right.Servers.Values) && ActivatableFromApp == right.ActivatableFromApp && TrustedMarshaller == right.TrustedMarshaller && Source == right.Source && PackageId == right.PackageId); }
protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed) { base.setJSON(obj, host, processed); if (!double.IsNaN(mElevation)) { obj["Elevation"] = Elevation.ToString(); } }
/// <summary> /// Convert back to service model /// </summary> /// <returns></returns> public RequestHeaderModel ToServiceModel() { return(new RequestHeaderModel { Diagnostics = Diagnostics?.ToServiceModel(), Elevation = Elevation?.ToServiceModel(), Locales = Locales }); }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); if (!double.IsNaN(mElevation)) { obj["Elevation"] = Elevation.ToString(); } }
void Terrain() { Random random = new Random(seed); Planet[] planets = new Planet[ObjCount]; for (int i = 0; i < ObjCount; i++) { int planetseed = random.Next(); Planet planet; float r = random.NextFloat() * 20 + 1; float mult = random.NextFloat(); mult = (1 - mult * mult); float mDiff = mult * Mathf.Sqrt(r);//if the radius is bigger, the planet gains more detail, more roughness, same height difference float roughness = mult * r * 0.25f; Vector3 pos = random.NextPoint() * 0x100; planet = new Planet { Speed = random.NextVector() * .1f, color = NormalColor.White, shapeSettings = new ShapeSettings { position = pos * 0x10, PlanetRadius = r, MaxDifference = mDiff, NoiseSettings = new NoiseSettings { centre = pos, BaseRougness = roughness, numlayers = 5, roughness = 2f, filterType = (NoiseSettings.FilterType)random.Next(2) } } }; float h = random.NextFloat(); h *= h; planet.shapeSettings.NoiseSettings.settings = new ElevationSettings { WaterHeight = h, WaterColor = random.NextColor() }; int layercount = random.Next(10) + 1;//1 to 10 Elevation[] elevations = new Elevation[layercount]; for (int j = 0; j < layercount - 1; j++) { int ToGo = layercount - j; float f = random.NextFloat(); f = Mathf.Sqrt(f); h = Mathf.Lerp(h, 1, f / ToGo); elevations[j] = new Elevation(random.NextColor(), h); } elevations[layercount - 1] = new Elevation(random.NextColor(), 1); planet.shapeSettings.NoiseSettings.settings.Elevations = new List <Elevation>(elevations); planet.Initialize(); planets[i] = planet; } this.planets = new List <Planet>(planets); }
/// <summary> /// Creates a new instance using the specified unique identifier, location around the horizon, and elevation up from the horizon. /// </summary> /// <param name="pseudorandomNumber">The pseudorandom number.</param> /// <param name="azimuth">The azimuth.</param> /// <param name="elevation">The elevation.</param> /// <param name="signalToNoiseRatio">The signal to noise ratio.</param> /// <param name="isFixed">if set to <c>true</c> [is fixed].</param> public Satellite(int pseudorandomNumber, Azimuth azimuth, Elevation elevation, SignalToNoiseRatio signalToNoiseRatio, bool isFixed) { _pseudorandomNumber = pseudorandomNumber; _azimuth = azimuth; _elevation = elevation; _signalToNoiseRatio = signalToNoiseRatio; _isFixed = isFixed; _lastSignalReceived = DateTime.MinValue; }
public ImportedTreeStub(TMD.Model.Imports.Site site) { this.Site = site; Height = Distance.Null(); Girth = Distance.Null(); CrownSpread = Distance.Null(); Elevation = Elevation.Null(); Photos = new List <IPhoto>(); }
public IFeature ToFeature() { Feature f = new Feature(); f.GeoData = GetPosition().ToString(); f["Elevation"] = Elevation.ToString(); f["Time"] = Time.ToString(); return(f); }
public DensityAltitudeApplicationTester(String browser, String application, Elevation elevation, Temperature temperature, Altimeter altimeter, DewPoint dewPoint) { this.browser = browser; this.application = application; this.elevation = elevation; this.temperature = temperature; this.altimeter = altimeter; this.dewPoint = dewPoint; }
/// <summary> /// Initializes all config classes /// </summary> public Config() { map = new Map(); elevation = new Elevation(); temperature = new Temperature(); precipitation = new Precipitation(); humidity = new Humidity(); circulation = new Circulation(); }
public override XElement ToXml() { var config = base.ToXml(); Elevation.ToXml(config); CornerRadius.ToXml(config); MedianCornerRadius.ToXml(config); return(config); }
void ElevationChanged(object sender, DistanceEventArgs e) { lock (syncRoot) { Elevation = e.Distance; } Debug.WriteLine("Altitude changed: " + Elevation.ToString()); NotifyOfGpsDataUpdate(); }
private void UpdateTileDefs() { Rails = WorldHelpers.AddWallRails(WorldHelpers.GetLineSegments(CurrentTile), 1); SpecialRails = WorldHelpers.AddWallRails(WorldHelpers.GetLineSpecialSegments(CurrentTile, new Point(-1, -1)), 1); Bouncers = WorldHelpers.AddBouncerNodes(WorldHelpers.GetBouncers(CurrentTile), 1); Water = WorldHelpers.GetWater(CurrentTile); Teleporters = WorldHelpers.GetTeleporters(CurrentTile); Elevation = WorldHelpers.GetElevation(CurrentTile); Connections = WorldHelpers.GetSideConnections(CurrentTile); }
public void sendMessageToOSCHandler() { string[] data = new string[2]; data[0] = masterAzimuth; data[1] = Azimuth.ToString(); output.SendMessage("SendOSCMessageToClient", data); data[0] = masterElevation; data[1] = Elevation.ToString(); output.SendMessage("SendOSCMessageToClient", data); }
/// <summary> /// Converts the domain model into an entity. /// </summary> /// <returns>The entity.</returns> /// <param name="elevation">Elevation.</param> internal static ElevationEntity ToEntity(this Elevation elevation) { ElevationEntity elevationEntity = new ElevationEntity { Roof = elevation.Roof, Unknown = elevation.Unknown }; return(elevationEntity); }
/// <summary> /// Converts the entity into a domain model. /// </summary> /// <returns>The domain model.</returns> /// <param name="elevationEntity">Elevation entity.</param> internal static Elevation ToDomainModel(this ElevationEntity elevationEntity) { Elevation elevation = new Elevation { Roof = elevationEntity.Roof, Unknown = elevationEntity.Unknown }; return(elevation); }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hash = 17; hash = hash * 23 + Elevation.GetHashCode(); hash = hash * 23 + ColumnId.GetHashCode(); return(hash); } }
/// <summary> /// Creates a new instance containing the specified Elevation object. /// </summary> public ElevationEventArgs(Elevation angle) { _Elevation = angle; }
private bool spawnTraps(Elevation elevation, int brick, int trapLocation = 0) { if (trapLocation == 0) { trapLocation = Random.Range(1, 4); } switch (brick) { case 1: switch (trapLocation) { case 1: elevation.bottomBrick.activateSaw(Brick.SAW_LEFT); return true; case 2: elevation.bottomBrick.activateSaw(Brick.SAW_UP); return true; case 3: elevation.bottomBrick.activateSaw(Brick.SAW_RIGHT); return true; } break; case 2: switch (trapLocation) { case 1: elevation.middleBrick.activateSaw(Brick.SAW_LEFT); return true; case 2: elevation.middleBrick.activateSaw(Brick.SAW_UP); return true; case 3: elevation.middleBrick.activateSaw(Brick.SAW_RIGHT); return true; } break; case 3: switch (trapLocation) { case 1: elevation.upperBrick.activateSaw(Brick.SAW_LEFT); return true; case 2: elevation.upperBrick.activateSaw(Brick.SAW_UP); return true; case 3: elevation.upperBrick.activateSaw(Brick.SAW_RIGHT); return true; } break; } return false; }