26 #ifndef __CM93CHART_H__
27 #define __CM93CHART_H__
29 #include <wx/listctrl.h>
32 #include "model/cutil.h"
33 #include "poly_math.h"
36 #define INDEX_m_sor 217
38 #define CM93_ZOOM_FACTOR_MAX_RANGE 5
41 int Get_CM93_CellIndex(
double lat,
double lon,
int scale);
42 void Get_CM93_Cell_Origin(
int cellindex,
int scale,
double *lat,
double *lon);
55 bool WriteWKB(
void *p);
56 int ReadWKB(wxFFileInputStream &ifs);
65 float_2Dpt *pvertices;
68 float_2Dpt *gl_screen_vertices;
69 int gl_screen_projection_type;
72 double transform_WGS84_offset_x;
73 double transform_WGS84_offset_y;
74 double m_covr_lat_min;
75 double m_covr_lat_max;
76 double m_covr_lon_min;
77 double m_covr_lon_max;
80 double m_centerlat_cos;
86 WX_DECLARE_OBJARRAY(
M_COVR_Desc, Array_Of_M_COVR_Desc);
87 WX_DEFINE_ARRAY_PTR(
M_COVR_Desc *, Array_Of_M_COVR_Desc_Ptr);
99 static const double CM93_semimajor_axis_meters =
104 class Extended_Geometry;
132 unsigned short usn_vector_records;
133 int n_vector_record_points;
136 unsigned short usn_point3d_records;
139 unsigned short usn_point2d_records;
142 unsigned short usn_feature_records;
149 int m_nrelated_object_pointers;
160 unsigned short n_points;
161 unsigned short x_min;
162 unsigned short y_min;
163 unsigned short x_max;
164 unsigned short y_max;
171 unsigned char segment_usage;
176 unsigned char geotype;
177 unsigned short n_geom_elements;
179 unsigned char n_related_objects;
180 void *p_related_object_pointer_array;
181 unsigned char n_attributes;
182 unsigned char *attributes_block;
188 double transform_x_rate;
189 double transform_y_rate;
190 double transform_x_origin;
191 double transform_y_origin;
194 Object **pprelated_object_block;
195 unsigned char *attribute_block_top;
197 *edge_vector_descriptor_block;
202 int m_nvector_records;
203 int m_nfeature_records;
204 int m_n_point3d_records;
205 int m_n_point2d_records;
207 List_Of_M_COVR_Desc m_cell_mcovr_list;
209 bool b_have_user_offsets;
214 double min_lat, min_lon;
233 bool LoadDictionary(
const wxString &dictionary_dir);
234 bool IsOk(
void) {
return m_ok; }
235 wxString GetDictDir(
void) {
return m_dict_dir; }
237 wxString GetClassName(
int iclass);
238 wxString GetAttrName(
int iattr);
239 char GetAttrType(
int iattr);
244 wxArrayString *m_S57ClassArray;
245 wxArrayString *m_AttrArray;
246 int *m_GeomTypeArray;
247 char *m_ValTypeArray;
255 unsigned char *GetNextAttr();
258 unsigned char *m_block;
270 bool Loadcm93Dictionary(
const wxString &name);
299 InitReturn Init(
const wxString &name, ChartInitFlag flags);
301 void ResetSubcellKey() { m_loadcell_key =
'0'; }
303 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
304 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
307 void SetVPParms(
const ViewPort &vpt);
308 void GetPointPix(ObjRazRules *rzRules,
float northing,
float easting,
310 void GetPointPix(ObjRazRules *rzRules, wxPoint2DDouble *en, wxPoint *r,
312 void GetPixPoint(
int pixx,
int pixy,
double *plat,
double *plon,
316 void SetCM93Prefix(
const wxString &prefix) { m_prefix = prefix; }
317 void SetCM93Manager(
cm93manager *pManager) { m_pManager = pManager; }
320 bool IsPointInLoadedM_COVR(
double xc,
double yc);
321 covr_set *GetCoverSet() {
return m_pcovr_set; }
322 LLRegion GetValidRegion();
324 const wxString &GetLastFileName(
void)
const {
return m_LastFileName; }
326 std::vector<int> GetVPCellArray(
const ViewPort &vpt);
328 Array_Of_M_COVR_Desc_Ptr m_pcovr_array_loaded;
330 void SetUserOffsets(
int cell_index,
int object_id,
int subcell,
int xoff,
332 wxString GetScaleChar() {
return m_scalechar; }
334 wxPoint *GetDrawBuffer(
int nSize);
339 InitReturn CreateHeaderDataFromCM93Cell(
void);
341 Extended_Geometry *BuildGeom(
Object *pobject, wxFileOutputStream *postream,
344 S57Obj *CreateS57Obj(
int cell_index,
int iobject,
int subcell,
346 Extended_Geometry *xgeom,
double ref_lat,
double ref_lon,
347 double scale,
double view_scale_ppm);
349 void ProcessMCOVRObjects(
int cell_index,
char subcell);
351 void translate_colmar(
const wxString &sclass, S57attVal *pattValTmp);
353 int CreateObjChain(
int cell_index,
int subcell,
double view_scale_ppm);
355 void Unload_CM93_Cell(
void);
358 void Transform(
cm93_point *s,
double trans_x,
double trans_y,
double *lat,
361 int loadcell_in_sequence(
int,
char);
362 int loadsubcell(
int, wxChar);
363 void ProcessVectorEdges(
void);
365 wxPoint2DDouble FindM_COVROffset(
double lat,
double lon);
366 M_COVR_Desc *FindM_COVR_InWorkingSet(
double lat,
double lon);
377 wxString m_scalechar;
378 std::vector<int> m_cells_loaded_array;
380 int m_current_cell_vearray_offset;
381 int *m_pcontour_array;
382 int m_ncontour_alloc;
384 wxChar m_loadcell_key;
389 wxPoint *m_pDrawBuffer;
390 int m_nDrawBufferSize;
392 wxString m_LastFileName;
395 wxArrayString m_noFindArray;
408 InitReturn Init(
const wxString &name, ChartInitFlag flags);
411 void Deactivate(
void);
413 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
414 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
415 int GetNativeScale(
void);
417 wxString GetPubDate();
419 void SetVPParms(
const ViewPort &vpt);
421 LLRegion GetValidRegion();
423 ThumbData *GetThumbData(
int tnx,
int tny,
float lat,
float lon);
428 bool RenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
431 virtual bool RenderRegionViewOnGL(
const wxGLContext &glc,
434 const LLRegion &Region);
435 void SetColorScheme(ColorScheme cs,
bool bApplyImmediate);
439 void GetPointPix(ObjRazRules *rzRules,
float rlat,
float rlon, wxPoint *r);
440 void GetPixPoint(
int pixx,
int pixy,
double *plat,
double *plon,
442 void GetPointPix(ObjRazRules *rzRules, wxPoint2DDouble *en, wxPoint *r,
445 ListOfObjRazRules *GetObjRuleListAtLatLon(
float lat,
float lon,
448 int selection_mask = MASK_ALL);
451 std::unordered_map<unsigned, VE_Element *> &Get_ve_hash(
void);
452 std::unordered_map<unsigned, VC_Element *> &Get_vc_hash(
void);
455 void ForceEdgePriorityEvaluate(
void);
456 std::list<S57Obj*> *GetAssociatedObjects(S57Obj *obj);
457 cm93chart *GetCurrentSingleScaleChart() {
return m_pcm93chart_current; }
459 void SetSpecialOutlineCellIndex(
int cell_index,
int object_id,
int subcell) {
460 m_cell_index_special_outline = cell_index;
461 m_object_id_special_outline = object_id;
462 m_subcell_special_outline = subcell;
465 void SetSpecialCellIndexOffset(
int cell_index,
int object_id,
int subcell,
467 void CloseandReopenCurrentSubchart(
void);
469 void InvalidateCache();
472 void UpdateRenderRegions(
const ViewPort &VPoint);
476 bool RenderViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint);
478 InitReturn CreateHeaderData();
480 void FillScaleArray(
double lat,
double lon);
481 int PrepareChartScale(
const ViewPort &vpt,
int cmscale,
482 bool bOZ_protect =
true);
483 int GetCMScaleFromVP(
const ViewPort &vpt);
484 bool DoRenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
487 bool DoRenderRegionViewOnGL(
const wxGLContext &glc,
const ViewPort &VPoint,
489 const LLRegion &Region);
500 bool m_bScale_Array[8];
504 wxString m_prefixComposite;
506 int m_current_cell_pub_date;
509 wxBitmap *m_pDummyBM;
510 int m_cell_index_special_outline;
511 int m_object_id_special_outline;
512 int m_subcell_special_outline;
513 int m_special_offset_x;
514 int m_special_offset_y;
526 DECLARE_EVENT_TABLE()
532 void OnClose(wxCloseEvent &event);
533 void OnOK(wxCommandEvent &event);
536 void SetColorScheme();
537 void UpdateMCOVRList(
const ViewPort &vpt);
540 Array_Of_M_COVR_Desc_Ptr m_pcovr_array;
542 wxString m_selected_chart_scale_char;
545 void OnCellSelected(wxListEvent &event);
546 void OnOffSetSet(wxCommandEvent &event);
548 void UpdateOffsets(
void);
550 wxSpinCtrl *m_pSpinCtrlXoff;
551 wxSpinCtrl *m_pSpinCtrlYoff;
552 wxButton *m_OKButton;
559 int m_selected_cell_index;
560 int m_selected_object_id;
561 int m_selected_subcell;
562 int m_selected_list_index;
563 double m_centerlat_cos;
Runtime representation of a plugin block.