Beispiel #1
0
 public int Row(int col)
 {
     try
     {
         return(System.Convert.ToInt32(grid.get_Value(col, rowNum), CultureInfo.InvariantCulture));
     }
     catch (InvalidCastException)
     {
         readError = true;
         return(0);
     }
 }
Beispiel #2
0
        private void DisplaySelectedValues(double SelValue)
        {
            if (SkipDisplayValues)
            {
                return;
            }
            if (m_Extents == null || m_Grid == null)
            {
                return;
            }

            try
            {
                int    endRow = 0, endCol = 0;
                int    startRow = 0, startCol = 0;
                double x = 0, y = 0;
                double cellValue = 0;

                //find the begining and end cells
                m_Grid.ProjToCell(m_Extents.xMin, m_Extents.yMax, out startCol, out startRow);
                m_Grid.ProjToCell(m_Extents.xMax, m_Extents.yMin, out endCol, out endRow);

                //get the data type of the grid
                MapWinGIS.GridDataType type = m_Grid.DataType;

                //creat a drawing suface
                if (m_hDraw == -1)
                {
                    m_hDraw = m_parent.m_MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList);
                }
                else
                {
                    m_parent.m_MapWin.View.Draw.ClearDrawing(m_hDraw);
                    m_hDraw = m_parent.m_MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList);
                }

                //display all the selected values
                for (int row = startRow; row <= endRow; row++)
                {
                    for (int col = startCol; col <= endCol; col++)
                    {
                        if (type == MapWinGIS.GridDataType.LongDataType)
                        {
                            cellValue = int.Parse(m_Grid.get_Value(col, row).ToString());
                        }
                        else if (type == MapWinGIS.GridDataType.DoubleDataType)
                        {
                            cellValue = double.Parse(m_Grid.get_Value(col, row).ToString());
                        }
                        else if (type == MapWinGIS.GridDataType.FloatDataType)
                        {
                            cellValue = float.Parse(m_Grid.get_Value(col, row).ToString());
                        }
                        else if (type == MapWinGIS.GridDataType.ShortDataType)
                        {
                            cellValue = short.Parse(m_Grid.get_Value(col, row).ToString());
                        }

                        if (Math.Round(SelValue, 8) == Math.Round(cellValue, 8))
                        {
                            m_Grid.CellToProj(col, row, out x, out y);
                            m_parent.m_MapWin.View.Draw.DrawPoint(x, y, 3, RED);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                ShowErrorBox("DisplaySelectedValues()", ex.Message);
            }
        }