131 ShapeBaseChart(
const std::string &filename,
const size_t &min_scale,
132 const wxColor &color = *wxBLACK)
137 _min_scale(min_scale),
141 _is_usable = fs::exists(filename);
145 this->_filename = t._filename;
146 this->_is_usable = t._is_usable;
147 this->_is_tiled = t._is_tiled;
148 this->_min_scale = t._min_scale;
149 this->_reader =
nullptr;
150 this->_color = t._color;
152 this->_loading = t._loading;
159 void SetColor(wxColor color) { _color = color; }
186 bool IsUsable() {
return _is_usable && !_loading; }
187 size_t MinScale() {
return _min_scale; }
188 void RenderViewOnDC(
ocpnDC &dc,
ViewPort &vp) { DrawPolygonFilled(dc, vp); }
189 static const std::string ConstructPath(
const std::string &dir,
190 const std::string &quality_suffix) {
191 return std::string(dir + fs::path::preferred_separator +
"basemap_" +
192 quality_suffix +
".shp");
212 bool CrossesLand(
double &lat1,
double &lon1,
double &lat2,
double &lon2);
218 std::future<bool> _loaded;
234 const shp::Feature &feature);
236 const shp::Feature &feature);
239 void AddPointToTessList(shp::Point &point,
ViewPort &vp, GLUtesselator *tobj,
247 std::string _filename;
254 shp::ShapefileReader *_reader;
261 std::unordered_map<LatLonKey, std::vector<size_t>> _tiles;
292 bool LineLineIntersect(
const std::pair<double, double> &A,
293 const std::pair<double, double> &B,
294 const std::pair<double, double> &C,
295 const std::pair<double, double> &D);
315 bool PolygonLineIntersect(
const shp::Feature &feature,
316 const std::pair<double, double> &A,
317 const std::pair<double, double> &B);
329 static wxPoint2DDouble GetDoublePixFromLL(
ViewPort &vp,
double lat,
332 void SetBasemapLandColor(wxColor color);
333 wxColor GetBasemapLandColor();
344 return _basemap_map.size() > 0 && LowestQualityBaseMap().
IsUsable();
358 bool CrossesLand(
double lat1,
double lon1,
double lat2,
double lon2) {
360 return HighestQualityBaseMap().
CrossesLand(lat1, lon1, lat2, lon2);
366 for (
auto &pair : _basemap_map) {
367 pair.second.CancelLoading();
369 _basemap_map.clear();
375 void LoadBasemaps(
const std::string &dir);
376 void DrawPolygonFilled(
ocpnDC &pnt,
ViewPort &vp, wxColor
const &color);
378 wxColor
const &color,
bool idl);
404 std::map<Quality, ShapeBaseChart> _basemap_map;
bool CrossesLand(double lat1, double lon1, double lat2, double lon2)
Determines if a line segment between two geographical points crosses any land mass.
bool CrossesLand(double &lat1, double &lon1, double &lat2, double &lon2)
Determines if a line segment between two geographical points intersects any land mass represented in ...