Exemplo n.º 1
1
		public HeliAttack(Actor self, Target target, bool attackOnlyVisibleTargets = true)
		{
			Target = target;
			helicopter = self.Trait<Aircraft>();
			attackHeli = self.Trait<AttackHeli>();
			ammoPools = self.TraitsImplementing<AmmoPool>().ToArray();
			this.attackOnlyVisibleTargets = attackOnlyVisibleTargets;
		}
Exemplo n.º 2
0
 public HeliReturnToBase(Actor self, bool abortOnResupply, Actor dest = null, bool alwaysLand = true)
 {
     heli = self.Trait<Aircraft>();
     this.alwaysLand = alwaysLand;
     this.abortOnResupply = abortOnResupply;
     this.dest = dest;
 }
    static void Main (  ) {
      // No adapter
      Console.WriteLine("Experiment 1: test the aircraft engine");
      IAircraft aircraft = new Aircraft(  );
      aircraft.TakeOff(  );
      if (aircraft.Airborne) Console.WriteLine(
           "The aircraft engine is fine, flying at "
           +aircraft.Height+"meters");

      // Classic usage of an adapter
      Console.WriteLine("\nExperiment 2: Use the engine in the Seabird");
      IAircraft seabird = new Seabird(  );
      seabird.TakeOff(  ); // And automatically increases speed
      Console.WriteLine("The Seabird took off");

      // Two-way adapter: using seacraft instructions on an IAircraft object
      // (where they are not in the IAircraft interface)
      Console.WriteLine("\nExperiment 3: Increase the speed of the Seabird:");
      (seabird as ISeacraft).IncreaseRevs(  );
      (seabird as ISeacraft).IncreaseRevs(  );
      if (seabird.Airborne)
        Console.WriteLine("Seabird flying at height "+ seabird.Height +
            " meters and speed "+(seabird as ISeacraft).Speed + " knots");
      Console.WriteLine("Experiments successful; the Seabird flies!");
     }
Exemplo n.º 4
0
		public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange)
		{
			this.target = target;
			plane = self.Trait<Aircraft>();
			this.minRange = minRange;
			this.maxRange = maxRange;
		}
Exemplo n.º 5
0
 public FallToEarth(Actor self, FallsToEarthInfo info)
 {
     this.info = info;
     aircraft = self.Trait<Aircraft>();
     if (info.Spins)
         acceleration = self.World.SharedRandom.Next(2) * 2 - 1;
 }
Exemplo n.º 6
0
 public ReturnToBase(Actor self, bool abortOnResupply, Actor dest = null, bool alwaysLand = true)
 {
     this.dest = dest;
     this.alwaysLand = alwaysLand;
     this.abortOnResupply = abortOnResupply;
     plane = self.Trait<Aircraft>();
     planeInfo = self.Info.TraitInfo<AircraftInfo>();
 }
Exemplo n.º 7
0
 public void HandleCollision(Aircraft aircraft, Position position)
 {
     if (collision == null)
     {
         collision = new HandleCollision(_positionRepository, _conflictRepository);
     }
     collision.HandleCollisions(position);
 }
Exemplo n.º 8
0
 public FlyAttack(Actor self, Target target)
 {
     this.target = target;
     aircraft = self.Trait<Aircraft>();
     attackPlane = self.TraitOrDefault<AttackPlane>();
     ammoPools = self.TraitsImplementing<AmmoPool>().ToArray();
     ticksUntilTurn = attackPlane.AttackPlaneInfo.AttackTurnDelay;
 }
Exemplo n.º 9
0
 public void HandleInActiveAircraft(Aircraft aircraft)
 {
     var position = _positionRepository.Search(e => e.AircraftId == aircraft.Id, 0, 1).FirstOrDefault();
     Helper.NullifyPosition(position);
     //Remove collision potentials associated with this position
     RemoveCollisions(position);
     position.IsActive = false; position.IsInFlight = false;
     _positionRepository.Update(position.Id, position);
 }
        private string CreateCommand(string[] commandArgs)
        {
            // Learn to use Reflection!
            if (commandArgs[1].Equals("BattleUnit"))
            {
                Aircraft aircraft = new Aircraft(commandArgs[2], int.Parse(commandArgs[3]));
            }

            throw new NotImplementedException();
        }
    // Use this for initialization
    void Start()
    {
        RotationAxis.Normalize();

        //Store root rotation.
        InitialRotation = gameObject.transform.localRotation;

        //Get aeroplane.
        GameObject root = gameObject.transform.root.gameObject;
        Parent = root.GetComponent<Aircraft>();
    }
Exemplo n.º 12
0
 public PickupUnit(Actor self, Actor cargo)
 {
     this.cargo = cargo;
     carryable = cargo.Trait<Carryable>();
     cargoFacing = cargo.Trait<IFacing>();
     movement = self.Trait<IMove>();
     carryall = self.Trait<Carryall>();
     aircraft = self.Trait<Aircraft>();
     selfFacing = self.Trait<IFacing>();
     state = State.Intercept;
 }
Exemplo n.º 13
0
 //Some sort of Textures ID method?
 ResourceID toTextureID(Aircraft.Type type)
 {
     switch(type)
         {
         case Aircraft.Type.Eagle:
             return ResourceID.Eagle;
         case Aircraft.Type.Raptor:
             return ResourceID.Raptor;
         default:
             return 0;
         }
 }
Exemplo n.º 14
0
		public DeliverUnit(Actor self)
		{
			carryall = self.Trait<Carryall>();
			this.self = self;
			cargo = carryall.Carrying;
			movement = self.Trait<IMove>();
			carryable = cargo.Trait<Carryable>();
			aircraft = self.Trait<Aircraft>();
			positionable = cargo.Trait<IPositionable>();
			cargoFacing = cargo.Trait<IFacing>();
			selfFacing = self.Trait<IFacing>();
			state = State.Transport;
		}
Exemplo n.º 15
0
        public static bool AdjustAltitude(Actor self, Aircraft helicopter, WDist targetAltitude)
        {
            targetAltitude = new WDist(helicopter.CenterPosition.Z) + targetAltitude - self.World.Map.DistanceAboveTerrain(helicopter.CenterPosition);

            var altitude = helicopter.CenterPosition.Z;
            if (altitude == targetAltitude.Length)
                return false;

            var delta = helicopter.Info.AltitudeVelocity.Length;
            var dz = (targetAltitude.Length - altitude).Clamp(-delta, delta);
            helicopter.SetPosition(self, helicopter.CenterPosition + new WVec(0, 0, dz));

            return true;
        }
Exemplo n.º 16
0
 private Flight NewFlight(Aircraft aircraft, int flightnumber, string origin, string destination)
 {
     switch (aircraft.IsAircraftUndergoingMaintinance)
     {
         case (false):
             {
                 Flight flight = new Flight(aircraft, flightnumber, origin, destination);
                 aircraft.Schedule.Add(flight);
                 return flight;
             }
         default:
             {
                 throw new Exception("The Aircraft Specified for flight is currently undergoing maintenance.");
             }
     }
 }
Exemplo n.º 17
0
		public static void FlyToward(Actor self, Aircraft plane, int desiredFacing, WDist desiredAltitude)
		{
			desiredAltitude = new WDist(plane.CenterPosition.Z) + desiredAltitude - self.World.Map.DistanceAboveTerrain(plane.CenterPosition);

			var move = plane.FlyStep(plane.Facing);
			var altitude = plane.CenterPosition.Z;

			plane.Facing = Util.TickFacing(plane.Facing, desiredFacing, plane.ROT);

			if (altitude != desiredAltitude.Length)
			{
				var delta = move.HorizontalLength * plane.Info.MaximumPitch.Tan() / 1024;
				var dz = (desiredAltitude.Length - altitude).Clamp(-delta, delta);
				move += new WVec(0, 0, dz);
			}

			plane.SetPosition(self, plane.CenterPosition + move);
		}
