Exemplo n.º 1
0
 private void DrawGraph(ToothPolygon polygon)
 {
     if (polygon != null)
     {
         polygon.DrawGraph(DrawPoint, DrawLine);
     }
 }
Exemplo n.º 2
0
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            this.CB_N7.IsChecked = sender == CB_N7;
            this.CB_N8.IsChecked = sender == CB_N8;
            this.CB_Bone.IsChecked = sender == CB_Bone;

            if (sender == CB_N7)
            {
                setLastEdgeForSwitchedPolygon(_polygon);
                //_toothSet.ProblemTooth = this._polygon;
                saveCurrentPolygon(prevoiusMode);

                this._polygon = this._toothSet.NormalTooth;
                //this._polygon.MaxPoligonPointsNumber = ToothSet.MaxNormalToothPointsCount;

                //cnvGraph.Children.Clear();

                DrawAllPolygons(false);
                _selectedPoint = _polygon.LastSetEdge;

            }
            else if (sender == CB_N8)
            {

                setLastEdgeForSwitchedPolygon(_polygon);

                //_toothSet.NormalTooth = this._polygon;
                saveCurrentPolygon(prevoiusMode);

                this._polygon = this._toothSet.ProblemTooth;
                //this._polygon.MaxPoligonPointsNumber = ToothSet.MaxProblemToothPointsCount;

                DrawAllPolygons(false);
                _selectedPoint = _polygon.LastSetEdge;

            }
            else if (sender == CB_Bone)
            {
                setLastEdgeForSwitchedPolygon(_polygon);
                //_toothSet.NormalTooth = this._polygon;
                saveCurrentPolygon(prevoiusMode);

                this._polygon = this._toothSet.BoneEdge;
                //this._polygon.MaxPoligonPointsNumber = ToothSet.MaxBonePointsCount;

                DrawAllPolygons(false);
                _selectedPoint = _polygon.LastSetEdge;
            }
        }
Exemplo n.º 3
0
 private void setLastEdgeForSwitchedPolygon(ToothPolygon polygon)
 {
     if (!polygon.IsClosed)
     {
         polygon.LastSetEdge = _selectedPoint;
     }
 }
Exemplo n.º 4
0
        private void ButtonLoad_Click(object sender, RoutedEventArgs e)
        {
            string file = GetXMLFileName() + @".xml";
            ClearAuxiliaryPrimitives();
            if (!File.Exists(file))
            {
                _toothSet = new ToothSet();
                _selectedPoint = null;
                _polygon = new ToothPolygon();
                setMaxPloygonPointsCount(currentMode);
                cnvGraph.Children.Clear();
                this.CB_N7.IsChecked = false;
                this.CB_N7.IsChecked = true;
                return;
            }

            using (Stream reader = File.Open(file, FileMode.OpenOrCreate))
            {
                System.Xml.Serialization.XmlSerializer formatter =
                    new System.Xml.Serialization.XmlSerializer(_toothSet.GetType());

                try
                {
                    _toothSet = (ToothSet)formatter.Deserialize(reader);
                }
                catch {
                    MessageBox.Show("Файл з контуром для даного знімка є пошкодженим і буде перестворений.");
                }

                //shouldBeAddedEdge = true;
                _selectedPoint = null;
                _polygon = new ToothPolygon();
                _polygon.MaxPoligonPointsNumber = _toothSet.ProblemTooth.MaxPoligonPointsNumber;
                cnvGraph.Children.Clear();
                foreach (ToothPoint p in _toothSet.ProblemTooth.Points)
                {
                    AddPoint(p);
                }

                _toothSet.ProblemTooth = _polygon;

                _selectedPoint = null;
                _polygon = new ToothPolygon();
                _polygon.MaxPoligonPointsNumber = _toothSet.NormalTooth.MaxPoligonPointsNumber;
                foreach (ToothPoint p in _toothSet.NormalTooth.Points)
                {
                    AddPoint(p);
                }
                _toothSet.NormalTooth = _polygon;

                _selectedPoint = null;
                _polygon = new ToothPolygon();
                _polygon.MaxPoligonPointsNumber = _toothSet.BoneEdge.MaxPoligonPointsNumber;
                foreach (ToothPoint p in _toothSet.BoneEdge.Points)
                {
                    AddPoint(p);
                }
                _toothSet.BoneEdge = _polygon;

                _polygon = _toothSet.NormalTooth;
                //shouldBeAddedEdge = false;

                //saveActivePlygon(currentMode);
            }
        }
Exemplo n.º 5
0
        private void initializePoligonAfterLoad()
        {
            switch (currentMode)
            {
                case ActiveMode._7Tooth:
                    _polygon = _toothSet.NormalTooth;
                    break;
                case ActiveMode._8Tooth:
                    _polygon = _toothSet.ProblemTooth;
                    break;
                case ActiveMode._Bone:
                    _polygon = _toothSet.BoneEdge;
                    break;

            }
        }