Example #1
0
        /// <summary>
        /// 初期化処理
        /// </summary>
        protected void init()
        {
            _CadMode = CadModeType.None;

            for (int y = 0; y < MaxDiv.Height; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    AreaSelection[y, x]    = false;
                    AreaToMediaIndex[y, x] = 0;
                }
            }
            for (int x = 0; x < MaxDiv.Width + 1; x++)
            {
                for (int y = 0; y < MaxDiv.Height; y++)
                {
                    YBoundarySelection[y, x] = false;
                }
            }
            for (int y = 0; y < MaxDiv.Height + 1; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    XBoundarySelection[y, x] = false;
                }
            }
            EdgeList.Clear();
            IncidentPortNo = 1;
            for (int i = 0; i < Medias.Length; i++)
            {
                MediaInfo media = new MediaInfo();
                media.BackColor = MediaBackColors[i];
                Medias[i]       = media;
            }
        }
Example #2
0
        /// <summary>
        /// 初期化処理
        /// </summary>
        protected void init()
        {
            _CadMode = CadModeType.None;

            for (int y = 0; y < MaxDiv.Height; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    AreaSelection[y, x] = CellType.Empty;
                }
            }
            for (int x = 0; x < MaxDiv.Width + 1; x++)
            {
                for (int y = 0; y < MaxDiv.Height; y++)
                {
                    YBoundarySelection[y, x] = false;
                }
            }
            for (int y = 0; y < MaxDiv.Height + 1; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    XBoundarySelection[y, x] = false;
                }
            }
            EdgeList.Clear();
            IncidentPortNo = 1;
            System.Diagnostics.Debug.Assert(Medias.Length == 2);
            Color[]  workBackColorList = { VacumnBackColor, RodBackColor };
            double[] workEpsList       = { 1.0, Constants.DefRodEps };
            for (int i = 0; i < Medias.Length; i++)
            {
                MediaInfo media = new MediaInfo();
                double    eps   = workEpsList[i];
                media.BackColor = workBackColorList[i];
                media.SetP(new double[3, 3] {
                    { 1.0 / 1.0, 0.0, 0.0 },
                    { 0.0, 1.0 / 1.0, 0.0 },
                    { 0.0, 0.0, 1.0 / 1.0 },
                });
                media.SetQ(new double[3, 3] {
                    { eps, 0.0, 0.0 },
                    { 0.0, eps, 0.0 },
                    { 0.0, 0.0, eps },
                });
                Medias[i] = media;
            }
            _NdivForOneLattice = Constants.DefNDivForOneLattice;
            _RodRadiusRatio    = Constants.DefRodRadiusRatio;
            _RodCircleDiv      = Constants.DefRodCircleDiv;
            _RodRadiusDiv      = Constants.DefRodRadiusDiv;
        }
