| 112 | /************************************************************************/ |
| 113 | |
| 114 | int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image, |
| 115 | rasterBufferObj *rb, void *hDSVoid ) |
| 116 | |
| 117 | { |
| 118 | int i,j, k; /* loop counters */ |
| 119 | int cmap[MAXCOLORS], cmap_set = FALSE; |
| 120 | unsigned char rb_cmap[4][MAXCOLORS]; |
| 121 | double adfGeoTransform[6], adfInvGeoTransform[6]; |
| 122 | int dst_xoff, dst_yoff, dst_xsize, dst_ysize; |
| 123 | int src_xoff, src_yoff, src_xsize, src_ysize; |
| 124 | int anColorCube[256]; |
| 125 | double llx, lly, urx, ury; |
| 126 | rectObj copyRect, mapRect; |
| 127 | unsigned char *pabyRaw1=NULL, *pabyRaw2=NULL, *pabyRaw3=NULL, |
| 128 | *pabyRawAlpha = NULL; |
| 129 | int classified = FALSE; |
| 130 | int red_band=0, green_band=0, blue_band=0, alpha_band=0, cmt=0; |
| 131 | int band_count, band_numbers[4]; |
| 132 | GDALDatasetH hDS = hDSVoid; |
| 133 | GDALColorTableH hColorMap; |
| 134 | GDALRasterBandH hBand1=NULL, hBand2=NULL, hBand3=NULL, hBandAlpha=NULL; |
| 135 | int bHaveRGBNoData = FALSE; |
| 136 | int nNoData1=-1,nNoData2=-1,nNoData3=-1; |
| 137 | |
| 138 | /*only support rawdata and pluggable renderers*/ |
| 139 | assert(MS_RENDERER_RAWDATA(image->format) || (MS_RENDERER_PLUGIN(image->format) && rb)); |
| 140 | |
| 141 | /*make sure we don't have a truecolor gd image*/ |
| 142 | assert(!rb || rb->type != MS_BUFFER_GD || !gdImageTrueColor(rb->data.gd_img)); |
| 143 | |
| 144 | memset( cmap, 0xff, MAXCOLORS * sizeof(int) ); |
| 145 | memset( rb_cmap, 0, sizeof(rb_cmap) ); |
| 146 | |
| 147 | /* -------------------------------------------------------------------- */ |
| 148 | /* Test the image format instead of the map format. */ |
| 149 | /* Normally the map format and the image format should be the */ |
| 150 | /* same but In somes cases like swf and pdf support, a temporary */ |
| 151 | /* GD image object is created and used to render raster layers */ |
| 152 | /* and then dumped into the SWF or the PDF file. */ |
| 153 | /* -------------------------------------------------------------------- */ |
| 154 | |
| 155 | |
| 156 | src_xsize = GDALGetRasterXSize( hDS ); |
| 157 | src_ysize = GDALGetRasterYSize( hDS ); |
| 158 | |
| 159 | /* |
| 160 | * If the RAW_WINDOW attribute is set, use that to establish what to |
| 161 | * load. This is normally just set by the mapresample.c module to avoid |
| 162 | * problems with rotated maps. |
| 163 | */ |
| 164 | |
| 165 | if( CSLFetchNameValue( layer->processing, "RAW_WINDOW" ) != NULL ) |
| 166 | { |
| 167 | char **papszTokens = |
| 168 | CSLTokenizeString( |
| 169 | CSLFetchNameValue( layer->processing, "RAW_WINDOW" ) ); |
| 170 | |
| 171 | if( layer->debug ) |
no test coverage detected