30 #ifndef __OCPNVIEWPORT_H__
31 #define __OCPNVIEWPORT_H__
38 static const long long lNaN = 0xfff8000000000000;
39 #define NAN (*(double *)&lNaN)
44 typedef enum ChartTypeEnum
46 CHART_TYPE_UNKNOWN = 0,
58 typedef enum ChartFamilyEnum
60 CHART_FAMILY_UNKNOWN = 0,
66 typedef enum ColorScheme
68 GLOBAL_COLOR_SCHEME_RGB,
69 GLOBAL_COLOR_SCHEME_DAY,
70 GLOBAL_COLOR_SCHEME_DUSK,
71 GLOBAL_COLOR_SCHEME_NIGHT,
76 #define INVALID_COORD (-2147483647 - 1)
85 wxPoint GetPixFromLL(
double lat,
double lon);
86 void GetLLFromPix(
const wxPoint &p,
double *lat,
double *lon) {
87 GetLLFromPix(wxPoint2DDouble(p), lat, lon);
89 void GetLLFromPix(
const wxPoint2DDouble &p,
double *lat,
double *lon);
90 wxPoint2DDouble GetDoublePixFromLL(
double lat,
double lon);
92 LLRegion GetLLRegion(
const OCPNRegion ®ion);
94 const LLRegion &llregion,
95 int chart_native_scale);
97 float *llpoints,
int chart_native_scale,
99 wxRect GetVPRectIntersect(
size_t n,
float *llpoints);
100 ViewPort BuildExpandedVP(
int width,
int height);
103 void PixelScale(
float factor);
106 void Invalidate() { bValid =
false; }
107 void Validate() { bValid =
true; }
108 bool IsValid()
const {
return bValid; }
110 void SetRotationAngle(
double angle_rad) { rotation = angle_rad; }
111 void SetProjectionType(
int type) { m_projection_type = type; }
113 LLBBox &GetBBox() {
return vpBBox; }
115 void SetBBoxDirect(
const LLBBox &bbox) { vpBBox = bbox; }
116 void SetBBoxDirect(
double latmin,
double lonmin,
double latmax,
120 void InvalidateTransformCache() { lat0_cache = NAN; }
121 void SetVPTransformMatrix();
126 double view_scale_ppm;
139 bool b_FullScreenQuilt;
141 int m_projection_type;
142 bool b_MercatorProjectionOverride;
146 float vp_matrix_transform[16];
147 float norm_transform[16];
150 bool operator==(
const ViewPort& rhs)
const
152 return (clat == rhs.clat)
153 && (clon == rhs.clon)
154 && (view_scale_ppm == rhs.view_scale_ppm)
155 && (skew == rhs.skew)
156 && (rotation == rhs.rotation)
157 && (tilt == rhs.tilt)
158 && (chart_scale == rhs.chart_scale)
159 && (ref_scale == rhs.ref_scale)
160 && (pix_width == rhs.pix_width)
161 && (pix_height == rhs.pix_height)
162 && (b_quilt == rhs.b_quilt)
163 && (b_FullScreenQuilt == rhs.b_FullScreenQuilt)
164 && (m_projection_type == rhs.m_projection_type)
165 && (b_MercatorProjectionOverride == rhs.b_MercatorProjectionOverride);
173 double lat0_cache, cache0, cache1;