Exemplo n.º 18
0
        public World(RenderWindow window)
        {
            mWindow = window;
            mWorldView = window.DefaultView;
            mWorldBounds = new IntRect(0, 0, (int)mWorldView.Size.X, 2000); //have to explcitly cast Size.X from float to int because of cast issues between IntRect and FloatRect later on
            mSpawnPosition = new Vector2f(mWorldView.Size.X / 2, mWorldBounds.Height - mWorldView.Size.Y); //original code is mWorldBounds.Height - mWorldView.Size, but caused error
            mScrollSpeed = -50; //this is not included in book but in source code
            mSceneLayers = new SceneNode[(int)Layer.LayerCount];
            mTextures = new ResourceHolder<Texture, ResourceID>();
            mSceneGraph = new SceneNode();
            mPlayerAircraft = null;
            mCommandQueue = new CommandQueue();

            mWorldView.Center = mSpawnPosition;

            loadTextures();
            buildScene();
        }
        /* http://www.lll.lu/~edward/edward/adsb/DecodingADSBposition.html */
        private void decodeCPR(Aircraft a)
        {
            const double AirDlat0 = 360.0 / 60;
            const double AirDlat1 = 360.0 / 59;
            double lat0 = a.evenFrameCprLatitude;
            double lat1 = a.oddFrameCprLatitude;
            double lon0 = a.evenFrameCprLongitude;
            double lon1 = a.oddFrameCprLongitude;

            double tempLatitude;
            double tempLongitude;

            int j = (int)Math.Floor(((59 * lat0 - 60 * lat1) / 131072) + 0.5);
            double rlat0 = AirDlat0 * (cprModFunction(j, 60) + lat0 / 131072);
            double rlat1 = AirDlat1 * (cprModFunction(j, 59) + lat1 / 131072);

            if (rlat0 >= 270) rlat0 -= 360;
            if (rlat1 >= 270) rlat1 -= 360;

            if (cprNLFunction(rlat0) != cprNLFunction(rlat1)) return;

            if (a.evenFrameCprTime > a.oddFrameCprTime)
            {
                int ni = cprNFunction(rlat0, 0);
                int m = (int)Math.Floor((((lon0 * (cprNLFunction(rlat0) - 1)) -
                (lon1 * cprNLFunction(rlat0))) / 131072) + 0.5);
                tempLongitude = cprDlonFunction(rlat0, 0) * (cprModFunction(m, ni) + lon0 / 131072);
                tempLatitude = rlat0;
            }
            else
            {
                int ni = cprNFunction(rlat1, 1);
                int m = (int)Math.Floor((((lon0 * (cprNLFunction(rlat1) - 1)) -
                (lon1 * cprNLFunction(rlat1))) / 131072.0) + 0.5);
                tempLongitude = cprDlonFunction(rlat1, 1) * (cprModFunction(m, ni) + lon1 / 131072);
                tempLatitude = rlat1;
            }
            if (tempLongitude > 180) tempLongitude -= 360;

            currentMessage.longitude = tempLongitude;
            currentMessage.latitude = tempLatitude;
        }
        /* modesSendSBSOutput*/
        internal void convertToSBS(Aircraft a)
        {
            String tempRespond="";
            int emergency = 0, ground = 0, alert = 0, spi = 0;

            if (currentMessage.downlinkFormat == 4 || currentMessage.downlinkFormat == 5 || currentMessage.downlinkFormat == 21)
            {
                /* Node: identity is calculated/kept in base10 but is actually octal (07500 is represented as 7500) */
                if (currentMessage.squawkIdentity == 7500 || currentMessage.squawkIdentity == 7600 || currentMessage.squawkIdentity == 7700)
                    emergency = -1;
                if (currentMessage.flightStatus == 1 || currentMessage.flightStatus == 3)
                    ground = -1;
                if (currentMessage.flightStatus == 2 || currentMessage.flightStatus == 3 || currentMessage.flightStatus == 4)
                    alert = -1;
                if (currentMessage.flightStatus == 4 || currentMessage.flightStatus == 5)
                    spi = -1;
            }

            if (currentMessage.downlinkFormat == 0)
            {
                tempRespond = string.Format("MSG,5,,,{0:X2}{1:X2}{2:X2},,,,,,,{3:D},,,,,,,,,,", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, currentMessage.altitude);
            }
            else if (currentMessage.downlinkFormat == 4)
            {
                tempRespond = string.Format("MSG,5,,,{0:X2}{1:X2}{2:X2},,,,,,,{3:D},,,,,,,{4:D},{5:D},{6:D},{7:D}", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, currentMessage.altitude, alert, emergency, spi, ground);
            }
            else if (currentMessage.downlinkFormat == 5)
            {
                tempRespond = string.Format("MSG,6,,,{0:X2}{1:X2}{2:X2},,,,,,,,,,,,,{3:D},{4:D},{5:D},{6:D},{7:D}", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, currentMessage.squawkIdentity, alert, emergency, spi, ground);
            }
            else if (currentMessage.downlinkFormat == 11)
            {
                tempRespond = string.Format("MSG,8,,,{0:X2}{1:X2}{2:X2},,,,,,,,,,,,,,,,,", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree);
            }
            else if (currentMessage.downlinkFormat == 17 && currentMessage.esMessageType == 4)
            {
                string flightNumber = new string(currentMessage.flightNumber);
                if (createID)
                {
                    tempRespond = string.Format("ID,,,,{0:X2}{1:X2}{2:X2},,,,,,{3},,,,,,,,,,,", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, flightNumber);
                }
                else
                {
                    tempRespond = string.Format("MSG,1,,,{0:X2}{1:X2}{2:X2},,,,,,{3},,,,,,,,,,,", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, flightNumber);
                }

            }
            else if (currentMessage.downlinkFormat == 17 && currentMessage.esMessageType >= 9 && currentMessage.esMessageType <= 18)
            {
                if (currentMessage.latitude == 0 && currentMessage.longitude == 0)
                    tempRespond = string.Format("MSG,3,,,{0:X2}{1:X2}{2:X2},,,,,,,{3:D},,,,,,,0,0,0,0", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, currentMessage.altitude);
                else
                {
                    String tempLat = string.Format("{0:F5}", currentMessage.latitude).Replace(",", ".");
                    String tempLon = string.Format("{0:F5}", currentMessage.longitude).Replace(",", ".");
                    tempRespond = string.Format("MSG,3,,,{0:X2}{1:X2}{2:X2},,,,,,,{3:D},,,{4},{5},,,0,0,0,0", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, currentMessage.altitude, tempLat, tempLon);
                }
            }
            else if (currentMessage.downlinkFormat == 17 && currentMessage.esMessageType == 19 && currentMessage.esMessageSubType == 1)
            {
                int vr = (currentMessage.verticalRateSign == 0 ? 1 : -1) * (currentMessage.verticalRate - 1) * 64;
                tempRespond = string.Format("MSG,4,,,{0:X2}{1:X2}{2:X2},,,,,,,,{3:D},{4:D},,,{5:D},,0,0,0,0", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, currentMessage.velocity, currentMessage.track, vr);
            }
            else if (currentMessage.downlinkFormat == 21)
            {
                tempRespond = string.Format("MSG,6,,,{0:X2}{1:X2}{2:X2},,,,,,,,,,,,,{3:D},{4:D},{5:D},{6:D},{7:D}", currentMessage.icaoAddrPartOne, currentMessage.icaoAddrPartTwo, currentMessage.icaoAddrPartThree, currentMessage.squawkIdentity, alert, emergency, spi, ground);
            }

            if (!String.IsNullOrEmpty(messageSBS))
                messageSBS += Environment.NewLine;

            messageSBS += tempRespond;
        }
 // Use this for initialization
 public void Start()
 {
     gameObject.camera.enabled = false;
     TargetAeroplane = transform.root.gameObject.GetComponent<Aircraft>();
 }
Exemplo n.º 22
0
    public void AddPictures(Object sender, GridViewRowEventArgs e)
    {
        if (e != null && e.Row.RowType == DataControlRowType.DataRow)
        {
            Aircraft ac = (Aircraft)e.Row.DataItem;

            // Refresh the images
            if (!IsAdminMode)
            {
                ((Controls_mfbHoverImageList)e.Row.FindControl("mfbHoverThumb")).Refresh();
            }

            // Show aircraft capabilities too.
            Controls_popmenu popup = (Controls_popmenu)e.Row.FindControl("popmenu1");
            switch (ac.RoleForPilot)
            {
            case Aircraft.PilotRole.None:
                ((RadioButton)popup.FindControl("rbRoleNone")).Checked = true;
                break;

            case Aircraft.PilotRole.CFI:
                ((RadioButton)popup.FindControl("rbRoleCFI")).Checked = true;
                break;

            case Aircraft.PilotRole.SIC:
                ((RadioButton)popup.FindControl("rbRoleSIC")).Checked = true;
                break;

            case Aircraft.PilotRole.PIC:
                ((RadioButton)popup.FindControl("rbRolePIC")).Checked = true;
                break;
            }
            ((CheckBox)popup.FindControl("ckShowInFavorites")).Checked = !ac.HideFromSelection;
            ((CheckBox)popup.FindControl("ckAddNameAsPIC")).Checked    = ac.CopyPICNameWithCrossfill;

            ((Label)popup.FindControl("lblOptionHeader")).Text = String.Format(CultureInfo.CurrentCulture, Resources.Aircraft.optionHeader, ac.DisplayTailnumber);

            if (!IsAdminMode)
            {
                List <LinkedString> lst = new List <LinkedString>();

                if (ac.Stats != null)
                {
                    lst.Add(ac.Stats.UserStatsDisplay);
                }
                MakeModel mm = MakeModel.GetModel(ac.ModelID);
                if (mm != null)
                {
                    if (!String.IsNullOrEmpty(mm.FamilyName))
                    {
                        lst.Add(new LinkedString(ModelQuery.ICAOPrefix + mm.FamilyName));
                    }

                    foreach (string sz in mm.AttributeList(ac.AvionicsTechnologyUpgrade, ac.GlassUpgradeDate))
                    {
                        lst.Add(new LinkedString(sz));
                    }
                }

                Repeater rpt = (Repeater)e.Row.FindControl("rptAttributes");
                rpt.DataSource = lst;
                rpt.DataBind();
            }

            Controls_mfbSelectTemplates selectTemplates = (Controls_mfbSelectTemplates)popup.FindControl("mfbSelectTemplates");
            foreach (int i in ac.DefaultTemplates)
            {
                selectTemplates.AddTemplate(i);
            }

            selectTemplates.Refresh();

            if (IsAdminMode)
            {
                HyperLink lnkRegistration = (HyperLink)e.Row.FindControl("lnkRegistration");
                string    szURL           = ac.LinkForTailnumberRegistry();
                lnkRegistration.Visible     = szURL.Length > 0;
                lnkRegistration.NavigateUrl = szURL;
            }
        }
    }
