public async Task <IActionResult> PutBearing(int id, Bearing bearing) { if (id != bearing.Id) { return(BadRequest()); } _context.Entry(bearing).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BearingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public int addBearing(string name, string no) { int flag = 0; using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Bearing bear = new Bearing() { Code = int.Parse(no), Name = name, CreateDatetime = DateTime.Now, CreateBy = 1, Deleted = 1, Status = 1 }; entities.Bearing.Add(bear); try { flag = entities.SaveChanges(); } catch (Exception ex) { ex.ToString(); } } return(flag); }
public async Task <ActionResult <Bearing> > PostBearing(Bearing bearing) { _context.Bearing.Add(bearing); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBearing", new { id = bearing.Id }, bearing)); }
public BaseRequest() { Coordinates = new Location[0]; Bearings = new Bearing[0]; Radiuses = new int[0]; Hints = new string[0]; }
public void Execute(Robot robot, string parameters) { var inputs = parameters.Split(","); if (inputs.Length != 3) { throw new ArgumentException("Expected X,Y,F"); } int x, y; if (!Int32.TryParse(inputs[0], out x)) { throw new ArgumentException("Invalid X parameter for PLACE"); } if (!Int32.TryParse(inputs[1], out y)) { throw new ArgumentException("Invalid Y parameter for PLACE"); } if (!Bearing.IsValidBearing(inputs[2])) { throw new ArgumentException("Invalid F parameter for PLACE"); } robot.SetPosition(x, y); robot.SetBearing(inputs[2]); }
public RobotSimulator(Bearing bearing, Coordinate coordinate) { Bearing = bearing; Coordinate = coordinate; }
public Tile(int startX, int startY) { // Initialise the starting position and bearing of the tile X = startX; Y = startY; Bearing = Bearing.North; }
/// <summary> /// Create an XmlElement representation of the fleet report for saving. /// </summary> /// <param name="xmldoc">The parent XmlDocument.</param> /// <returns>An XmlElement representation of the report.</returns> public new XmlElement ToXml(XmlDocument xmldoc) { XmlElement xmlelFleetIntel = xmldoc.CreateElement("FleetIntel"); // include inherited Item properties xmlelFleetIntel.AppendChild(base.ToXml(xmldoc)); Global.SaveData(xmldoc, xmlelFleetIntel, "Year", Year.ToString(System.Globalization.CultureInfo.InvariantCulture)); Global.SaveData(xmldoc, xmlelFleetIntel, "Icon", Icon.Source); Global.SaveData(xmldoc, xmlelFleetIntel, "Bearing", Bearing.ToString(System.Globalization.CultureInfo.InvariantCulture)); Global.SaveData(xmldoc, xmlelFleetIntel, "Speed", Speed.ToString(System.Globalization.CultureInfo.InvariantCulture)); Global.SaveData(xmldoc, xmlelFleetIntel, "InOrbit", InOrbit.ToString()); Global.SaveData(xmldoc, xmlelFleetIntel, "IsStarbase", IsStarbase.ToString()); // Store the composition XmlElement xmlelComposition = xmldoc.CreateElement("Composition"); foreach (ShipToken token in Composition.Values) { xmlelComposition.AppendChild(token.ToXml(xmldoc)); } xmlelFleetIntel.AppendChild(xmlelComposition); return(xmlelFleetIntel); }
public PlayerTank(Color tint, int x, int y, Bearing b, PlayerIndex controllingIndex) { this.tint = tint; this.position = new Vector2(x, y); this.bearing = b; this.controllingIndex = controllingIndex; }
// Gives the displacement vector that gets a Hex to its neighbor in a given bearing public static Vector2 NeighborOffsetFromBearing(Bearing b) { switch (b) { case Bearing.E: return(new Vector2(1, 0)); case Bearing.NNE: return(new Vector2(1, -1)); case Bearing.NNW: return(new Vector2(0, -1)); case Bearing.W: return(new Vector2(-1, 0)); case Bearing.SSW: return(new Vector2(-1, 1)); case Bearing.SSE: return(new Vector2(0, 1)); } // never reached, but you didn't know that, did you C# compiler? return(new Vector2(0, 0)); }
public int delByBearing(string id) { int flag = 0; using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Bearing bear = new Bearing() { BearingId = int.Parse(id), UpdateBy = 1, Deleted = 1, UpdateDatetime = DateTime.Now }; DbEntityEntry <Bearing> entry = entities.Entry <Bearing>(bear); entry.State = System.Data.EntityState.Unchanged; entry.Property("UpdateBy").IsModified = true; entry.Property("Deleted").IsModified = true; entry.Property("UpdateDatetime").IsModified = true; try { entities.Configuration.ValidateOnSaveEnabled = false; flag = entities.SaveChanges(); entities.Configuration.ValidateOnSaveEnabled = true; } catch (Exception ex) { ex.ToString(); } } return(flag); }
public int editByBearing(string id, string name, string no) { int flag = 0; using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Bearing bear = new Bearing() { BearingId = int.Parse(id), Code = int.Parse(no), Name = name, UpdateBy = 1, UpdateDatetime = DateTime.Now }; DbEntityEntry <Bearing> entry = entities.Entry <Bearing>(bear); entry.State = System.Data.EntityState.Unchanged; entry.Property("Code").IsModified = true; entry.Property("Name").IsModified = true; entry.Property("UpdateBy").IsModified = true; entry.Property("UpdateDatetime").IsModified = true; try { flag = entities.SaveChanges(); } catch (Exception ex) { ex.ToString(); } } return(flag); }
public RobotSimulator(Bearing bearing, Coordinate coordinate) { this.bearing = bearing; this.coordinate = coordinate; x = coordinate.X; y = coordinate.Y; }
public void CompassTests(Bearing current, Direction turn, Bearing expected) { var compass = new Compass(current); compass.Turn(turn); Assert.Equal(expected, compass.Bearing); }
public void TestGetMovementOffsetValid() { int x, y; Bearing.GetMovementOffset("NORTH", out x, out y); Assert.AreEqual(0, x); Assert.AreEqual(1, y); }
public bool SharesEndpointAndBearing(Line other, Double distance, Double bearingSlack) { bool result = SharesEndPointWith(other, distance) && (Bearing.AngularDifference(other.Bearing) <= bearingSlack || Bearing.AddDegrees(180).AngularDifference(other.Bearing) <= bearingSlack); return(result); }
public void Project_ReturnsNewGeoPointInstance() { GeoPoint geoPoint = GeoPoint.Parse(0.0, 0.0); GeoPoint pointTwo = geoPoint.Project(Distance.Kilometers(5), Bearing.DecimalDegrees(90)); Assert.IsInstanceOfType(pointTwo, typeof(GeoPoint)); Assert.AreNotSame(geoPoint, pointTwo); }
/// <inheritdoc /> public bool Equals([AllowNull] MapBox other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Domain == other.Domain || Domain != null && Domain.Equals(other.Domain) ) && ( AccessToken == other.AccessToken || AccessToken != null && AccessToken.Equals(other.AccessToken) ) && ( Style == other.Style || Style != null && Style.Equals(other.Style) ) && ( Center == other.Center || Center != null && Center.Equals(other.Center) ) && ( Zoom == other.Zoom || Zoom != null && Zoom.Equals(other.Zoom) ) && ( Bearing == other.Bearing || Bearing != null && Bearing.Equals(other.Bearing) ) && ( Pitch == other.Pitch || Pitch != null && Pitch.Equals(other.Pitch) ) && ( Equals(Layers, other.Layers) || Layers != null && other.Layers != null && Layers.SequenceEqual(other.Layers) ) && ( UiRevision == other.UiRevision || UiRevision != null && UiRevision.Equals(other.UiRevision) )); }
public Boat(Coordinate location, Velocity speed, Bearing bearing, Rudder rudder) { Location = location; Speed = speed; Bearing = bearing; Rudder = rudder; GPS = new GPSSimulator(); Autopilot = new AutoPilot.AutoPilot(this); }
private void LateUpdate() { Vector3 character_position = main_character.forward; Vector3 controller_position = main_controller.forward; Vector3 crosshair_up = Bearing.repeller(controller_position, character_position); crosshair_renderer.angle = Vector3.SignedAngle(main_controller.up, crosshair_up, main_controller.forward) * Mathf.Deg2Rad; crosshair_renderer.scale = Mathf.Lerp(0, crosshair_size, DebrisNoirsInput.get_axes().magnitude); }
private void LateUpdate() { Vector3 character_position = main_character.forward; Vector3 controller_position = main_controller.forward; Vector3 crosshair_up = Bearing.repeller(controller_position, character_position); crosshair_renderer.angle = Vector3.SignedAngle(main_controller.up, crosshair_up, main_controller.forward) * Mathf.Deg2Rad; crosshair_renderer.scale = Mathf.Lerp(crosshair_size / 2, crosshair_size, satellite.acceleration_direction().magnitude); }
/// <summary> /// Changes the direction of the ICommandable object /// </summary> /// <param name="rotation">The new direction in which the tile should face</param> public void ChangeBearing(Rotation rotation) { Bearing = rotation switch { Rotation.Clockwise => Bearing == Bearing.West ? Bearing.North : Bearing += 1, Rotation.Anticlockwise => Bearing == Bearing.North ? Bearing.West : Bearing -= 1, _ => throw new Exception("Invalid bearing!"), }; }
public RobotSimulator(Bearing bearing, Coordinate coordinate) { Bearing = bearing; Coordinate = coordinate; _instructions.Add('R', TurnRight); _instructions.Add('L', TurnLeft); _instructions.Add('A', Advance); }
public void ShouldCalculateInitialCourse() { Bearing course = Ourhouse.InitialCourse(PointRobertsMarina); Assert.IsTrue(course.Degrees > 169 && course.Degrees < 170); course = Ourhouse.InitialCourse(MammasHuis); Assert.IsTrue(course.Degrees > 28 && course.Degrees < 32); }
public void Project_HasToBeChainable() { GeoPoint pointTwo = geoPoint .Project(Distance.Meters(100), Bearing.DecimalDegrees(0)) .Project(Distance.Meters(100), Bearing.DecimalDegrees(90)) .Project(Distance.Meters(100), Bearing.DecimalDegrees(180)) .Project(Distance.Meters(100), Bearing.DecimalDegrees(270)); Assert.IsTrue(pointTwo.DistanceTo(geoPoint).In(MetricUnit.meters) < 0.0015); }
public void Update(Vector3D vIn, double fzIn, double muMaxIn, double b) { vd.SetVec(vIn); vd.z = 0.0D; fz = fzIn; Bearing br = new Bearing(vd.R2l()); beta = br.yaw.GetValue(); if (fz > 0.0D) { s = (t_b_max / r * 0.1D / fz * b); if (s > 1.0D) { s = 1.0D; } } else { s = 0.0D; } muMax = muMaxIn; if (beta < 1.570796326794897D) { muX = (-(muMax * (Jp.Maker1.Fsim.TireMu.X(s, beta) + mu_load0))); muY = (-muMax * Jp.Maker1.Fsim.TireMu.Y(s, beta)); } else if (beta < Math.PI) { muX = (muMax * (Jp.Maker1.Fsim.TireMu.X(s, Math.PI - beta) + mu_load0)); muY = (-muMax * Jp.Maker1.Fsim.TireMu.Y(s, Math.PI - beta)); } else if (beta < 4.71238898038469D) { muX = (muMax * (Jp.Maker1.Fsim.TireMu.X(s, -Math.PI + beta) + mu_load0)); muY = (muMax * Jp.Maker1.Fsim.TireMu.Y(s, -Math.PI + beta)); } else { muX = (-(muMax * (Jp.Maker1.Fsim.TireMu.X(s, 6.283185307179586D - beta) + mu_load0))); muY = (muMax * Jp.Maker1.Fsim.TireMu.Y(s, 6.283185307179586D - beta)); } fx = (muX * fz); fy = (muY * fz); }
private void Construct_proposedPolicy() { int accHours = 0; int order = 1; while (true) { ProposedSimulationCase tmpSimulationCase = new ProposedSimulationCase(); List <Bearing> tmpbearings = new List <Bearing>(); List <int> Hours = new List <int>(); for (int i = 0; i < _simulationSystem.NumberOfBearings; i++) { Bearing tmpBearing = new Bearing(); tmpBearing.Hours = Get_HoursOfind(order, i + 1); tmpbearings.Add(tmpBearing); Hours.Add(tmpBearing.Hours); } order++; Hours.Sort(); tmpSimulationCase.Bearings = tmpbearings; tmpSimulationCase.FirstFailure = Hours[0]; accHours += tmpSimulationCase.FirstFailure; tmpSimulationCase.AccumulatedHours = accHours; tmpSimulationCase.RandomDelay = _rnd.Next(1, 11); tmpSimulationCase.Delay = Get_Delay(tmpSimulationCase.RandomDelay); _proposedSimulationCases.Add(tmpSimulationCase); if (accHours >= _simulationSystem.NumberOfHours) { break; } } _simulationSystem.ProposedSimulationCases = _proposedSimulationCases; PerformanceMeasures tmpMeasures = new PerformanceMeasures(); tmpMeasures.BearingCost = (_simulationSystem.NumberOfBearings * _simulationSystem.ProposedSimulationCases.Count) * _simulationSystem.BearingCost; tmpMeasures.DelayCost = Get_Sum_proposed_Delay(_simulationSystem.ProposedSimulationCases) * _simulationSystem.DowntimeCost; tmpMeasures.DowntimeCost = _simulationSystem.ProposedSimulationCases.Count * _simulationSystem.RepairTimeForAllBearings * _simulationSystem.DowntimeCost; Decimal val = Convert.ToDecimal(_simulationSystem.RepairPersonCost) / 60; tmpMeasures.RepairPersonCost = _simulationSystem.ProposedSimulationCases.Count * _simulationSystem.RepairTimeForAllBearings * val; tmpMeasures.TotalCost = tmpMeasures.BearingCost + tmpMeasures.DelayCost + tmpMeasures.DowntimeCost + tmpMeasures.RepairPersonCost; _simulationSystem.ProposedPerformanceMeasures = tmpMeasures; TotlBearingCost_lbl1.Text = tmpMeasures.BearingCost.ToString(CultureInfo.CurrentCulture); TotlDelayCost_lbl1.Text = tmpMeasures.DelayCost.ToString(CultureInfo.CurrentCulture); TotlDownCost_lbl1.Text = tmpMeasures.DowntimeCost.ToString(CultureInfo.CurrentCulture); TotlRepairPerson_lbl1.Text = tmpMeasures.RepairPersonCost.ToString(CultureInfo.CurrentCulture); TotlCost_lbl1.Text = tmpMeasures.TotalCost.ToString(CultureInfo.CurrentCulture); }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Domain != null) { hashCode = hashCode * 59 + Domain.GetHashCode(); } if (AccessToken != null) { hashCode = hashCode * 59 + AccessToken.GetHashCode(); } if (Style != null) { hashCode = hashCode * 59 + Style.GetHashCode(); } if (Center != null) { hashCode = hashCode * 59 + Center.GetHashCode(); } if (Zoom != null) { hashCode = hashCode * 59 + Zoom.GetHashCode(); } if (Bearing != null) { hashCode = hashCode * 59 + Bearing.GetHashCode(); } if (Pitch != null) { hashCode = hashCode * 59 + Pitch.GetHashCode(); } if (Layers != null) { hashCode = hashCode * 59 + Layers.GetHashCode(); } if (UiRevision != null) { hashCode = hashCode * 59 + UiRevision.GetHashCode(); } return(hashCode); } }
public void Right() { if (orientation != Bearing.West) { orientation++; } else { orientation = Bearing.North; } }
public void Left() { if (orientation != Bearing.North) { orientation--; } else { orientation = Bearing.West; } }
public void Set_pMotionLand() { Vector3D p0 = new Vector3D(landing_gear[1, 0].p0_base); p0.y = 0.0D; p0.z -= landing_gear[1, 0].stroke0; Vector3D p1 = new Vector3D(landing_gear[0, 0].p0_base); p1.y = 0.0D; p1.z -= landing_gear[0, 0].stroke0; Vector3D land = p1.Sub(p0).NmlVec(); if (land.x < 0.0D) { land = land.SclProd(-1.0D); } Bearing br = new Bearing(land.R2l()); double pitch = -br.pitch.GetValue(); double h0 = p0.SclProd(-1.0D).Sub(land.SclProd(land.DotProd(p0.SclProd(-1.0D)))).Length(); pMotion = new PlaneMotion(inp, pMotion.wpos.x, h0, pMotion.wpos.y, 0.0D, pitch, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); int i; for (i = 0; i < n_LandingGear; i++) { for (int lr = 0; lr <= 1; lr++) { if (landing_gear[i, lr].flag == 1) { landing_gear[i, lr].delta = 1.0D; } } } flag_landing_gear = 1; for (i = 0; i < n_powerPlant; i++) { if (powerPlant[i].engine_type == 1) { ((ReciprocatingEngine)powerPlant[i].engine).enginePower.output = 0.0D; } } for (i = 0; i < n_t_flap; i++) { t_flap[i, 0].delta = 0.0D; t_flap[i, 1].delta = t_flap[i, 0].delta; } cif = new CockpitInterface(); }
public void Turn(Direction direction) { _bearing += direction == Direction.R ? 1 : -1; if (_bearing > Bearing.W) { _bearing = Bearing.N; } if (_bearing < Bearing.N) { _bearing = Bearing.W; } }
public void TestGetNewBearingRightFullAntiClockwise() { // Turn 450 degrees string bearing = "EAST"; bearing = Bearing.GetNewBearing(bearing, false); bearing = Bearing.GetNewBearing(bearing, false); bearing = Bearing.GetNewBearing(bearing, false); bearing = Bearing.GetNewBearing(bearing, false); bearing = Bearing.GetNewBearing(bearing, false); Assert.AreEqual("NORTH", bearing); }
public static Bearing randomBearing( Bearing notbearing) { int i = random.Next(0, 4); Bearing b = Bearing.NONE; if (i == 0) b = Bearing.NORTH; else if (i == 1) b = Bearing.SOUTH; else if (i == 2) b = Bearing.EAST; else b = Bearing.WEST; if (b == notbearing) return randomBearing(notbearing); return b; }
public Bullet(TankBase firer, Vector2 firedFrom, Bearing b, float bulletv) { position = new Vector2(firedFrom.X, firedFrom.Y); bearing = b; parentTank = firer; exploding = false; if (bearing == Bearing.NORTH) this.velocity = new Vector2(0, -bulletv); else if (bearing == Bearing.SOUTH) this.velocity = new Vector2(0, bulletv); else if (bearing == Bearing.EAST) this.velocity = new Vector2(bulletv,0); else if (bearing == Bearing.WEST) this.velocity = new Vector2(-bulletv,0); }
public void handleInput(Manager.InputController inputController) { if (spawnState == SpawnState.SPAWNED) { // first reset target bearing targetBearing = Bearing.NONE; if (inputController.isKeyPressed(GameKey.UP, controllingIndex)) targetBearing = Bearing.NORTH; else if (inputController.isKeyPressed(GameKey.DOWN, controllingIndex)) targetBearing = Bearing.SOUTH; else if (inputController.isKeyPressed(GameKey.LEFT, controllingIndex)) targetBearing = Bearing.WEST; else if (inputController.isKeyPressed(GameKey.RIGHT, controllingIndex)) targetBearing = Bearing.EAST; if (inputController.isKeyPressed(GameKey.FIRE, controllingIndex)) { if (canFire()) { BulletManager.Instance.addBullet(Fire()); } } } }
/** * Attempt to change direction of the tank. This just sets the target bearing, Update() does the actual collision detection * and movement whilst Draw() uses the actual bearing variable to draw the correct sprite. */ public void attemptDirection(Bearing b) { targetBearing = b; }
public Robot(Coordinates position, Bearing orientation) { this.position = position; this.orientation = orientation; }
public void TurnRight() { if (Bearing == Bearing.West) Bearing = Bearing.North; else Bearing += 1; }
public void TurnLeft() { if (Bearing == Bearing.North) Bearing = Bearing.West; else Bearing -= 1; }