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
|
/***************************** 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:
// CommonXSectView
//
// .AUTHOR:
// Geir Austad. Modified by Fernando Ii 03-2012
//
// .SUMMARY:
// Convenience class, for implementing methods common
// to XSectView and AverageView.
//
// .CLIENTS:
// DropAction
//
// .RESPONSIBILITY:
//
// .ASCENDENT:
// PlotModView, PlotModService
//
// .DESCENDENT:
// XSectView, AverageView
//
//
#ifndef CommonXSectView_H
#define CommonXSectView_H
#include <string>
#include "Page.h"
#include "PlotModService.h"
#include "PlotModView.h"
class CommonXSectView: public PlotModView, public PlotModService {
public:
// -- Constructor
CommonXSectView( Page&, const MvRequest&, const MvRequest& );
CommonXSectView(const CommonXSectView &);
// -- Destructor
~CommonXSectView();
// -- Methods overriden from PlotModView class
virtual string Name();
// Call a service and wait its return
bool CallService(const MvRequest&, PmContext&, MvRequest&);
// -- Methods that the subclasses must provide
// Replace the current view
virtual bool UpdateView () = 0;
// Decode the data Unit
virtual void DecodeDataUnit ( MvIcon& dataUnit );
// Process a drop
virtual void Drop ( PmContext& context );
// Draw the background (axis )
virtual void DrawBackground ( ) = 0;
// Draw the foreground.
virtual void DrawForeground ( ) { }
// Describe the contents of the view
virtual void DescribeYourself ( ObjectInfo& description ) = 0;
// Set data unit id
void ParentDataUnitId ( int parentDataUnitId ) {
viewRequest_("_PARENT_DATAUNIT_ID") = parentDataUnitId;
appViewReq_("_PARENT_DATAUNIT_ID") = parentDataUnitId;
parentDataUnitId_ = parentDataUnitId;
}
int ParentDataUnitId () { return parentDataUnitId_; }
virtual bool ConsistencyCheck( MvRequest&, MvRequest&)
{ return true; }
protected:
void ApplicationName( const string& appname )
{ applicationName_ = appname; }
string& ApplicationName() { return applicationName_; }
virtual void Draw(SubPage *);
// Save some data specific to some DataApplication
// It must be pure virtual because ThermoView and
// HovmoellerView have their own implementation.
virtual void ApplicationInfo( const MvRequest& ) = 0;
// Insert a new data request into the page hierarchy
MvIconList InsertDataRequest ( MvRequest& dropRequest );
// Get output requests from executing a Module (they all have the
// same tag _MODULEID
bool DropFromModule ( MvRequest&, MvRequest&, bool& );
#if 0
// Provide Axis information
void DescribeAxis ( ObjectInfo& description,
MvRequest& axisRequest,
const Cached& axisName );
// Check and set axis values.
void CheckAxis(double minValue,double maxValue,
int axisType,MvRequest&,
string title = "");
bool CheckLatLon(const string&,double,double,MvRequest&, const char *);
virtual void SetVariables(const MvRequest&, bool) {}
// Check horizontal value
virtual bool CheckHorizontal(MvRequest &) = 0;
// Add values to a request
void AddValues ( MvRequest& dataRequest, vector<double>& dataVector, const char* variableName );
// Functions for generating matrix data.
// convert a netcdf file into a matrix file for use by magics.
bool NetCDFtoMatrix(MvIcon&,MvRequest&);
void GenerateData(FILE *fp,int startIndex,double yMin,
double yMax,vector<double> &xvector,
vector<double> &yvector, int nrPoints,
bool logax = false, bool modlev = false);
bool FindPressure(vector<double> &yvector,double pk,
int &firstindex,int &nextindex, int);
#endif
double latMin_,latMax_, lonMin_,lonMax_;
double yMin_, yMax_;
string applicationName_;
MvRequest appViewReq_; //original application view request
private:
// No assignment
CommonXSectView& operator=(const CommonXSectView&);
};
#endif
|