Exemplo n.º 23
0
        ///<summary>
        ///</summary>
        ///<param name="checkItems"></param>
        ///<param name="aircraftDocuments"></param>
        ///<param name="aircraft"></param>
        ///<param name="schedule"></param>
        public void UpdateInformation(MaintenanceCheckCollection checkItems,
                                      IEnumerable <Document> aircraftDocuments,
                                      Aircraft aircraft,
                                      bool schedule)
        {
            _aircraftDocuments.Clear();
            _aircraftDocuments.AddRange(aircraftDocuments);
            _checkItems                = checkItems;
            _schedule                  = schedule;
            _currentAircraft           = aircraft;
            _complianceGroupCollection = _checkItems.GetNextComplianceCheckGroups(_schedule).OrderBy(c => c.GetNextComplianceDate());
            _aircraftLifelength        = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(aircraft);

            labelMSGValue.Text                       = aircraft.MSG.ToString();
            labelManufactureDateValue.Text           = SmartCore.Auxiliary.Convert.GetDateFormat(aircraft.ManufactureDate);
            labelOwnerValue.Text                     = aircraft.Owner;
            labelOperatorValue.Text                  = GlobalObjects.CasEnvironment.Operators.First(o => o.ItemId == _currentAircraft.OperatorId).Name;
            labelAircraftTypeCertificateNoValue.Text = aircraft.TypeCertificateNumber;
            labelCurrentValue.Text                   = _aircraftLifelength.ToHoursMinutesAndCyclesFormat("FH", "FC");

            labelBasicEmptyWeightValue.Text            = aircraft.BasicEmptyWeight.ToString();
            labelBasicEmptyWeightCargoConfigValue.Text = aircraft.BasicEmptyWeightCargoConfig.ToString();
            labelCargoCapacityContainerValue.Text      = aircraft.CargoCapacityContainer;
            labelCruiseValue.Text                = aircraft.Cruise;
            labelCruiseFuelFlowValue.Text        = aircraft.CruiseFuelFlow;
            labelFuelCapacityValue.Text          = aircraft.FuelCapacity;
            labelMaxCruiseAltitudeValue.Text     = aircraft.MaxCruiseAltitude;
            labelMaxLandingWeightValue.Text      = aircraft.MaxLandingWeight.ToString();
            labelMaxPayloadValue.Text            = aircraft.MaxPayloadWeight.ToString();
            labelMaxTakeOffCrossWeightValue.Text = aircraft.MaxTakeOffCrossWeight.ToString();
            labelMaxZeroFuelWeightValue.Text     = aircraft.MaxZeroFuelWeight.ToString();
            labelMaxTaxiWeightValue.Text         = aircraft.MaxTaxiWeight.ToString();
            labelOpertionalEmptyWeightValue.Text = aircraft.OperationalEmptyWeight.ToString();
            labelCockpitSeatingValue.Text        = aircraft.CockpitSeating;
            labelGalleysValue.Text               = aircraft.Galleys;
            labelLavatoryValue.Text              = aircraft.Lavatory;
            labelSeatingEconomyValue.Text        = aircraft.SeatingEconomy.ToString();
            labelSeatingBusinessValue.Text       = aircraft.SeatingBusiness.ToString();
            labelSeatingFirstValue.Text          = aircraft.SeatingFirst.ToString();
            labelOvenValue.Text          = aircraft.Oven;
            labelBoilerValue.Text        = aircraft.Boiler;
            labelAirStairDoorsValue.Text = aircraft.AirStairsDoors;

            var aircraftEquipment = _currentAircraft.AircraftEquipments.Where(a => a.AircraftEquipmetType == AircraftEquipmetType.Equipmet);
            var aircraftApproval  = _currentAircraft.AircraftEquipments.Where(a => a.AircraftEquipmetType == AircraftEquipmetType.TapeOfOperationApproval);

            var row = 4;

            foreach (var equipmentse in aircraftApproval)
            {
                var labelTitle = new Label
                {
                    Text      = equipmentse.AircraftOtherParameter + " :",
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                var labelValue = new Label
                {
                    Text      = equipmentse.Description,
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                row++;
                tableLayoutPanelMain.Controls.Add(labelTitle, 2, row);
                tableLayoutPanelMain.Controls.Add(labelValue, 3, row);
            }

            row = 4;
            foreach (var equipmentse in aircraftEquipment)
            {
                var labelTitle = new Label
                {
                    Text      = equipmentse.AircraftOtherParameter + " :",
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                var labelValue = new Label
                {
                    Text      = equipmentse.Description,
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                row++;
                tableLayoutPanelMain.Controls.Add(labelTitle, 6, row);
                tableLayoutPanelMain.Controls.Add(labelValue, 7, row);
            }

            //List<Document> operatorDocs =
            //    GlobalObjects.CasEnvironment.Loader.GetDocuments(aircraft.Operator, DocumentType.Certificate, true);
            //DocumentSubType aocType = (DocumentSubType)
            //    GlobalObjects.CasEnvironment.Dictionaries[typeof(DocumentSubType)].ToArray().FirstOrDefault(d => d.FullName == "AOC");
            //Document awDoc = aocType != null ? operatorDocs.FirstOrDefault(d => d.DocumentSubType == aocType) : null;
            //string aocUpTo = awDoc != null && awDoc.ValidTo
            //                    ? awDoc.DateValidTo.ToString(new GlobalTermsProvider()["DateFormat"].ToString())
            //                    : "";

            var aircraftDocs = GlobalObjects.DocumentCore.GetAircraftDocuments(aircraft);
            var awType       = (DocumentSubType)
                               GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>().ToArray().FirstOrDefault(d => d.FullName == "AW");
            var awDoc = awType != null?aircraftDocs.FirstOrDefault(d => d.DocumentSubType.ItemId == awType.ItemId) : null;

            string awUpTo = awDoc != null && awDoc.IssueValidTo
                                ? awDoc.IssueDateValidTo.ToString(new GlobalTermsProvider()["DateFormat"].ToString())
                                : "";

            labelAWCValue.Text = awUpTo;

            tableLayoutPanelLastChecks.RowCount = 1;
            tableLayoutPanelLastChecks.RowStyles.Clear();
            tableLayoutPanelLastChecks.RowStyles.Add(new RowStyle());
            tableLayoutPanelLastChecks.Controls.Clear();
            tableLayoutPanelLastChecks.Controls.Add(labelLastCheck, 0, 0);
            tableLayoutPanelLastChecks.Controls.Add(labelLastDate, 1, 0);
            tableLayoutPanelLastChecks.Controls.Add(labelLastTsnCsn, 2, 0);

            tableLayoutPanelNextChecks.RowCount = 1;
            tableLayoutPanelNextChecks.RowStyles.Clear();
            tableLayoutPanelNextChecks.RowStyles.Add(new RowStyle());
            tableLayoutPanelNextChecks.Controls.Clear();
            tableLayoutPanelNextChecks.Controls.Add(labelNextCheck, 0, 0);
            tableLayoutPanelNextChecks.Controls.Add(labelNextDate, 1, 0);
            tableLayoutPanelNextChecks.Controls.Add(labelNextTsnCan, 2, 0);
            tableLayoutPanelNextChecks.Controls.Add(labelRemains, 3, 0);

            tableLayoutPanelDocs.RowCount = 1;
            tableLayoutPanelDocs.RowStyles.Clear();
            tableLayoutPanelDocs.RowStyles.Add(new RowStyle());
            tableLayoutPanelDocs.Controls.Clear();
            tableLayoutPanelDocs.Controls.Add(labelDocDescription, 0, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocNumber, 1, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocIssue, 2, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocValidTo, 3, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocRemain, 4, 0);

            if (_checkItems.Count == 0)
            {
                return;
            }

            if (!BackGroundWorker.IsBusy)
            {
                BackGroundWorker.RunWorkerAsync();
            }
            List <MaintenanceCheck> orderedBySchedule =
                checkItems.OrderBy(c => c.Schedule)
                .ThenByDescending(c => c.Grouping)
                .OrderBy(c => c.Resource)
                .ToList();

            List <MaintenanceCheckGroupByType> checkGroups = new List <MaintenanceCheckGroupByType>();

            foreach (MaintenanceCheck check in orderedBySchedule)
            {
                MaintenanceCheckGroupByType group = checkGroups
                                                    .FirstOrDefault(g => g.Schedule == check.Schedule &&
                                                                    g.Grouping == check.Grouping &&
                                                                    g.Resource == check.Resource);
                if (group != null)
                {
                    group.Checks.Add(check);
                }
                else
                {
                    group = new MaintenanceCheckGroupByType(check.Schedule)
                    {
                        Grouping = check.Grouping,
                        Resource = check.Resource
                    };
                    group.Checks.Add(check);
                    checkGroups.Add(group);
                }
            }
        }
Exemplo n.º 24
0
 public void Open(Simulation sim, Aircraft aircraft)
 {
     this.aircraft = aircraft;
     this.sim      = sim;
     Show();
 }
Exemplo n.º 25
0
		public Fly(Actor self, Target t)
		{
			plane = self.Trait<Aircraft>();
			target = t;
		}
 /// <summary>
 /// Создает элемент управления для отображения списка выполненных работ по Maintenance Status
 /// </summary>
 /// <param name="aircraft">ВС</param>
 public MaintenanceStatusComplianceControl(Aircraft aircraft)
 {
     this.aircraft = aircraft;
     InitializeComponent();
 }
 /// <summary>
 /// Отобразить элементы
 /// </summary>
 public void DisplayItems(Aircraft parentAircraft)
 {
     aircraft = parentAircraft;
     DisplayItems();
 }
Exemplo n.º 28
0
 public Land(Actor self)
     : this(self, Target.FromPos(Aircraft.GroundPosition(self)), WVec.Zero)
 {
 }
Exemplo n.º 29
0
 public Land(Actor self, Target t, WVec offset)
 {
     target      = t;
     aircraft    = self.Trait <Aircraft>();
     this.offset = offset;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Создает форму для редактирования данных среднего использования
 /// </summary>
 /// <param name="aircraft">ВС</param>
 public AverageUtilizationForm(Aircraft aircraft)
 {
     currentAircraft = aircraft;
     InitializeComponent();
     UpdateInformation();
 }
Exemplo n.º 31
0
 /// <summary>
 /// Контрол редактирует данные о залитом масле для одного агрегата
 /// </summary>
 public ComponentOilControl(Aircraft aircraft) : this(aircraft, new ComponentOilCondition())
 {
 }
Exemplo n.º 32
0
		public TakeOff(Actor self)
		{
			aircraft = self.Trait<Aircraft>();
			move = self.Trait<IMove>();
		}
Exemplo n.º 33
0
 public FlyOffMap(Actor self)
 {
     plane = self.Trait <Aircraft>();
 }
Exemplo n.º 34
0
        private void seed(ModelBuilder modelBuilder)
        {
            var bilbaoAirport = new Airport
            {
                Id        = 1,
                IATA      = "BIO",
                City      = "Bilbao",
                Latitude  = 43.30110168457031,
                Longitude = 2.9106099605560303
            };

            var malagaAirport = new Airport
            {
                Id        = 2,
                IATA      = "AGP",
                City      = "Malaga",
                Latitude  = 36.67490005493164,
                Longitude = 4.499110221862793
            };

            var newYorkAirport = new Airport
            {
                Id        = 3,
                IATA      = "JFK",
                City      = "New York",
                Latitude  = 40.63980103,
                Longitude = 73.77890015
            };

            var parisAirport = new Airport
            {
                Id        = 4,
                IATA      = "CDG",
                City      = "Paris",
                Latitude  = 49.0127983093,
                Longitude = 2.54999995232
            };

            var airBus320 = new Aircraft
            {
                Id                   = 1,
                ModelName            = "Airbus A320",
                ConsumptionPerKm     = 100,
                ConsumptionOnTakeOff = 20
            };

            var boeing757 = new Aircraft
            {
                Id                   = 2,
                ModelName            = "Boeing 757",
                ConsumptionPerKm     = 150,
                ConsumptionOnTakeOff = 35
            };

            modelBuilder.Entity <Airport>().HasData(
                bilbaoAirport,
                malagaAirport,
                newYorkAirport,
                parisAirport);

            modelBuilder.Entity <Aircraft>().HasData(
                airBus320,
                boeing757);


            // REF ->https://wildermuth.com/2018/08/12/Seeding-Related-Entities-in-EF-Core-2-1-s-HasData()
            modelBuilder.Entity <Flight>().HasData(
                new
            {
                Id = 100,
                DepartureAirportId   = 1,
                DestinationAirportId = 2,
                AircraftId           = 1
            },
                new
            {
                Id = 101,
                DepartureAirportId   = 3,
                DestinationAirportId = 4,
                AircraftId           = 2
            },
                new
            {
                Id = 102,
                DepartureAirportId   = 1,
                DestinationAirportId = 3,
                AircraftId           = 1
            }
                );
        }
Exemplo n.º 35
0
 /// <summary>
 /// Контрол редактирует данные о залитом масле для одного агрегата
 /// </summary>
 public ComponentOilControl(Aircraft aircraft, ComponentOilCondition condition): this()
 {
     _currentAircraft = aircraft;
     AttachedObject = condition;
 }
Exemplo n.º 36
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.SelectedTab = tabID.tabLogbook;

        if (!IsPostBack)
        {
            try
            {
                if (Request.PathInfo.Length > 0)
                {
                    try { CurrentFlightID = Convert.ToInt32(Request.PathInfo.Substring(1), CultureInfo.InvariantCulture); }
                    catch (FormatException) { CurrentFlightID = LogbookEntry.idFlightNone; }
                }
                if (CurrentFlightID == LogbookEntry.idFlightNone)
                {
                    throw new MyFlightbookException("No valid ID passed");
                }

                string szFQParam = util.GetStringParam(Request, "fq");
                if (!String.IsNullOrEmpty(szFQParam))
                {
                    try
                    {
                        Restriction = FlightQuery.FromBase64CompressedJSON(szFQParam);
                        Restriction.Refresh();
                    }
                    catch (ArgumentNullException) { }
                    catch (FormatException) { }
                    catch (JsonSerializationException) { }
                    catch (JsonException) { }
                }

                DetailsTab dtRequested = DetailsTab.Flight;
                if (Enum.TryParse <DetailsTab>(util.GetStringParam(Request, "tabID"), out dtRequested))
                {
                    int iTab = (int)dtRequested;
                    if (AccordionCtrl.Panes[iTab].Visible)
                    {
                        AccordionCtrl.SelectedIndex = iTab;
                    }
                }

                LogbookEntryDisplay led = CurrentFlight = LoadFlight(CurrentFlightID);
                SetUpChart(TelemetryData);
                UpdateChart();
                UpdateRestriction();

                if (Viewer.CloudAhoyToken == null || Viewer.CloudAhoyToken.AccessToken == null)
                {
                    lnkSendCloudAhoy.Visible = false;
                }

                lblOriginalFormat.Text = DataSourceType.DataSourceTypeFromFileType(led.Telemetry.TelemetryType).DisplayName;

                // allow selection of units if units are not implicitly known.
                switch (led.Telemetry.TelemetryType)
                {
                case DataSourceType.FileType.GPX:
                case DataSourceType.FileType.KML:
                case DataSourceType.FileType.NMEA:
                case DataSourceType.FileType.IGC:
                    cmbAltUnits.Enabled = cmbSpeedUnits.Enabled = false;
                    break;

                default:
                    cmbAltUnits.Enabled = cmbSpeedUnits.Enabled = true;
                    break;
                }

                // shouldn't happen but sometimes does: GetUserAircraftByID returns null.  Not quite sure why.
                Aircraft ac = (new UserAircraft(led.User).GetUserAircraftByID(led.AircraftID)) ?? new Aircraft(led.AircraftID);
                fmvAircraft.DataSource = new Aircraft[] { ac };
                fmvAircraft.DataBind();

                if (String.IsNullOrEmpty(CurrentFlight.FlightData) && dtRequested != DetailsTab.Aircraft && dtRequested != DetailsTab.Flight)
                {
                    AccordionCtrl.SelectedIndex = (int)DetailsTab.Flight;
                }
            }
            catch (MyFlightbookException ex)
            {
                lblPageErr.Text       = ex.Message;
                AccordionCtrl.Visible = mfbGoogleMapManager1.Visible = pnlMap.Visible = pnlAccordionMenuContainer.Visible = pnlFlightDesc.Visible = false;
                return;
            }

            // for debugging, have a download option that skips all the rest
            if (util.GetIntParam(Request, "d", 0) != 0 && !String.IsNullOrEmpty(CurrentFlight.FlightData))
            {
                Response.Clear();
                Response.ContentType = "application/octet-stream";
                // Give it a name that is the brand name, user's name, and date.  Convert spaces to dashes, and then strip out ANYTHING that is not alphanumeric or a dash.
                string szFilename    = String.Format(CultureInfo.InvariantCulture, "Data{0}-{1}-{2}", Branding.CurrentBrand.AppName, MyFlightbook.Profile.GetUser(Page.User.Identity.Name).UserFullName, DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)).Replace(" ", "-");
                string szDisposition = String.Format(CultureInfo.InvariantCulture, "inline;filename={0}.csv", System.Text.RegularExpressions.Regex.Replace(szFilename, "[^0-9a-zA-Z-]", ""));
                Response.AddHeader("Content-Disposition", szDisposition);
                Response.Write(CurrentFlight.FlightData);
                Response.End();
                return;
            }
        }
        else
        {
            m_fd.Data = TelemetryData;
            UpdateChart();
        }

        if (Restriction != null && !Restriction.IsDefault)
        {
            mfbFlightContextMenu.EditTargetFormatString = mfbFlightContextMenu.EditTargetFormatString + "?fq=" + HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString());
        }
        mfbFlightContextMenu.Flight = CurrentFlight;

        cmbAltUnits.SelectedValue   = ((int)m_fd.AltitudeUnits).ToString(CultureInfo.InvariantCulture);
        cmbSpeedUnits.SelectedValue = ((int)m_fd.SpeedUnits).ToString(CultureInfo.InvariantCulture);
        if (!m_fd.HasDateTime)
        {
            lnkSendCloudAhoy.Visible = false;
        }

        // Set up any maps.
        mfbGoogleMapManager1.Map.Airports    = RoutesList.Result;
        mfbGoogleMapManager1.ShowMarkers     = true;
        mfbGoogleMapManager1.Map.PathVarName = PathLatLongArrayID;
        mfbGoogleMapManager1.Map.Path        = m_fd.GetPath();
        if (m_fd.HasLatLongInfo && m_fd.Data.Rows.Count > 1)
        {
            cmbFormat.Items[(int)DownloadFormat.KML].Enabled = true;
            cmbFormat.Items[(int)DownloadFormat.GPX].Enabled = true;
            mfbGoogleMapManager1.Mode = MyFlightbook.Mapping.GMap_Mode.Dynamic;
            pnlMapControls.Visible    = true;
        }
        else
        {
            cmbFormat.Items[(int)DownloadFormat.KML].Enabled = false;
            cmbFormat.Items[(int)DownloadFormat.GPX].Enabled = false;
            mfbGoogleMapManager1.Mode = MyFlightbook.Mapping.GMap_Mode.Static;
            pnlMapControls.Visible    = false;
        }
        lnkZoomToFit.NavigateUrl = mfbGoogleMapManager1.ZoomToFitScript;

        if (!IsPostBack)
        {
            // Bind details - this will bind everything else.
            fmvLE.DataSource = new LogbookEntryDisplay[] { CurrentFlight };
            fmvLE.DataBind();
        }
    }
Exemplo n.º 37
0
 protected string GetTotalAircraft()
 {
     return("" + Aircraft.GetTotalShips());
 }
Exemplo n.º 38
0
 public TakeOff(Actor self, Target target)
 {
     aircraft    = self.Trait <Aircraft>();
     move        = self.Trait <IMove>();
     this.target = target;
 }
        //

        /// <summary>
        /// Try to sync this item's data, and request more for the next call.
        /// </summary>
        /// <param name="existingItem"></param>
        /// <returns>Enum: error/ok status</returns>
        public Enum DoSimConnectSync(Aircraft existingItem)
        {
            if (existingItem == null)
            {
                return(ErrorCode.RecordNotFound);
            }
            if (existingItem.LocalSimRequestType != SimConnectManager.RequestName.NONE && existingItem.LocalSimRequestType != SimConnectManager.RequestName.DummyUser)
            {
                // is real sim object - check status of the sim connection before proceeding
                if (!Program.simConnectManager.SetUp())
                {
                    return(ErrorCode.CannotReadSimObjectWithoutConnection);                                                    // setup failed, try again and report
                }
            }

            switch (existingItem.LocalSimRequestType)             // check if this sim object has an implemented bind
            {
            case SimConnectManager.RequestName.NONE:              // no relevant request type or not a sim object
            {
                break;
            }

            case SimConnectManager.RequestName.DummyUser:
            {
                aircraftRepository.Update(new Aircraft()
                    {
                        LocalItem           = existingItem.LocalItem,
                        LocalDescription    = existingItem.LocalDescription,
                        GUID                = existingItem.GUID,
                        LocalSimRequestType = existingItem.LocalSimRequestType,

                        Title = "A title! " + Guid.NewGuid().ToString("n").Substring(0, 8),

                        FlightNumber = Guid.NewGuid().ToString("n").Substring(0, 8),
                        TailNumber   = Guid.NewGuid().ToString("n").Substring(0, 8),
                        CraftType    = Guid.NewGuid().ToString("n").Substring(0, 8),
                        CraftModel   = Guid.NewGuid().ToString("n").Substring(0, 8),

                        //52.403331,-1.5385686
                        IsOnGround = (Program.random.Next(0, 9) > 4) ? double.MaxValue : double.MinValue,
                        Latitude   = 52.403331 + (Program.lifeTimer.Elapsed.TotalMilliseconds * (-0.0000001)),
                        Longitude  = -1.5385686 + (Program.lifeTimer.Elapsed.TotalMilliseconds * (0.0000001)),
                        Heading    = (existingItem.Heading == 359) ? 0 : existingItem.Heading + 0.5,

                        PlaneAltitude = (Math.Sin(Program.lifeTimer.Elapsed.TotalMilliseconds * 2 * Math.PI / 100000) * (15000 / 2) + (15000 / 2)),
                        //PlaneAltitude = 0,
                        GroundAltitude = 0,

                        Roll  = (existingItem.Roll > 6.28319) ? 0 : existingItem.Roll + 0.01,
                        Pitch = 0,
                        Yaw   = 0,                               // unused

                        AirspeedTrue      = Program.random.NextDouble(),
                        AirspeedIndicated = Program.random.NextDouble(),
                        AirspeedMach      = Program.random.NextDouble(),
                        GroundSpeed       = Program.random.NextDouble(),
                    });

                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Write("\nSimConnectManager: ");
                Console.ResetColor();
                Console.Write($"Generating dummy data for dummy user : '******' \n");

                break;
            }

            case SimConnectManager.RequestName.User:
            {
                #region @MOD API - sync data
                aircraftRepository.Update(new Aircraft()
                    {
                        LocalItem           = existingItem.LocalItem,
                        LocalDescription    = existingItem.LocalDescription,
                        GUID                = existingItem.GUID,
                        LocalSimRequestType = existingItem.LocalSimRequestType,

                        Title = Program.simConnectManager.UserRequestReturnedData.title,

                        FlightNumber = Program.simConnectManager.UserRequestReturnedData.flightNumber,
                        TailNumber   = Program.simConnectManager.UserRequestReturnedData.tailNumber,
                        CraftType    = Program.simConnectManager.UserRequestReturnedData.craftType,
                        CraftModel   = Program.simConnectManager.UserRequestReturnedData.craftModel,

                        IsOnGround = Program.simConnectManager.UserRequestReturnedData.isOnGround,
                        Latitude   = Program.simConnectManager.UserRequestReturnedData.latitude,
                        Longitude  = Program.simConnectManager.UserRequestReturnedData.longitude,
                        Heading    = Program.simConnectManager.UserRequestReturnedData.heading,

                        PlaneAltitude  = Program.simConnectManager.UserRequestReturnedData.planeAltitude,
                        GroundAltitude = Program.simConnectManager.UserRequestReturnedData.groundAltitude,

                        Roll  = Program.simConnectManager.UserRequestReturnedData.roll,
                        Pitch = Program.simConnectManager.UserRequestReturnedData.pitch,
                        Yaw   = Program.simConnectManager.UserRequestReturnedData.heading,                               // YAW == heading

                        AirspeedTrue      = Program.simConnectManager.UserRequestReturnedData.airspeedTrue,
                        AirspeedIndicated = Program.simConnectManager.UserRequestReturnedData.airspeedIndicated,
                        AirspeedMach      = Program.simConnectManager.UserRequestReturnedData.airspeedMach,
                        GroundSpeed       = Program.simConnectManager.UserRequestReturnedData.groundSpeed,
                    });
                #endregion

                // feedback
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Write("\nSimConnectManager: ");
                Console.ResetColor();
                Console.Write($"Processing SimConnect data : '{existingItem.LocalSimRequestType}' \n");

                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Write("\nSimConnectManager: ");
                Console.ResetColor();
                Console.Write($"Requested new SimConnect data : '{existingItem.LocalSimRequestType}' \n");

                // request new SimConnect data for next API request (so always reporting one tick behind)
                Program.simConnectManager.RequestSimData(existingItem.LocalSimRequestType, SimConnectManager.DataStructName.SimDataAircraft);

                break;
            }
            }

            return(OKCode.ItemFound);
        }
Exemplo n.º 40
0
 public void Insert(Employee employee, Aircraft aircraft = null, byte columnNumber = 0)
 {
     SqlMidlandsFly.Instance.AddCommand(InsertCmd(employee, aircraft));
 }
Exemplo n.º 41
0
Arquivo: ATLB.cs Projeto: jecus/Cas
 /// <summary>
 /// Создает бортовой журнал и привязывает его к указанному ВС
 /// </summary>
 public ATLB(Aircraft parentAircraft) : this()
 {
     ParentAircraftId = parentAircraft.ItemId;
 }
Exemplo n.º 42
0
        /// <summary>
        /// Заполняет краткую информацию о директиве
        /// </summary>
        private void UpdateInformation()
        {
            if ((_currentOutOfPhase == null) || _currentOutOfPhase.ParentBaseComponent == null)
            {
                return;
            }
            Aircraft aircraft = GlobalObjects.AircraftsCore.GetParentAircraft(_currentOutOfPhase);

            labelDirectiveValue.Text     = _currentOutOfPhase.Title + " for";
            labelDescriptionValue.Text   = _currentOutOfPhase.Description;
            labelEffectiveDateValue.Text = Convert.GetDateFormat(_currentOutOfPhase.Threshold.EffectiveDate);
            labelSBValue.Text            = _currentOutOfPhase.ServiceBulletinNo;
            labelEOValue.Text            = _currentOutOfPhase.EngineeringOrders;
            labelATAChapterValue.Text    = _currentOutOfPhase.ATAChapter.ToString();
            labelApplicabilityValue.Text = "";//_currentOutOfPhase.Applicability;
            linkDetailInfoFirst.Text     = aircraft.RegistrationNumber;
            labelRemarksLast.Text        = "";
            if (CurrentAircraft != null)
            {
                linkDirectiveStatus.Text = BackLinkText;
            }

            GlobalObjects.PerformanceCalculator.GetNextPerformance(_currentOutOfPhase);
            if (_currentOutOfPhase.Remains != null && _currentOutOfPhase.Condition != ConditionState.NotEstimated)
            {
                if (_currentOutOfPhase.Remains.IsOverdue() && _currentOutOfPhase.Condition == ConditionState.Overdue)
                {
                    labelRemains.Text           = "Overdue:";
                    imageLinkLabelStatus.Status = Statuses.NotSatisfactory;
                }
                else if (_currentOutOfPhase.Condition == ConditionState.Notify)
                {
                    labelRemains.Text           = "Remains:";
                    imageLinkLabelStatus.Status = Statuses.Notify;
                }
                else if (_currentOutOfPhase.Condition == ConditionState.Satisfactory)
                {
                    labelRemains.Text           = "Remains:";
                    imageLinkLabelStatus.Status = Statuses.Satisfactory;
                }
                else
                {
                    labelRemains.Text           = "Remains:";
                    imageLinkLabelStatus.Status = Statuses.NotActive;
                }
            }
            imageLinkLabelStatus.Text = _currentOutOfPhase.WorkType.ToString();

            labelRemainsValue.Text = "";

            if (_currentOutOfPhase.Remains != null)
            {
                labelRemainsValue.Text = _currentOutOfPhase.Remains.ToString();
            }


            labelCostValue.Text     = _currentOutOfPhase.Cost.ToString();
            labelManHoursValue.Text = _currentOutOfPhase.ManHours.ToString();
            labelKitValue.Text      = _currentOutOfPhase.KitRequired == "" ? "N" : _currentOutOfPhase.KitRequired;
            labelNDTvalue.Text      = _currentOutOfPhase.NDTType.ShortName;
            labelRemarksValue.Text  = _currentOutOfPhase.Remarks;

            labelHiddenRemarksValue.Text = "";
            if (labelHiddenRemarksValue.Text == "")
            {
                labelHiddenRemarksValue.Text = "No Important information"; // labelHiddenRemarks.Visible = false;
            }
            labelDateLast.Text            = "";
            labelAircraftTsnCsnLast.Text  = "";
            labelDateNext.Text            = "n/a";
            labelAircraftTsnCsnNext.Text  = "n/a";
            labelComponentTsnCsnNext.Text = "n/a";
            labelRemarksValue.Text        = "";


            var parentBaseComponent = _currentOutOfPhase.ParentBaseComponent;

            if (_currentOutOfPhase.LastPerformance != null)
            {
                labelDateLast.Text = Convert.GetDateFormat(_currentOutOfPhase.LastPerformance.RecordDate);

                if (!_currentOutOfPhase.LastPerformance.OnLifelength.IsNullOrZero())
                {
                    labelComponentTsnCsnLast.Text = _currentOutOfPhase.LastPerformance.OnLifelength.ToString();

                    labelAircraftTsnCsnLast.Text =
                        GlobalObjects.CasEnvironment.Calculator.
                        GetFlightLifelengthOnEndOfDay(parentBaseComponent, _currentOutOfPhase.LastPerformance.RecordDate).ToString();
                }
            }

            ///////////////////////////////////////////////////////////////////////////////////////////////
            labelFirstPerformanceValue.Text = "n/a";
            labelRptIntervalValue.Text      = "n/a";

            if (_currentOutOfPhase.Threshold.FirstPerformanceSinceNew != null &&
                !_currentOutOfPhase.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
            {
                labelFirstPerformanceValue.Text = "s/n: " + _currentOutOfPhase.Threshold.FirstPerformanceSinceNew;
            }

            if (_currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate != null &&
                !_currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero())
            {
                if (labelFirstPerformanceValue.Text != "n/a")
                {
                    labelFirstPerformanceValue.Text += " or ";
                }
                else
                {
                    labelFirstPerformanceValue.Text = "";
                }
                labelFirstPerformanceValue.Text += "s/e.d: " + _currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate;
            }

            if (_currentOutOfPhase.Threshold.RepeatInterval != null)
            {
                labelRptIntervalValue.Text = _currentOutOfPhase.Threshold.RepeatInterval.IsNullOrZero()
                                                 ? "n/a"
                                                 : _currentOutOfPhase.Threshold.RepeatInterval.ToString();
            }
            ////////////////////////////////////////////////////////////////////////////////////////////////
            labelRemarksValue.Text = _currentOutOfPhase.Remarks;


            if (_currentOutOfPhase.IsClosed)
            {
                return;                             //если директива принудительно закрыта пользователем
            }
            //то вычисление следующего выполнения не нужно


            labelDateNext.Text = labelAircraftTsnCsnNext.Text = "n/a";
            if (_currentOutOfPhase.LastPerformance == null)
            {
                if (_currentOutOfPhase.Threshold.PerformSinceNew &&
                    _currentOutOfPhase.Threshold.FirstPerformanceSinceNew != null &&
                    !_currentOutOfPhase.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    //если наработка исчисляется с момента выпуска
                    if (_currentOutOfPhase.Threshold.FirstPerformanceSinceNew.Days != null)
                    {
                        //если в первом выполнении заданы дни
                        //то выводится точная дата следующего выполнения
                        labelDateNext.Text =
                            Convert.GetDateFormat(
                                parentBaseComponent.ManufactureDate.AddDays(
                                    (double)_currentOutOfPhase.Threshold.FirstPerformanceSinceNew.Days)) +
                            " s/n";
                    }
                    else
                    {
                        //иначе, если (дополнительно) дата не определена
                        labelDateNext.Text = "n/a";
                    }
                    labelComponentTsnCsnNext.Text = "s/n: " + _currentOutOfPhase.Threshold.FirstPerformanceSinceNew;
                    //labelAircraftTsnCsnNext.Text = "s/n: " + currentDirective.Threshold.SinceNew.ToString();
                }


                if (_currentOutOfPhase.Threshold.PerformSinceEffectiveDate &&
                    _currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate != null &&
                    !_currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero())
                {
                    //если наработка исчисляется с эффективной даты

                    //Определение даты исполнения
                    if (_currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate.Days != null)
                    {
                        //если в первом выполнении заданы дни
                        //то выводится точная дата следующего выполнения
                        if (labelDateNext.Text != "n/a")
                        {
                            labelDateNext.Text += " or ";
                        }
                        else
                        {
                            labelDateNext.Text = "";
                        }


                        labelDateNext.Text +=
                            Convert.GetDateFormat(
                                _currentOutOfPhase.Threshold.EffectiveDate.AddDays
                                    ((double)_currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate.Days)) + " s/e.d.";
                    }
                    else
                    {
                        //иначе, дату определить нельзя
                        if (labelDateNext.Text == "")
                        {
                            labelDateNext.Text = "n/a";
                        }
                    }


                    //Определение наработки
                    if (_currentOutOfPhase.Threshold.EffectiveDate < DateTime.Today)
                    {
                        Lifelength sinceEffDate =
                            GlobalObjects.CasEnvironment.Calculator.
                            GetFlightLifelengthOnEndOfDay(parentBaseComponent, _currentOutOfPhase.Threshold.EffectiveDate);
                        sinceEffDate.Add(_currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate);
                        sinceEffDate.Resemble(_currentOutOfPhase.Threshold.FirstPerformanceSinceEffectiveDate);

                        if (labelComponentTsnCsnNext.Text != "n/a")
                        {
                            labelComponentTsnCsnNext.Text += " or ";
                        }
                        else
                        {
                            labelComponentTsnCsnNext.Text = "";
                        }
                        labelComponentTsnCsnNext.Text += "s/e.d: " + sinceEffDate;
                    }
                }
            }
            else
            {
                if (_currentOutOfPhase.Threshold.PerformRepeatedly &&
                    _currentOutOfPhase.Threshold.RepeatInterval != null)
                {
                    //повторяющаяся директива
                    //если есть последнне выполнение, то следующая дата расчитывается
                    //по повторяющемуся интервалу
                    if (_currentOutOfPhase.Threshold.RepeatInterval.Days != null)
                    {
                        //если в первом выполнении заданы дни
                        //то выводится точная дата следующего выполнения
                        labelDateNext.Text =
                            Convert.GetDateFormat(
                                _currentOutOfPhase.LastPerformance.RecordDate.AddDays(
                                    (double)_currentOutOfPhase.Threshold.RepeatInterval.Days));
                    }
                    else
                    {
                        //иначе, точную дату выполнения расчитать нельзя
                        labelDateNext.Text            = "n/a";
                        labelComponentTsnCsnNext.Text = "n/a";
                    }

                    //Определение наработки
                    if (!_currentOutOfPhase.Threshold.RepeatInterval.IsNullOrZero())
                    {
                        Lifelength nextTsnCsn;
                        if (!_currentOutOfPhase.LastPerformance.OnLifelength.IsNullOrZero())
                        {
                            nextTsnCsn = new Lifelength(_currentOutOfPhase.LastPerformance.OnLifelength);
                        }
                        else
                        {
                            nextTsnCsn = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnEndOfDay(parentBaseComponent,
                                                                                                               _currentOutOfPhase.
                                                                                                               LastPerformance.
                                                                                                               RecordDate);
                        }
                        Lifelength nextAircraftTsnCsn = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnEndOfDay(
                            parentBaseComponent,
                            _currentOutOfPhase.
                            LastPerformance.
                            RecordDate);

                        nextTsnCsn.Add(_currentOutOfPhase.Threshold.RepeatInterval);
                        nextTsnCsn.Resemble(_currentOutOfPhase.Threshold.RepeatInterval);
                        labelComponentTsnCsnNext.Text = nextTsnCsn.ToString();

                        nextAircraftTsnCsn.Add(_currentOutOfPhase.Threshold.RepeatInterval);
                        nextAircraftTsnCsn.Resemble(_currentOutOfPhase.Threshold.RepeatInterval);
                        labelAircraftTsnCsnNext.Text = nextAircraftTsnCsn.ToString();

                        if (labelComponentTsnCsnNext.Text == "")
                        {
                            labelComponentTsnCsnNext.Text = "n/a";
                        }
                        if (labelAircraftTsnCsnNext.Text == "")
                        {
                            labelAircraftTsnCsnNext.Text = "n/a";
                        }
                    }
                    else
                    {
                        labelComponentTsnCsnNext.Text = "n/a";
                    }
                }
            }
        }
 private static void TestAirCraftEngine()
 {
     // No adapter
     Console.WriteLine("Experiment 1: test the aircraft engine");
     IAircraft aircraft = new Aircraft();
     aircraft.TakeOff();
     if (aircraft.Airborne)
         Console.WriteLine("The aircraft engine is fine, flying at " + aircraft.Height + "metres");
 }
Exemplo n.º 44
0
 public HeliFly(Actor self, Target target)
 {
     helicopter  = self.Trait <Aircraft>();
     this.target = target;
 }
        private Aircraft createAircraft(uint addr)
        {
            Aircraft aircraft = new Aircraft();
            aircraft.addr = addr;

            return aircraft;
        }
Exemplo n.º 46
0
 /// <summary>
 /// Отображение директив для всего ВС
 /// </summary>
 /// <param name="currentItem">ВС, для которого отображаются директивы</param>
 public DispatcheredDamageDirectiveListScreen(Aircraft currentItem) : base(currentItem, null)
 {
 }
Exemplo n.º 47
0
		public FlyCircle(Actor self)
		{
			plane = self.Trait<Aircraft>();
			cruiseAltitude = plane.Info.CruiseAltitude;
		}
 // Use this for initialization
 public void Start()
 {
     WingBoxCollider = (BoxCollider)gameObject.collider;
     Parent = transform.root.gameObject.GetComponent<Rigidbody>();
     ParentAircraft = transform.root.gameObject.GetComponent<Aircraft>();
     AttachedControlSurface = gameObject.GetComponent<ControlSurface>();
     AttachedPropWash = gameObject.GetComponent<PropWash>();
     AttachedGroundEffect = gameObject.GetComponent<GroundEffect>();
 }
Exemplo n.º 49
0
 protected void AircraftUpdated(object sender, EventArgs e)
 {
     Aircraft.SaveLastTail(MfbEditAircraft1.AircraftID);
     Response.Redirect(!String.IsNullOrEmpty(hdnReturnURL.Value) ? hdnReturnURL.Value : "Aircraft.aspx");
 }
Exemplo n.º 50
0
 public AllowYieldingReservation(Actor self)
 {
     aircraft = self.Trait<Aircraft>();
 }
Exemplo n.º 51
0
 public HeliFlyCircle(Actor self)
 {
     helicopter = self.Trait<Aircraft>();
 }
Exemplo n.º 52
0
 public FlyOffMap(Actor self, int endingDelay = 25)
 {
     aircraft         = self.Trait <Aircraft>();
     ChildHasPriority = false;
     this.endingDelay = endingDelay;
 }
        /// <summary>
        /// Calculates total C_L of the aircraft, taking into account flaps, wings, and horizontal stabilizers
        /// </summary>
        /// <param name="aircraft">Aircraft type to evaluate</param>
        /// <param name="alpha">Aircraft pitch in degrees</param>
        /// <param name="flaps">Flap extension in the interval [0, 1] to indicate 0-100% flap extension</param>
        /// <returns></returns>
        public static float CalculateC_L(this Aircraft aircraft, float alpha = 0, float flaps = 0)
        {
            var combinedC_L = CalculateCombinedC_L(aircraft, alpha, flaps);

            return(combinedC_L.C_Lw + (aircraft.HorizontalStabilizer.Area / aircraft.Wing.Area) * combinedC_L.C_Lh + combinedC_L.C_Lf);
        }
Exemplo n.º 54
0
 public TakeOff(Actor self)
 {
     aircraft = self.Trait <Aircraft>();
     move     = self.Trait <IMove>();
 }
        public static float CalculateTakeoffGroundRoll(this Aircraft aircraft)
        {
            var V_TD = 1.1f * CalculateStallSpeed(aircraft);

            return(CalculateGroundRoll(aircraft, 0, V_TD, 0.7f, 0.03f));
        }
        public static float CalculateLandingGroundRoll(this Aircraft aircraft)
        {
            var V_TD = 1.15f * CalculateStallSpeed(aircraft);

            return(CalculateGroundRoll2(aircraft, 0, V_TD, 1f, 0.3f, 0.1f));
        }
Exemplo n.º 57
0
 public HeliFly(Actor self, Target t)
 {
     helicopter = self.Trait<Aircraft>();
     target = t;
 }
Exemplo n.º 58
0
        /// <summary>
        /// Создает элемент управления для отображения информации о ВС
        /// </summary>
        /// <param name="currentAircraft"></param>
        public AircraftGeneralDataScreen(Aircraft currentAircraft)
        {
            ((DispatcheredAircraftGeneralDataScreen)this).InitComplition += AircraftGeneralDataScreen_InitComplition;
            this.currentAircraft = currentAircraft;
            BackColor            = Css.CommonAppearance.Colors.BackColor;
            Dock = DockStyle.Fill;
            aircraftHeaderControl = new AircraftHeaderControl(currentAircraft, true, true);
            //
            // aircraftControl
            //
            aircraftControl = new AircraftControl(currentAircraft, DateTime.Now);
            //
            // powerPlantsControl
            //
            powerPlantsControl = new PowerPlantsControl(currentAircraft, DateTime.Now);
            //
            // APUControl
            //
            APUControl = new APUControl(currentAircraft.Apu, DateTime.Now);
            //
            // performanceDataControl
            //
            performanceDataControl = new PerformanceDataControl(currentAircraft);
            //
            // landingGearsControl
            //
            landingGearsControl = new LandingGearsControl(currentAircraft, DateTime.Now);
            //
            // maintenanceStatusControl
            //
            maintenanceStatusControl = new MaintenanceStatusSummaryControl(currentAircraft);
            maintenanceStatusControl.LinkLabelText            = "View Maintenance Status";
            maintenanceStatusControl.LinkLabelDisplayerText   = currentAircraft.RegistrationNumber + ". Maintenance Status";
            maintenanceStatusControl.LinkLabelRequestedEntity = new DispatcheredMaintenanceStatusControl(currentAircraft.MaintenanceDirective);
            maintenanceStatusControl.DisplayDateAsOFAndTSNCSN = false;
            maintenanceStatusControl.DisplayLimitations();
            //maintenanceStatusControl.DisplayLimitations(currentAircraft.MaintenanceDirective.Limitations);
            //
            // interiorConfigurationControl
            //
            interiorConfigurationControl = new InteriorConfigurationControl(currentAircraft);
            //
            // otherControl
            //
            otherControl = new OtherControl(currentAircraft);

/*            //
 *          // maintenancePanel
 *          //
 *          maintenancePanel.AutoSize = true;
 *          maintenancePanel.Controls.Add(maintenanceStatusControl);
 *          maintenancePanel.Controls.Add(maintenanceLink);
 *          //
 *          // maintenanceLink
 *          //
 *          maintenanceLink.AutoSize = true;
 *          maintenanceLink.Font = Css.SimpleLink.Fonts.Font;
 *          maintenanceLink.LinkColor = Css.SimpleLink.Colors.LinkColor;
 *          maintenanceLink.Location = new Point(maintenanceStatusControl.Left, maintenanceStatusControl.Bottom + 10);
 *          maintenanceLink.ReflectionType = ReflectionTypes.DisplayInNew;
 *          maintenanceLink.Text = "View Maintenance Status";
 *          maintenanceLink.DisplayerRequested += maintenanceLink_DisplayerRequested;*/
            //
            // aircraftContainer
            //
            aircraftContainer.Caption       = "A. Aircraft";
            aircraftContainer.UpperLeftIcon = icons.GrayArrow;
            aircraftContainer.MainControl   = aircraftControl;
            aircraftContainer.Dock          = DockStyle.Top;
            aircraftContainer.TabIndex      = 0;
            //
            // powerPlantsContainer
            //
            powerPlantsContainer.Caption       = "B. Power Plants";
            powerPlantsContainer.UpperLeftIcon = icons.GrayArrow;
            powerPlantsContainer.MainControl   = powerPlantsControl;
            powerPlantsContainer.Dock          = DockStyle.Top;
            powerPlantsContainer.Extended      = false;
            powerPlantsContainer.TabIndex      = 1;
            //
            // APUContainer
            //
            APUContainer.Caption       = "C. Auxiliary Power Unit";
            APUContainer.UpperLeftIcon = icons.GrayArrow;
            if (currentAircraft.Apu != null)
            {
                APUContainer.MainControl = APUControl;
            }
            APUContainer.Dock     = DockStyle.Top;
            APUContainer.Extended = false;
            APUContainer.TabIndex = 2;
            //
            // performanceDataContainer
            //
            performanceDataContainer.Caption       = "D. Performance Data";
            performanceDataContainer.UpperLeftIcon = icons.GrayArrow;
            performanceDataContainer.MainControl   = performanceDataControl;
            performanceDataContainer.Dock          = DockStyle.Top;
            performanceDataContainer.Extended      = false;
            performanceDataContainer.TabIndex      = 3;
            //
            // landingGearsContainer
            //
            landingGearsContainer.Caption       = "E. Landing Gears";
            landingGearsContainer.UpperLeftIcon = icons.GrayArrow;
            landingGearsContainer.MainControl   = landingGearsControl;
            landingGearsContainer.Dock          = DockStyle.Top;
            landingGearsContainer.Extended      = false;
            landingGearsContainer.TabIndex      = 4;
            //
            // maintenanceStatusContainer
            //
            maintenanceStatusContainer.Caption       = "F. Maintenance Status";
            maintenanceStatusContainer.UpperLeftIcon = icons.GrayArrow;
            //maintenanceStatusContainer.MainControl = maintenancePanel;
            maintenanceStatusContainer.MainControl = maintenanceStatusControl;
            maintenanceStatusContainer.Dock        = DockStyle.Top;
            maintenanceStatusContainer.Extended    = false;
            maintenanceStatusContainer.TabIndex    = 5;
            //
            // interiorConfigurationContainer
            //
            interiorConfigurationContainer.Caption       = "G. Interior Configuration";
            interiorConfigurationContainer.UpperLeftIcon = icons.GrayArrow;
            interiorConfigurationContainer.MainControl   = interiorConfigurationControl;
            interiorConfigurationContainer.Dock          = DockStyle.Top;
            interiorConfigurationContainer.Extended      = false;
            interiorConfigurationContainer.TabIndex      = 6;
            //
            // otherContainer
            //
            otherContainer.Caption       = "H. Other";
            otherContainer.UpperLeftIcon = icons.GrayArrow;
            otherContainer.MainControl   = otherControl;
            otherContainer.Dock          = DockStyle.Top;
            otherContainer.Extended      = false;
            otherContainer.TabIndex      = 7;
            //
            // headerControl
            //
            headerControl.ContextActionControl.ShowPrintButton                 = true;
            headerControl.ActionControl.ButtonEdit.TextMain                    = "Save";
            headerControl.ActionControl.ButtonEdit.Icon                        = icons.Save;
            headerControl.ActionControl.ButtonEdit.IconNotEnabled              = icons.SaveGray;
            headerControl.ActionControl.ButtonEdit.DisplayerRequested         += ButtonSave_Click;
            headerControl.ActionControl.ButtonReload.Click                    += ButtonReload_Click;
            headerControl.ContextActionControl.ButtonPrint.DisplayerRequested += PrintButton_DisplayerRequested;
            headerControl.Controls.Add(aircraftHeaderControl);
            headerControl.ActionControl.ShowEditButton = currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Update);
            headerControl.TabIndex = 0;
            headerControl.ContextActionControl.ButtonHelp.TopicID = "aircraft_general_data";
            //
            // mainPanel
            //
            mainPanel.AutoScroll = true;
            mainPanel.Dock       = DockStyle.Fill;
            mainPanel.TabIndex   = 2;

            mainPanel.Controls.Add(otherContainer);
            mainPanel.Controls.Add(interiorConfigurationContainer);
            mainPanel.Controls.Add(maintenanceStatusContainer);
            mainPanel.Controls.Add(landingGearsContainer);
            mainPanel.Controls.Add(performanceDataContainer);
            if (currentAircraft.Apu != null)
            {
                mainPanel.Controls.Add(APUContainer);
            }
            mainPanel.Controls.Add(powerPlantsContainer);
            mainPanel.Controls.Add(aircraftContainer);


            Controls.Add(mainPanel);
            Controls.Add(headerControl);
            Controls.Add(footerControl);
        }
 ///<summary>
 /// Создается объект, описывающий отображение добавления директивы
 ///</summary>
 /// <param name="parentAircraft">Родительский объект, в который добавляется директива</param>
 public DispatcheredCPCPDirectiveAddingScreen(Aircraft parentAircraft) : base(parentAircraft)
 {
 }
Exemplo n.º 60
0
        public async Task Handle(AircraftAddedToFleet message, IMessageHandlerContext context)
        {
            var aircraft = new Aircraft(message.Id);

            await _aircraftRepository.AddAircraft(aircraft);
        }