示例#1
0
            /// <summary>
            /// (*.gorg)ファイルを読み込みます.
            /// </summary>
            /// <param name="mode">The mode.</param>
            /// <param name="filePath">読み込むファイルへのパス</param>
            /// <exception cref="FileNotFoundException"></exception>
            /// <exception cref="FileLoadException"></exception>
            /// <exception cref="IOException"></exception>
            /// <exception cref="ArgumentException"></exception>
            /// <exception cref="ArgumentNullException"></exception>
            /// <exception cref="FormatException"></exception>
            public void ReadGridOriginalFine(int mode, string filePath)
            {
                char[]            delimiterChars = { ' ', '\t' };
                EmulsionParameter ep             = parameterManager.EmulsionParameter;
                StreamReader      sr             = new StreamReader(filePath);

                sr.ReadLine();
                while (!sr.EndOfStream)
                {
                    string   line = sr.ReadLine();
                    string[] args = line.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
                    double   x    = double.Parse(args[0]) - ep.GridOriginalX0;
                    double   y    = double.Parse(args[1]) - ep.GridOriginalY0;
                    double   xp   = (x * Math.Cos(ep.GridOriginalSita) + y * Math.Sin(ep.GridOriginalSita)) / ep.GridOriginalMag;
                    double   yp   = (-x * Math.Sin(ep.GridOriginalSita) + y * Math.Cos(ep.GridOriginalSita)) / ep.GridOriginalMag;
                    switch (mode)
                    {
                    case 0:
                    case 1:
                        int ix = (int)((x + FineGridArea) / (FineGridStep / 2) + 0.5);
                        int iy = (int)((y + FineGridArea) / (FineGridStep / 2) + 0.5);
                        if (ix % 2 == mode && iy % 2 == mode)
                        {
                            ix = (ix - mode) / 2;
                            iy = (iy - mode) / 2;
                            if (ix >= 0 && ix <= NFineGridX && iy >= 0 && iy <= NFineGridY)
                            {
                                gridOriginalFineX[ix, iy]     = xp;
                                gridOriginalFineY[ix, iy]     = yp;
                                gridOriginalPositionX[ix, iy] = double.Parse(args[0]);
                                gridOriginalPositionY[ix, iy] = double.Parse(args[1]);
                            }
                        }
                        break;

                    case 2:
                        ix = (int)((x + FineGridArea2) / FineGridStep2);
                        iy = (int)((y + FineGridArea2) / FineGridStep2);
                        if (ix >= 0 && ix <= NFineGridXY2 && iy >= 0 && iy <= NFineGridXY2)
                        {
                            gridOriginalFineX[ix, iy]     = xp;
                            gridOriginalFineY[ix, iy]     = yp;
                            gridOriginalPositionX[ix, iy] = double.Parse(args[0]);
                            gridOriginalPositionY[ix, iy] = double.Parse(args[1]);
                        }
                        break;
                    }
                    loadedGridOriginalFine = true;
                }
                sr.Close();
            }
示例#2
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="_parameterManager">値が設定されているParameterManagerのインスタンス</param>
 public CoordManager(ParameterManager _parameterManager)
 {
     this.parameterManager  = _parameterManager;
     this.emulsionParameter = parameterManager.EmulsionParameter;
     this.gridMarks         = new GridMark[AllGridMarksNum];
     for (int i = 0; i < gridMarks.Length; ++i)
     {
         this.gridMarks[i] = new GridMark();
     }
     this.gridOrgX = emulsionParameter.GridOrgX;
     this.gridOrgY = emulsionParameter.GridOrgY;
     this.hfdx     = 0.0;
     this.hfdy     = 0.0;
 }
示例#3
0
            /// <summary>
            /// (*.gofs)ファイルを読み込みます.
            /// </summary>
            /// <param name="filePath">読み込むファイルへのパス</param>
            /// <param name="readAnyTime"></param>
            /// <exception cref="FormatException">読み込みに失敗した場合</exception>
            /// <exception cref="System.IO.FileNotFoundException">ファイルが存在しなかった場合</exception>
            public void ReadGridFineParameter(string filePath, Boolean readAnyTime)
            {
                if (!File.Exists(filePath))
                {
                    throw new FileNotFoundException(filePath);
                }

                EmulsionParameter emParam           = parameterManager.EmulsionParameter;
                double            emulsionThickness = new double();
                int ret = Ipt.ReadWriteGridFine("r", filePath, ref emulsionThickness);

                if (ret == -1)
                {
                    throw new FormatException(string.Format("ThisGelThickness can not input from {0}", filePath));
                }

                thisGelThickness = (emulsionThickness - emParam.BaseThick) * 0.5;
                definedGridFine  = true;
            }
示例#4
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="_parameterManager"></param>
 public TracksManager(ParameterManager _parameterManager)
 {
     this.parameterManager = _parameterManager;
     this.emParameter      = parameterManager.EmulsionParameter;
 }
示例#5
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public ParameterManager()
 {
     emulsionParameter = new EmulsionParameter(this);
     tracksManager     = new TracksManager(this);
     gridParameter     = new GridParameter(this);
 }