302 | | In the upper case, the cached bounding box and resolution are not changed. However, if the application employs the tile approach to improve the map loading performance, the bounding box and resolution in the cached !GetMap parameters couldn't meet the request. The methods !SetBoundingBox, !SetHeight and !SetWidth need be called to specify the expected ones, and the command would automatically replace the cached parameters before execution.[[BR]] |
303 | | |
304 | | Note: If the select command isn't called before executing the !FdoWmsCommandType_!GetFeatureInfo command, an exception would be thrown.[[BR]] |
| 302 | In the upper case, the cached bounding box and resolution are not changed. However, if the application employs the tile approach to improve the map loading performance, the following extra code snippets would be involved to set the select command for execution. |
| 303 | {{{ |
| 304 | // This is the specified bounding box and resolution values for a tile. |
| 305 | double minx, miny, maxx, maxy; |
| 306 | long xResolution, yResolution; |
| 307 | |
| 308 | // Set up the CLIP function. |
| 309 | FdoString* pRasterName = L"RasterPropertyName"; |
| 310 | FdoPtr<FdoExpressionCollection> clipFuncParams = FdoExpressionCollection::Create(); |
| 311 | FdoPtr<FdoIdentifier> rasterProp = FdoIdentifier::Create(pRasterName); |
| 312 | funcParams->Add(rasterProp); |
| 313 | FdoPtr<FdoDataValue> minX = FdoDataValue::Create(minx, FdoDataType_Double); |
| 314 | clipFuncParams->Add(minX); |
| 315 | FdoPtr<FdoDataValue> minY = FdoDataValue::Create(miny, FdoDataType_Double); |
| 316 | clipFuncParams->Add(minY); |
| 317 | FdoPtr<FdoDataValue> maxX = FdoDataValue::Create(maxx, FdoDataType_Double); |
| 318 | clipFuncParams->Add(maxX); |
| 319 | FdoPtr<FdoDataValue> maxY = FdoDataValue::Create(maxy, FdoDataType_Double); |
| 320 | clipFuncParams->Add(maxY); |
| 321 | FdoPtr<FdoFunction> clipFunc = FdoFunction::Create(L"CLIP", clipFuncParams); |
| 322 | FdoPtr<FdoComputedIdentifier> clipIdentifier = FdoComputedIdentifier::Create(L"ClippedRaster", clipFunc ); |
| 323 | selProps->Add(clipIdentifier); |
| 324 | |
| 325 | // Set up the RESAMPLE function. |
| 326 | FdoPtr<FdoExpressionCollection> resampleFuncParams = FdoExpressionCollection::Create(); |
| 327 | FdoPtr<FdoIdentifier> rasterProp = FdoIdentifier::Create(pRasterName); |
| 328 | resampleFuncParams->Add(rasterProp); |
| 329 | minX = FdoDataValue::Create(minx, FdoDataType_Double); |
| 330 | resampleFuncParams->Add(minX); |
| 331 | minY = FdoDataValue::Create(miny, FdoDataType_Double); |
| 332 | resampleFuncParams->Add(minY); |
| 333 | maxX = FdoDataValue::Create(maxx, FdoDataType_Double); |
| 334 | resampleFuncParams->Add(maxX); |
| 335 | maxY = FdoDataValue::Create(maxy, FdoDataType_Double); |
| 336 | resampleFuncParams->Add(maxY); |
| 337 | FdoPtr<FdoDataValue> height = FdoDataValue::Create((unsigned int)(yResolution), FdoDataType_Double); |
| 338 | resampleFuncParams->Add(height); |
| 339 | FdoPtr<FdoDataValue> width = FdoDataValue::Create((unsigned int)(xResolution), FdoDataType_Double); |
| 340 | resampleFuncParams->Add(width); |
| 341 | FdoPtr<FdoFunction> resampleFunc = FdoFunction::Create(L"RESAMPLE", resampleFuncParams); |
| 342 | FdoPtr<FdoComputedIdentifier> resampleIdentifier = FdoComputedIdentifier::Create(pRasterName, resampleFunc); |
| 343 | selProps->Add(resampleIdentifier); |
| 344 | |
| 345 | // Execute the command with "CLIP" and "RESAMPLE" functions. |
| 346 | featReader = cmd->Execute (); |
| 347 | }}} |
| 348 | |
| 349 | In this situation, the bounding box and resolution in the cached !GetMap parameters couldn't meet the request. If the requested tile for the feature information isn't the last requested one in the select phase, the cached !GetMap request should be updated with the relevant bounding box and height/width; the methods !SetBoundingBox, !SetHeight and !SetWidth need be called to set the expected values, and the command would automatically replace the cached parameters before execution. However, the application has the responsibilities to calculate which tile the specified interest point is in, and the new envelope points and resolution would be obtained. Accordingly, the !GetFeatureInfo command would be called with the extra settings as below.[[BR]] |
| 350 | {{{ |
| 351 | ... |
| 352 | FdoPtr<FdoIEnvelope> env = gf->CreateEnvelopeXY( |
| 353 | minx, |
| 354 | miny, |
| 355 | maxx, |
| 356 | maxy |
| 357 | ); |
| 358 | // Update the cached bounding box. |
| 359 | cmdGFI->SetBoundingBox(env); |
| 360 | // Update the resolution. |
| 361 | cmdGFI->SetWidth(xResolution); |
| 362 | cmdGFI->SetHeight(yResolution); |
| 363 | |
| 364 | // Execute the command in consideration of new bounding box and resolution. |
| 365 | stream = cmdGFI->Execute (); |
| 366 | }}} |
| 367 | |
| 368 | Note: If the select command isn't called before executing the !FdoWmsCommandType_!GetFeatureInfo command, there is no cached !GetMap request and an exception would be thrown.[[BR]] |