Example #1
0
        /// <summary>
        /// writes the pixel values from arrayList to grid
        /// </summary>
        /// <param name="gr"></param>
        /// <param name="pxList"></param>
        /// <param name="val"></param>
        /// <param name="cback"></param>
        private void writePxList(MapWinGIS.Grid gr, MapWinGIS.GridDataType grType, 
            System.Collections.ArrayList pxList, object val, MapWinGIS.ICallback cback)
        {
            switch (grType)
            {
            case GridDataType.ShortDataType:
                short v1 = Convert.ToInt16(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v1);
                }
                break;
            case GridDataType.LongDataType:
                int v2 = Convert.ToInt32(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v2);
                }
                break;
            case GridDataType.FloatDataType:
                float v3 = Convert.ToSingle(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v3);
                }
                break;
            case GridDataType.DoubleDataType:
                double v4 = Convert.ToDouble(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v4);
                }
                break;
            default:
                reportError("the grid data type " + grType.ToString() + "is not supported.", cback);
                break;
            }

            pxList.Clear();
        }
Example #2
0
 private void writePx(MapWinGIS.Grid gr, MapWinGIS.GridDataType grType,
     GridPixel pix, object val, MapWinGIS.ICallback cback)
 {
     switch (grType)
     {
     case GridDataType.ShortDataType:
         short v1 = Convert.ToInt16(val);
         gr.set_Value(pix.col, pix.row, v1);
         break;
     case GridDataType.LongDataType:
         int v2 = Convert.ToInt32(val);
         gr.set_Value(pix.col, pix.row, v2);
         break;
     case GridDataType.FloatDataType:
         float v3 = Convert.ToSingle(val);
         gr.set_Value(pix.col, pix.row, v3);
         break;
     case GridDataType.DoubleDataType:
         double v4 = Convert.ToDouble(val);
         gr.set_Value(pix.col, pix.row, v4);
         break;
     default:
         reportError("the grid data type " + grType.ToString() + "is not supported.", cback);
         break;
     }
 }