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)
114 void GetLLFromPix(
const wxPoint2DDouble &p,
double *lat,
double *lon);
124 LLRegion GetLLRegion(
const OCPNRegion ®ion);
133 const LLRegion &llregion,
134 int chart_native_scale);
147 float *llpoints,
int chart_native_scale,
156 ViewPort BuildExpandedVP(
int width,
int height);
173 void Invalidate() { bValid =
false; }
174 void Validate() { bValid =
true; }
175 bool IsValid()
const {
return bValid; }
177 void SetRotationAngle(
double angle_rad) {
rotation = angle_rad; }
178 void SetProjectionType(
int type) { m_projection_type = type; }
180 LLBBox &GetBBox() {
return vpBBox; }
182 void SetBBoxDirect(
const LLBBox &bbox) { vpBBox = bbox; }
183 void SetBBoxDirect(
double latmin,
double lonmin,
double latmax,
187 void InvalidateTransformCache() { lat0_cache = NAN; }
188 void SetVPTransformMatrix();
224 bool b_FullScreenQuilt;
226 int m_projection_type;
227 bool b_MercatorProjectionOverride;
231 float vp_matrix_transform[16];
232 float norm_transform[16];
235 bool operator==(
const ViewPort &rhs)
const {
241 (b_quilt == rhs.b_quilt) &&
242 (b_FullScreenQuilt == rhs.b_FullScreenQuilt) &&
243 (m_projection_type == rhs.m_projection_type) &&
244 (b_MercatorProjectionOverride == rhs.b_MercatorProjectionOverride);
253 double lat0_cache, cache0, cache1;
256 double m_displayScale;
A wrapper class for wxRegion with additional functionality.
Represents the view port for chart display in OpenCPN.
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.
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).