106 ShapeBaseChart(
const std::string &filename,
const size_t &min_scale,
107 const wxColor &color = *wxBLACK)
112 _min_scale(min_scale),
116 _is_usable = fs::exists(filename);
120 this->_filename = t._filename;
121 this->_is_usable = t._is_usable;
122 this->_is_tiled = t._is_tiled;
123 this->_min_scale = t._min_scale;
124 this->_reader =
nullptr;
125 this->_color = t._color;
126 this->_dmod = t._dmod;
127 this->_loading = t._loading;
134 void SetColor(wxColor color) { _color = color; }
139 bool IsUsable() {
return _is_usable && !_loading; }
140 size_t MinScale() {
return _min_scale; }
141 void RenderViewOnDC(
ocpnDC &dc,
ViewPort &vp) { DrawPolygonFilled(dc, vp); }
142 static const std::string ConstructPath(
const std::string &dir,
143 const std::string &quality_suffix) {
144 return std::string(dir + fs::path::preferred_separator +
"basemap_" +
145 quality_suffix +
".shp");
148 bool CrossesLand(
double &lat1,
double &lon1,
double &lat2,
double &lon2);
154 std::future<bool> _loaded;
160 const shp::Feature &feature);
162 const shp::Feature &feature);
164 void AddPointToTessList(shp::Point &point,
ViewPort &vp, GLUtesselator *tobj,
167 std::string _filename;
168 shp::ShapefileReader *_reader;
169 std::unordered_map<LatLonKey, std::vector<size_t>> _tiles;
172 bool LineLineIntersect(
const std::pair<double, double> &A,
173 const std::pair<double, double> &B,
174 const std::pair<double, double> &C,
175 const std::pair<double, double> &D);
177 bool PolygonLineIntersect(
const shp::Feature &feature,
178 const std::pair<double, double> &A,
179 const std::pair<double, double> &B);
191 static wxPoint2DDouble GetDoublePixFromLL(
ViewPort &vp,
double lat,
194 void SetBasemapLandColor(wxColor color);
195 wxColor GetBasemapLandColor();
201 return _basemap_map.size() > 0 && LowestQualityBaseMap().IsUsable();
204 bool CrossesLand(
double lat1,
double lon1,
double lat2,
double lon2) {
206 return HighestQualityBaseMap().CrossesLand(lat1, lon1, lat2, lon2);
212 for (
auto &pair : _basemap_map) {
213 pair.second.CancelLoading();
215 _basemap_map.clear();
221 void LoadBasemaps(
const std::string &dir);
222 void DrawPolygonFilled(
ocpnDC &pnt,
ViewPort &vp, wxColor
const &color);
224 wxColor
const &color,
bool idl);
231 std::map<Quality, ShapeBaseChart> _basemap_map;