| 2197 | // similar to a zoomed in version of the rectangular world map chart. |
| 2198 | |
| 2199 | void XChartLocal() |
| 2200 | { |
| 2201 | char sz[cchSzDef]; |
| 2202 | int xunit, yunit, x1, y1, x2, y2, xs, ys, xc, yc, xp, yp, xp2, yp2, |
| 2203 | m1, n1, m2, n2, i, j, k, l, zLimit, nShowMinute; |
| 2204 | real xBase, yBase, xScale, yScale, xBase2, yBase2, xScale2, yScale2, |
| 2205 | xr, yr, xi, yi, lon, lat, len; |
| 2206 | flag fShowLabel, fDidBitmap; |
| 2207 | TELE te; |
| 2208 | static real lonPrev = rLarge, latPrev = rLarge; |
| 2209 | static int objPrev = nLarge; |
| 2210 | |
| 2211 | // Initialize variables. |
| 2212 | for (nShowMinute = 0; nShowMinute <= 2; nShowMinute++) { |
| 2213 | xunit = xFontT * N012(nShowMinute, 4, 6, 9); |
| 2214 | yunit = 6*gi.nScaleTextT2; |
| 2215 | x1 = xunit; y1 = yunit; x2 = gs.xWin-1-xunit; y2 = gs.yWin-1-yunit; |
| 2216 | xs = x2-x1; ys = y2-y1; xc = (x1+x2)/2; yc = (y1+y2)/2; |
| 2217 | |
| 2218 | // Determine point to center chart around. |
| 2219 | if (objPrev == nLarge) |
| 2220 | objPrev = gs.objTrack; |
| 2221 | if (gs.objTrack >= 0 && gs.objTrack != objPrev) { |
| 2222 | objPrev = -1; |
| 2223 | xBase = planet[gs.objTrack], yBase = planetalt[gs.objTrack]; |
| 2224 | EclToEqu(&xBase, &yBase); |
| 2225 | xBase = Mod(xBase - cp0.lonMC - Lon + rDegHalf); |
| 2226 | } else { |
| 2227 | if (Lon != lonPrev || Lat != latPrev) { |
| 2228 | lonPrev = Lon; latPrev = Lat; |
| 2229 | gs.rRot = Mod(rDegHalf - lonPrev); gs.rTilt = latPrev; |
| 2230 | } |
| 2231 | xBase = gs.rRot; yBase = gs.rTilt; |
| 2232 | } |
| 2233 | |
| 2234 | // Determine degrees the chart area covers. |
| 2235 | len = (real)Min(xs, ys); |
| 2236 | yScale = gs.rspace > 0.0 ? len / Max(Min(gs.rspace, 90.0), 1.0/60.0) : |
| 2237 | len / (real)(1 << (4-gi.nScale/gi.nScaleT)); |
| 2238 | len = (real)ys/yScale/2.0; |
| 2239 | if (yBase - len < -89.0) |
| 2240 | yBase = len - 89.0; |
| 2241 | else if (yBase + len > 89.0) |
| 2242 | yBase = 89.0 - len; |
| 2243 | if (len > 89.0 || !FBetween(yBase, -89.9, 89.0)) |
| 2244 | yBase = 0.0; |
| 2245 | xScale = yScale * RSinD(rDegQuad - yBase); |
| 2246 | xi = xs/xScale; yi = ys/yScale; |
| 2247 | if (xi > rDegMax) { |
| 2248 | xi = rDegMax; |
| 2249 | xScale = xs/xi; |
| 2250 | } |
| 2251 | gi.zViewRatio = (xi + yi) / 128.0; |
| 2252 | if (gi.zViewRatio > 1.0) |
| 2253 | gi.zViewRatio = 1.0; |
| 2254 | if (N012(nShowMinute, |
| 2255 | xi >= 2.0 || yi >= 2.0, xi >= 2.0/60.0 || yi >= 2.0/60.0, fTrue)) |
| 2256 | break; |
no test coverage detected