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

Function msGraticuleLayerGetIntersectionPoints

mapgraticule.c:623–1011  ·  view source on GitHub ↗

/ msGraticuleLayerGetIntersectionPoints */ / Utility function thar returns all intersection positions and */ labels (4 sides of the map) for a grid layer. */ /

Source from the content-addressed store, hash-verified

621/* labels (4 sides of the map) for a grid layer. */
622/************************************************************************/
623graticuleIntersectionObj *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;

Callers 1

layer.cFile · 0.85

Calls 15

msAdjustExtentFunction · 0.85
msSmallMallocFunction · 0.85
msProjectRectFunction · 0.85
msLayerOpenFunction · 0.85
msLayerWhichShapesFunction · 0.85
msLayerCloseFunction · 0.85
msInitShapeFunction · 0.85
msLayerNextShapeFunction · 0.85
msCopyShapeFunction · 0.85
msProjectionsDifferFunction · 0.85
msProjectShapeFunction · 0.85

Tested by

no test coverage detected