File: PlotModView.h

package info (click to toggle)
metview 5.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 44,932 kB
  • sloc: cpp: 211,811; ansic: 33,467; xml: 3,942; sh: 2,942; yacc: 1,183; fortran: 762; lex: 761; perl: 700; python: 340; f90: 236; makefile: 92
file content (190 lines) | stat: -rw-r--r-- 4,879 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/***************************** LICENSE START ***********************************

 Copyright 2012 ECMWF and INPE. This software is distributed under the terms
 of the Apache License version 2.0. In applying this license, ECMWF does not
 waive the privileges and immunities granted to it by virtue of its status as
 an Intergovernmental Organization or submit itself to any jurisdiction.

 ***************************** LICENSE END *************************************/

//
// .NAME:
//  PlotModView
//
// .AUTHOR:
//  Gilberto Camara, Baudoin Raoult and Fernando Ii
//
// .SUMMARY:
//  Describes the PlotModView class, a base class
//  for the various types of views in PlotMod
//
//  There is one view per page and the view is responsible
//  for providing the page with the matching information
//
//
// .CLIENTS:
//  CreateAction, DropAction
//
// .RESPONSIBILITY:
//
//  - For a page already with data, inform if two
//    matching information are compatible
//
//
// .COLLABORATORS:
//  ObjectList - extracts information from the request
//  MatchingCriteria - verify compatibility of data 
//
// .ASCENDENT:
//
//
// .DESCENDENT:
//  MapView
//
// .REFERENCES:
//
//  The design of this class is based on the "Factory" pattern
//  ("Design Patterns", page. 107)
//
//
#ifndef PlotModView_H
#define PlotModView_H

#include <inc_stl.h>
#include <Cached.h>
#include <MvRequest.h>

#include "Presentable.h"
#include "MatchingCriteria.h"

class PlotModView;
class Page;

class PlotModViewFactory
{

protected:

   typedef map< Cached, PlotModViewFactory*, less<Cached> > FactoryMap;
   static FactoryMap* factoryMap_;
   Cached             name_;

   virtual PlotModView* Build ( Page&, const MvRequest&, const MvRequest& ) = 0;

public:

   // Normal Constructor
   PlotModViewFactory ( const Cached& decoderName );

   // Virtual Constructor
   static PlotModView* Make ( Page& , MvRequest& viewRequest );

   // Keep compiler happy
   virtual ~PlotModViewFactory() {}
};

class PlotModView
{

public:

   // Contructor
   PlotModView ( Page& , const MvRequest&, const MvRequest&);
        PlotModView(const PlotModView &old);
        virtual PlotModView* Clone() const  = 0;

   // Destructor
   virtual ~PlotModView();

   // Get the object name
   virtual string Name() = 0;

   virtual string MacroName();

   virtual Page& Owner() { return *owner_; }
   virtual void Owner( Page &xx );

   // Overridden by views that needs to call an application.
   virtual bool CallService(const MvRequest &,  PmContext &)
      { return false; }

   // Verify if matching is possible
   virtual bool Match(const MatchingInfo& lhs,const MatchingInfo& rhs) const;

   // Delete all data and drop it to PlotMod again
   virtual void RecreateData();

   // Get a visdef from the database matching the fields in the given request
   virtual bool GetVisDef(Presentable&, const MvRequest&,MvIconList&);

   // -- Methods which are overriden by derived classes

   // Process the drop
   virtual void Drop ( PmContext& context ) = 0;

   // Dealing with Contents tools
   virtual void contentsRequest( MvRequest& );

   // Retrieves a list of visdefs
   virtual bool RetrieveVisdefList (MvRequest& dropReq, MvRequest& vdReqList);

   // Insert a new data request into the page hierarchy
   virtual MvIconList InsertDataRequest ( MvRequest& dropRequest ) = 0;

   // Decode the data unit
   virtual void DecodeDataUnit(MvIcon & ) = 0;

   // Replace the current view depending on the type of the view
   virtual bool UpdateView () { return true; }

   // Replace the current geographical area
   //virtual void ReplaceArea ( const Location&, int /* izoom=-1 */ ) {}

   // Sets up the drawing area
   virtual void DrawNewPage ( );

   virtual void DrawBackground ( ) = 0;

   // Draw the foreground (coastlines or axis )
   virtual void DrawForeground ( ) = 0;

   virtual void Draw (SubPage *);

   virtual void CommonDraw(SubPage*, DrawPriorMap&);

   // Describe the contents of the view
   virtual void DescribeYourself ( ObjectInfo& ) = 0;

   virtual MvRequest& ViewRequest ()
      { return viewRequest_; }

   virtual void ViewRequest ( const MvRequest& viewReq )
      { viewRequest_ = viewReq; }

   void ParentDataUnitId ( int parentDataUnitId ) {
         viewRequest_("_PARENT_DATAUNIT_ID") = parentDataUnitId;
         parentDataUnitId_ = parentDataUnitId;
        }

   int  ParentDataUnitId () { return parentDataUnitId_; }

   virtual bool BackgroundFromData() const
      { return false; }

   // Overridden by derived classes if they need to do something when things are removed from contents
   virtual bool Reset(const MvRequest &)
      { return false; }

   // Zoom inquiry
   virtual bool CanDoZoom() { return true; }

protected:

   Page* owner_;
   MvRequest viewRequest_;
   MatchingCriteria matchingCriteria_;
   int  pageId_;
   int parentDataUnitId_;
};

#endif