SAGA API Version 9.14
Loading...
Searching...
No Matches
map_layer.h
Go to the documentation of this file.
1
3// //
4// SAGA //
5// //
6// System for Automated Geoscientific Analyses //
7// //
8// Application Programming Interface //
9// //
10// Library: SAGA_API //
11// //
12//-------------------------------------------------------//
13// //
14// map_layer.h //
15// //
16// Copyright (C) 2026 by //
17// Olaf Conrad //
18// //
19//-------------------------------------------------------//
20// //
21// This file is part of 'SAGA - System for Automated //
22// Geoscientific Analyses'. SAGA is free software; you //
23// can redistribute it and/or modify it under the terms //
24// of the GNU General Public License as published by the //
25// Free Software Foundation, either version 2 of the //
26// License, or (at your option) any later version. //
27// //
28// SAGA is distributed in the hope that it will be //
29// useful, but WITHOUT ANY WARRANTY; without even the //
30// implied warranty of MERCHANTABILITY or FITNESS FOR A //
31// PARTICULAR PURPOSE. See the GNU General Public //
32// License for more details. //
33// //
34// You should have received a copy of the GNU General //
35// Public License along with this program; if not, see //
36// <http://www.gnu.org/licenses/>. //
37// //
38//-------------------------------------------------------//
39// //
40// e-mail: oconrad@saga-gis.org //
41// //
42// contact: Olaf Conrad //
43// Institute of Geography //
44// University of Hamburg //
45// Germany //
46// //
48
49//---------------------------------------------------------
50#ifndef _HEADER_INCLUDED__SAGA_GDI__Map_Layer_H
51#define _HEADER_INCLUDED__SAGA_GDI__Map_Layer_H
52
53
55// //
56// //
57// //
59
60//---------------------------------------------------------
61#include "map_dc.h"
62#include "../parameters.h"
63#include "../grids.h"
64#include "../pointcloud.h"
65
66
68// //
69// //
70// //
72
73//---------------------------------------------------------
74#define LAYER_DRAW_FLAG_THUMBNAIL 0x01
75#define LAYER_DRAW_FLAG_SELECTION 0x02
76#define LAYER_DRAW_FLAG_HIGHLIGHT 0x04
77#define LAYER_DRAW_FLAG_NOEDITS 0x08
78#define LAYER_DRAW_FLAG_NOLABELS 0x10
79
80
82// //
84
85//---------------------------------------------------------
87{
88public:
89
91 virtual ~CSG_Map_Layer(void);
92
93 const TSG_Data_Object_Type & Get_ObjectType (void) const { return( m_Type ); }
94
95 bool Set_Object (CSG_Data_Object *pObject);
96 CSG_Data_Object * Get_Object (void) const { return( m_pObject ); }
97 CSG_Rect Get_Extent (void) const;
98
99 static CSG_Parameters & Get_Defaults (void);
100
101 virtual bool Add_Parameters (CSG_Parameters &Parameters);
103 bool Set_Parameters (const CSG_Parameters &Parameters);
104
105 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
106
107 virtual bool Parameters_Changed (void);
108 virtual bool DataObject_Changed (void);
109
110 bool Sync_Back (CSG_Parameters &Target) const;
111 bool Sync_Forward (const CSG_Parameters &Source);
112
113 bool Draw (CSG_Map_DC &dc_Map, int Flags = 0, CSG_Data_Object *pObject = NULL);
114
115 CSG_Table & Get_LUT (void);
116 CSG_Colors & Get_Colors (void);
117 const CSG_Colors & Get_Colors (void) const;
118 bool Get_Colors ( CSG_Colors &Colors) const;
119 bool Set_Colors (const CSG_Colors &Colors);
120
121 wxString Get_Legend_Title (void) const;
122 wxString Get_Legend_Subtitle (void) const;
123
124 bool Get_Field_Value (sLong Index, int Field, int Normalize, double Scale, wxString &Value) const;
125 bool Get_Field_Value (sLong Index, int Field, int Normalize, double Scale, double &Value) const;
126
127 double Get_Stretch_Minimum (void) const;
128 double Get_Stretch_Maximum (void) const;
129 double Get_Stretch_Range (void) const;
130 bool Set_Stretch_Range (double Minimum, double Maximum);
131 bool Set_Stretch_FullRange (void);
132 virtual bool Set_Stretch_Extent (const CSG_Rect &Extent) { return( false ); }
133
134 bool Classify (const CSG_MetaData &Options);
135
136 class CSG_Map_Symbology * Get_Symbology (void) { return( m_pSymbology ); }
137 class CSG_Map_Legend * Get_Legend (void) { return( m_pLegend ); }
138
139 virtual bool asImage (CSG_Grid *pImage) { return( false ); }
140
141 const class wxBitmap * Get_Thumbnail (int dx, int dy);
142 bool Set_Thumbnail (void);
143
144
145protected:
146
148
150
152
154
156
157 class wxBitmap *m_pThumbnail = NULL;
158
160
161
163
164 virtual void On_Draw (CSG_Map_DC &dc_Map, int Flags) {}
165
166 bool Set_Stretch (CSG_Parameters &Parameters, CSG_Data_Object *pObject = NULL, const CSG_String &Suffix = "");
167
168 bool Set_Normalization (int Field_Value, int Field_Normalize, double Scale_Normalize, sLong maxSamples = 0);
169
170 bool Set_Fields_Choice (CSG_Parameter &Choice, bool bNumeric, bool bAddNone, bool bSelectNone = false);
171 static int Get_Fields_Choice (CSG_Parameter &Choice);
172
173
174private:
175
176 CSG_Table * _Get_Field_Table (int &Field, const CSG_Parameters &Parameters);
177
178
179 //---------------------------------------------------------
180public:
181
183 {
184 public:
185
186 bool Create (CSG_Grid *pGrid, double Minimum, double Maximum)
187 {
188 m_pGrid = pGrid && Minimum != Maximum ? pGrid : NULL;
189
190 if( m_pGrid )
191 {
192 m_Minimum = Minimum; m_Scale = 255. / (Maximum - Minimum);
193 }
194
195 return( m_pGrid != NULL );
196 }
197
198 bool is_Okay (void) const { return( m_pGrid != NULL ); }
199
200 BYTE Get_Alpha (const CSG_Point &Point) const
201 {
202 return( Get_Alpha(Point.x, Point.y) );
203 }
204
205 BYTE Get_Alpha (double x, double y) const
206 {
207 if( m_pGrid )
208 {
209 double Alpha;
210
211 if( m_pGrid->Get_Value(x, y, Alpha) )
212 {
213 Alpha = (Alpha - m_Minimum) * m_Scale;
214
215 return( Alpha <= 0. ? 0 : Alpha >= 255. ? 255 : (BYTE)Alpha );
216 }
217
218 return( 0 );
219 }
220
221 return( 255 );
222 }
223
224 BYTE Get_Alpha (const CSG_Grid_System &System, int x, int y) const
225 {
226 return( Get_Alpha(System.Get_xGrid_to_World(x), System.Get_yGrid_to_World(y)) );
227 }
228
229 bool Set_Alpha (int &Color, const CSG_Point &Point) const
230 {
231 return( Set_Alpha(Color, Point.x, Point.y) );
232 }
233
234 bool Set_Alpha (int &Color, double x, double y) const
235 {
236 if( m_pGrid )
237 {
238 ((BYTE *)&Color)[3] = Get_Alpha(x, y);
239
240 return( true );
241 }
242
243 return( false );
244 }
245
246 bool Set_Alpha (int &Color, const CSG_Grid_System &System, int x, int y) const
247 {
248 if( m_pGrid )
249 {
250 ((BYTE *)&Color)[3] = Get_Alpha(System.Get_xGrid_to_World(x), System.Get_yGrid_to_World(y));
251
252 return( true );
253 }
254
255 return( false );
256 }
257
258
259 private:
260
261 double m_Minimum = 0., m_Scale = 1.;
262
263 CSG_Grid *m_pGrid = NULL;
264
265 };
266
267};
268
269
271// //
273
274//---------------------------------------------------------
276{
277public:
278 CSG_Map_Grid(CSG_Grid *pGrid = NULL);
279
280 virtual bool Add_Parameters (CSG_Parameters &Parameters);
281
282 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
283
284 virtual bool Parameters_Changed (void);
285 virtual bool DataObject_Changed (void);
286
287
288public:
289
290 virtual bool Update (CSG_Data_Object *pChanged);
291
292 virtual bool Set_Stretch_Extent (const CSG_Rect &Extent);
293
294 virtual bool asImage (CSG_Grid *pImage);
295
296 virtual bool Get_Image (wxImage &Image , bool bFitSize = true, int Width = 0, int Height = 0);
297 virtual bool Get_Bitmap (wxBitmap &Bitmap, bool bFitSize = true, int Width = 0, int Height = 0);
298 virtual bool Get_Bitmap_Legend (wxBitmap &Bitmap, double Zoom);
299
300 CSG_Grid * Get_Composite_Band (int Band);
301
302
303protected:
304
305 virtual void On_Draw (CSG_Map_DC &dc_Map, int Flags);
306
307
308private:
309
310 int m_Stretch_Extent = -1, m_xSel = 0, m_ySel = 0;
311
312 CTransparency m_Alpha;
313
314 //-----------------------------------------------------
315 class CComposite
316 {
317 public:
318 CSG_Grid *pReference = NULL, *pGrid = NULL; CSG_Scaler Scaler;
319
320 CComposite & operator = (const CComposite &Composite)
321 {
322 pReference = Composite.pReference; pGrid = Composite.pGrid; Scaler = Composite.Scaler;
323
324 return( *this );
325 }
326
327 bool Set_Color (BYTE &Color, int x, int y)
328 {
329 if( pGrid )
330 {
331 if( pReference && pReference != pGrid && pReference->Get_System() != pGrid->Get_System() )
332 {
333 return( Set_Color(Color, pReference->Get_System().Get_Grid_to_World(x, y), CSG_Grid_Resampling::NearestNeighbour) );
334 }
335
336 if( pGrid->is_InGrid(x, y) )
337 {
338 double Value = Scaler.to_Relative(pGrid->asDouble(x, y));
339
340 Color = Value <= 0. ? 0 : Value >= 1. ? 255 : (BYTE)(255. * Value);
341
342 return( true );
343 }
344 }
345
346 if( pGrid != pReference )
347 {
348 Color = 255;
349
350 return( true );
351 }
352
353 return( false );
354 }
355
356 bool Set_Color (BYTE &Color, const CSG_Point &Point, CSG_Grid_Resampling Resampling)
357 {
358 if( pGrid )
359 {
360 double Value;
361
362 if( pGrid->Get_Value(Point, Value, Resampling) )
363 {
364 Value = Scaler.to_Relative(Value);
365
366 Color = Value <= 0. ? 0 : Value >= 1. ? 255 : (BYTE)(255. * Value);
367
368 return( true );
369 }
370 }
371
372 if( pGrid != pReference )
373 {
374 Color = 255;
375
376 return( true );
377 }
378
379 return( false );
380 }
381
382 } m_Composite[3];
383
384
385 //-----------------------------------------------------
386 void _Composite_Update (void);
387 void _Composite_Get (CComposite Composite[3]);
388
389 bool _Get_Stretch_Extent (const CSG_Rect &Extent, CSG_Grid *pGrid, double &Minimum, double &Maximum) const;
390
391 void _Draw_Cells (CSG_Map_DC &dc_Map, CComposite Composite[3]);
392 void _Draw_Points (CSG_Map_DC &dc_Map, CComposite Composite[3], CSG_Grid_Resampling Resampling);
393 void _Draw_Points (CSG_Map_DC &dc_Map, CComposite Composite[3], CSG_Grid_Resampling Resampling, int yDC, int axDC, int bxDC);
394
395 int _Adjust_Color (const CSG_Point &p, int Color, CSG_Grid_Resampling Resampling);
396 int _Adjust_Color (int x, int y, int Color);
397
398 void _Draw_Values (CSG_Map_DC &dc_Map);
399
400
401private:
402
403 //-----------------------------------------------------
404 class CShading
405 {
406 public:
407
408 bool Create (int Mode, CSG_Grid *pGrid, double Height, double Azimuth, double Exaggeration, double Minimum, double Maximum)
409 {
410 m_Mode = pGrid && pGrid->Get_Range() > 0. && Height >= 0. && Minimum != Maximum ? Mode : 0;
411
412 if( m_Mode )
413 {
414 m_pGrid = pGrid;
415 m_Sin_Height = sin(M_DEG_TO_RAD * Height);
416 m_Cos_Height = cos(M_DEG_TO_RAD * Height);
417 m_Azimuth = M_DEG_TO_RAD * Azimuth;
418 m_Exaggeration = Exaggeration;
419 m_Minimum = Minimum;
420 m_Range = Maximum - Minimum;
421 }
422
423 return( is_Okay() );
424 }
425
426 bool is_Okay (void) const { return( m_Mode != 0 ); }
427
428 bool Set_Shading (int &Color, int x, int y) const
429 {
430 double s, a; return( m_Mode && m_pGrid && m_pGrid->Get_Gradient(x, y, s, a ) && _Set_Shading(s, a, Color) );
431 }
432
433 bool Set_Shading (int &Color, const CSG_Point &Point, CSG_Grid_Resampling Resampling) const
434 {
435 double s, a; return( m_Mode && m_pGrid && m_pGrid->Get_Gradient(Point, s, a, Resampling) && _Set_Shading(s, a, Color) );
436 }
437
438
439 private:
440
441 int m_Mode = 0;
442
443 double m_Sin_Height = 0., m_Cos_Height = 0, m_Azimuth = 0., m_Exaggeration = 1., m_Minimum = 0., m_Range = 1.;
444
445 CSG_Grid *m_pGrid = NULL;
446
447
448 bool _Set_Shading (double s, double a, int &Color) const
449 {
450 s = M_PI_090 - atan(m_Exaggeration * tan(s));
451
452 if( m_Mode == 1 )
453 {
454 _Set_Shading(acos(sin(s) * m_Sin_Height + cos(s) * m_Cos_Height * cos(a - m_Azimuth)), (BYTE *)&Color);
455 }
456 else
457 {
458 double sum = 0., dir = m_Azimuth - M_PI_180 / 2., sin_Slope = sin(s) * m_Sin_Height, cos_Slope = cos(s) * m_Cos_Height;
459
460 for(int i=0; i<6; i++, dir+=M_PI_180/5.)
461 {
462 sum += acos(sin_Slope + cos_Slope * cos(a - dir));
463 }
464
465 _Set_Shading(sum / 6., (BYTE *)&Color);
466 }
467
468 return( true );
469 }
470
471 void _Set_Shading (double Shade, BYTE *Color) const
472 {
473 Shade = m_Range * ((1. - Shade / M_PI_090) - m_Minimum); double c;
474
475 c = Shade * Color[0]; Color[0] = c <= 0. ? 0 : c >= 255. ? 255 : (BYTE)c;
476 c = Shade * Color[1]; Color[1] = c <= 0. ? 0 : c >= 255. ? 255 : (BYTE)c;
477 c = Shade * Color[2]; Color[2] = c <= 0. ? 0 : c >= 255. ? 255 : (BYTE)c;
478 }
479
480 };
481
482 CShading m_Shading;
483
484};
485
486
488// //
490
491//---------------------------------------------------------
493{
494public:
495 CSG_Map_Grids(CSG_Grids *pGrids = NULL);
496
497 virtual bool Add_Parameters (CSG_Parameters &Parameters);
498
499 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
500
501 virtual bool Parameters_Changed (void);
502 virtual bool DataObject_Changed (void);
503
504
505public:
506
507 CSG_Grid * Get_Grid (void);
508 CSG_Grid * Get_Grid (int Band);
509 CSG_String Get_Grid_Name (int Band, int Style = SG_GRIDS_NAME_GRID);
510
511 bool Set_Grid_Choices (CSG_Parameters &Parameters, int NameField = -1);
512
513 virtual bool Set_Stretch_Extent (const CSG_Rect &Extent);
514
515 virtual bool asImage (CSG_Grid *pImage);
516
517 virtual bool Get_Image (wxImage &Image , bool bFitSize = true, int Width = 0, int Height = 0);
518 virtual bool Get_Bitmap (wxBitmap &Bitmap, bool bFitSize = true, int Width = 0, int Height = 0);
519 virtual bool Get_Bitmap_Legend (wxBitmap &Bitmap, double Zoom);
520
521
522protected:
523
524 virtual void On_Draw (CSG_Map_DC &dc_Map, int Flags);
525
526
527private:
528
529 int m_Stretch_Extent = -1;
530
531 CTransparency m_Alpha;
532
533 CSG_Scaler m_Stretch[3];
534
535
536 CSG_String _Get_List_Attributes (void);
537 CSG_String _Get_List_Bands (int Attribute = -1);
538
539 CSG_Grid * _Get_Grid (int Band, const CSG_Parameters &Parameters);
540
541 bool _Get_Stretch_Extent (const CSG_Rect &Extent, CSG_Data_Object *pObject, double &Minimum, double &Maximum) const;
542
543 void _Draw_Cells (CSG_Map_DC &dc_Map);
544 void _Draw_Points (CSG_Map_DC &dc_Map);
545
546 bool _Draw_Get_Color (int &Color, int x, int y );
547 bool _Draw_Get_Color (int &Color, const CSG_Point &Point);
548
549
550private:
551
552 class CBands
553 {
554 public:
555
556 bool bOverlay, bBandStatistics;
557
558 CSG_Grid_Resampling Resampling;
559
560 CSG_Grid *pBands[3];
561
562 void Set_Bands (CSG_Grid *pB0, CSG_Grid *pB1, CSG_Grid *pB2) { pBands[0] = pB0; pBands[1] = pB1; pBands[2] = pB2; }
563
564 CSG_Grid * operator [] (int i) { return( pBands[i] ); }
565 };
566
567 CBands m_Bands;
568
569};
570
571
573// //
575
576//---------------------------------------------------------
578{
579public:
580 CSG_Map_PointCloud(CSG_PointCloud *pPointCloud = NULL);
581
582 virtual bool Add_Parameters (CSG_Parameters &Parameters);
583
584 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
585
586 virtual bool Parameters_Changed (void);
587 virtual bool DataObject_Changed (void);
588
589
590public:
591
592 int Get_Field_Value (void) { return( m_Stretch.Value ); }
593 int Get_Field_Normal (void) { return( m_Stretch.Normal ); }
594 double Get_Scale_Normal (void) { return( m_Stretch.Scale ); }
595
596 bool asImage (CSG_Grid *pImage);
597
598
599protected:
600
601 virtual void On_Draw (CSG_Map_DC &dc_Map, int Flags);
602
603
604private:
605
606 int m_PointSize = 1, m_Aggregation = 0, m_Edit_Index = -1;
607
608 wxColour m_Color_Pen;
609
610 CSG_Grid m_Z, m_N, m_Symbol;
611
612 class CStretch { public: int Value = -1, Normal = -1; double Scale = 1.; } m_Stretch;
613
614
615 void _Draw_Pixel (CSG_Map_DC &dc_Map, int x, int y, double z, int Color);
616 void _Draw_Symbol (CSG_Map_DC &dc_Map, const CSG_Point_3D &Point, int Color);
617
618 void _Draw_Points (CSG_Map_DC &dc_Map, bool bSkipSelection);
619
620 void _Draw_Thumbnail (CSG_Map_DC &dc_Map);
621
622};
623
624
626// //
628
629//---------------------------------------------------------
631{
632public:
633
634 virtual bool Add_Parameters (CSG_Parameters &Parameters);
635
636 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
637
638 virtual bool Parameters_Changed (void);
639 virtual bool DataObject_Changed (void);
640
641
642public:
643
644 int Get_Field_Value (void) const { return( m_Stretch.Value ); }
645 int Get_Field_Normal (void) const { return( m_Stretch.Normal ); }
646 double Get_Scale_Normal (void) const { return( m_Stretch.Scale ); }
647 int Get_Field_Label (void) const { return( m_Label.Field ); }
648
649 wxPen Get_Def_Pen (void) const { return( m_Pen ); }
650 wxBrush Get_Def_Brush (void) const { return( m_Brush ); }
651
652 virtual void Draw_Thumbnails (CSG_Map_DC &dc_Map, int Limit);
653
654 virtual void Draw_Shape (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags = 0 ) {};
655 virtual void Draw_Label (CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label) {};
656
657
658protected:
659
660 bool m_bNoData = true;
661
663
664 wxPen m_Pen;
665
666 wxBrush m_Brush;
667
668 class CStretch { public: int Value = -1, Normal = -1; double Scale = 1.; } m_Stretch;
669
670 class CLabel { public: int Field = -1, Precision = -1, Effect = 0, Effect_Size = 1; wxColour Effect_Color; } m_Label;
671
672
673 CSG_Map_Shapes(void);
674
675 virtual void On_Draw (CSG_Map_DC &dc_Map, int Flags);
676
678
679 bool Get_Class_Color (CSG_Shape *pShape, int &Color);
680
681 CSG_Parameter * BrushList_Add (CSG_Parameters &Parameters, const CSG_String &ParentID, const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description) const;
682 wxBrushStyle BrushList_Get_Style (const CSG_String &Identifier);
683
684 CSG_Parameter * PenList_Add (CSG_Parameters &Parameters, const CSG_String &ParentID, const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description) const;
685 int PenList_Get_Style (const CSG_String &Identifier);
686
687 virtual void Draw_Initialize (CSG_Map_DC &dc_Map, int Flags) {}
688
689
690private:
691
692 void _Draw_Shape (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags = 0);
693 void _Draw_Label (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int PointSize = 0);
694
695
696 //-----------------------------------------------------
697 // Charts...
698
699 class CChart
700 {
701 public:
702
703 bool is_Valid (void) { return( m_Fields.Get_Count() > 0 ); }
704
705 bool Set_Options (const CSG_Shapes *pShapes, CSG_Parameters &Parameters);
706 bool Get_Options (const CSG_Shapes *pShapes, const CSG_Parameters &Parameters);
707
708 void Draw (CSG_Map_DC &dc_Map, CSG_Shape *pShape);
709
710
711 private:
712
713 int m_Type = 0;
714
715 CSG_Points_Int m_Fields;
716
717 class CSize { public: int Size = 1, Field = -1, Type = 0; double Scale = 1., Range = 0.; } m_Size;
718
719 void _Draw_Pie (CSG_Map_DC &dc_Map, CSG_Table_Record *pRecord, bool bOutline, int x, int y, int size);
720 void _Draw_Bar (CSG_Map_DC &dc_Map, CSG_Table_Record *pRecord, bool bOutline, int x, int y, int sx, int sy);
721
722 } m_Chart;
723
724};
725
726
728// //
730
731//---------------------------------------------------------
733{
734public:
735 CSG_Map_Shapes_Point(CSG_Shapes *pShapes = NULL);
736
737 virtual bool Add_Parameters (CSG_Parameters &Parameters);
738
739 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
740
741 virtual bool Parameters_Changed (void);
742 virtual bool DataObject_Changed (void);
743
744
745public:
746
747 virtual void Draw_Shape (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags = 0 );
748 virtual void Draw_Label (CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label);
749
750 bool Get_Outline (void) { return( m_bOutline ); }
751 bool Get_Style_Size (int &minSize, int &maxSize, double &Minimum, double &Scale, wxString *pName);
752
753 void Draw_Symbol (wxDC &dc, int x, int y, int size);
754
755
756protected:
757
759
761
762 class CSize { public: int Unit, Field, Adjust; double Minimum, Offset, Scale; } m_Size;
763
765
766 class CSymbol { public: int Type; wxImage Image; } m_Symbol;
767
768 class CImage { public: int Field, Align, Fit; double Offset, Scale; } m_Image;
769
770 class CArrow { public: int Field, Style, Width, Orientation, Unit; double Offset; } m_Arrow;
771
772 class CBeachball { public: int Strike, Dip, Rake; } m_Beachball;
773
774
775 virtual void Draw_Initialize (CSG_Map_DC &dc_Map , int Flags);
776 virtual bool Draw_Initialize (CSG_Map_DC &dc_Map, int &Size, CSG_Shape *pShape, int Flags);
777
778 void Draw_Symbol (CSG_Map_DC &dc, int x, int y, int size);
779
780
781private:
782
783 void _Image_Draw (CSG_Map_DC &dc, int x, int y, int size, const wxString &file);
784
785 void _Arrow_Draw (CSG_Map_DC &dc_Map, int x, int y, int size, double direction);
786
787 void _Beachball_Draw (CSG_Map_DC &dc, int x, int y, int size, double strike, double dip, double rake);
788 void _Beachball_Get_Plane (CSG_Shape *pPlane, CSG_Shape *pCircle, const CSG_Vector &Normal);
789 void _Beachball_Get_Scaled (CSG_Shape *pShape, double x, double y, double size);
790
791};
792
793
795// //
797
798//---------------------------------------------------------
800{
801public:
802 CSG_Map_Shapes_Points(CSG_Shapes *pShapes = NULL);
803
804 virtual void Draw_Shape (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags = 0 );
805 virtual void Draw_Label (CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label);
806
807};
808
809
811// //
813
814//---------------------------------------------------------
816{
817public:
818 CSG_Map_Shapes_Line(CSG_Shapes *pShapes = NULL);
819
820 virtual bool Add_Parameters (CSG_Parameters &Parameters);
821
822 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
823
824 virtual bool Parameters_Changed (void);
825 virtual bool DataObject_Changed (void);
826
827
828public:
829
830 virtual void Draw_Shape (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags = 0 );
831 virtual void Draw_Label (CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label);
832
833 bool Get_Style_Size (int &min_Size, int &max_Size, double &min_Value, double &dValue, wxString *pName);
834
835
836protected:
837
839
841
843
845
847
848
849 virtual void Draw_Initialize (CSG_Map_DC &dc_Map, int Flags);
850
851
852private:
853
854 void _Draw_Shape (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int xOffset = 0, int yOffset = 0);
855
856};
857
858
860// //
862
863//---------------------------------------------------------
865{
866public:
867 CSG_Map_Shapes_Polygon(CSG_Shapes *pShapes = NULL);
868
869 virtual bool Add_Parameters (CSG_Parameters &Parameters);
870
871 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
872
873 virtual bool Parameters_Changed (void);
874 virtual bool DataObject_Changed (void);
875
876
877public:
878
879 virtual void Draw_Shape (CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags = 0 );
880 virtual void Draw_Label (CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label);
881
882 virtual void Draw_Thumbnails (CSG_Map_DC &dc_Map, int Limit);
883
884 bool Get_Outline (void) { return( m_bOutline ); }
885
886
887protected:
888
890
891
892 virtual void Draw_Initialize (CSG_Map_DC &dc_Map, int Flags);
893
894};
895
896
898// //
900
901//---------------------------------------------------------
903{
904public:
905 CSG_Map_TIN(CSG_TIN *pTIN = NULL);
906
907 virtual bool Add_Parameters (CSG_Parameters &Parameters);
908
909 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
910
911 virtual bool Parameters_Changed (void);
912 virtual bool DataObject_Changed (void);
913
914
915public:
916
917 int Get_Field_Value (void) { return( m_Stretch.Value ); }
918 int Get_Field_Normal (void) { return( m_Stretch.Normal ); }
919 double Get_Scale_Normal (void) { return( m_Stretch.Scale ); }
920
921 virtual bool asImage (CSG_Grid *pImage);
922
923
924protected:
925
926 class CStretch { public: int Value = -1, Normal = -1; double Scale = 1.; } m_Stretch;
927
928
929 virtual void On_Draw (CSG_Map_DC &dc_Map, int Flags);
930
931
932private:
933
934 typedef struct { int x, y; double z; } TPoint;
935
936
937 void _Draw_Points (CSG_Map_DC &dc_Map);
938 void _Draw_Edges (CSG_Map_DC &dc_Map);
939 void _Draw_Triangles (CSG_Map_DC &dc_Map);
940 void _Draw_Triangle (CSG_Map_DC &dc_Map, TPoint p[3]);
941 void _Draw_Triangle_Line (CSG_Map_DC &dc_Map, int xa, int xb, int y, double za, double zb);
942
943};
944
945
947// //
948// //
949// //
951
952//---------------------------------------------------------
954{
955public:
956 CSG_Map_Graticule(void);
957 virtual ~CSG_Map_Graticule(void);
958
959 virtual CSG_Parameters & Get_Parameters (void) { return( m_Parameters ); }
960 virtual bool Set_Parameters (const CSG_Parameters &Parameters);
961
962 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
963
964 virtual bool Parameters_Changed (void);
965
966 virtual bool Draw (CSG_Map_DC &dc, const CSG_Projection &Projection);
967
968
969private:
970
971 CSG_Parameters m_Parameters;
972
973 CSG_Shapes m_Graticule, m_Coordinates;
974
975 class CSG_Tool *m_pTool = NULL;
976
977
978 bool Get_Graticule (const CSG_Rect &Extent, const CSG_Projection &Projection);
979
980 CSG_String Get_Unit (CSG_Shape *pPoint, int Units, int Decimals, bool bLatitude);
981
982};
983
984
986// //
987// //
988// //
990
991//---------------------------------------------------------
993{
994public:
995 CSG_Map_BaseMap(void);
996 virtual ~CSG_Map_BaseMap(void);
997
998 virtual CSG_Parameters & Get_Parameters (void) { return( m_Parameters ); }
999 virtual bool Set_Parameters (const CSG_Parameters &Parameters);
1000
1001 virtual bool Parameter_Changed (CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags);
1002
1003 virtual bool Parameters_Changed (void);
1004
1005 virtual bool Draw (CSG_Map_DC &dc, const CSG_Projection &Projection);
1006
1007
1008private:
1009
1010 CSG_Parameters m_Parameters;
1011
1012 CSG_Grid m_BaseMap;
1013
1014 class CSG_Tool *m_pTool = NULL;
1015
1016
1017 bool Get_BaseMap (const CSG_Grid_System &System, const CSG_Projection &Projection);
1018
1019};
1020
1021
1023// //
1024// //
1025// //
1027
1028//---------------------------------------------------------
1029#endif // #ifndef _HEADER_INCLUDED__SAGA_GDI__Map_Layer_H
signed long long sLong
Definition api_core.h:158
#define SAGA_API_DLL_EXPORT
Definition api_core.h:94
TSG_Point Get_Grid_to_World(int xGrid, int yGrid) const
Definition grid.h:306
double Get_yGrid_to_World(int yGrid) const
Definition grid.h:304
double Get_xGrid_to_World(int xGrid) const
Definition grid.h:303
const CSG_Grid_System & Get_System(void) const
Definition grid.h:559
double Get_Range(void)
Definition grid.cpp:1032
virtual CSG_Parameters & Get_Parameters(void)
Definition map_layer.h:998
virtual CSG_Parameters & Get_Parameters(void)
Definition map_layer.h:959
virtual bool Get_Image(wxImage &Image, bool bFitSize=true, int Width=0, int Height=0)
Definition map_grid.cpp:811
virtual bool Set_Stretch_Extent(const CSG_Rect &Extent)
Definition map_grid.cpp:267
virtual bool Add_Parameters(CSG_Parameters &Parameters)
Definition map_grid.cpp:81
virtual bool Get_Bitmap(wxBitmap &Bitmap, bool bFitSize=true, int Width=0, int Height=0)
Definition map_grid.cpp:838
virtual bool Parameters_Changed(void)
Definition map_grid.cpp:250
CSG_Grid * Get_Composite_Band(int Band)
Definition map_grid.cpp:403
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
Definition map_grid.cpp:159
virtual bool Update(CSG_Data_Object *pChanged)
Definition map_grid.cpp:373
virtual bool DataObject_Changed(void)
Definition map_grid.cpp:236
virtual bool asImage(CSG_Grid *pImage)
Definition map_grid.cpp:783
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
Definition map_grid.cpp:489
virtual bool Get_Bitmap_Legend(wxBitmap &Bitmap, double Zoom)
Definition map_grid.cpp:865
CSG_Map_Grid(CSG_Grid *pGrid=NULL)
Definition map_grid.cpp:67
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual bool Set_Stretch_Extent(const CSG_Rect &Extent)
CSG_String Get_Grid_Name(int Band, int Style=SG_GRIDS_NAME_GRID)
virtual bool Get_Bitmap_Legend(wxBitmap &Bitmap, double Zoom)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
Definition map_grids.cpp:79
virtual bool Get_Bitmap(wxBitmap &Bitmap, bool bFitSize=true, int Width=0, int Height=0)
CSG_Map_Grids(CSG_Grids *pGrids=NULL)
Definition map_grids.cpp:65
virtual bool Parameters_Changed(void)
bool Set_Grid_Choices(CSG_Parameters &Parameters, int NameField=-1)
CSG_Grid * Get_Grid(void)
virtual bool DataObject_Changed(void)
virtual bool Get_Image(wxImage &Image, bool bFitSize=true, int Width=0, int Height=0)
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
virtual bool asImage(CSG_Grid *pImage)
bool Set_Alpha(int &Color, double x, double y) const
Definition map_layer.h:234
bool is_Okay(void) const
Definition map_layer.h:198
bool Create(CSG_Grid *pGrid, double Minimum, double Maximum)
Definition map_layer.h:186
BYTE Get_Alpha(double x, double y) const
Definition map_layer.h:205
bool Set_Alpha(int &Color, const CSG_Point &Point) const
Definition map_layer.h:229
bool Set_Alpha(int &Color, const CSG_Grid_System &System, int x, int y) const
Definition map_layer.h:246
BYTE Get_Alpha(const CSG_Grid_System &System, int x, int y) const
Definition map_layer.h:224
BYTE Get_Alpha(const CSG_Point &Point) const
Definition map_layer.h:200
CSG_Table m_Normalization
Definition map_layer.h:159
class CSG_Map_Symbology * Get_Symbology(void)
Definition map_layer.h:136
class CSG_Map_Legend * Get_Legend(void)
Definition map_layer.h:137
class CSG_Map_Legend * m_pLegend
Definition map_layer.h:155
CSG_Parameters & Get_Parameters(void)
Definition map_layer.h:102
TSG_Data_Object_Type m_Type
Definition map_layer.h:147
CSG_Data_Object * m_pObject
Definition map_layer.h:151
const TSG_Data_Object_Type & Get_ObjectType(void) const
Definition map_layer.h:93
class wxBitmap * m_pThumbnail
Definition map_layer.h:157
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
Definition map_layer.h:164
CSG_Data_Object * Get_Object(void) const
Definition map_layer.h:96
CSG_Parameters m_Parameters
Definition map_layer.h:149
virtual bool asImage(CSG_Grid *pImage)
Definition map_layer.h:139
class CSG_Map_Symbology * m_pSymbology
Definition map_layer.h:153
virtual bool Set_Stretch_Extent(const CSG_Rect &Extent)
Definition map_layer.h:132
CSG_Map_Layer(void)
Definition map_layer.h:90
virtual bool Parameters_Changed(void)
int Get_Field_Normal(void)
Definition map_layer.h:593
double Get_Scale_Normal(void)
Definition map_layer.h:594
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual bool DataObject_Changed(void)
int Get_Field_Value(void)
Definition map_layer.h:592
virtual bool Add_Parameters(CSG_Parameters &Parameters)
CSG_Map_PointCloud(CSG_PointCloud *pPointCloud=NULL)
bool Get_Style_Size(int &min_Size, int &max_Size, double &min_Value, double &dValue, wxString *pName)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
virtual bool Parameters_Changed(void)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
virtual bool DataObject_Changed(void)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
CSG_Map_Shapes_Line(CSG_Shapes *pShapes=NULL)
wxColour m_Effect_Color
Definition map_layer.h:846
void Draw_Symbol(wxDC &dc, int x, int y, int size)
class CSG_Map_Shapes_Point::CSize m_Size
bool Get_Outline(void)
Definition map_layer.h:750
class CSG_Map_Shapes_Point::CLabel_Point m_Label_Point
CSG_Map_Shapes_Point(CSG_Shapes *pShapes=NULL)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
virtual bool DataObject_Changed(void)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
class CSG_Map_Shapes_Point::CImage m_Image
class CSG_Map_Shapes_Point::CArrow m_Arrow
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
class CSG_Map_Shapes_Point::CBeachball m_Beachball
class CSG_Map_Shapes_Point::CSymbol m_Symbol
virtual bool Parameters_Changed(void)
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
CSG_Map_Shapes_Points(CSG_Shapes *pShapes=NULL)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
virtual bool DataObject_Changed(void)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual void Draw_Thumbnails(CSG_Map_DC &dc_Map, int Limit)
virtual bool Parameters_Changed(void)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
CSG_Map_Shapes_Polygon(CSG_Shapes *pShapes=NULL)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
CSG_Parameter * BrushList_Add(CSG_Parameters &Parameters, const CSG_String &ParentID, const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description) const
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
wxBrush Get_Def_Brush(void) const
Definition map_layer.h:650
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
Definition map_layer.h:654
int Get_Field_Label(void) const
Definition map_layer.h:647
int Get_Field_Normal(void) const
Definition map_layer.h:645
double Get_Scale_Normal(void) const
Definition map_layer.h:646
wxPen Get_Def_Pen(void) const
Definition map_layer.h:649
wxBrushStyle BrushList_Get_Style(const CSG_String &Identifier)
bool Get_Class_Color(CSG_Shape *pShape, int &Color)
CSG_Shape * Get_Shape(sLong i)
class CSG_Map_Shapes::CLabel m_Label
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
Definition map_layer.h:687
class CSG_Map_Shapes::CStretch m_Stretch
wxBrush m_Brush
Definition map_layer.h:666
int PenList_Get_Style(const CSG_String &Identifier)
CSG_Parameter * PenList_Add(CSG_Parameters &Parameters, const CSG_String &ParentID, const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description) const
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
Definition map_layer.h:655
int Get_Field_Value(void) const
Definition map_layer.h:644
virtual bool Parameters_Changed(void)
virtual bool DataObject_Changed(void)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
Definition map_tin.cpp:98
virtual bool DataObject_Changed(void)
Definition map_tin.cpp:120
virtual bool Add_Parameters(CSG_Parameters &Parameters)
Definition map_tin.cpp:76
double Get_Scale_Normal(void)
Definition map_layer.h:919
CSG_Map_TIN(CSG_TIN *pTIN=NULL)
Definition map_tin.cpp:62
int Get_Field_Value(void)
Definition map_layer.h:917
virtual bool Parameters_Changed(void)
Definition map_tin.cpp:140
int Get_Field_Normal(void)
Definition map_layer.h:918
class CSG_Map_TIN::CStretch m_Stretch
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
Definition map_tin.cpp:192
double to_Relative(double Value) const
Definition mat_tools.h:1155
Definition tin.h:222
TSG_Data_Object_Type
Definition dataobject.h:117
@ SG_DATAOBJECT_TYPE_Undefined
Definition dataobject.h:124
CSG_Grid_Resampling
Definition grid.h:156
#define SG_GRIDS_NAME_GRID
Definition grids.h:103
#define M_PI_090
Definition mat_tools.h:100
#define M_PI_180
Definition mat_tools.h:102
#define M_DEG_TO_RAD
Definition mat_tools.h:109
double x
Definition geo_tools.h:129
double y
Definition geo_tools.h:129