Exemplo n.º 1
0
        public void Load(System.IO.StreamReader sr)
        {
            clsPoint3d p1;

            //var version = myPGLoadedVersion.Split('.');
            //var nLoadedVersionMajor = version.Count() >= 1 ? Convert.ToInt32(version[0]) : 0;
            //var nLoadedVersionMinor = version.Count() >= 2 ? Convert.ToInt32(version[1]) : 0;

            while (sr.EndOfStream == false)
            {
                var myLine = sr.ReadLine();
                if (myLine == "END_MARKER_POINT_SETTINGS")
                {
                    break;
                }
                if (myLine.IndexOf(",") > -1)
                {
                    var mySplit = myLine.Split(',');
                    if (mySplit.GetUpperBound(0) == 1)
                    {
                        if (mySplit[0] == "MarkerID")
                        {
                            myMarkerID = Convert.ToInt32(mySplit[1]);
                        }
                        if (mySplit[0] == "SeenFromMarkerID")
                        {
                            mySeenFromMarkerID = Convert.ToInt32(mySplit[1]);
                        }
                        if (mySplit[0] == "SeenFromMarkerIDs")
                        {
                            mySeenFromMarkerIDs.Add(Convert.ToInt32(mySplit[1]));
                        }
                        if (mySplit[0] == "ActualMarkerID")
                        {
                            myActualMarkerID = Convert.ToInt32(mySplit[1]);
                        }
                        if (mySplit[0] == "VerticalVectorX")
                        {
                            if (myVerticalVect == null)
                            {
                                myVerticalVect = new clsPoint3d();
                            }
                            myVerticalVect.X = Convert.ToDouble(mySplit[1]);
                        }
                        if (mySplit[0] == "VerticalVectorY")
                        {
                            if (myVerticalVect == null)
                            {
                                myVerticalVect = new clsPoint3d();
                            }
                            myVerticalVect.Y = Convert.ToDouble(mySplit[1]);
                        }
                        if (mySplit[0] == "VerticalVectorZ")
                        {
                            if (myVerticalVect == null)
                            {
                                myVerticalVect = new clsPoint3d();
                            }
                            myVerticalVect.Z = Convert.ToDouble(mySplit[1]);
                        }
                        if (mySplit[0] == "BulkheadHeight")
                        {
                            BulkheadHeight = Convert.ToDouble(mySplit[1]);
                        }
                        if (mySplit[0] == "Confirmed")
                        {
                            _confirmed = (mySplit[1] == "1");
                        }
                    }
                }
            }

            if (mySeenFromMarkerIDs.Contains(mySeenFromMarkerID) == false)
            {
                mySeenFromMarkerIDs.Add(mySeenFromMarkerID);
            }

            myOrigin.Load(sr);
            myEndXAxis.Load(sr);
            myEndYAxis.Load(sr);
            myPoint.Load(sr);
            VX.Load(sr);
            VY.Load(sr);
            VZ.Load(sr);

            var n = Convert.ToInt32(sr.ReadLine());

            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                myCameraPoints.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                mySeenFromCameraPoints.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                myPts1.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                myPts2.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                myPts3.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                GyroData.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                LastGyroData.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                AccelData.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                p1 = new clsPoint3d();
                p1.Load(sr);
                LastAccelData.Add(p1);
            }

            n = Convert.ToInt32(sr.ReadLine());
            for (var i = 1; i <= n; i++)
            {
                var myHistoricPoint = new clsMarkerPoint();
                myHistoricPoint.Load(sr);
                myHistory.Add(myHistoricPoint);
            }
        }
Exemplo n.º 2
0
        public clsMarkerPoint Copy(bool includeConfirmedFlag = false, bool avoidHistory = false)
        {
            clsMarkerPoint myCopy = new clsMarkerPoint();
            int            i;

            myCopy.MarkerID         = myMarkerID;
            myCopy.SeenFromMarkerID = mySeenFromMarkerID;
            myCopy.ActualMarkerID   = myActualMarkerID;
            myCopy.Origin           = myOrigin;
            myCopy.XAxisPoint       = myEndXAxis;
            myCopy.YAxisPoint       = myEndYAxis;
            myCopy.Point            = myPoint?.Copy();
            myCopy.VX = VX;
            myCopy.VY = VY;
            myCopy.VZ = VZ;
            if (includeConfirmedFlag)
            {
                myCopy.SetConfirmedFlag(_confirmed);
            }

            foreach (int myID in mySeenFromMarkerIDs)
            {
                myCopy.SeenFromMarkerIDs.Add(myID);
            }
            foreach (clsPoint3d p1 in myCameraPoints)
            {
                myCopy.CameraPoints.Add(p1.Copy());
            }
            foreach (clsPoint3d p1 in mySeenFromCameraPoints)
            {
                myCopy.SeenFromCameraPoints.Add(p1.Copy());
            }
            foreach (clsPoint3d p1 in myPts1)
            {
                myCopy.OriginPoints.Add(p1.Copy());
            }
            foreach (clsPoint3d p1 in myPts2)
            {
                myCopy.EndXAxisPoints.Add(p1.Copy());
            }
            foreach (clsPoint3d p1 in myPts3)
            {
                myCopy.EndYAxisPoints.Add(p1.Copy());
            }

            for (i = 0; i <= 15; i++)
            {
                myCopy.ModelViewMatrix[i] = myModelViewMatrix[i];
            }

            for (i = 0; i < GyroData.Count; i++)
            {
                myCopy.GyroData.Add(GyroData[i]?.Copy());
            }
            for (i = 0; i < LastGyroData.Count; i++)
            {
                myCopy.LastGyroData.Add(LastGyroData[i]?.Copy());
            }
            for (i = 0; i < AccelData.Count; i++)
            {
                myCopy.AccelData.Add(AccelData[i]?.Copy());
            }
            for (i = 0; i < LastAccelData.Count; i++)
            {
                myCopy.LastAccelData.Add(LastAccelData[i]?.Copy());
            }
            if (myVerticalVect != null)
            {
                myCopy.VerticalVect = myVerticalVect.Copy();
            }

            myCopy.BulkheadHeight = BulkheadHeight;


            if (!avoidHistory)
            {
                foreach (clsMarkerPoint myHistoricPoint in myHistory)
                {
                    myCopy.History.Add(myHistoricPoint.Copy());
                }
            }

            return(myCopy);
        }