30#ifndef __OCPNVIEWPORT_H__
31#define __OCPNVIEWPORT_H__
38static const long long lNaN = 0xfff8000000000000;
39#define NAN (*(double *)&lNaN)
44typedef enum ChartTypeEnum
46 CHART_TYPE_UNKNOWN = 0,
58typedef enum ChartFamilyEnum
60 CHART_FAMILY_UNKNOWN = 0,
66typedef 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,
119 void InvalidateTransformCache() { lat0_cache = NAN; }
124 double view_scale_ppm;
137 bool b_FullScreenQuilt;
139 int m_projection_type;
140 bool b_MercatorProjectionOverride;
144 float vp_matrix_transform[16];
145 float norm_transform[16];
148 bool operator==(
const ViewPort& rhs)
const
150 return (clat == rhs.clat)
151 && (clon == rhs.clon)
152 && (view_scale_ppm == rhs.view_scale_ppm)
153 && (skew == rhs.skew)
154 && (rotation == rhs.rotation)
155 && (tilt == rhs.tilt)
156 && (chart_scale == rhs.chart_scale)
157 && (ref_scale == rhs.ref_scale)
158 && (pix_width == rhs.pix_width)
159 && (pix_height == rhs.pix_height)
160 && (b_quilt == rhs.b_quilt)
161 && (b_FullScreenQuilt == rhs.b_FullScreenQuilt)
162 && (m_projection_type == rhs.m_projection_type)
163 && (b_MercatorProjectionOverride == rhs.b_MercatorProjectionOverride);
171 double lat0_cache, cache0, cache1;