MCPcopy Index your code
hub / github.com/MapServer/MapServer / msDrawRasterLayerGDAL

Function msDrawRasterLayerGDAL

mapdrawgdal.c:114–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112/************************************************************************/
113
114int 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 )

Callers 2

msResampleGDALToMapFunction · 0.85
msDrawRasterLayerLowFunction · 0.85

Calls 14

msDebugFunction · 0.85
msSetErrorFunction · 0.85
msGetGDALGeoTransformFunction · 0.85
InvGeoTransformFunction · 0.85
msGetGDALBandListFunction · 0.85
msGetGDALNoDataValueFunction · 0.85
msGetClassFunction · 0.85
msValueToRangeFunction · 0.85
msAddColorGDFunction · 0.85
allocColorCubeFunction · 0.85

Tested by

no test coverage detected