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

Function msOffsetPointRelativeTo

mapprimitive.c:702–757  ·  view source on GitHub ↗

** offsets a point relative to an image position */

Source from the content-addressed store, hash-verified

700** offsets a point relative to an image position
701*/
702void msOffsetPointRelativeTo(pointObj *point, layerObj *layer)
703{
704 double x=0, y=0;
705 if ( msCheckParentPointer(layer->map,"map")==MS_FAILURE )
706 return;
707
708
709 if(layer->transform == MS_TRUE) return; /* nothing to do */
710
711 if(layer->units == MS_PERCENTAGES) {
712 point->x *= (layer->map->width-1);
713 point->y *= (layer->map->height-1);
714 }
715
716 if(layer->transform == MS_FALSE || layer->transform == MS_UL) return; /* done */
717
718 switch(layer->transform) {
719 case MS_UC:
720 x = (layer->map->width-1)/2;
721 y = 0;
722 break;
723 case MS_UR:
724 x = layer->map->width-1;
725 y = 0;
726 break;
727 case MS_CL:
728 x = 0;
729 y = layer->map->height/2;
730 break;
731 case MS_CC:
732 x = layer->map->width/2;
733 y = layer->map->height/2;
734 break;
735 case MS_CR:
736 x = layer->map->width-1;
737 y = layer->map->height/2;
738 break;
739 case MS_LL:
740 x = 0;
741 y = layer->map->height-1;
742 break;
743 case MS_LC:
744 x = layer->map->width/2;
745 y = layer->map->height-1;
746 break;
747 case MS_LR:
748 x = layer->map->width-1;
749 y = layer->map->height-1;
750 break;
751 }
752
753 point->x += x;
754 point->y += y;
755
756 return;
757}
758
759/*

Callers 2

msDrawShapeFunction · 0.85
msDrawPointFunction · 0.85

Calls 1

msCheckParentPointerFunction · 0.85

Tested by

no test coverage detected