Пример #1
0
        static void DrawIsoline(DataP3[,] Points, float H, ref PaintEventArgs e)
        {
            List<PointF> crossPoints = new List<PointF>();
            int rows = Points.GetLength(0);
            int cols = Points.GetLength(1);

            for (int i = 0; i < rows-1; i++)
            {
                for (int j = 0; j < cols-1; j++)
                {
                    DataP3 crPoint;
                    //up
                    crPoint = CheckExpression(Points[i, j], Points[i, j + 1], H);
                    if (crPoint.H != -1)
                        crossPoints.Add((PointF)crPoint);
                    //right
                    crPoint = CheckExpression(Points[i, j + 1], Points[i + 1, j + 1], H);
                    if (crPoint.H != -1)
                        crossPoints.Add((PointF)crPoint);
                    //down
                    crPoint = CheckExpression(Points[i + 1, j + 1], Points[i + 1, j], H);
                    if (crPoint.H != -1)
                        crossPoints.Add((PointF)crPoint);
                    //left
                    crPoint = CheckExpression(Points[i + 1, j], Points[i, j], H);
                    if (crPoint.H != -1)
                        crossPoints.Add((PointF)crPoint);

                    if (crossPoints.Count > 1 && crossPoints.Count < 4)
                        DrawCrossLines(crossPoints, ref e);
                    crossPoints.Clear();
                }
            }
        }
        public _3DSurfaceForm(DataP3[,] _data, string _dataType)
        {
            InitializeComponent();
            control = Controller.getInstance();

            data = new DataP3[_data.Length];
            int indexArr = 0;
            for (int i = 0; i < _data.GetLength(0); i++)
            {
                for (int j = 0; j < _data.GetLength(0); j++)
                {
                    data[indexArr] = _data[i, j];
                    indexArr++;
                }
            }

            dataType = _dataType;
            Init();
        }
Пример #3
0
 /// <summary>
 /// Запись в файл
 /// </summary>
 /// <param name="dataPoints">Исходные точки</param>
 /// <param name="targetPoints">Точки регулярной сетки</param>
 /// <param name="fileName">Имя файла записи</param>
 public void Write(ref DataP3[] dataPoints, ref DataP3[,] targetPoints, string fileName)
 {
     Init(fileName);
     if (dataPoints.Length != 0)
     {
         _workSheet.Cells[1, 1] = "X";
         _workSheet.Cells[1, 2] = "Y";
         _workSheet.Cells[1, 3] = "H";
         for (int i = 0; i < dataPoints.Length; i++) // по всем строкам
         {
             _workSheet.Cells[i + 2, 1] = dataPoints[i].X;
             _workSheet.Cells[i + 2, 2] = dataPoints[i].Y;
             _workSheet.Cells[i + 2, 3] = dataPoints[i].H;
         }
     }
     if (targetPoints.Length != 0)
     {
         _workSheet = _workSheet.Next;
         _workSheet.Cells[1, 1] = "X";
         _workSheet.Cells[1, 2] = "Y";
         _workSheet.Cells[1, 3] = "H";
         int indexCell = 2;
         for (int i = 0; i < targetPoints.GetLength(0); i++) // по всем строкам
             for (int j = 0; j < targetPoints.GetLength(1); j++)
             {
                 _workSheet.Cells[indexCell, 1] = targetPoints[i,j].X;
                 _workSheet.Cells[indexCell, 2] = targetPoints[i,j].Y;
                 _workSheet.Cells[indexCell, 3] = targetPoints[i,j].H;
                 indexCell++;
             }
     }
     _application.Visible = true;//открываем файл
 }