140 ShapeBaseChart(
const std::string &filename,
const size_t &min_scale,
141 const wxColor &color = *wxBLACK)
146 _min_scale(min_scale),
150 _is_usable = fs::exists(filename);
154 this->_filename = t._filename;
155 this->_is_usable = t._is_usable;
156 this->_is_tiled = t._is_tiled;
157 this->_min_scale = t._min_scale;
158 this->_reader =
nullptr;
159 this->_color = t._color;
161 this->_loading = t._loading;
168 void SetColor(wxColor color) { _color = color; }
195 bool IsUsable() {
return _is_usable && !_loading; }
196 size_t MinScale() {
return _min_scale; }
197 void RenderViewOnDC(
ocpnDC &dc,
ViewPort &vp) { DrawPolygonFilled(dc, vp); }
198 static const std::string ConstructPath(
const std::string &dir,
199 const std::string &quality_suffix) {
200 return std::string(dir + fs::path::preferred_separator +
"basemap_" +
201 quality_suffix +
".shp");
221 bool CrossesLand(
double &lat1,
double &lon1,
double &lat2,
double &lon2);
227 std::future<bool> _loaded;
243 const shp::Feature &feature);
245 const shp::Feature &feature);
247 void AddPointToTessList(shp::Point &point,
ViewPort &vp, GLUtesselator *tobj,
254 std::string _filename;
261 shp::ShapefileReader *_reader;
268 std::unordered_map<LatLonKey, std::vector<size_t>> _tiles;
299 bool LineLineIntersect(
const std::pair<double, double> &A,
300 const std::pair<double, double> &B,
301 const std::pair<double, double> &C,
302 const std::pair<double, double> &D);
322 bool PolygonLineIntersect(
const shp::Feature &feature,
323 const std::pair<double, double> &A,
324 const std::pair<double, double> &B);
336 static wxPoint2DDouble GetDoublePixFromLL(
ViewPort &vp,
double lat,
339 void SetBasemapLandColor(wxColor color);
340 wxColor GetBasemapLandColor();
351 return _basemap_map.size() > 0 && LowestQualityBaseMap().
IsUsable();
365 bool CrossesLand(
double lat1,
double lon1,
double lat2,
double lon2) {
367 return HighestQualityBaseMap().
CrossesLand(lat1, lon1, lat2, lon2);
373 for (
auto &pair : _basemap_map) {
374 pair.second.CancelLoading();
376 _basemap_map.clear();
382 void LoadBasemaps(
const std::string &dir);
383 void DrawPolygonFilled(
ocpnDC &pnt,
ViewPort &vp, wxColor
const &color);
385 wxColor
const &color,
bool idl);
411 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 ...