예제 #1
0
        public static ModelBlock[] GetModelBlocksFromFile(string filename)
        {
            List <ModelBlock> mlist = new List <ModelBlock>();

            StreamReader sr = new StreamReader(filename);

            //Skip to modelblock part
            while (!sr.ReadLine().Contains("/Coordinates of model blocks (with topography)."))
            {
            }
            for (int i = 0; i < 4; i++)
            {
                sr.ReadLine();
            }

            Regex regex = new Regex(" +");

            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine();
                if (line == "")
                {
                    break;
                }
                string[]   result = regex.Split(line.Trim());
                ModelBlock mb     = new ModelBlock();
                mb.RealCorners = new List <PointF>();
                mb.RealCorners.Add(new PointF(float.Parse(result[1], CultureInfo.InvariantCulture), float.Parse(result[2], CultureInfo.InvariantCulture)));
                mb.RealCorners.Add(new PointF(float.Parse(result[3], CultureInfo.InvariantCulture), float.Parse(result[4], CultureInfo.InvariantCulture)));
                mb.RealCorners.Add(new PointF(float.Parse(result[5], CultureInfo.InvariantCulture), float.Parse(result[6], CultureInfo.InvariantCulture)));
                mb.RealCorners.Add(new PointF(float.Parse(result[7], CultureInfo.InvariantCulture), float.Parse(result[8], CultureInfo.InvariantCulture)));

                mb.Resistivities = new List <float>();

                /*
                 * mb.Resistivities.Add(float.Parse(result[9], CultureInfo.InvariantCulture));
                 */
                mb.Number = int.Parse(result[0], CultureInfo.InvariantCulture);
                mlist.Add(mb);
            }

            return(mlist.ToArray());
        }
예제 #2
0
 public static MinMaxResistivity GetMinMaxResistivityOfBlockOverTime(ModelBlock input)
 {
     return(new MinMaxResistivity(input.Resistivities.Min(), input.Resistivities.Max()));
 }