MCPcopy Create free account
hub / github.com/MapServer/MapServer / transform

Method transform

renderers/agg/src/agg_trans_single_path.cpp:116–198  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

114
115 //------------------------------------------------------------------------
116 void trans_single_path::transform(double *x, double *y) const
117 {
118 if(m_status == ready)
119 {
120 if(m_base_length > 1e-10)
121 {
122 *x *= m_src_vertices[m_src_vertices.size() - 1].dist /
123 m_base_length;
124 }
125
126 double x1 = 0.0;
127 double y1 = 0.0;
128 double dx = 1.0;
129 double dy = 1.0;
130 double d = 0.0;
131 double dd = 1.0;
132 if(*x < 0.0)
133 {
134 // Extrapolation on the left
135 //--------------------------
136 x1 = m_src_vertices[0].x;
137 y1 = m_src_vertices[0].y;
138 dx = m_src_vertices[1].x - x1;
139 dy = m_src_vertices[1].y - y1;
140 dd = m_src_vertices[1].dist - m_src_vertices[0].dist;
141 d = *x;
142 }
143 else
144 if(*x > m_src_vertices[m_src_vertices.size() - 1].dist)
145 {
146 // Extrapolation on the right
147 //--------------------------
148 unsigned i = m_src_vertices.size() - 2;
149 unsigned j = m_src_vertices.size() - 1;
150 x1 = m_src_vertices[j].x;
151 y1 = m_src_vertices[j].y;
152 dx = x1 - m_src_vertices[i].x;
153 dy = y1 - m_src_vertices[i].y;
154 dd = m_src_vertices[j].dist - m_src_vertices[i].dist;
155 d = *x - m_src_vertices[j].dist;
156 }
157 else
158 {
159 // Interpolation
160 //--------------------------
161 unsigned i = 0;
162 unsigned j = m_src_vertices.size() - 1;
163 if(m_preserve_x_scale)
164 {
165 unsigned k;
166 for(i = 0; (j - i) > 1; )
167 {
168 if(*x < m_src_vertices[k = (i + j) >> 1].dist)
169 {
170 j = k;
171 }
172 else
173 {

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected