43 #include <wx/geometry.h>
45 #include "model/ocpn_types.h"
48 #include "model/cutil.h"
49 #include "poly_math.h"
50 #include "color_types.h"
53 #pragma warning(disable : 4251)
60 #define M_PI_2 1.57079632679489661923
63 #define M_PI_4 0.785398163397448309616
69 wxLineF(
double x1,
double y1,
double x2,
double y2) {
70 m_p1 = wxRealPoint(x1, y1);
71 m_p2 = wxRealPoint(x2, y2);
73 wxRealPoint &p1() {
return m_p1; }
74 wxRealPoint &p2() {
return m_p2; }
75 wxRealPoint m_p1, m_p2;
93 typedef std::vector<wxRealPoint> contour;
94 typedef std::vector<contour> contour_list;
106 void drawMapPlain(
ocpnDC &pnt,
double dx,
ViewPort &vp, wxColor seaColor,
107 wxColor landColor,
bool idl);
110 std::vector<wxLineF> *getCoasts() {
return &coasts; }
111 contour_list &getPoly1() {
return poly1; }
115 std::vector<wxLineF> *high_res_map[GSSH_SUBM * GSSH_SUBM];
123 std::vector<wxLineF> coasts;
125 contour_list poly1, poly2, poly3, poly4, poly5;
128 float_2Dpt *polyv[6];
131 void DrawPolygonFilled(
ocpnDC &pnt, contour_list *poly,
double dx,
132 ViewPort &vp, wxColor
const &color);
134 void DrawPolygonFilledGL(
ocpnDC &pnt, contour_list *p, float_2Dpt **pv,
int *pvc,
135 ViewPort &vp, wxColor
const &color,
bool idl);
137 void DrawPolygonContour(
ocpnDC &pnt, contour_list *poly,
double dx,
140 void ReadPoly(contour_list &poly);
141 void ReadPolygonFile();
149 void drawGshhsPolyMapPlain(
ocpnDC &pnt,
ViewPort &vp, wxColor
const &seaColor,
150 wxColor
const &landColor);
154 void InitializeLoadQuality(
int quality);
155 bool crossing1(
wxLineF trajectWorld);
157 int ReadPolyVersion();
158 int GetPolyVersion() {
return polyHeader.version; }
167 wxMutex mutex1, mutex2;
204 int getLevel() {
return flag & 255; }
205 int isGreenwich() {
return greenwich; }
206 int isAntarctic() {
return antarctic; }
207 bool isOk() {
return ok; }
214 double west, east, south, north;
216 int areaFull, container, ancestor;
218 std::vector<GshhsPoint *> lsPoints;
223 bool greenwich, antarctic;
233 void drawContinents(
ocpnDC &pnt,
ViewPort &vp, wxColor
const &seaColor,
234 wxColor
const &landColor);
240 int GetPolyVersion() {
return gshhsPoly_reader->GetPolyVersion(); }
242 static wxString getNameExtension(
int quality);
243 static wxString getFileName_boundaries(
int quality);
244 static wxString getFileName_rivers(
int quality);
245 static wxString getFileName_Land(
int quality);
246 static bool gshhsFilesExists(
int quality);
248 int getQuality() {
return quality; }
251 bool crossing1(
wxLineF trajectWorld);
252 int ReadPolyVersion();
253 bool qualityAvailable[6];
255 void LoadQuality(
int quality);
256 int GetMinAvailableQuality() {
return minQualityAvailable; }
257 int GetMaxAvailableQuality() {
return maxQualityAvailable; }
261 int selectBestQuality(
void);
262 int selectBestQuality(
ViewPort &vp);
264 int maxQualityAvailable;
265 int minQualityAvailable;
271 std::vector<GshhsPolygon *> *lsPoly_boundaries[5];
272 std::vector<GshhsPolygon *> *lsPoly_rivers[5];
274 std::vector<GshhsPolygon *> &getList_boundaries();
275 std::vector<GshhsPolygon *> &getList_rivers();
278 int GSHHS_scaledPoints(
GshhsPolygon *pol, wxPoint *pts,
double decx,
281 void GsshDrawLines(
ocpnDC &pnt, std::vector<GshhsPolygon *> &lst,
286 inline bool GshhsReader::crossing1(
wxLineF trajectWorld) {
287 return this->gshhsPoly_reader->crossing1(trajectWorld);
289 #define GSHHS_SCL 1.0e-6
297 void SetColorScheme(ColorScheme scheme);
300 void SetColorsDirect(wxColour newLand, wxColour newWater);
304 int GetMinAvailableQuality();
305 int GetMaxAvailableQuality();
311 void gshhsCrossesLandInit();
312 void gshhsCrossesLandReset();
313 bool gshhsCrossesLand(
double lat1,
double lon1,
double lat2,
double lon2);