Example #3
0
        /// <summary>
        /// Cadデータをコピーする
        /// </summary>
        /// <param name="src"></param>
        public void CopyData(CadLogicBase src)
        {
            // CadモードもUndo/Redo対象に入れる
            _CadMode = src._CadMode;

            for (int y = 0; y < MaxDiv.Height; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    AreaSelection[y, x] = src.AreaSelection[y, x];
                }
            }
            for (int x = 0; x < MaxDiv.Width + 1; x++)
            {
                for (int y = 0; y < MaxDiv.Height; y++)
                {
                    YBoundarySelection[y, x] = src.YBoundarySelection[y, x];
                }
            }
            for (int y = 0; y < MaxDiv.Height + 1; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    XBoundarySelection[y, x] = src.XBoundarySelection[y, x];
                }
            }
            EdgeList.Clear();
            foreach (Edge srcEdge in src.EdgeList)
            {
                Edge edge = new Edge(srcEdge.Delta);
                edge.CP(srcEdge);
                EdgeList.Add(edge);
            }
            IncidentPortNo = src.IncidentPortNo;
            //SelectedMediaIndex = src.SelectedMediaIndex;
            for (int i = 0; i < src.Medias.Length; i++)
            {
                Medias[i].SetP(src.Medias[i].P);
                Medias[i].SetQ(src.Medias[i].Q);
            }
            _NdivForOneLattice = src._NdivForOneLattice;
            _RodRadiusRatio    = src._RodRadiusRatio;
            _RodCircleDiv      = src._RodCircleDiv;
            _RodRadiusDiv      = src._RodRadiusDiv;
        }
        /// <summary>
        /// 初期化処理
        /// </summary>
        protected void init()
        {
            _CadMode             = CadModeType.None;
            SerializedCadObjBuff = "";
            LoopList.Clear();
            EdgeCollectionList.Clear();

            //edit
            EditPts.Clear();
            EditVertexIds.Clear();
            EditEdgeIds.Clear();

            IncidentPortNo = 1;
            for (int i = 0; i < Medias.Length; i++)
            {
                MediaInfo media = new MediaInfo();
                media.BackColor = MediaBackColors[i];
                Medias[i]       = media;
            }
        }
        /// <summary>
        /// 初期化処理
        /// </summary>
        protected void init()
        {
            _CadMode = CadModeType.None;

            for (int y = 0; y < MaxDiv.Height; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    AreaSelection[y, x] = false;
                    AreaToMediaIndex[y, x] = 0;
                }
            }
            for (int x = 0; x < MaxDiv.Width + 1; x++)
            {
                for (int y = 0; y < MaxDiv.Height; y++)
                {
                    YBoundarySelection[y, x] = false;
                }
            }
            for (int y = 0; y < MaxDiv.Height + 1; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    XBoundarySelection[y, x] = false;
                }
            }
            EdgeList.Clear();
            IncidentPortNo = 1;
            for (int i = 0; i < Medias.Length; i++)
            {
                MediaInfo media = new MediaInfo();
                media.BackColor = MediaBackColors[i];
                Medias[i] = media;
            }
        }
        /// <summary>
        /// Cadデータをコピーする
        /// </summary>
        /// <param name="src"></param>
        public void CopyData(CadLogicBase src)
        {
            // CadモードもUndo/Redo対象に入れる
            _CadMode = src._CadMode;

            for (int y = 0; y < MaxDiv.Height; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    AreaSelection[y, x] = src.AreaSelection[y, x];
                    AreaToMediaIndex[y, x] = src.AreaToMediaIndex[y, x];
                }
            }
            for (int x = 0; x < MaxDiv.Width + 1; x++)
            {
                for (int y = 0; y < MaxDiv.Height; y++)
                {
                    YBoundarySelection[y, x] = src.YBoundarySelection[y, x];
                }
            }
            for (int y = 0; y < MaxDiv.Height + 1; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    XBoundarySelection[y, x] = src.XBoundarySelection[y, x];
                }
            }
            EdgeList.Clear();
            foreach (Edge srcEdge in src.EdgeList)
            {
                Edge edge = new Edge(srcEdge.Delta);
                edge.CP(srcEdge);
                EdgeList.Add(edge);
            }
            IncidentPortNo = src.IncidentPortNo;
            //SelectedMediaIndex = src.SelectedMediaIndex;
            for (int i = 0; i < src.Medias.Length; i++)
            {
                Medias[i].SetP(src.Medias[i].P);
                Medias[i].SetQ(src.Medias[i].Q);
            }
        }
        /// <summary>
        /// Cadデータをコピーする
        /// </summary>
        /// <param name="src"></param>
        public void CopyData(CadLogicBase src)
        {
            //System.Diagnostics.Debug.WriteLine("-------CadLogicBase CopyData-------");
            if (src == this)
            {
                System.Diagnostics.Debug.WriteLine("Why? another me exists!");
                //System.Diagnostics.Debug.Assert(false);
                return;
            }

            // CadモードもUndo/Redo対象に入れる
            _CadMode = src._CadMode;
            // CadObj
            SerializedCadObjBuff = src.SerializedCadObjBuff;
            // LoopList
            LoopList.Clear();
            foreach (Loop srcLoop in src.LoopList)
            {
                Loop loop = new Loop(srcLoop);
                LoopList.Add(loop);
            }
            //check
            //foreach (EdgeCollection work in EdgeCollectionList)
            //{
            //    System.Diagnostics.Debug.WriteLine("  prev:No {0}  cnt {1}",  work.No, work.EdgeIds.Count);
            //}
            //foreach (EdgeCollection work in src.EdgeCollectionList)
            //{
            //    System.Diagnostics.Debug.WriteLine("  src:No {0}  cnt {1}", work.No, work.EdgeIds.Count);
            //}
            EdgeCollectionList.Clear();
            foreach (EdgeCollection srcEdge in src.EdgeCollectionList)
            {
                EdgeCollection edge = new EdgeCollection();
                edge.CP(srcEdge);
                EdgeCollectionList.Add(edge);
            }
            //check
            //foreach (EdgeCollection work in EdgeCollectionList)
            //{
            //    System.Diagnostics.Debug.WriteLine("  setted:No {0}  cnt {1}", work.No, work.EdgeIds.Count);
            //}

            // edit
            EditPts.Clear();
            foreach (CVector2D pp in src.EditPts)
            {
                EditPts.Add(pp);
            }
            // edit
            EditVertexIds.Clear();
            foreach (uint id_v in src.EditVertexIds)
            {
                EditVertexIds.Add(id_v);
            }
            // edit
            EditEdgeIds.Clear();
            foreach (uint id_e in src.EditEdgeIds)
            {
                EditEdgeIds.Add(id_e);
            }

            IncidentPortNo = src.IncidentPortNo;
            //SelectedMediaIndex = src.SelectedMediaIndex;
            for (int i = 0; i < src.Medias.Length; i++)
            {
                Medias[i].SetP(src.Medias[i].P);
                Medias[i].SetQ(src.Medias[i].Q);
            }
            //System.Diagnostics.Debug.WriteLine("-------CadLogicBase CopyData end----------");
        }
        /// <summary>
        /// 初期化処理
        /// </summary>
        protected void init()
        {
            _CadMode = CadModeType.None;
            SerializedCadObjBuff = "";
            LoopList.Clear();
            EdgeCollectionList.Clear();

            //edit
            EditPts.Clear();
            EditVertexIds.Clear();
            EditEdgeIds.Clear();

            IncidentPortNo = 1;
            for (int i = 0; i < Medias.Length; i++)
            {
                MediaInfo media = new MediaInfo();
                media.BackColor = MediaBackColors[i];
                Medias[i] = media;
            }
        }
        /// <summary>
        /// Cadデータをコピーする
        /// </summary>
        /// <param name="src"></param>
        public void CopyData(CadLogicBase src)
        {
            //Console.WriteLine("-------CadLogicBase CopyData-------");
            if (src == this)
            {
                Console.WriteLine("Why? another me exists!");
                //System.Diagnostics.Debug.Assert(false);
                return;
            }

            // CadモードもUndo/Redo対象に入れる
            _CadMode = src._CadMode;
            // CadObj
            SerializedCadObjBuff = src.SerializedCadObjBuff;
            // LoopList
            LoopList.Clear();
            foreach (Loop srcLoop in src.LoopList)
            {
                Loop loop = new Loop(srcLoop);
                LoopList.Add(loop);
            }
            //check
            //foreach (EdgeCollection work in EdgeCollectionList)
            //{
            //    Console.WriteLine("  prev:No {0}  cnt {1}",  work.No, work.EdgeIds.Count);
            //}
            //foreach (EdgeCollection work in src.EdgeCollectionList)
            //{
            //    Console.WriteLine("  src:No {0}  cnt {1}", work.No, work.EdgeIds.Count);
            //}
            EdgeCollectionList.Clear();
            foreach (EdgeCollection srcEdge in src.EdgeCollectionList)
            {
                EdgeCollection edge = new EdgeCollection();
                edge.CP(srcEdge);
                EdgeCollectionList.Add(edge);
            }
            //check
            //foreach (EdgeCollection work in EdgeCollectionList)
            //{
            //    Console.WriteLine("  setted:No {0}  cnt {1}", work.No, work.EdgeIds.Count);
            //}

            // edit
            EditPts.Clear();
            foreach (CVector2D pp in src.EditPts)
            {
                EditPts.Add(pp);
            }
            // edit
            EditVertexIds.Clear();
            foreach (uint id_v in src.EditVertexIds)
            {
                EditVertexIds.Add(id_v);
            }
            // edit
            EditEdgeIds.Clear();
            foreach (uint id_e in src.EditEdgeIds)
            {
                EditEdgeIds.Add(id_e);
            }

            IncidentPortNo = src.IncidentPortNo;
            //SelectedMediaIndex = src.SelectedMediaIndex;
            for (int i = 0; i < src.Medias.Length; i++)
            {
                Medias[i].SetP(src.Medias[i].P);
                Medias[i].SetQ(src.Medias[i].Q);
            }
            //Console.WriteLine("-------CadLogicBase CopyData end----------");
        }
