Exemplo n.º 1
0
        private void definePosition()
        {
            int mode = 1; // 0 := pointing, 1 := aiming, 2 := both
            this.calibrationHandler = new CalibrationHandler(this.SAMPLING_VECTORS, this.exhibition.getThreshold()); // Initiate calibrator
            List<GeometryHandler.Vector> vectors = sampleVectors(1, this.SAMPLING_POSITIONS, this.SAMPLING_VECTORS, mode); // Sampled vectors
            Point3D position = this.calibrationHandler.definePosition(this.exhibition.getExhibitionPlane(), vectors, this.SAMPLING_POSITIONS, mode); // Calibration-points

            switch (this.setting)
            {
                case Setting.None: // Defining or validating exhibit's position
                    if (this.headline == Headline.ExhibitDef)
                    {
                        this.TMP_POSITION = position;
                        this.contentLabel1 = this.TMP_NAME.ToUpper() + " - POSITIONSVALIDIERUNG";
                        this.contentLabel2 = this.INSTRUCTIONS_EXHIBIT;
                        this.contentButton4 = "zurück";
                        this.contentButton5 = "Start";
                        this.headline = Headline.ExhibitVal;

                        stopCalibration();
                    }
                    else if (this.headline == Headline.ExhibitVal)
                    {
                        this.TMP_POSITION_2 = position;
                        this.contentLabel1 = this.TMP_NAME.ToUpper() + " - POSITIONSBESTIMMUNG";
                        if (this.calibrationHandler.validatePoint(this.TMP_POSITION, this.TMP_POSITION_2) == 3) // All three axis are within threshold
                        {
                            this.contentLabel2 = "Position erfolgreich validiert.";
                            this.contentButton4 = "zurück";
                            this.contentButton5 = "OK";
                            this.headline = Headline.ExhibitDone;

                            stopCalibration();
                            stopTracking();
                        }
                        else
                        {
                            this.contentLabel2 = "Position konnte nicht validiert werden." + '\n' + "Erneut definieren?";
                            this.contentLabel2 += +'\n' + "1.: " + (int)this.TMP_POSITION.X + ";" + (int)this.TMP_POSITION.Y + ";" + (int)this.TMP_POSITION.Z;
                            this.contentLabel2 += +'\n' + "2.: " + (int)this.TMP_POSITION_2.X + ";" + (int)this.TMP_POSITION_2.Y + ";" + (int)this.TMP_POSITION_2.Z;
                            this.contentButton4 = "zurück";
                            this.contentButton5 = "OK";
                            this.headline = Headline.ExhibitDef;

                            stopCalibration();
                        }
                    }
                    else
                    {
                        MessageBox.Show("definePosition()-Problem: Setting.None, Headline?");

                        stopCalibration();
                        stopTracking();
                    }
                    break;
                case Setting.Position: // Re-defining exhibit's position
                    if (this.headline == Headline.ExhibitDef)
                    {
                        this.TMP_POSITION = position;
                        this.contentLabel1 = this.TMP_NAME.ToUpper() + " - POSITIONSVALIDIERUNG";
                        this.contentLabel2 = this.INSTRUCTIONS_EXHIBIT;
                        this.contentButton4 = "zurück";
                        this.contentButton5 = "Start";
                        this.headline = Headline.ExhibitVal;

                        stopCalibration();
                    }
                    else if (this.headline == Headline.ExhibitVal)
                    {
                        this.TMP_POSITION_2 = position;
                        this.contentLabel1 = this.TMP_NAME.ToUpper() + " - POSITIONSBESTIMMUNG";
                        if (this.calibrationHandler.validatePoint(this.TMP_POSITION, this.TMP_POSITION_2) == 3) // All three axis are within threshold
                        {
                            this.contentLabel2 = "Position erfolgreich validiert.";
                            this.contentButton4 = "zurück";
                            this.contentButton5 = "OK";
                            this.headline = Headline.ExhibitDone;

                            stopCalibration();
                            stopTracking();
                        }
                        else
                        {
                            this.contentLabel2 = "Position konnte nicht validiert werden." + '\n' + "Erneut definieren?";
                            this.contentLabel2 += + '\n' + "1.: " + (int)this.TMP_POSITION.X + ";" + (int)this.TMP_POSITION.Y + ";" + (int)this.TMP_POSITION.Z;
                            this.contentLabel2 += + '\n' + "2.: " + (int)this.TMP_POSITION_2.X + ";" + (int)this.TMP_POSITION_2.Y + ";" + (int)this.TMP_POSITION_2.Z;
                            this.contentButton4 = "zurück";
                            this.contentButton5 = "OK";
                            this.headline = Headline.ExhibitDef;

                            stopCalibration();
                        }
                    }
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 2
0
        private void definePlane()
        {
            int mode = 2; // 0 := pointing, 1 := aiming, 2 := both
            this.calibrationHandler = new CalibrationHandler(this.SAMPLING_VECTORS); // Initiate calibrator
            List<GeometryHandler.Vector> vectors = sampleVectors(this.SAMPLING_POINTS, this.SAMPLING_POSITIONS, this.SAMPLING_VECTORS, mode); // Sampled vectors
            List<Point3D> corners = this.calibrationHandler.definePlane(vectors, this.SAMPLING_POSITIONS, mode); // Calibration-points

            switch (this.headline)
            {
                case Headline.ExhibitionPlaneDef:
                    this.TMP_EXHIBITION_PLANE = new GeometryHandler.Plane(corners);

                    this.contentLabel1 = this.TMP_NAME.ToUpper() + " - EBENENVALIDIERUNG";
                    this.contentLabel2 = this.INSTRUCTIONS_EXHIBITION_PLANE;
                    this.contentButton4 = "zurück";
                    this.contentButton5 = "Start";
                    this.headline = Headline.ExhibitionPlaneVal;

                    stopCalibration();
                    break;
                case Headline.ExhibitionPlaneVal:
                    this.TMP_EXHIBITION_PLANE_2 = new GeometryHandler.Plane(corners);

                    this.contentLabel1 = this.TMP_NAME.ToUpper() + " - EBENENBESTIMMUNG";
                    if (this.calibrationHandler.validatePlane(this.TMP_EXHIBITION_PLANE, this.TMP_EXHIBITION_PLANE_2))
                    {
                        this.exhibition = new Exhibition(this.TMP_NAME, this.calibrationHandler.makePlane(this.TMP_EXHIBITION_PLANE, this.TMP_EXHIBITION_PLANE_2));

                        this.contentLabel2 = "Eckpunkte erfolgreich validiert.";
                        this.contentButton4 = "zurück";
                        this.contentButton5 = "OK";
                        this.headline = Headline.ExhibitionPlaneDone;

                        stopCalibration();
                        stopTracking();
                    }
                    else
                    {
                        this.contentLabel2 = "Eckpunkte konnten nicht validiert werden." + '\n' + '\n' + "Erneut definieren?";
                        this.contentButton4 = "zurück";
                        this.contentButton5 = "OK";
                        this.headline = Headline.ExhibitionPlaneDef;

                        stopCalibration();
                    }

                    break;
                default:
                    MessageBox.Show("definePlane()-Problem!");
                    break;
            }
        }