/ msGraticuleLayerGetIntersectionPoints */ / Utility function thar returns all intersection positions and */ labels (4 sides of the map) for a grid layer. */ /
| 621 | /* labels (4 sides of the map) for a grid layer. */ |
| 622 | /************************************************************************/ |
| 623 | graticuleIntersectionObj *msGraticuleLayerGetIntersectionPoints(mapObj *map, |
| 624 | layerObj *layer) |
| 625 | { |
| 626 | |
| 627 | shapeObj shapegrid, tmpshape; |
| 628 | rectObj searchrect; |
| 629 | int status; |
| 630 | pointObj oFirstPoint; |
| 631 | pointObj oLastPoint; |
| 632 | lineObj oLineObj; |
| 633 | rectObj cliprect; |
| 634 | graticuleObj *pInfo = NULL; |
| 635 | double dfTmp; |
| 636 | graticuleIntersectionObj *psValues = NULL; |
| 637 | int i=0; |
| 638 | |
| 639 | if (layer->connectiontype != MS_GRATICULE) |
| 640 | return NULL; |
| 641 | |
| 642 | pInfo = (graticuleObj *) layer->layerinfo; |
| 643 | |
| 644 | /*set cellsize if bnot already set*/ |
| 645 | if (map->cellsize == 0) |
| 646 | map->cellsize = msAdjustExtent(&(map->extent),map->width,map->height); |
| 647 | |
| 648 | psValues = (graticuleIntersectionObj *)msSmallMalloc(sizeof(graticuleIntersectionObj)); |
| 649 | |
| 650 | msGraticuleLayerInitIntersectionPoints(psValues); |
| 651 | |
| 652 | if(layer->transform == MS_TRUE) |
| 653 | searchrect = map->extent; |
| 654 | else { |
| 655 | searchrect.minx = searchrect.miny = 0; |
| 656 | searchrect.maxx = map->width-1; |
| 657 | searchrect.maxy = map->height-1; |
| 658 | } |
| 659 | |
| 660 | #ifdef USE_PROJ |
| 661 | if((map->projection.numargs > 0) && (layer->projection.numargs > 0)) |
| 662 | msProjectRect(&map->projection, &layer->projection, &searchrect); /* project the searchrect to source coords */ |
| 663 | #endif |
| 664 | |
| 665 | msLayerOpen(layer); |
| 666 | |
| 667 | status = msLayerWhichShapes(layer, searchrect, MS_FALSE); |
| 668 | if(status == MS_DONE) { /* no overlap */ |
| 669 | msLayerClose(layer); |
| 670 | return NULL; |
| 671 | } else if(status != MS_SUCCESS) { |
| 672 | msLayerClose(layer); |
| 673 | return NULL; |
| 674 | } |
| 675 | |
| 676 | /* step through the target shapes */ |
| 677 | msInitShape(&shapegrid); |
| 678 | cliprect.minx = map->extent.minx- map->cellsize; |
| 679 | cliprect.miny = map->extent.miny- map->cellsize; |
| 680 | cliprect.maxx = map->extent.maxx + map->cellsize; |
no test coverage detected