Example #10
0
        /// <summary>
        /// 初期化処理
        /// </summary>
        protected void init()
        {
            _CadMode = CadModeType.None;

            for (int y = 0; y < MaxDiv.Height; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    AreaSelection[y, x] = CellType.Empty;
                }
            }
            for (int x = 0; x < MaxDiv.Width + 1; x++)
            {
                for (int y = 0; y < MaxDiv.Height; y++)
                {
                    YBoundarySelection[y, x] = false;
                }
            }
            for (int y = 0; y < MaxDiv.Height + 1; y++)
            {
                for (int x = 0; x < MaxDiv.Width; x++)
                {
                    XBoundarySelection[y, x] = false;
                }
            }
            EdgeList.Clear();
            IncidentPortNo = 1;
            System.Diagnostics.Debug.Assert(Medias.Length == 2);
            Color[] workBackColorList = { VacumnBackColor, RodBackColor };
            double[] workEpsList = { 1.0, Constants.DefRodEps };
            for (int i = 0; i < Medias.Length; i++)
            {
                MediaInfo media = new MediaInfo();
                double eps = workEpsList[i];
                media.BackColor = workBackColorList[i];
                media.SetP(new double[3,3] {
                    {1.0 / 1.0, 0.0, 0.0},
                    {0.0, 1.0 / 1.0, 0.0},
                    {0.0, 0.0, 1.0 / 1.0},
                } );
                media.SetQ(new double[3, 3] {
                    {eps, 0.0, 0.0},
                    {0.0, eps, 0.0},
                    {0.0, 0.0, eps},
                });
                Medias[i] = media;
            }
            _NdivForOneLattice = Constants.DefNDivForOneLattice;
            _RodRadiusRatio = Constants.DefRodRadiusRatio;
            _RodCircleDiv = Constants.DefRodCircleDiv;
            _RodRadiusDiv = Constants.DefRodRadiusDiv;
        }