Exemple #1
0
        private void btnRightArrow_Click(object sender, EventArgs e)
        {
            currentFlightLine++;
            if (currentFlightLine == ps.msnSum[missionNumber].numberOfFlightlines) currentFlightLine = 0;

            currentFlightLineChanged = true;

            this.lblFlightLine.Text = currentFlightLine.ToString("D2");
            currentFlightlineIsOpen = false; // becomes true when we capture it
            FLGeometry = new CurrentFlightLineGeometry(missionNumber, currentFlightLine, ps, priorFlownFLs);  //Right arrow
            semiInfiniteFlightLineStartPix = GeoToPix(FLGeometry.semiInfiniteFLstartGeo);
            semiInfiniteFlightLineEndPix = GeoToPix(FLGeometry.semiInfiniteFLendGeo);
            FlightLineStartPix = GeoToPix(FLGeometry.FLstartGeo);
            FlightLineEndPix = GeoToPix(FLGeometry.FLendGeo);
        }
Exemple #2
0
        private void flightLineUpdate()
        {
            //mark this line as successful so its colored green
            priorFlownFLs[currentFlightLine] = true;

            //write out the status of this flight line;
            reflyFile.WriteLine("flightlineStatus   " + currentFlightLine.ToString("D3") + "   success");

            //treatment of last flight line in a mission
            if (currentFlightLine == (ps.msnSum[missionNumber].numberOfFlightlines-1) )
            {
                //what do we do if we complete the last flight line???
                //  (1) if we are in the sim -- go back to flightline zero
                //  (2) if we are flying, reset to an incompleted line
                currentFlightLine = -1;   //this is incremented +1 below to get back to FL=0 at the end
            }

            logFile.WriteLine("");
            logFile.WriteLine(" end of flight line event ");
            logFile.WriteLine("");

            priorFlightLine = currentFlightLine;

            //increment to the next unflown flight line
            currentFlightLine++;
            while (priorFlownFLs[currentFlightLine])
            {
                if (currentFlightLine == priorFlownFLs.Count() - 1)
                {
                    currentFlightLine = 0;
                    break;
                }
                currentFlightLine++;
            }

            //
            inturnOutSegment = true;

            Console.WriteLine(" flight line incremented:  " + priorFlightLine.ToString() + "   " + currentFlightLine.ToString());

            currentFlightLineChanged = true;  //repaints the current flight line on the map display
            //display the next flight line
            this.lblFlightLine.Text = currentFlightLine.ToString("D2");

            //get the flightline geometry for this next flightline
            FLGeometry = new CurrentFlightLineGeometry(missionNumber, currentFlightLine, ps, priorFlownFLs); //from mission prepMissionDisplay
            FLGeometry.getPlatformToFLGeometry(platFormPosVel);

            //flightlne endpoints in pixel units
            semiInfiniteFlightLineStartPix = GeoToPix(FLGeometry.semiInfiniteFLstartGeo);
            semiInfiniteFlightLineEndPix = GeoToPix(FLGeometry.semiInfiniteFLendGeo);
            FlightLineStartPix = GeoToPix(FLGeometry.FLstartGeo);
            FlightLineEndPix = GeoToPix(FLGeometry.FLendGeo);
        }
Exemple #3
0
        private void setupPolygonMission()
        {
            //////////////////////////////////////////////
            // called from btn_OK_clicked ...
            //////////////////////////////////////////////

            //determine the first flight line that is non-zero length (has an image)
            currentFlightLine = 0;
            for (int i = 0; i < ps.msnSum[missionNumber].FlightLinesCurrentPlan.Count; i++)
                if (!priorFlownFLs[i])  //test for the first unflown flight line
                {
                    currentFlightLine = i;   //set the first flight line for polygon coverage
                    break;
                }

            this.lblFlightLine.Text = currentFlightLine.ToString("D2");

            currentFlightlineIsOpen = false; // becomes true when we capture it

            //need to redo this for a linear feature ..
            //returns the semi-infinite line used to set up for capturing this flight line
            FLGeometry = new CurrentFlightLineGeometry(missionNumber, currentFlightLine, ps, priorFlownFLs);  //from Mission BtnClick

            //panel1 is for the right-left FL increment arrows
            this.panel1.Visible = false;

            //pre-load the crumbtrail array prior to the start point
            for (int i = 0; i < numberCrumbTrailPoints; i++) crumbTrail[i] = GeoToPix(platFormPosVel.GeodeticPos);

            this.lblFlightAlt.Visible = false;
            this.lblFlightLines.Visible = false;
            this.lblMissionNumber.Visible = false;
            btnOK.Visible = false;  //dont need this anymore --- reset to visible if we return to a selected mission

            btnBack.Text = "EXIT"; // this is a better name because we exit the realtime mission and return to the mission selection Form
            //note we can exit a mission in the middle of a line and renter the mission at the exited point.

            /////////////////////////////////////////////////////////////////////////////
            //determine the aircraft platform starting point for a simulated mission
            /////////////////////////////////////////////////////////////////////////////
            if (simulatedMission)
            {
                //set the start position 1.0 mile from the start and offset by 0.25mi
                //constant velocity will be along the start-to-end flight line

                double startDistanceBeforeFlightline = 1.0;  //miles
                double offsetDistance = 0.25;  //miles
                double startUTMX = FLGeometry.FLstartUTM.X
                    - startDistanceBeforeFlightline * 5280 * 0.3048 * FLGeometry.start2EndFlightLineUnit.X
                    - offsetDistance * 5280 * 0.3048 * FLGeometry.start2EndFlightLineUnit.Y;
                double startUTMY = FLGeometry.FLstartUTM.Y
                    - startDistanceBeforeFlightline * 5280 * 0.3048 * FLGeometry.start2EndFlightLineUnit.Y
                    + offsetDistance * 5280 * 0.3048 * FLGeometry.start2EndFlightLineUnit.X;

                PointD startGeo = new PointD();

                utm.UTMtoLL(new PointD(startUTMX, startUTMY), ps.UTMZone, ref startGeo);

                //uncomment below code to start the sim at the center of the project map --- tests the zoomed out capability.
                //startGeo.X = (ps.ProjectImage.eastDeg + ps.ProjectImage.westDeg)/2.0;
                //startGeo.Y = (ps.ProjectImage.northDeg + ps.ProjectImage.southDeg) / 2.0;
                //utm.LLtoUTM(startGeo.Y * Deg2Rad, startGeo.X * Deg2Rad, ref startUTMY, ref startUTMX, ref ps.UTMZone, true);

                platFormPosVel.UTMPos.X = startUTMX;
                platFormPosVel.UTMPos.Y = startUTMY;
                platFormPosVel.GeodeticPos = startGeo;

                //////////////////////////////////////////////////////////
                speed = 51.4;   // 100 knots
                //////////////////////////////////////////////////////////

                //sim uses heading as a state -- velE and VelN are computed from heading and speed
                heading = Math.Atan2(FLGeometry.start2EndFlightLineUnit.X, FLGeometry.start2EndFlightLineUnit.Y);

                platFormPosVel.velD = 0.0;
                platFormPosVel.velE = speed * Math.Sin(heading);
                platFormPosVel.velN = speed * Math.Cos(heading);
            }
        }