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

Function get_metrics_line

maplabel.c:874–962  ·  view source on GitHub ↗

pointObj get_metrics_line(pointObj *p, int position, rectObj rect, int ox, int oy, double angle, int buffer, lineObj *poly) * called by get_metrics and drawLabelCache * the poly lineObj MUST have at least 5 points allocated in poly->point * it should also probably have poly->numpoints set to 5 */

Source from the content-addressed store, hash-verified

872 * the poly lineObj MUST have at least 5 points allocated in poly->point
873 * it should also probably have poly->numpoints set to 5 */
874pointObj get_metrics_line(pointObj *p, int position, rectObj rect, int ox, int oy, double angle, int buffer, lineObj *poly)
875{
876 pointObj q;
877 double x1=0, y1=0, x2=0, y2=0;
878 double sin_a,cos_a;
879 double w, h, x, y;
880
881 w = rect.maxx - rect.minx;
882 h = rect.maxy - rect.miny;
883
884 switch(position) {
885 case MS_UL:
886 x1 = -w - ox;
887 y1 = -oy;
888 break;
889 case MS_UC:
890 x1 = -(w/2.0);
891 y1 = -oy - MARKER_SLOP;
892 break;
893 case MS_UR:
894 x1 = ox;
895 y1 = -oy;
896 break;
897 case MS_CL:
898 x1 = -w - ox - MARKER_SLOP;
899 y1 = (h/2.0);
900 break;
901 case MS_CC:
902 x1 = -(w/2.0) + ox;
903 y1 = (h/2.0) + oy;
904 break;
905 case MS_CR:
906 x1 = ox + MARKER_SLOP;
907 y1 = (h/2.0);
908 break;
909 case MS_LL:
910 x1 = -w - ox;
911 y1 = h + oy;
912 break;
913 case MS_LC:
914 x1 = -(w/2.0);
915 y1 = h + oy + MARKER_SLOP;
916 break;
917 case MS_LR:
918 x1 = ox;
919 y1 = h + oy;
920 break;
921 }
922
923 sin_a = sin(MS_DEG_TO_RAD*angle);
924 cos_a = cos(MS_DEG_TO_RAD*angle);
925
926 x = x1 - rect.minx;
927 y = rect.maxy - y1;
928 q.x = p->x + (x * cos_a - (y) * sin_a);
929 q.y = p->y - (x * sin_a + (y) * cos_a);
930
931 if(poly) {

Callers 3

msDrawLabelFunction · 0.85
msDrawLabelCacheFunction · 0.85
get_metricsFunction · 0.85

Calls 1

MS_NINTFunction · 0.85

Tested by

no test coverage detected