コード例 #1
0
        private void FormStrain_VisibleChanged(object sender, EventArgs e)
        {
            if (this.Visible)
            {
                skipCrystalChangedEvent = true;
                CrystalControl.GenerateFromInterface();
                originalCrystal = Deep.Copy(CrystalControl.Crystal);

                SetStrainedCrystal();
                skipCrystalChangedEvent = false;
            }
            else
            {
                resetOriginalCrystal();
            }
        }
コード例 #2
0
        private void crystalControl_CrystalChanged(object sender, EventArgs e)
        {
            if (skipCrystalChangedEvent || !this.Visible)
            {
                return;
            }

            //ここが呼ばれるのは、crystalControl側が操作されて結晶が変更される場合のみ。
            //このformStrainがcrystalControlを変更する時は、その時だけこのイベントを無視する
            skipCrystalChangedEvent = true;
            CrystalControl.GenerateFromInterface();
            originalCrystal = Deep.Copy(CrystalControl.Crystal);

            SetStrainedCrystal();
            skipCrystalChangedEvent = false;

            numericBoxStrain_ValueChanged(new object(), new EventArgs());
        }
コード例 #3
0
        public void SetCrystal()
        {
            CrystalControl.GenerateFromInterface();
            OriginalCrystal = Deep.Copy(CrystalControl.Crystal);
            OriginalCrystal.SetAxis();

            CrystalControl.SymmetrySeriesNumber = 1;
            CrystalControl.Crystal.Atoms        = new Atoms[0];
            for (int i = 0; i < OriginalCrystal.Atoms.Length; i++)
            {
                for (int j = 0; j < OriginalCrystal.Atoms[i].Atom.Count; j++)
                {
                    var atom = Deep.Copy(OriginalCrystal.Atoms[i]);
                    atom.X = OriginalCrystal.Atoms[i].Atom[j].X;
                    atom.Y = OriginalCrystal.Atoms[i].Atom[j].Y;
                    atom.Z = OriginalCrystal.Atoms[i].Atom[j].Z;
                    CrystalControl.Crystal.AddAtoms(atom);
                }
            }
            CrystalControl.SetToInterface();
        }
コード例 #4
0
        private void SetStrainedCrystal()
        {
            skipCrystalChangedEvent = true;

            CrystalControl.SymmetrySeriesNumber = 1;
            CrystalControl.Crystal.Atoms        = new Atoms[0];
            for (int i = 0; i < originalCrystal.Atoms.Length; i++)
            {
                for (int j = 0; j < originalCrystal.Atoms[i].Atom.Count; j++)
                {
                    var atom = Deep.Copy(originalCrystal.Atoms[i]);
                    atom.X = originalCrystal.Atoms[i].Atom[j].X;
                    atom.Y = originalCrystal.Atoms[i].Atom[j].Y;
                    atom.Z = originalCrystal.Atoms[i].Atom[j].Z;
                    CrystalControl.Crystal.AddAtoms(atom);
                }
            }
            CrystalControl.SetToInterface();
            numericBoxStrain_ValueChanged(new object(), new EventArgs());

            skipCrystalChangedEvent = false;
        }