20#ifndef __OCPNVIEWPORT_H__
21#define __OCPNVIEWPORT_H__
28static const long long lNaN = 0xfff8000000000000;
29#define NAN (*(double *)&lNaN)
34typedef enum ChartTypeEnum
36 CHART_TYPE_UNKNOWN = 0,
48typedef enum ChartFamilyEnum
50 CHART_FAMILY_UNKNOWN = 0,
56typedef enum ColorScheme
58 GLOBAL_COLOR_SCHEME_RGB,
59 GLOBAL_COLOR_SCHEME_DAY,
60 GLOBAL_COLOR_SCHEME_DUSK,
61 GLOBAL_COLOR_SCHEME_NIGHT,
66#define INVALID_COORD (-2147483647 - 1)
115 void GetLLFromPix(
const wxPoint2DDouble &p,
double *lat,
double *lon);
125 LLRegion GetLLRegion(
const OCPNRegion ®ion);
134 const LLRegion &llregion,
135 int chart_native_scale);
148 float *llpoints,
int chart_native_scale,
157 ViewPort BuildExpandedVP(
int width,
int height);
203 void Invalidate() { bValid =
false; }
204 void Validate() { bValid =
true; }
205 bool IsValid()
const {
return bValid; }
207 void SetRotationAngle(
double angle_rad) {
rotation = angle_rad; }
208 void SetProjectionType(
int type) { m_projection_type = type; }
210 LLBBox &GetBBox() {
return vpBBox; }
212 void SetBBoxDirect(
const LLBBox &bbox) { vpBBox = bbox; }
213 void SetBBoxDirect(
double latmin,
double lonmin,
double latmax,
217 void InvalidateTransformCache() { lat0_cache = NAN; }
218 void SetVPTransformMatrix();
261 bool b_FullScreenQuilt;
263 int m_projection_type;
264 bool b_MercatorProjectionOverride;
268 float vp_matrix_transform[16];
269 float norm_transform[16];
272 bool operator==(
const ViewPort &rhs)
const {
278 (b_quilt == rhs.b_quilt) &&
279 (b_FullScreenQuilt == rhs.b_FullScreenQuilt) &&
280 (m_projection_type == rhs.m_projection_type) &&
281 (b_MercatorProjectionOverride == rhs.b_MercatorProjectionOverride);
291 double lat0_cache, cache0, cache1;
294 double m_displayScale;
A wrapper class for wxRegion with additional functionality.
ViewPort - Core geographic projection and coordinate transformation engine.
double view_scale_ppm
Requested view scale in physical pixels per meter (ppm), before applying projections.
double ref_scale
The nominal scale of the "reference chart" for this view.
int pix_height
Height of the viewport in physical pixels.
void SetBoxes(void)
Computes the bounding box coordinates for the current viewport.
double rotation
Rotation angle of the viewport in radians.
void SetPixelScale(double scale)
Set the physical to logical pixel ratio for the display.
wxRect GetVPRectIntersect(size_t n, float *llpoints)
Get the viewport rectangle intersecting with a set of lat/lon points.
int pix_width
Width of the viewport in physical pixels.
wxPoint2DDouble GetDoublePixFromLL(double lat, double lon)
Convert latitude and longitude on the ViewPort to physical pixel coordinates with double precision.
double tilt
Tilt angle for perspective view in radians.
double skew
Angular distortion (shear transform) applied to the viewport in radians.
void GetLLFromPix(const wxPoint &p, double *lat, double *lon)
Convert physical pixel coordinates on the ViewPort to latitude and longitude.
OCPNRegion GetVPRegionIntersect(const OCPNRegion ®ion, const LLRegion &llregion, int chart_native_scale)
Get the intersection of the viewport with a given region.
double clon
Center longitude of the viewport in degrees.
double clat
Center latitude of the viewport in degrees.
wxPoint GetPixFromLL(double lat, double lon)
Convert latitude and longitude on the ViewPort to physical pixel coordinates.
double chart_scale
Chart scale denominator (e.g., 50000 for a 1:50000 scale).