From 4aed6c261dec6f9a94b564eaeb3ffe08742f1e40 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 23 May 2022 17:44:34 +0100 Subject: [PATCH 01/66] HotFix 4.12.2: wmsstyles for skinnywWMS + legend_text_font for CDS --- CMakeLists.txt | 2 +- src/basic/FortranMagics.cc | 2 +- src/basic/LegendVisitor.cc | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f8f063d3..b7601ea62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake") find_package( ecbuild 3.4 REQUIRED ) -project( magics VERSION 4.12.1 LANGUAGES CXX ) +project( magics VERSION 4.12.2 LANGUAGES CXX ) # make sure that the header files are installed into include/magics # note that this needs to be done before ecbuild_declare_project() diff --git a/src/basic/FortranMagics.cc b/src/basic/FortranMagics.cc index 7f8a00041..a6b424299 100644 --- a/src/basic/FortranMagics.cc +++ b/src/basic/FortranMagics.cc @@ -641,7 +641,7 @@ const char* FortranMagics::metainput() { StyleEntry style; library->getStyle(request, attributes, style); ostringstream out; - out << style; + out << "{" << style << "}"; static string temp; temp = out.str(); return temp.c_str(); diff --git a/src/basic/LegendVisitor.cc b/src/basic/LegendVisitor.cc index 21794b07b..4fcc0e4ac 100644 --- a/src/basic/LegendVisitor.cc +++ b/src/basic/LegendVisitor.cc @@ -204,7 +204,8 @@ void LegendVisitor::build() { vector::const_iterator position = positions_.begin(); if (title_) { Text* legend = new Text(); - MagFont font; + MagFont font(font_); + double font_size = (title_font_size_ == -1) ? font_size_ : title_font_size_; font.size(font_size); Colour colour = title_font_colour_->automatic() ? *colour_ : *title_font_colour_; From 99f088539d3e7325afe3493a92ec9432c2fd6a2c Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 24 May 2022 15:28:22 +0100 Subject: [PATCH 02/66] Update version number --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d38ba725c..4bcfcd159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake") find_package( ecbuild 3.4 REQUIRED ) -project( magics VERSION 4.12.0 LANGUAGES CXX ) +project( magics VERSION 4.13.0 LANGUAGES CXX ) # make sure that the header files are installed into include/magics # note that this needs to be done before ecbuild_declare_project() From 00ef1bd5754de08993e34f75eeb7f4564e975003 Mon Sep 17 00:00:00 2001 From: Sandor Kertesz Date: Fri, 27 May 2022 15:27:33 +0100 Subject: [PATCH 03/66] Update MvLocation code due to changes in Metview MAGP-1341 --- src/eckit_readers/MvLocation.cc | 186 +++++++++++++++++++++++--------- src/eckit_readers/MvLocation.h | 163 ++++++++++++++++------------ 2 files changed, 229 insertions(+), 120 deletions(-) diff --git a/src/eckit_readers/MvLocation.cc b/src/eckit_readers/MvLocation.cc index 9191cac07..04bc03b9f 100644 --- a/src/eckit_readers/MvLocation.cc +++ b/src/eckit_readers/MvLocation.cc @@ -7,74 +7,142 @@ ***************************** LICENSE END *************************************/ -// MvLocation.cc, vk 940901... -// rev vk 011025 +#include +#include "MvLocation.h" -// classes: MvLocation, MvArea, MvXSectionLine +//=================================================== +// +// MvLocation +// +//=================================================== +const double MvLocation::cRadian = 180. / M_PI; +const double MvLocation::cDegree = 1 / MvLocation::cRadian; +const double MvLocation::cRadianToMetre = 1852 *180.0 * 60.0 / M_PI; +const double MvLocation::cMetreToRadian = 1./MvLocation::cRadianToMetre; -#include "MvLocation.h" -#include -//_____________________________________________________________________ set -void MvLocation ::set(double aLat, double aLong) { - fLatitude = aLat; - fLongitude = aLong; +MvLocation& MvLocation::operator=(const MvLocation& aLoc) +{ + set(aLoc.latitude(), aLoc.longitude()); + return *this; +} + +void MvLocation::set(double aLat, double aLong) +{ + lat_ = aLat; + lon_ = aLong; } -//______________________________________________________________ distanceInRadians -double MvLocation ::distanceInRadians(const MvLocation& anOtherLocation) const { - const double cDEG2RAD = M_PI / 180.0; +void MvLocation::ensureLongitudeBelow360() +{ + while (lon_ >= 360) { + lon_ -= 360; + } +} - double lat1 = latitude() * cDEG2RAD; - double lat2 = anOtherLocation.latitude() * cDEG2RAD; - double lon1 = longitude() * cDEG2RAD; - double lon2 = anOtherLocation.longitude() * cDEG2RAD; +// compute the cosine of the angular distance between the current and the other location +double MvLocation::cosOfDistance(double aLat, double aLon) const +{ + // short-circuit if the two points are the same, because floating-point + // imprecisions can cause a 'nan' on the next calculation + if ((lat_ == aLat) && (lon_ == aLon)) { + return 1.; + } - //-- from: http://williams.best.vwh.net/avform.htm (020815/vk) -- - double d = acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon1 - lon2)); + double lat1 = degToRad(lat_); + double lat2 = degToRad(aLat); + double dlon = degToRad(lon_ - aLon); - return d; + //-- from: http://williams.best.vwh.net/avform.htm + return std::sin(lat1) * std::sin(lat2) + std::cos(lat1) * std::cos(lat2) * std::cos(dlon); } -//_____________________________________________________________ distanceInDegrees -double MvLocation ::distanceInDegrees(const MvLocation& anOtherLocation) const { - return distanceInRadians(anOtherLocation) * 180.0 / M_PI; +// compute the cosine of the angular distance between the current and the other location +double MvLocation::cosOfDistance(const MvLocation& other) const +{ + return cosOfDistance(other.latitude(), other.longitude()); } -//_____________________________________________________________ distanceInMeters -double MvLocation ::distanceInMeters(const MvLocation& anOtherLocation) const { - const double cR2NM = 180.0 * 60.0 / M_PI; //-- radians -> nautical miles - const double cNM2M = 1852; //-- nautical miles -> metres +// compute the angular distance in radians between the current and the other location +double MvLocation::distanceInRadians(const MvLocation& other) const +{ + return std::acos(cosOfDistance(other)); +} - double nm = distanceInRadians(anOtherLocation) * cR2NM; - return nm * cNM2M; - ; +// compute the angular distance in degrees between the current and the other location +double MvLocation::distanceInDegrees(const MvLocation& other) const +{ + return radToDeg(distanceInRadians(other)); } -//_____________________________________________________________ operator= -MvLocation& MvLocation ::operator=(const MvLocation& aLoc) { - set(aLoc.latitude(), aLoc.longitude()); - return *this; +// compute the distance in metres on the surface of Earth +// between the current and the other location +double MvLocation::distanceInMeters(const MvLocation& other) const +{ + return radiansToMetres(distanceInRadians(other)); } -//_____________________________________________________________ operator<< -ostream& operator<<(ostream& aStream, const MvLocation& aLocation) { +std::ostream& operator<<(std::ostream& aStream, const MvLocation& aLocation) +{ aStream << "(" << aLocation.latitude() << "," << aLocation.longitude() << ")"; + /*--- How to get a constant field width + constant nr of decimal digits!? + aStream << "("; + aStream.width( 6 ); aStream.fill( ' ' ); + aStream << aLocation.latitude() << ","; + aStream.width( 7 ); aStream.fill( ' ' ); + aStream << aLocation.longitude() << ")"; +---*/ return aStream; } +//=================================================== +// +// MvLocationHub +// +//=================================================== + +MvLocationHub& MvLocationHub::operator=(const MvLocationHub& aLoc) +{ + set(aLoc.latitude(), aLoc.longitude()); + cosLat_ = aLoc.cosLat_; + sinLat_ = aLoc.sinLat_; + return *this; +} + +double MvLocationHub::cosOfDistance(double aLat, double aLon) const +{ + if (sinLat_ < -100) { + sinLat_ = std::sin(degToRad(lat_)); + cosLat_ = std::cos(degToRad(lat_)); + } + + // short-circuit if the two points are the same, because floating-point + // imprecisions can cause a 'nan' on the next calculation + if (lat_ == aLat && lon_ == aLon) { + return 1.; + } + + double lat2 = degToRad(aLat); + double dLon = degToRad(lon_ - aLon); + + //-- from: http://williams.best.vwh.net/avform.htm + return sinLat_* std::sin(lat2) + cosLat_ * std::cos(lat2) * std::cos(dLon); +} + //____________________________________________________________________________ //============================================================================ MvArea //____________________________________________________________________________ -MvArea ::MvArea(void) { +MvArea ::MvArea() +{ MvLocation myLocation; set(myLocation, myLocation); } //____________________________________________________________________ -void MvArea ::set(const MvLocation& aLocation1, const MvLocation& aLocation2) { +void MvArea ::set(const MvLocation& aLocation1, const MvLocation& aLocation2) +{ double y1 = aLocation1.latitude(); double x1 = aLocation1.longitude(); double y2 = aLocation2.latitude(); @@ -94,22 +162,28 @@ void MvArea ::set(const MvLocation& aLocation1, const MvLocation& aLocation2) { } //____________________________________________________________________ -bool MvArea ::inside(const MvLocation& aPoint) const { - if (aPoint.latitude() >= fLowerLeft.latitude() && aPoint.latitude() <= fUpperRight.latitude() && - aPoint.longitude() >= fLowerLeft.longitude() && aPoint.longitude() <= fUpperRight.longitude()) +bool MvArea ::inside(const MvLocation& aPoint) const +{ + if (aPoint.latitude() >= fLowerLeft.latitude() && + aPoint.latitude() <= fUpperRight.latitude() && + aPoint.longitude() >= fLowerLeft.longitude() && + aPoint.longitude() <= fUpperRight.longitude()) return true; else return false; } //____________________________________________________________________ -MvArea& MvArea ::operator=(const MvArea& anArea) { +MvArea& +MvArea ::operator=(const MvArea& anArea) +{ set(anArea.lowerLeft(), anArea.upperRight()); return *this; } //____________________________________________________________________ -ostream& operator<<(ostream& aStream, const MvArea& anArea) { +std::ostream& operator<<(std::ostream& aStream, const MvArea& anArea) +{ aStream << anArea.lowerLeft() << "-" << anArea.upperRight(); return aStream; } @@ -119,7 +193,8 @@ ostream& operator<<(ostream& aStream, const MvArea& anArea) { //______________________________________________________________________ //_____________________________________________________________ WithinDelta -bool MvXSectionLine ::withinDelta(const MvLocation& aLocation) const { +bool MvXSectionLine ::withinDelta(const MvLocation& aLocation) const +{ //-- check that max delta has been set if (fMaxDeltaInMeters < 0) return false; @@ -132,7 +207,8 @@ bool MvXSectionLine ::withinDelta(const MvLocation& aLocation) const { return insideXLine(aLocation); } //_____________________________________________________________ InsideXLine -bool MvXSectionLine ::insideXLine(const MvLocation& aLocation) const { +bool MvXSectionLine ::insideXLine(const MvLocation& aLocation) const +{ MvLocation myLocation = nearestPointOnXLine(aLocation); MvArea myArea(fLocation1, fLocation2); return myArea.inside(myLocation); @@ -144,7 +220,9 @@ bool MvXSectionLine ::insideXLine(const MvLocation& aLocation) const { // WARNING: calculates distance from a line going through end // points of XSectionLine, NOT ONLY between points! //------------------------------------------------------------- -MvLocation MvXSectionLine ::nearestPointOnXLine(const MvLocation& aLocation) const { +MvLocation +MvXSectionLine ::nearestPointOnXLine(const MvLocation& aLocation) const +{ MvLocation myNearestPointOnXLine; double dy = fLocation1.latitude() - fLocation2.latitude(); @@ -177,19 +255,25 @@ MvLocation MvXSectionLine ::nearestPointOnXLine(const MvLocation& aLocation) con return myNearestPointOnXLine; } //_____________________________________________________________ DeltaInDegrees -double MvXSectionLine ::deltaInDegrees(const MvLocation& aLocation) const { +double +MvXSectionLine ::deltaInDegrees(const MvLocation& aLocation) const +{ return aLocation.distanceInDegrees(nearestPointOnXLine(aLocation)); } //_____________________________________________________________ DeltaInMeters // Q&D approximation for delta, uses DeltaInDegrees //------------------------------------------------------------- -double MvXSectionLine ::deltaInMeters(const MvLocation& aLocation) const { +double +MvXSectionLine ::deltaInMeters(const MvLocation& aLocation) const +{ //-- Q&D formula, out of my old used brains, unchecked!!!! (vk 940901) -- double degreeIntoMeters = 6370. * 1000. * 2. * M_PI / 360.; return deltaInDegrees(aLocation) * degreeIntoMeters; } //_____________________________________________________________ operator= -MvXSectionLine& MvXSectionLine ::operator=(const MvXSectionLine& anXLine) { +MvXSectionLine& +MvXSectionLine ::operator=(const MvXSectionLine& anXLine) +{ setLine(anXLine.startPoint(), anXLine.endPoint()); setMaxDelta(anXLine.maxDelta()); return *this; @@ -198,7 +282,9 @@ MvXSectionLine& MvXSectionLine ::operator=(const MvXSectionLine& anXLine) { // output format: "(lat1,long1)-(lat2,long2)/delta" //------------------------------------------------- -ostream& operator<<(ostream& aStream, const MvXSectionLine& anXLine) { - aStream << anXLine.startPoint() << "-" << anXLine.endPoint() << "/" << anXLine.fMaxDeltaInMeters; // << endl; +std::ostream& operator<<(std::ostream& aStream, const MvXSectionLine& anXLine) +{ + aStream << anXLine.startPoint() << "-" << anXLine.endPoint() + << "/" << anXLine.fMaxDeltaInMeters; // << std::endl; return aStream; } diff --git a/src/eckit_readers/MvLocation.h b/src/eckit_readers/MvLocation.h index a54bd1a57..81a5536bc 100644 --- a/src/eckit_readers/MvLocation.h +++ b/src/eckit_readers/MvLocation.h @@ -7,85 +7,100 @@ ***************************** LICENSE END *************************************/ -// MvLocation.h, vk 940901... -// rev vk 950303 +#pragma once -#ifndef MvLocation_DEFINED_ -#define MvLocation_DEFINED_ - -#include "inc_iostream.h" +#include const double MISSING_LOC_VALUE = -99999.; +//========================================================= +// WARNING: we cannot use MvSci here because this code is +// also included in the Magics source!!! +//========================================================= -//_________________________________________________________________________ MvLocation //! Class for geographical locations /*! MvLocation is used to store latitude-longitude location values. * Class also provides methods to calculate the distance to another * geographical location */ -class MvLocation { +class MvLocation +{ //! Output operator for MvLocation object /*! The output is enclosed in parenthesis and latitude and longitude values - * are separated by a comma, for instance: - *
-     *      MvLocation loc1(51.46,-1.33);
-     *      MvLocation loc2(60.45,25.0);
-     *      std::cout << "Locations are: " << loc1 << " and " << loc2 << std::endl;
-     * 
- * would output the following line: - *
-     *      Locations are: (51.46,-1.33) and (60.45,25)
-     * 
- */ - friend ostream& operator<<(ostream& aStream, const MvLocation& aLocation); + * are separated by a comma, for instance: + *
+ *      MvLocation loc1(51.46,-1.33);
+ *      MvLocation loc2(60.45,25.0);
+ *      std::cout << "Locations are: " << loc1 << " and " << loc2 << std::endl;
+ * 
+ * would output the following line: + *
+ *      Locations are: (51.46,-1.33) and (60.45,25)
+ * 
+ */ + friend std::ostream& operator<<(std::ostream& aStream, const MvLocation& aLocation); public: - //! Constructor, location is assigned with missing values - MvLocation() { - fLatitude = MISSING_LOC_VALUE; - fLongitude = MISSING_LOC_VALUE; - } - - //! Constructor for latitude-longitude location + MvLocation() {} MvLocation(double aLat, double aLong) { set(aLat, aLong); } + MvLocation& operator=(const MvLocation& aLoc); - //! Sets new latitude-longitude location void set(double aLat, double aLong); - //! Checks that the stored location is a valid geographical point - /*! Latitude value must be in interval [-90,90] and longitude - * value in interval [-360,360], in degrees. - */ - bool ok() { return (fLatitude <= 90 && fLatitude >= -90 && fLongitude <= 360 && fLongitude >= -360); } - - //! Returns the latitude value - double latitude() const { return fLatitude; } - - //! Alias to method latitude() - double y() const { return fLatitude; } - - //! Returns the longitude value - double longitude() const { return fLongitude; } - - //! Alias to method longitude() - double x() const { return fLongitude; } - - //! Returns the distance (in radians) to the given point - double distanceInRadians(const MvLocation& anOtherLocation) const; - - //! Returns the distance (in degrees) to the given point - double distanceInDegrees(const MvLocation& anOtherLocation) const; - - //! Returns the distance (in metres) to the given point - double distanceInMeters(const MvLocation& anOtherLocation) const; + // Checks that the stored location is a valid geographical point + // Latitude value must be in interval [-90,90] and longitude + // value in interval [-360,360], in degrees. + bool ok() const { return (lat_ <= 90 && lat_ >= -90 && + lon_ <= 360 && lon_ >= -360); } + + // Subtracts 360 until the longitude is below 360 (e.g. 360 becomes 0, 370 becomes 10) + void ensureLongitudeBelow360(); + + double latitude() const { return lat_; } + double y() const { return lat_; } + double longitude() const { return lon_; } + double x() const { return lon_; } + + // Returns the cosine of the angular distance to the given point + double cosOfDistance(const MvLocation& other) const; + virtual double cosOfDistance(double aLat, double aLon) const; + + // Returns the distance (in radians) to the given point + double distanceInRadians(const MvLocation& other) const; + + // Returns the distance (in degrees) to the given point + double distanceInDegrees(const MvLocation& other) const; + + // Returns the distance (in metres) to the given point + double distanceInMeters(const MvLocation& other) const; + +protected: + // ideally McSci should be used here, but see warning above! + static double degToRad(double d) {return d * cDegree;} + static double radToDeg(double r) {return r * cRadian;} + static double metresToRadians(double m) {return m*cMetreToRadian;} + static double radiansToMetres(double r) {return r*cRadianToMetre;} + + static const double cRadian; + static const double cDegree; + static const double cMetreToRadian; + static const double cRadianToMetre; + double lat_{MISSING_LOC_VALUE}; + double lon_{MISSING_LOC_VALUE}; +}; - //! Assignment operator - MvLocation& operator=(const MvLocation& aLoc); +// A location from that the distance to other locations are computed. It +// caches some trigonometric values to make the computations faster. +class MvLocationHub : public MvLocation +{ +public: + using MvLocation::MvLocation; + MvLocationHub& operator=(const MvLocationHub& aLoc); + double cosOfDistance(double aLat, double aLon) const override; -private: - double fLatitude; - double fLongitude; +protected: + mutable double cosLat_{-1000.}; + mutable double sinLat_{-1000.}; }; //_________________________________________________________________________ MvArea @@ -93,12 +108,16 @@ class MvLocation { /*! This is another incarnation of MvGeoBox class, used mainly by * MvObsSetIterator. For other usage MvGeoBox is recommended over MvArea. */ -class MvArea { - friend ostream& operator<<(ostream& aStream, const MvArea& aArea); +class MvArea +{ + friend std::ostream& operator<<(std::ostream& aStream, const MvArea& aArea); public: MvArea(); - MvArea(const MvLocation& aLoc1, const MvLocation& aLoc2) { set(aLoc1, aLoc2); } + MvArea(const MvLocation& aLoc1, const MvLocation& aLoc2) + { + set(aLoc1, aLoc2); + } void set(const MvLocation& aLoc1, const MvLocation& aLoc2); bool inside(const MvLocation& aPoint) const; @@ -118,12 +137,14 @@ class MvArea { * distance (max delta) from the given line, i.e. close enough to be * considered to be within the line. */ -class MvXSectionLine { - friend ostream& operator<<(ostream& aStream, const MvXSectionLine& aXSectionLine); +class MvXSectionLine +{ + friend std::ostream& operator<<(std::ostream& aStream, const MvXSectionLine& aXSectionLine); public: //! Empty constructor creates a missing line - MvXSectionLine(void) { + MvXSectionLine(void) + { fLocation1.set(MISSING_LOC_VALUE, MISSING_LOC_VALUE); fLocation2.set(MISSING_LOC_VALUE, MISSING_LOC_VALUE); fMaxDeltaInMeters = -1; @@ -131,22 +152,25 @@ class MvXSectionLine { //! Constructor, only points defined, no max delta given /*! Use method setMaxDelta() to set the maximum allowed distance from the line - */ - MvXSectionLine(const MvLocation& aLoc1, const MvLocation& aLoc2) { + */ + MvXSectionLine(const MvLocation& aLoc1, const MvLocation& aLoc2) + { fLocation1 = aLoc1; fLocation2 = aLoc2; fMaxDeltaInMeters = -1; } //! Constructor, two points and max distance from the line - MvXSectionLine(const MvLocation& aLoc1, const MvLocation& aLoc2, double aDelta) { + MvXSectionLine(const MvLocation& aLoc1, const MvLocation& aLoc2, double aDelta) + { fLocation1 = aLoc1; fLocation2 = aLoc2; fMaxDeltaInMeters = aDelta; } //! Set a new line between points aLoc1 and aLoc2 - void setLine(const MvLocation& aLoc1, const MvLocation& aLoc2) { + void setLine(const MvLocation& aLoc1, const MvLocation& aLoc2) + { fLocation1 = aLoc1; fLocation2 = aLoc2; } @@ -188,5 +212,4 @@ class MvXSectionLine { double fMaxDeltaInMeters; }; -#endif // MvLocation_DEFINED_ From d7c08978e959d70ba512ba648dfabc4c15da1307 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 31 May 2022 17:34:19 +0200 Subject: [PATCH 04/66] Metview : Adding Skeleton for the boxplot. Magics : Adding first implementation of the OutOfBound Feature --- src/attributes/AxisAttributes.cc | 32 ++- src/attributes/AxisAttributes.h | 4 + src/attributes/AxisWrapper.cc | 22 ++ src/attributes/BoxPlotVisualiserWrapper.cc | 7 - src/attributes/BoxPlotVisualiserWrapper.h | 6 +- src/attributes/ColourTechniqueAttributes.cc | 16 +- src/attributes/ColourTechniqueAttributes.h | 3 + src/attributes/ColourTechniqueWrapper.cc | 12 + src/attributes/IsoShadingAttributes.cc | 20 +- src/attributes/IsoShadingAttributes.h | 4 +- src/attributes/IsoShadingWrapper.cc | 8 +- src/attributes/LevelSelectionAttributes.cc | 28 +- src/attributes/LevelSelectionAttributes.h | 4 +- src/attributes/LevelSelectionWrapper.cc | 12 +- src/attributes/NetcdfInterpretorAttributes.cc | 9 +- src/attributes/NetcdfInterpretorAttributes.h | 1 + src/attributes/NetcdfInterpretorWrapper.cc | 6 + src/attributes/NoBoxPlotAttributes.cc | 99 +++++++ src/attributes/NoBoxPlotAttributes.h | 63 +++++ src/attributes/NoBoxPlotBoxAttributes.cc | 99 +++++++ src/attributes/NoBoxPlotBoxAttributes.h | 63 +++++ src/attributes/NoBoxPlotBoxWrapper.cc | 67 +++++ src/attributes/NoBoxPlotBoxWrapper.h | 91 +++++++ src/attributes/NoBoxPlotWhiskerAttributes.cc | 99 +++++++ src/attributes/NoBoxPlotWhiskerAttributes.h | 63 +++++ src/attributes/NoBoxPlotWhiskerWrapper.cc | 67 +++++ src/attributes/NoBoxPlotWhiskerWrapper.h | 91 +++++++ src/attributes/NoBoxPlotWrapper.cc | 67 +++++ src/attributes/NoBoxPlotWrapper.h | 91 +++++++ src/basic/LegendVisitor.cc | 255 ++++++++++++++++++ src/basic/LegendVisitor.h | 19 ++ src/decoders/GribDecoder.cc | 7 +- src/decoders/NetcdfGeopointsInterpretor.cc | 14 +- src/decoders/NetcdfGeopointsInterpretor.h | 5 +- src/libMagWrapper/MagPlus.cc | 30 +++ src/libMagWrapper/MagPlus.h | 2 + src/params/Axis.xml | 29 ++ src/params/BoxPlotVisualiser.xml | 1 - src/params/ColourTechnique.xml | 21 +- src/params/GribDecoder.xml | 4 +- src/params/IsoShading.xml | 4 +- src/params/LevelSelection.xml | 26 +- src/params/NetcdfInterpretor.xml | 8 +- src/params/NetcdfXYpointsInterpretor.xml | 6 +- src/params/NoBoxPlot.xml | 15 ++ src/params/NoBoxPlotBox.xml | 15 ++ src/params/NoBoxPlotWhisker.xml | 15 ++ src/visualisers/Axis.cc | 40 +++ src/visualisers/Axis.h | 11 + src/visualisers/CalculateColourTechnique.h | 5 + src/visualisers/ColourTechnique.cc | 32 ++- src/visualisers/ColourTechnique.h | 10 +- src/visualisers/CountSelectionType.cc | 62 ++++- src/visualisers/GradientsColourTechnique.h | 6 + src/visualisers/IntervalSelectionType.cc | 37 ++- src/visualisers/IsoShading.h | 4 +- src/visualisers/LevelListSelectionType.cc | 27 +- src/visualisers/LevelSelection.h | 7 + src/visualisers/ListColourTechnique.h | 6 + 59 files changed, 1767 insertions(+), 110 deletions(-) create mode 100644 src/attributes/NoBoxPlotAttributes.cc create mode 100644 src/attributes/NoBoxPlotAttributes.h create mode 100644 src/attributes/NoBoxPlotBoxAttributes.cc create mode 100644 src/attributes/NoBoxPlotBoxAttributes.h create mode 100644 src/attributes/NoBoxPlotBoxWrapper.cc create mode 100644 src/attributes/NoBoxPlotBoxWrapper.h create mode 100644 src/attributes/NoBoxPlotWhiskerAttributes.cc create mode 100644 src/attributes/NoBoxPlotWhiskerAttributes.h create mode 100644 src/attributes/NoBoxPlotWhiskerWrapper.cc create mode 100644 src/attributes/NoBoxPlotWhiskerWrapper.h create mode 100644 src/attributes/NoBoxPlotWrapper.cc create mode 100644 src/attributes/NoBoxPlotWrapper.h create mode 100644 src/params/NoBoxPlot.xml create mode 100644 src/params/NoBoxPlotBox.xml create mode 100644 src/params/NoBoxPlotWhisker.xml diff --git a/src/attributes/AxisAttributes.cc b/src/attributes/AxisAttributes.cc index 0b235cb2a..446ea50d0 100644 --- a/src/attributes/AxisAttributes.cc +++ b/src/attributes/AxisAttributes.cc @@ -66,7 +66,9 @@ AxisAttributes::AxisAttributes(): tip_(ParameterManager::getBool("axis_tip_title")), tip_text_(ParameterManager::getString("axis_tip_title_text")), tip_height_(ParameterManager::getDouble("axis_tip_title_height")), - tip_quality_(ParameterManager::getString("axis_tip_title_quality")) + tip_quality_(ParameterManager::getString("axis_tip_title_quality")), + highlighted_values_(ParameterManager::getDoubleArray("axis_highlighted_values")), + highlighted_values_thickness_(ParameterManager::getInt("axis_highlighted_values_thickness")) , method_(MagTranslator().magics("axis_type")), line_colour_(MagTranslator().magics("axis_line_colour")), @@ -81,7 +83,9 @@ AxisAttributes::AxisAttributes(): tick_colour_(MagTranslator().magics("axis_tick_colour")), label_colour_(MagTranslator().magics("axis_tick_label_colour")), minor_tick_colour_(MagTranslator().magics("axis_minor_tick_colour")), - tip_colour_(MagTranslator().magics("axis_tip_title_colour")) + tip_colour_(MagTranslator().magics("axis_tip_title_colour")), + highlighted_values_colour_(MagTranslator().magics("axis_highlighted_values_colour")), + highlighted_values_style_(MagTranslator().magics("axis_highlighted_values_style")) { } @@ -141,6 +145,8 @@ void AxisAttributes::set(const std::map& params) setAttribute(prefix, "axis_tip_title_text", tip_text_, params); setAttribute(prefix, "axis_tip_title_height", tip_height_, params); setAttribute(prefix, "axis_tip_title_quality", tip_quality_, params); + setAttribute(prefix, "axis_highlighted_values", highlighted_values_, params); + setAttribute(prefix, "axis_highlighted_values_thickness", highlighted_values_thickness_, params); setMember(prefix, "axis_type", method_, params); setMember(prefix, "axis_line_colour", line_colour_, params); @@ -156,6 +162,8 @@ void AxisAttributes::set(const std::map& params) setMember(prefix, "axis_tick_label_colour", label_colour_, params); setMember(prefix, "axis_minor_tick_colour", minor_tick_colour_, params); setMember(prefix, "axis_tip_title_colour", tip_colour_, params); + setMember(prefix, "axis_highlighted_values_colour", highlighted_values_colour_, params); + setAttribute(prefix, "axis_highlighted_values_style", highlighted_values_style_, params); } @@ -203,6 +211,8 @@ void AxisAttributes::copy(const AxisAttributes& other) tip_text_ = other.tip_text_; tip_height_ = other.tip_height_; tip_quality_ = other.tip_quality_; + highlighted_values_ = other.highlighted_values_; + highlighted_values_thickness_ = other.highlighted_values_thickness_; method_ = unique_ptr(other.method_->clone()); line_colour_ = unique_ptr(other.line_colour_->clone()); line_style_ = other.line_style_; @@ -217,6 +227,8 @@ void AxisAttributes::copy(const AxisAttributes& other) label_colour_ = unique_ptr(other.label_colour_->clone()); minor_tick_colour_ = unique_ptr(other.minor_tick_colour_->clone()); tip_colour_ = unique_ptr(other.tip_colour_->clone()); + highlighted_values_colour_ = unique_ptr(other.highlighted_values_colour_->clone()); + highlighted_values_style_ = other.highlighted_values_style_; } @@ -301,6 +313,8 @@ void AxisAttributes::print(ostream& out) const out << " tip_text = " << tip_text_; out << " tip_height = " << tip_height_; out << " tip_quality = " << tip_quality_; + out << " highlighted_values = " << highlighted_values_; + out << " highlighted_values_thickness = " << highlighted_values_thickness_; out << " method = " << *method_; out << " line_colour = " << *line_colour_; out << " line_style = " << line_style_; @@ -315,6 +329,8 @@ void AxisAttributes::print(ostream& out) const out << " label_colour = " << *label_colour_; out << " minor_tick_colour = " << *minor_tick_colour_; out << " tip_colour = " << *tip_colour_; + out << " highlighted_values_colour = " << *highlighted_values_colour_; + out << " highlighted_values_style = " << highlighted_values_style_; out << "]" << "\n"; } @@ -406,6 +422,10 @@ void AxisAttributes::toxml(ostream& out) const niceprint(out,tip_height_); out << ", \"axis_tip_title_quality\":"; niceprint(out,tip_quality_); + out << ", \"axis_highlighted_values\":"; + niceprint(out,highlighted_values_); + out << ", \"axis_highlighted_values_thickness\":"; + niceprint(out,highlighted_values_thickness_); out << ", \"axis_type\":"; method_->toxml(out); out << ", \"axis_line_colour\":"; @@ -434,6 +454,10 @@ void AxisAttributes::toxml(ostream& out) const niceprint(out, *minor_tick_colour_); out << ", \"axis_tip_title_colour\":"; niceprint(out, *tip_colour_); + out << ", \"axis_highlighted_values_colour\":"; + niceprint(out, *highlighted_values_colour_); + out << ", \"axis_highlighted_values_style\":"; + niceprint(out, highlighted_values_style_); } @@ -479,6 +503,8 @@ static MagicsParameter axis_tip_title("axis_tip_title", "off"); static MagicsParameter axis_tip_title_text("axis_tip_title_text", ""); static MagicsParameter axis_tip_title_height("axis_tip_title_height", 0.4); static MagicsParameter axis_tip_title_quality("axis_tip_title_quality", "medium"); +static MagicsParameter axis_highlighted_values("axis_highlighted_values", floatarray()); +static MagicsParameter axis_highlighted_values_thickness("axis_highlighted_values_thickness", 1); static MagicsParameter axis_type("axis_type", "regular"); static MagicsParameter axis_line_colour("axis_line_colour", "automatic"); static MagicsParameter axis_line_style("axis_line_style", "solid"); @@ -493,6 +519,8 @@ static MagicsParameter axis_tick_colour("axis_tick_colour", "automatic") static MagicsParameter axis_tick_label_colour("axis_tick_label_colour", "automatic"); static MagicsParameter axis_minor_tick_colour("axis_minor_tick_colour", "automatic"); static MagicsParameter axis_tip_title_colour("axis_tip_title_colour", "automatic"); +static MagicsParameter axis_highlighted_values_colour("axis_highlighted_values_colour", "black"); +static MagicsParameter axis_highlighted_values_style("axis_highlighted_values_style", "solid"); #include "AxisMethod.h" #include "DateAxis.h" static SimpleObjectMaker regular_AxisMethod("regular"); diff --git a/src/attributes/AxisAttributes.h b/src/attributes/AxisAttributes.h index 7adb7394f..1410aff32 100644 --- a/src/attributes/AxisAttributes.h +++ b/src/attributes/AxisAttributes.h @@ -94,6 +94,8 @@ class AxisAttributes string tip_text_; double tip_height_; string tip_quality_; + doublearray highlighted_values_; + int highlighted_values_thickness_; unique_ptr method_; unique_ptr line_colour_; LineStyle line_style_; @@ -108,6 +110,8 @@ class AxisAttributes unique_ptr label_colour_; unique_ptr minor_tick_colour_; unique_ptr tip_colour_; + unique_ptr highlighted_values_colour_; + LineStyle highlighted_values_style_; private: diff --git a/src/attributes/AxisWrapper.cc b/src/attributes/AxisWrapper.cc index 99bb85571..a45b68f46 100644 --- a/src/attributes/AxisWrapper.cc +++ b/src/attributes/AxisWrapper.cc @@ -245,6 +245,15 @@ void AxisWrapper::set(const MagRequest& request) string tip_quality_value = request("AXIS_TIP_TITLE_QUALITY"); axis_->tip_quality_ = tip_quality_value; } + doublearray highlighted_values_value; + for (int i = 0; i < request.countValues("AXIS_HIGHLIGHTED_VALUES"); i++) + highlighted_values_value.push_back((double)request("AXIS_HIGHLIGHTED_VALUES", i)); + if ( !highlighted_values_value.empty() ) + axis_->highlighted_values_ = highlighted_values_value; + if (request.countValues("AXIS_HIGHLIGHTED_VALUES_THICKNESS") ) { + int highlighted_values_thickness_value = request("AXIS_HIGHLIGHTED_VALUES_THICKNESS"); + axis_->highlighted_values_thickness_ = highlighted_values_thickness_value; + } string method_value = request.countValues("AXIS_TYPE") ? (string) request("AXIS_TYPE") : "regular"; @@ -333,6 +342,17 @@ void AxisWrapper::set(const MagRequest& request) axis_->tip_colour_ = unique_ptr(MagTranslator()(tip_colour_value)); } + if (request.countValues("AXIS_HIGHLIGHTED_VALUES_COLOUR") ) { + string highlighted_values_colour_value = request("AXIS_HIGHLIGHTED_VALUES_COLOUR"); + axis_->highlighted_values_colour_ = unique_ptr(MagTranslator()(highlighted_values_colour_value)); + } + + + if (request.countValues("AXIS_HIGHLIGHTED_VALUES_STYLE") ) { + string highlighted_values_style_value = request("AXIS_HIGHLIGHTED_VALUES_STYLE"); + axis_->highlighted_values_style_ = MagTranslator()(highlighted_values_style_value); + } + } @@ -381,3 +401,5 @@ static SimpleObjectMaker Axis_axis_ty + + diff --git a/src/attributes/BoxPlotVisualiserWrapper.cc b/src/attributes/BoxPlotVisualiserWrapper.cc index 5e7b96a2f..9773f40fa 100644 --- a/src/attributes/BoxPlotVisualiserWrapper.cc +++ b/src/attributes/BoxPlotVisualiserWrapper.cc @@ -37,16 +37,12 @@ BoxPlotVisualiserWrapper::BoxPlotVisualiserWrapper(): boxplotvisualiser_(new Box - BoxPlotDecoderWrapper::object(boxplotvisualiser_); - } BoxPlotVisualiserWrapper::BoxPlotVisualiserWrapper(BoxPlotVisualiser* boxplotvisualiser): boxplotvisualiser_(boxplotvisualiser) { - BoxPlotDecoderWrapper::object(boxplotvisualiser_); - } BoxPlotVisualiserWrapper::~BoxPlotVisualiserWrapper() @@ -59,9 +55,6 @@ void BoxPlotVisualiserWrapper::set(const MagRequest& request) - BoxPlotDecoderWrapper::set(request); - - string box_value = request.countValues("BOXPLOT_BOX") ? (string) request("BOXPLOT_BOX") : "on"; diff --git a/src/attributes/BoxPlotVisualiserWrapper.h b/src/attributes/BoxPlotVisualiserWrapper.h index 393a4b161..b3a87ca33 100644 --- a/src/attributes/BoxPlotVisualiserWrapper.h +++ b/src/attributes/BoxPlotVisualiserWrapper.h @@ -34,8 +34,6 @@ -#include "BoxPlotDecoderWrapper.h" - @@ -50,7 +48,8 @@ namespace magics { class MagRequest; -class BoxPlotVisualiserWrapper: public BoxPlotDecoderWrapper + +class BoxPlotVisualiserWrapper { public: @@ -69,7 +68,6 @@ class BoxPlotVisualiserWrapper: public BoxPlotDecoderWrapper virtual void object(BoxPlotVisualiser* o) { // Remember to delete the previous object boxplotvisualiser_ = o; - BoxPlotDecoderWrapper::object(o); } diff --git a/src/attributes/ColourTechniqueAttributes.cc b/src/attributes/ColourTechniqueAttributes.cc index 2af62957e..0a5211b76 100644 --- a/src/attributes/ColourTechniqueAttributes.cc +++ b/src/attributes/ColourTechniqueAttributes.cc @@ -24,8 +24,10 @@ using namespace magics; -ColourTechniqueAttributes::ColourTechniqueAttributes() +ColourTechniqueAttributes::ColourTechniqueAttributes(): + oob_min_colour_(MagTranslator().magics("contour_out_of_bound_min_colour")), + oob_max_colour_(MagTranslator().magics("contour_out_of_bound_max_colour")) { } @@ -44,11 +46,15 @@ void ColourTechniqueAttributes::set(const std::map& params) prefix[i++] = ""; + setMember(prefix, "contour_out_of_bound_min_colour", oob_min_colour_, params); + setMember(prefix, "contour_out_of_bound_max_colour", oob_max_colour_, params); } void ColourTechniqueAttributes::copy(const ColourTechniqueAttributes& other) { + oob_min_colour_ = unique_ptr(other.oob_min_colour_->clone()); + oob_max_colour_ = unique_ptr(other.oob_max_colour_->clone()); } @@ -87,6 +93,8 @@ void ColourTechniqueAttributes::set(const XmlNode& node) void ColourTechniqueAttributes::print(ostream& out) const { out << "Attributes["; + out << " oob_min_colour = " << *oob_min_colour_; + out << " oob_max_colour = " << *oob_max_colour_; out << "]" << "\n"; } @@ -94,6 +102,12 @@ void ColourTechniqueAttributes::print(ostream& out) const void ColourTechniqueAttributes::toxml(ostream& out) const { out << "\"\""; + out << ", \"contour_out_of_bound_min_colour\":"; + niceprint(out, *oob_min_colour_); + out << ", \"contour_out_of_bound_max_colour\":"; + niceprint(out, *oob_max_colour_); } +static MagicsParameter contour_out_of_bound_min_colour("contour_out_of_bound_min_colour", "blue"); +static MagicsParameter contour_out_of_bound_max_colour("contour_out_of_bound_max_colour", "red"); diff --git a/src/attributes/ColourTechniqueAttributes.h b/src/attributes/ColourTechniqueAttributes.h index 532f28a55..e67443055 100644 --- a/src/attributes/ColourTechniqueAttributes.h +++ b/src/attributes/ColourTechniqueAttributes.h @@ -25,6 +25,7 @@ #define ColourTechniqueAttributes_H #include "magics.h" +#include "Colour.h" namespace magics { class XmlNode; @@ -50,6 +51,8 @@ class ColourTechniqueAttributes virtual void toxml(std::ostream& out) const; // -- members: string tag_; + unique_ptr oob_min_colour_; + unique_ptr oob_max_colour_; private: diff --git a/src/attributes/ColourTechniqueWrapper.cc b/src/attributes/ColourTechniqueWrapper.cc index e615ccaed..5a5c5b179 100644 --- a/src/attributes/ColourTechniqueWrapper.cc +++ b/src/attributes/ColourTechniqueWrapper.cc @@ -56,6 +56,16 @@ void ColourTechniqueWrapper::set(const MagRequest& request) + if (request.countValues("CONTOUR_OUT_OF_BOUND_MIN_COLOUR") ) { + string oob_min_colour_value = request("CONTOUR_OUT_OF_BOUND_MIN_COLOUR"); + colourtechnique_->oob_min_colour_ = unique_ptr(MagTranslator()(oob_min_colour_value)); + } + + if (request.countValues("CONTOUR_OUT_OF_BOUND_MAX_COLOUR") ) { + string oob_max_colour_value = request("CONTOUR_OUT_OF_BOUND_MAX_COLOUR"); + colourtechnique_->oob_max_colour_ = unique_ptr(MagTranslator()(oob_max_colour_value)); + } + } @@ -65,3 +75,5 @@ void ColourTechniqueWrapper::print(ostream& out) const } + + diff --git a/src/attributes/IsoShadingAttributes.cc b/src/attributes/IsoShadingAttributes.cc index 67694dd79..c33ae9e27 100644 --- a/src/attributes/IsoShadingAttributes.cc +++ b/src/attributes/IsoShadingAttributes.cc @@ -25,8 +25,8 @@ using namespace magics; IsoShadingAttributes::IsoShadingAttributes(): - max_(ParameterManager::getDouble("contour_shade_max_level")), - min_(ParameterManager::getDouble("contour_shade_min_level")) + shade_max_(ParameterManager::getDouble("contour_shade_max_level")), + shade_min_(ParameterManager::getDouble("contour_shade_min_level")) , technique_(MagTranslator().magics("contour_shade_technique")), colourMethod_(MagTranslator().magics("contour_shade_colour_method")) @@ -51,8 +51,8 @@ void IsoShadingAttributes::set(const std::map& params) prefix[i++] = "contour_shade"; prefix[i++] = "contour_shade"; - setAttribute(prefix, "contour_shade_max_level", max_, params); - setAttribute(prefix, "contour_shade_min_level", min_, params); + setAttribute(prefix, "contour_shade_max_level", shade_max_, params); + setAttribute(prefix, "contour_shade_min_level", shade_min_, params); setMember(prefix, "contour_shade_technique", technique_, params); setMember(prefix, "contour_shade_colour_method", colourMethod_, params); @@ -61,8 +61,8 @@ void IsoShadingAttributes::set(const std::map& params) void IsoShadingAttributes::copy(const IsoShadingAttributes& other) { - max_ = other.max_; - min_ = other.min_; + shade_max_ = other.shade_max_; + shade_min_ = other.shade_min_; technique_ = unique_ptr(other.technique_->clone()); colourMethod_ = unique_ptr(other.colourMethod_->clone()); @@ -111,8 +111,8 @@ void IsoShadingAttributes::set(const XmlNode& node) void IsoShadingAttributes::print(ostream& out) const { out << "Attributes["; - out << " max = " << max_; - out << " min = " << min_; + out << " shade_max = " << shade_max_; + out << " shade_min = " << shade_min_; out << " technique = " << *technique_; out << " colourMethod = " << *colourMethod_; @@ -123,9 +123,9 @@ void IsoShadingAttributes::toxml(ostream& out) const { out << "\"shading\""; out << ", \"contour_shade_max_level\":"; - niceprint(out,max_); + niceprint(out,shade_max_); out << ", \"contour_shade_min_level\":"; - niceprint(out,min_); + niceprint(out,shade_min_); out << ", \"contour_shade_technique\":"; technique_->toxml(out); out << ", \"contour_shade_colour_method\":"; diff --git a/src/attributes/IsoShadingAttributes.h b/src/attributes/IsoShadingAttributes.h index 36273b00a..f6f724e97 100644 --- a/src/attributes/IsoShadingAttributes.h +++ b/src/attributes/IsoShadingAttributes.h @@ -52,8 +52,8 @@ class IsoShadingAttributes virtual void toxml(std::ostream& out) const; // -- members: string tag_; - double max_; - double min_; + double shade_max_; + double shade_min_; unique_ptr technique_; unique_ptr colourMethod_; diff --git a/src/attributes/IsoShadingWrapper.cc b/src/attributes/IsoShadingWrapper.cc index 85627a968..992d2a3de 100644 --- a/src/attributes/IsoShadingWrapper.cc +++ b/src/attributes/IsoShadingWrapper.cc @@ -63,12 +63,12 @@ void IsoShadingWrapper::set(const MagRequest& request) if (request.countValues("CONTOUR_SHADE_MAX_LEVEL") ) { - double max_value = request("CONTOUR_SHADE_MAX_LEVEL"); - isoshading_->max_ = max_value; + double shade_max_value = request("CONTOUR_SHADE_MAX_LEVEL"); + isoshading_->shade_max_ = shade_max_value; } if (request.countValues("CONTOUR_SHADE_MIN_LEVEL") ) { - double min_value = request("CONTOUR_SHADE_MIN_LEVEL"); - isoshading_->min_ = min_value; + double shade_min_value = request("CONTOUR_SHADE_MIN_LEVEL"); + isoshading_->shade_min_ = shade_min_value; } diff --git a/src/attributes/LevelSelectionAttributes.cc b/src/attributes/LevelSelectionAttributes.cc index ae20e3011..27e22b9b9 100644 --- a/src/attributes/LevelSelectionAttributes.cc +++ b/src/attributes/LevelSelectionAttributes.cc @@ -27,8 +27,8 @@ using namespace magics; LevelSelectionAttributes::LevelSelectionAttributes(): max_(ParameterManager::getDouble("contour_max_level")), min_(ParameterManager::getDouble("contour_min_level")), - max_shade_(ParameterManager::getDouble("contour_shade_max_level")), - min_shade_(ParameterManager::getDouble("contour_shade_min_level")) + oob_min_(ParameterManager::getDouble("contour_out_of_bound_min")), + oob_max_(ParameterManager::getDouble("contour_out_of_bound_max")) { @@ -49,8 +49,8 @@ void LevelSelectionAttributes::set(const std::map& params) setAttribute(prefix, "contour_max_level", max_, params); setAttribute(prefix, "contour_min_level", min_, params); - setAttribute(prefix, "contour_shade_max_level", max_shade_, params); - setAttribute(prefix, "contour_shade_min_level", min_shade_, params); + setAttribute(prefix, "contour_out_of_bound_min", oob_min_, params); + setAttribute(prefix, "contour_out_of_bound_max", oob_max_, params); } @@ -59,8 +59,8 @@ void LevelSelectionAttributes::copy(const LevelSelectionAttributes& other) { max_ = other.max_; min_ = other.min_; - max_shade_ = other.max_shade_; - min_shade_ = other.min_shade_; + oob_min_ = other.oob_min_; + oob_max_ = other.oob_max_; } @@ -101,8 +101,8 @@ void LevelSelectionAttributes::print(ostream& out) const out << "Attributes["; out << " max = " << max_; out << " min = " << min_; - out << " max_shade = " << max_shade_; - out << " min_shade = " << min_shade_; + out << " oob_min = " << oob_min_; + out << " oob_max = " << oob_max_; out << "]" << "\n"; } @@ -114,14 +114,14 @@ void LevelSelectionAttributes::toxml(ostream& out) const niceprint(out,max_); out << ", \"contour_min_level\":"; niceprint(out,min_); - out << ", \"contour_shade_max_level\":"; - niceprint(out,max_shade_); - out << ", \"contour_shade_min_level\":"; - niceprint(out,min_shade_); + out << ", \"contour_out_of_bound_min\":"; + niceprint(out,oob_min_); + out << ", \"contour_out_of_bound_max\":"; + niceprint(out,oob_max_); } static MagicsParameter contour_max_level("contour_max_level", 1.0e+21); static MagicsParameter contour_min_level("contour_min_level", -1.0e+21); -static MagicsParameter contour_shade_max_level("contour_shade_max_level", 1.0e+21); -static MagicsParameter contour_shade_min_level("contour_shade_min_level", -1.0e+21); +static MagicsParameter contour_out_of_bound_min("contour_out_of_bound_min", -1.0e+21); +static MagicsParameter contour_out_of_bound_max("contour_out_of_bound_max", 1.0e+21); diff --git a/src/attributes/LevelSelectionAttributes.h b/src/attributes/LevelSelectionAttributes.h index f86c651aa..b1e50046b 100644 --- a/src/attributes/LevelSelectionAttributes.h +++ b/src/attributes/LevelSelectionAttributes.h @@ -52,8 +52,8 @@ class LevelSelectionAttributes string tag_; double max_; double min_; - double max_shade_; - double min_shade_; + double oob_min_; + double oob_max_; private: diff --git a/src/attributes/LevelSelectionWrapper.cc b/src/attributes/LevelSelectionWrapper.cc index 158128cfa..05d0c0d78 100644 --- a/src/attributes/LevelSelectionWrapper.cc +++ b/src/attributes/LevelSelectionWrapper.cc @@ -63,13 +63,13 @@ void LevelSelectionWrapper::set(const MagRequest& request) double min_value = request("CONTOUR_MIN_LEVEL"); levelselection_->min_ = min_value; } - if (request.countValues("CONTOUR_SHADE_MAX_LEVEL") ) { - double max_shade_value = request("CONTOUR_SHADE_MAX_LEVEL"); - levelselection_->max_shade_ = max_shade_value; + if (request.countValues("CONTOUR_OUT_OF_BOUND_MIN") ) { + double oob_min_value = request("CONTOUR_OUT_OF_BOUND_MIN"); + levelselection_->oob_min_ = oob_min_value; } - if (request.countValues("CONTOUR_SHADE_MIN_LEVEL") ) { - double min_shade_value = request("CONTOUR_SHADE_MIN_LEVEL"); - levelselection_->min_shade_ = min_shade_value; + if (request.countValues("CONTOUR_OUT_OF_BOUND_MAX") ) { + double oob_max_value = request("CONTOUR_OUT_OF_BOUND_MAX"); + levelselection_->oob_max_ = oob_max_value; } diff --git a/src/attributes/NetcdfInterpretorAttributes.cc b/src/attributes/NetcdfInterpretorAttributes.cc index ae440323c..26109872d 100644 --- a/src/attributes/NetcdfInterpretorAttributes.cc +++ b/src/attributes/NetcdfInterpretorAttributes.cc @@ -58,7 +58,8 @@ NetcdfInterpretorAttributes::NetcdfInterpretorAttributes(): geo_y_convention_(ParameterManager::getString("netcdf_y_geoline_convention")), aux_y_(ParameterManager::getString("netcdf_y_auxiliary_variable")), primary_index_(ParameterManager::getString("netcdf_matrix_primary_index")), - interpretation_(ParameterManager::getString("netcdf_matrix_interpretation")) + interpretation_(ParameterManager::getString("netcdf_matrix_interpretation")), + ignore_missing_(ParameterManager::getBool("netcdf_ignore_missing_value")) { @@ -111,6 +112,7 @@ void NetcdfInterpretorAttributes::set(const std::map& params) setAttribute(prefix, "netcdf_y_auxiliary_variable", aux_y_, params); setAttribute(prefix, "netcdf_matrix_primary_index", primary_index_, params); setAttribute(prefix, "netcdf_matrix_interpretation", interpretation_, params); + setAttribute(prefix, "netcdf_ignore_missing_value", ignore_missing_, params); } @@ -151,6 +153,7 @@ void NetcdfInterpretorAttributes::copy(const NetcdfInterpretorAttributes& other) aux_y_ = other.aux_y_; primary_index_ = other.primary_index_; interpretation_ = other.interpretation_; + ignore_missing_ = other.ignore_missing_; } @@ -223,6 +226,7 @@ void NetcdfInterpretorAttributes::print(ostream& out) const out << " aux_y = " << aux_y_; out << " primary_index = " << primary_index_; out << " interpretation = " << interpretation_; + out << " ignore_missing = " << ignore_missing_; out << "]" << "\n"; } @@ -298,6 +302,8 @@ void NetcdfInterpretorAttributes::toxml(ostream& out) const niceprint(out,primary_index_); out << ", \"netcdf_matrix_interpretation\":"; niceprint(out,interpretation_); + out << ", \"netcdf_ignore_missing_value\":"; + niceprint(out,ignore_missing_); } @@ -335,3 +341,4 @@ static MagicsParameter netcdf_y_geoline_convention("netcdf_y_geoline_con static MagicsParameter netcdf_y_auxiliary_variable("netcdf_y_auxiliary_variable", ""); static MagicsParameter netcdf_matrix_primary_index("netcdf_matrix_primary_index", "longitude"); static MagicsParameter netcdf_matrix_interpretation("netcdf_matrix_interpretation", "automatic"); +static MagicsParameter netcdf_ignore_missing_value("netcdf_ignore_missing_value", "off"); diff --git a/src/attributes/NetcdfInterpretorAttributes.h b/src/attributes/NetcdfInterpretorAttributes.h index 328183968..b8a1e9262 100644 --- a/src/attributes/NetcdfInterpretorAttributes.h +++ b/src/attributes/NetcdfInterpretorAttributes.h @@ -84,6 +84,7 @@ class NetcdfInterpretorAttributes string aux_y_; string primary_index_; string interpretation_; + bool ignore_missing_; private: diff --git a/src/attributes/NetcdfInterpretorWrapper.cc b/src/attributes/NetcdfInterpretorWrapper.cc index e3a824497..a604c257a 100644 --- a/src/attributes/NetcdfInterpretorWrapper.cc +++ b/src/attributes/NetcdfInterpretorWrapper.cc @@ -194,6 +194,12 @@ void NetcdfInterpretorWrapper::set(const MagRequest& request) string interpretation_value = request("NETCDF_MATRIX_INTERPRETATION"); netcdfinterpretor_->interpretation_ = interpretation_value; } + if (request.countValues("NETCDF_IGNORE_MISSING_VALUE") ) { + string ignore_missing_value = request("NETCDF_IGNORE_MISSING_VALUE"); + + netcdfinterpretor_->ignore_missing_ = MagTranslator()(ignore_missing_value); + + } } diff --git a/src/attributes/NoBoxPlotAttributes.cc b/src/attributes/NoBoxPlotAttributes.cc new file mode 100644 index 000000000..a6d8d0c29 --- /dev/null +++ b/src/attributes/NoBoxPlotAttributes.cc @@ -0,0 +1,99 @@ + +/****************************** LICENSE ******************************* + + * (C) Copyright 1996-2017 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \\file NoBoxPlotAttributes.h + \\brief Definition of NoBoxPlot Attributes class. + + This file is automatically generated. + Do Not Edit! +*/ + +#include "NoBoxPlotAttributes.h" +#include "MagicsParameter.h" +#include "ParameterSettings.h" + +using namespace magics; + +NoBoxPlotAttributes::NoBoxPlotAttributes() + + +{ +} + + +NoBoxPlotAttributes::~NoBoxPlotAttributes() +{ + +} + + +void NoBoxPlotAttributes::set(const std::map& params) +{ + vector prefix(1); + int i = 0; + prefix[i++] = "boxplot"; + + + +} + +void NoBoxPlotAttributes::copy(const NoBoxPlotAttributes& other) +{ + +} + + +bool NoBoxPlotAttributes::accept(const string& node) +{ + + if ( magCompare(node, "boxplot") ) + return true; + + return false; +} + +void NoBoxPlotAttributes::set(const XmlNode& node) +{ + bool apply = false; + + if ( this->accept(node.name()) == false ) + return; + + if ( magCompare(node.name(), "boxplot") ) + apply = true; + + + if ( apply ) + set(node.attributes()); + else { + + } + for (auto &elt : node.elements()) + { + + } +} + +void NoBoxPlotAttributes::print(ostream& out) const +{ + out << "Attributes["; + + out << "]" << "\n"; +} + +void NoBoxPlotAttributes::toxml(ostream& out) const +{ + out << "\"boxplot\""; + +} + diff --git a/src/attributes/NoBoxPlotAttributes.h b/src/attributes/NoBoxPlotAttributes.h new file mode 100644 index 000000000..018ed8932 --- /dev/null +++ b/src/attributes/NoBoxPlotAttributes.h @@ -0,0 +1,63 @@ + +/******************************* LICENSE ******************************* + + * (C) Copyright 1996-2016 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \fileNoBoxPlotAttributes.h + \brief Definition of NoBoxPlot Attributes class. + + This file is automatically generated. + Do Not Edit! + + Generated: +*/ + + +#ifndef NoBoxPlotAttributes_H +#define NoBoxPlotAttributes_H + +#include "magics.h" +namespace magics { + +class XmlNode; +class NoBoxPlotAttributes +{ +public: +// -- constructor + NoBoxPlotAttributes(); + +// -- destructor + virtual ~NoBoxPlotAttributes(); + + virtual void set(const std::map&); + virtual void set(const XmlNode&); + virtual void copy(const NoBoxPlotAttributes&); + virtual bool accept(const std::string&); + + void setTag(const std::string& tag) { tag_ = tag; } + +public: + // -- method + virtual void print(std::ostream&) const; + virtual void toxml(std::ostream& out) const; + // -- members: + string tag_; + + +private: + friend ostream& operator<<(ostream& s,const NoBoxPlotAttributes& p) + { p.print(s); return s; } +}; + +} // namespace magics + +#endif + diff --git a/src/attributes/NoBoxPlotBoxAttributes.cc b/src/attributes/NoBoxPlotBoxAttributes.cc new file mode 100644 index 000000000..c215ddd1e --- /dev/null +++ b/src/attributes/NoBoxPlotBoxAttributes.cc @@ -0,0 +1,99 @@ + +/****************************** LICENSE ******************************* + + * (C) Copyright 1996-2017 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \\file NoBoxPlotBoxAttributes.h + \\brief Definition of NoBoxPlotBox Attributes class. + + This file is automatically generated. + Do Not Edit! +*/ + +#include "NoBoxPlotBoxAttributes.h" +#include "MagicsParameter.h" +#include "ParameterSettings.h" + +using namespace magics; + +NoBoxPlotBoxAttributes::NoBoxPlotBoxAttributes() + + +{ +} + + +NoBoxPlotBoxAttributes::~NoBoxPlotBoxAttributes() +{ + +} + + +void NoBoxPlotBoxAttributes::set(const std::map& params) +{ + vector prefix(1); + int i = 0; + prefix[i++] = "boxplot"; + + + +} + +void NoBoxPlotBoxAttributes::copy(const NoBoxPlotBoxAttributes& other) +{ + +} + + +bool NoBoxPlotBoxAttributes::accept(const string& node) +{ + + if ( magCompare(node, "boxplot") ) + return true; + + return false; +} + +void NoBoxPlotBoxAttributes::set(const XmlNode& node) +{ + bool apply = false; + + if ( this->accept(node.name()) == false ) + return; + + if ( magCompare(node.name(), "boxplot") ) + apply = true; + + + if ( apply ) + set(node.attributes()); + else { + + } + for (auto &elt : node.elements()) + { + + } +} + +void NoBoxPlotBoxAttributes::print(ostream& out) const +{ + out << "Attributes["; + + out << "]" << "\n"; +} + +void NoBoxPlotBoxAttributes::toxml(ostream& out) const +{ + out << "\"boxplot\""; + +} + diff --git a/src/attributes/NoBoxPlotBoxAttributes.h b/src/attributes/NoBoxPlotBoxAttributes.h new file mode 100644 index 000000000..ddb177109 --- /dev/null +++ b/src/attributes/NoBoxPlotBoxAttributes.h @@ -0,0 +1,63 @@ + +/******************************* LICENSE ******************************* + + * (C) Copyright 1996-2016 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \fileNoBoxPlotBoxAttributes.h + \brief Definition of NoBoxPlotBox Attributes class. + + This file is automatically generated. + Do Not Edit! + + Generated: +*/ + + +#ifndef NoBoxPlotBoxAttributes_H +#define NoBoxPlotBoxAttributes_H + +#include "magics.h" +namespace magics { + +class XmlNode; +class NoBoxPlotBoxAttributes +{ +public: +// -- constructor + NoBoxPlotBoxAttributes(); + +// -- destructor + virtual ~NoBoxPlotBoxAttributes(); + + virtual void set(const std::map&); + virtual void set(const XmlNode&); + virtual void copy(const NoBoxPlotBoxAttributes&); + virtual bool accept(const std::string&); + + void setTag(const std::string& tag) { tag_ = tag; } + +public: + // -- method + virtual void print(std::ostream&) const; + virtual void toxml(std::ostream& out) const; + // -- members: + string tag_; + + +private: + friend ostream& operator<<(ostream& s,const NoBoxPlotBoxAttributes& p) + { p.print(s); return s; } +}; + +} // namespace magics + +#endif + diff --git a/src/attributes/NoBoxPlotBoxWrapper.cc b/src/attributes/NoBoxPlotBoxWrapper.cc new file mode 100644 index 000000000..5458c6002 --- /dev/null +++ b/src/attributes/NoBoxPlotBoxWrapper.cc @@ -0,0 +1,67 @@ + +/****************************** LICENSE ******************************* + + * (C) Copyright 1996-2017 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \\file NoBoxPlotBoxAttributes.h + \\brief Definition of NoBoxPlotBox Attributes class. + + This file is automatically generated. + Do Not Edit! + +*/ + +#include "MagRequest.h" +#include "NoBoxPlotBoxWrapper.h" +#include "MagicsParameter.h" +#include "Factory.h" +#include "MagTranslator.h" +#include "MagicsGlobal.h" + +using namespace magics; + + + +NoBoxPlotBoxWrapper::NoBoxPlotBoxWrapper(): noboxplotbox_(new NoBoxPlotBox()) + + +{ + + + + +} +NoBoxPlotBoxWrapper::NoBoxPlotBoxWrapper(NoBoxPlotBox* noboxplotbox): noboxplotbox_(noboxplotbox) +{ + + +} + +NoBoxPlotBoxWrapper::~NoBoxPlotBoxWrapper() +{ + +} + +void NoBoxPlotBoxWrapper::set(const MagRequest& request) +{ + + + + + +} + +void NoBoxPlotBoxWrapper::print(ostream& out) const +{ + out << "NoBoxPlotBoxWrapper[]"; +} + + diff --git a/src/attributes/NoBoxPlotBoxWrapper.h b/src/attributes/NoBoxPlotBoxWrapper.h new file mode 100644 index 000000000..7d573a447 --- /dev/null +++ b/src/attributes/NoBoxPlotBoxWrapper.h @@ -0,0 +1,91 @@ + +/******************************* LICENSE ******************************* + + * (C) Copyright 1996-2016 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \fileNoBoxPlotBoxAttributes.h + \brief Definition of NoBoxPlotBox Attributes class. + + This file is automatically generated. + Do Not Edit! + + Generated: +*/ + + +#ifndef NoBoxPlotBoxWrapper_H +#define NoBoxPlotBoxWrapper_H + +#include "magics.h" +#include "ParameterManager.h" +#include "Factory.h" + + + +#include "BoxPlotItem.h" + + + + + + + + + + +namespace magics { + +class MagRequest; + + + +class NoBoxPlotBoxWrapper + +{ +public: +// -- constructor + NoBoxPlotBoxWrapper(); + NoBoxPlotBoxWrapper(NoBoxPlotBox*); +// -- destructor + virtual ~NoBoxPlotBoxWrapper(); + virtual void set(const MagRequest&); + + NoBoxPlotBox* me() { return noboxplotbox_; } + + virtual NoBoxPlotBox* object() { return noboxplotbox_; } + + + virtual void object(NoBoxPlotBox* o) { + // Remember to delete the previous object + noboxplotbox_ = o; + + + } + + + +protected: + NoBoxPlotBox* noboxplotbox_; + + +// -- method + virtual void print(ostream&) const; + + +private: + string tag_; + friend ostream& operator<<(ostream& s,const NoBoxPlotBoxWrapper& p) + { p.print(s); return s; } +}; + +} // namespace magics + +#endif \ No newline at end of file diff --git a/src/attributes/NoBoxPlotWhiskerAttributes.cc b/src/attributes/NoBoxPlotWhiskerAttributes.cc new file mode 100644 index 000000000..dc6d49cb1 --- /dev/null +++ b/src/attributes/NoBoxPlotWhiskerAttributes.cc @@ -0,0 +1,99 @@ + +/****************************** LICENSE ******************************* + + * (C) Copyright 1996-2017 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \\file NoBoxPlotWhiskerAttributes.h + \\brief Definition of NoBoxPlotWhisker Attributes class. + + This file is automatically generated. + Do Not Edit! +*/ + +#include "NoBoxPlotWhiskerAttributes.h" +#include "MagicsParameter.h" +#include "ParameterSettings.h" + +using namespace magics; + +NoBoxPlotWhiskerAttributes::NoBoxPlotWhiskerAttributes() + + +{ +} + + +NoBoxPlotWhiskerAttributes::~NoBoxPlotWhiskerAttributes() +{ + +} + + +void NoBoxPlotWhiskerAttributes::set(const std::map& params) +{ + vector prefix(1); + int i = 0; + prefix[i++] = "boxplot"; + + + +} + +void NoBoxPlotWhiskerAttributes::copy(const NoBoxPlotWhiskerAttributes& other) +{ + +} + + +bool NoBoxPlotWhiskerAttributes::accept(const string& node) +{ + + if ( magCompare(node, "boxplot") ) + return true; + + return false; +} + +void NoBoxPlotWhiskerAttributes::set(const XmlNode& node) +{ + bool apply = false; + + if ( this->accept(node.name()) == false ) + return; + + if ( magCompare(node.name(), "boxplot") ) + apply = true; + + + if ( apply ) + set(node.attributes()); + else { + + } + for (auto &elt : node.elements()) + { + + } +} + +void NoBoxPlotWhiskerAttributes::print(ostream& out) const +{ + out << "Attributes["; + + out << "]" << "\n"; +} + +void NoBoxPlotWhiskerAttributes::toxml(ostream& out) const +{ + out << "\"boxplot\""; + +} + diff --git a/src/attributes/NoBoxPlotWhiskerAttributes.h b/src/attributes/NoBoxPlotWhiskerAttributes.h new file mode 100644 index 000000000..6beadab70 --- /dev/null +++ b/src/attributes/NoBoxPlotWhiskerAttributes.h @@ -0,0 +1,63 @@ + +/******************************* LICENSE ******************************* + + * (C) Copyright 1996-2016 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \fileNoBoxPlotWhiskerAttributes.h + \brief Definition of NoBoxPlotWhisker Attributes class. + + This file is automatically generated. + Do Not Edit! + + Generated: +*/ + + +#ifndef NoBoxPlotWhiskerAttributes_H +#define NoBoxPlotWhiskerAttributes_H + +#include "magics.h" +namespace magics { + +class XmlNode; +class NoBoxPlotWhiskerAttributes +{ +public: +// -- constructor + NoBoxPlotWhiskerAttributes(); + +// -- destructor + virtual ~NoBoxPlotWhiskerAttributes(); + + virtual void set(const std::map&); + virtual void set(const XmlNode&); + virtual void copy(const NoBoxPlotWhiskerAttributes&); + virtual bool accept(const std::string&); + + void setTag(const std::string& tag) { tag_ = tag; } + +public: + // -- method + virtual void print(std::ostream&) const; + virtual void toxml(std::ostream& out) const; + // -- members: + string tag_; + + +private: + friend ostream& operator<<(ostream& s,const NoBoxPlotWhiskerAttributes& p) + { p.print(s); return s; } +}; + +} // namespace magics + +#endif + diff --git a/src/attributes/NoBoxPlotWhiskerWrapper.cc b/src/attributes/NoBoxPlotWhiskerWrapper.cc new file mode 100644 index 000000000..8bd638cb1 --- /dev/null +++ b/src/attributes/NoBoxPlotWhiskerWrapper.cc @@ -0,0 +1,67 @@ + +/****************************** LICENSE ******************************* + + * (C) Copyright 1996-2017 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \\file NoBoxPlotWhiskerAttributes.h + \\brief Definition of NoBoxPlotWhisker Attributes class. + + This file is automatically generated. + Do Not Edit! + +*/ + +#include "MagRequest.h" +#include "NoBoxPlotWhiskerWrapper.h" +#include "MagicsParameter.h" +#include "Factory.h" +#include "MagTranslator.h" +#include "MagicsGlobal.h" + +using namespace magics; + + + +NoBoxPlotWhiskerWrapper::NoBoxPlotWhiskerWrapper(): noboxplotwhisker_(new NoBoxPlotWhisker()) + + +{ + + + + +} +NoBoxPlotWhiskerWrapper::NoBoxPlotWhiskerWrapper(NoBoxPlotWhisker* noboxplotwhisker): noboxplotwhisker_(noboxplotwhisker) +{ + + +} + +NoBoxPlotWhiskerWrapper::~NoBoxPlotWhiskerWrapper() +{ + +} + +void NoBoxPlotWhiskerWrapper::set(const MagRequest& request) +{ + + + + + +} + +void NoBoxPlotWhiskerWrapper::print(ostream& out) const +{ + out << "NoBoxPlotWhiskerWrapper[]"; +} + + diff --git a/src/attributes/NoBoxPlotWhiskerWrapper.h b/src/attributes/NoBoxPlotWhiskerWrapper.h new file mode 100644 index 000000000..7258f3f1a --- /dev/null +++ b/src/attributes/NoBoxPlotWhiskerWrapper.h @@ -0,0 +1,91 @@ + +/******************************* LICENSE ******************************* + + * (C) Copyright 1996-2016 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \fileNoBoxPlotWhiskerAttributes.h + \brief Definition of NoBoxPlotWhisker Attributes class. + + This file is automatically generated. + Do Not Edit! + + Generated: +*/ + + +#ifndef NoBoxPlotWhiskerWrapper_H +#define NoBoxPlotWhiskerWrapper_H + +#include "magics.h" +#include "ParameterManager.h" +#include "Factory.h" + + + +#include "BoxPlotItem.h" + + + + + + + + + + +namespace magics { + +class MagRequest; + + + +class NoBoxPlotWhiskerWrapper + +{ +public: +// -- constructor + NoBoxPlotWhiskerWrapper(); + NoBoxPlotWhiskerWrapper(NoBoxPlotWhisker*); +// -- destructor + virtual ~NoBoxPlotWhiskerWrapper(); + virtual void set(const MagRequest&); + + NoBoxPlotWhisker* me() { return noboxplotwhisker_; } + + virtual NoBoxPlotWhisker* object() { return noboxplotwhisker_; } + + + virtual void object(NoBoxPlotWhisker* o) { + // Remember to delete the previous object + noboxplotwhisker_ = o; + + + } + + + +protected: + NoBoxPlotWhisker* noboxplotwhisker_; + + +// -- method + virtual void print(ostream&) const; + + +private: + string tag_; + friend ostream& operator<<(ostream& s,const NoBoxPlotWhiskerWrapper& p) + { p.print(s); return s; } +}; + +} // namespace magics + +#endif \ No newline at end of file diff --git a/src/attributes/NoBoxPlotWrapper.cc b/src/attributes/NoBoxPlotWrapper.cc new file mode 100644 index 000000000..5b48f7a6d --- /dev/null +++ b/src/attributes/NoBoxPlotWrapper.cc @@ -0,0 +1,67 @@ + +/****************************** LICENSE ******************************* + + * (C) Copyright 1996-2017 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \\file NoBoxPlotAttributes.h + \\brief Definition of NoBoxPlot Attributes class. + + This file is automatically generated. + Do Not Edit! + +*/ + +#include "MagRequest.h" +#include "NoBoxPlotWrapper.h" +#include "MagicsParameter.h" +#include "Factory.h" +#include "MagTranslator.h" +#include "MagicsGlobal.h" + +using namespace magics; + + + +NoBoxPlotWrapper::NoBoxPlotWrapper(): noboxplot_(new NoBoxPlot()) + + +{ + + + + +} +NoBoxPlotWrapper::NoBoxPlotWrapper(NoBoxPlot* noboxplot): noboxplot_(noboxplot) +{ + + +} + +NoBoxPlotWrapper::~NoBoxPlotWrapper() +{ + +} + +void NoBoxPlotWrapper::set(const MagRequest& request) +{ + + + + + +} + +void NoBoxPlotWrapper::print(ostream& out) const +{ + out << "NoBoxPlotWrapper[]"; +} + + diff --git a/src/attributes/NoBoxPlotWrapper.h b/src/attributes/NoBoxPlotWrapper.h new file mode 100644 index 000000000..d634b7542 --- /dev/null +++ b/src/attributes/NoBoxPlotWrapper.h @@ -0,0 +1,91 @@ + +/******************************* LICENSE ******************************* + + * (C) Copyright 1996-2016 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation nor + * does it submit to any jurisdiction. + + ******************************* LICENSE *******************************/ + +/*! \fileNoBoxPlotAttributes.h + \brief Definition of NoBoxPlot Attributes class. + + This file is automatically generated. + Do Not Edit! + + Generated: +*/ + + +#ifndef NoBoxPlotWrapper_H +#define NoBoxPlotWrapper_H + +#include "magics.h" +#include "ParameterManager.h" +#include "Factory.h" + + + +#include "BoxPlotItem.h" + + + + + + + + + + +namespace magics { + +class MagRequest; + + + +class NoBoxPlotWrapper + +{ +public: +// -- constructor + NoBoxPlotWrapper(); + NoBoxPlotWrapper(NoBoxPlot*); +// -- destructor + virtual ~NoBoxPlotWrapper(); + virtual void set(const MagRequest&); + + NoBoxPlot* me() { return noboxplot_; } + + virtual NoBoxPlot* object() { return noboxplot_; } + + + virtual void object(NoBoxPlot* o) { + // Remember to delete the previous object + noboxplot_ = o; + + + } + + + +protected: + NoBoxPlot* noboxplot_; + + +// -- method + virtual void print(ostream&) const; + + +private: + string tag_; + friend ostream& operator<<(ostream& s,const NoBoxPlotWrapper& p) + { p.print(s); return s; } +}; + +} // namespace magics + +#endif \ No newline at end of file diff --git a/src/basic/LegendVisitor.cc b/src/basic/LegendVisitor.cc index 4fcc0e4ac..a176a0964 100644 --- a/src/basic/LegendVisitor.cc +++ b/src/basic/LegendVisitor.cc @@ -635,6 +635,7 @@ Colour BoxEntry::colour() { return box_->getFillColour(); } + void LegendEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { Polyline* box = new Polyline(); FillShadingProperties* shading = new FillShadingProperties(); @@ -741,6 +742,36 @@ void BoxEntry::set(const PaperPoint& point, BasicGraphicsObjectContainer& legend legend.push_back(box_); } +void OOBEntry::set(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { + MagLog::debug() << "OOBEntry--->set at " << point << endl; + double width = computeWidth(0.8) / 2; + double height = 0.4; + PaperPoint p = centreSymbolBox(point); + double x = p.x(); + double y = p.y(); + + if ( type_ ==Type::MIN ) { + box_->push_back(PaperPoint(x - width, y + (height/2))); + box_->push_back(PaperPoint(x + width, y + height)); + box_->push_back(PaperPoint(x + width, y - height)); + box_->push_back(PaperPoint(x - width, y + (height/2))); + } + else { + box_->push_back(PaperPoint(x - width, y - height)); + box_->push_back(PaperPoint(x - width, y + height)); + box_->push_back(PaperPoint(x + width, y + (height/2))); + box_->push_back(PaperPoint(x - width, y - height)); + } + box_->setColour(Colour("black")); + + LegendVisitor::addLegendInfo("legend_entry_colour", box_->getFillColour().rgb()); + LegendVisitor::addLegendInfo("legend_entry_min_text", from()); + LegendVisitor::addLegendInfo("legend_entry_max_text", to()); + LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); + + legend.push_back(box_); +} + void BoxEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { double width = 1; double height = 0.4; @@ -844,6 +875,115 @@ void BoxEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& leg LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); } +void OOBEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { + double width = 1; + double height = 0.4; + double x = point.x(); + double y = point.y(); + + if (text_) { + Text* from = new Text(); + from->push_back(PaperPoint(x - width, y - height - 0.25)); + from->setVerticalAlign(VerticalAlign::BOTTOM); + from->setAngle(angle_); + legend.push_back(from); + + if (automatic_) { + if (!userMin_) { + ostringstream bottom; + bottom << MagicsFormat(format_, from_); + minText_ = bottom.str(); + } + + from->addText(minText_, font_); + } + else if (!last_) + from->addText(userText_, font_); + else if (userMax_) { + ostringstream bottom; + bottom << MagicsFormat(format_, from_); + from->addText(bottom.str(), font_); + } + } + if (last_) { + Text* to = new Text(); + to->setAngle(angle_); + to->setVerticalAlign(VerticalAlign::BOTTOM); + to->push_back(PaperPoint(x + width, y - height - 0.25)); + legend.push_back(to); + if (automatic_) { + if (!userMax_) { + ostringstream to; + to << MagicsFormat(format_, to_); + maxText_ = to.str(); + } + to->addText(maxText_, font_); + } + else + to->addText(userText_, font_); + } + + Polyline* top = new Polyline(); + top->push_back(PaperPoint(x - (width * 1.), y + (height * 2))); + top->push_back(PaperPoint(x + (width * 1.), y + (height * 2))); + top->setColour(borderColour_); + top->setThickness(2); + + Polyline* bottom = new Polyline(); + bottom->push_back(PaperPoint(x - width, y - height)); + bottom->push_back(PaperPoint(x + width, y - height)); + bottom->setColour(borderColour_); + bottom->setThickness(2); + + if ( type_ ==Type::MIN ) { + box_->push_back(PaperPoint(x - width, y + (height/2))); + box_->push_back(PaperPoint(x + width, y + height)); + box_->push_back(PaperPoint(x + width, y - height)); + box_->push_back(PaperPoint(x - width, y + (height/2))); + } + else { + box_->push_back(PaperPoint(x - width, y - height)); + box_->push_back(PaperPoint(x - width, y + height)); + box_->push_back(PaperPoint(x + width, y + (height/2))); + box_->push_back(PaperPoint(x - width, y - height)); + } + // Small check + Colour colour = (borderColour_.automatic()) ? box_->getFillColour() : borderColour_; + + if (box_->getFillColour() == Colour("none")) { + box_->setFilled(false); + colour = Colour("black"); + } + box_->setColour(colour); + + legend.push_back(box_); + legend.push_back(top); + legend.push_back(bottom); + + if (last_) { + Polyline* right = new Polyline(); + right->push_back(PaperPoint(x + width, y - height)); + right->push_back(PaperPoint(x + width, y + (height * 2))); + right->setColour(borderColour_); + right->setThickness(2); + legend.push_back(right); + } + + if (first_) { + Polyline* left = new Polyline(); + left->push_back(PaperPoint(x - width, y - height)); + left->push_back(PaperPoint(x - width, y + (height * 2))); + left->setColour(borderColour_); + left->setThickness(2); + legend.push_back(left); + } + + LegendVisitor::addLegendInfo("legend_entry_colour", box_->getFillColour().rgb()); + LegendVisitor::addLegendInfo("legend_entry_min_text", from()); + LegendVisitor::addLegendInfo("legend_entry_max_text", to()); + LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); +} + void BoxEntry::rowHisto(const PaperPoint& point, BasicGraphicsObjectContainer& legend, const Colour& colour) { // ShadingProperties* shading = box_->getShading(); // Normall the pilyline left the low value on their left! @@ -1115,6 +1255,120 @@ void BoxEntry::columnBox(const PaperPoint& point, BasicGraphicsObjectContainer& LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); } +void OOBEntry::columnBox(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { + double width = computeWidth(0.8) / 2; + double height = 0.5; + PaperPoint p = centreSymbolBox(point); + double x = p.x(); + double y = p.y(); + PaperPoint pt = leftTextBox(point); + + if (text_) { + Text* from = new Text(); + from->setJustification(Justification::LEFT); + from->setVerticalAlign(VerticalAlign::HALF); + if (automatic_) { + if (!userMin_) { + ostringstream bottom; + bottom << MagicsFormat(format_, from_); + minText_ = bottom.str(); + } + + from->addText(minText_, font_); + } + else if (!last_) + from->addText(userText_, font_); + else { + if (automatic_ || userMax_) { + ostringstream bottom; + bottom << MagicsFormat(format_, from_); + from->addText(bottom.str(), font_); + } + } + PaperPoint pfrom(pt); + pfrom.y_ = y - height; + from->push_back(pfrom); + from->setAngle(angle_); + legend.push_back(from); + } + if (last_) { + Text* to = new Text(); + to->setVerticalAlign(VerticalAlign::HALF); + to->setJustification(Justification::LEFT); + to->setAngle(angle_); + + if (automatic_) { + if (maxText_.empty()) { + ostringstream to; + to << MagicsFormat(format_, to_); + maxText_ = to.str(); + } + to->addText(maxText_, font_); + } + else + to->addText(userText_, font_); + PaperPoint pto(pt); + pto.y_ = y + height; + to->push_back(pto); + legend.push_back(to); + } + if ( type_ ==Type::MIN ) { + box_->push_back(PaperPoint(x - width, y + (height/2))); + box_->push_back(PaperPoint(x + width, y + height)); + box_->push_back(PaperPoint(x + width, y - height)); + box_->push_back(PaperPoint(x - width, y + (height/2))); + } + else { + box_->push_back(PaperPoint(x - width, y - height)); + box_->push_back(PaperPoint(x - width, y + height)); + box_->push_back(PaperPoint(x + width, y + (height/2))); + box_->push_back(PaperPoint(x - width, y - height)); + } + Colour colour = (borderColour_.automatic()) ? box_->getFillColour() : borderColour_; + if (box_->getFillColour() == Colour("none")) { + box_->setFilled(false); + } + box_->setColour(colour); + legend.push_back(box_); + + Polyline* left = new Polyline(); + left->push_back(PaperPoint(x - width, y - (height * 1.1))); + left->push_back(PaperPoint(x - width, y + (height * 1.1))); + left->setColour(borderColour_); + left->setThickness(2); + + Polyline* right = new Polyline(); + right->push_back(PaperPoint(x + width, y - height * 1.1)); + right->push_back(PaperPoint(x + width, y + (height * 1.1))); + right->setColour(borderColour_); + right->setThickness(2); + + legend.push_back(left); + legend.push_back(right); + + if (last_) { + Polyline* top = new Polyline(); + top->push_back(PaperPoint(x - width, y + (height))); + top->push_back(PaperPoint(x + width, y + (height))); + top->setColour(borderColour_); + top->setThickness(2); + legend.push_back(top); + } + if (first_) { + Polyline* bottom = new Polyline(); + bottom->push_back(PaperPoint(x - width, y - height)); + bottom->push_back(PaperPoint(x + width, y - height)); + bottom->setColour(borderColour_); + bottom->setThickness(2); + legend.push_back(bottom); + } + + LegendVisitor::addLegendInfo("legend_entry_colour", box_->getFillColour().rgb()); + LegendVisitor::addLegendInfo("legend_entry_min_text", from()); + LegendVisitor::addLegendInfo("legend_entry_max_text", to()); + LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); +} + void BoxEntry::columnHisto(const PaperPoint& point, BasicGraphicsObjectContainer& legend, const Colour& colour) { MagLog::debug() << "BoxEntry--->set at " << point << endl; double width = computeWidth(0.8) / 2; @@ -1544,3 +1798,4 @@ DoubleLineEntry::~DoubleLineEntry() {} //{ { delete line1_; delete line2_; } LineEntry::~LineEntry() {} CdfEntry::~CdfEntry() {} //{ delete line_;} RainbowEntry::~RainbowEntry() {} //{ delete line_;} +OOBEntry::~OOBEntry() {} //{ delete box_; } diff --git a/src/basic/LegendVisitor.h b/src/basic/LegendVisitor.h index 02f77248a..5fda3d7e9 100644 --- a/src/basic/LegendVisitor.h +++ b/src/basic/LegendVisitor.h @@ -367,6 +367,25 @@ class BoxEntry : public LegendEntry { Colour colour() override; }; +class OOBEntry : public BoxEntry { +public: + enum class Type { MIN, MAX }; + OOBEntry(const string label, Type type, Polyline* box = 0) : + BoxEntry(label, box), type_(type) {} + OOBEntry(const double label, Type type, Polyline* box = 0) : + BoxEntry(label, box), type_(type) { format(label); } + OOBEntry(double min, double max, Type type, Polyline* box = 0) : + BoxEntry(min, max, box), type_(type) { format(min, max); } + ~OOBEntry() override; + void set(const PaperPoint&, BasicGraphicsObjectContainer&) override; + void rowBox(const PaperPoint&, BasicGraphicsObjectContainer&) override; + void columnBox(const PaperPoint&, BasicGraphicsObjectContainer&) override; + +protected: + Type type_; + +}; + class LegendVisitor : public LayoutVisitor, public LegendVisitorAttributes, diff --git a/src/decoders/GribDecoder.cc b/src/decoders/GribDecoder.cc index 475d963ee..dbd1022f0 100644 --- a/src/decoders/GribDecoder.cc +++ b/src/decoders/GribDecoder.cc @@ -785,8 +785,8 @@ void GribDecoder::openThirdComponent() { MagLog::debug() << "received for colour -> " << colour_position_ << " from file " << colour_file_name_ < " << current_position_ << " from file " << current_file_name_ <::iterator y = ys.begin(); vector::iterator x = xs.begin(); + vector::const_iterator val = values.begin(); + + minDate_ = *std::min_element(xs.begin(), xs.end()); + maxDate_ = *std::max_element(xs.begin(), xs.end()); + while (x != xs.end() && y != ys.end()) { double value = 0; @@ -371,7 +377,6 @@ void NetcdfXYpointsInterpretor::print(ostream& out) const { void NetcdfXYpointsInterpretor::visit(Transformation& transformation) { // get the data ... - try { refDateX_ = (transformation.getAutomaticX()) ? "" : transformation.getReferenceX(); refDateY_ = (transformation.getAutomaticY()) ? "" : transformation.getReferenceY(); @@ -380,10 +385,15 @@ void NetcdfXYpointsInterpretor::visit(Transformation& transformation) { if (transformation.getAutomaticX()) { if (!this->baseDateX_.empty()) { - transformation.setDataMinMaxX(points.minX(), points.maxX(), this->baseDateX_); + if ( ignore_missing_) + transformation.setDataMinMaxX(points.minX(), points.maxX(), this->baseDateX_); + else + transformation.setDataMinMaxX(minDate_, maxDate_, this->baseDateX_); } else { + + transformation.setMinMaxX(points.minX(), points.maxX()); } } diff --git a/src/decoders/NetcdfGeopointsInterpretor.h b/src/decoders/NetcdfGeopointsInterpretor.h index d5095f586..57a982e05 100644 --- a/src/decoders/NetcdfGeopointsInterpretor.h +++ b/src/decoders/NetcdfGeopointsInterpretor.h @@ -78,7 +78,7 @@ class NetcdfGeopointsInterpretor : public NetcdfInterpretor { return s; } }; -class NetcdfXYpointsInterpretor : public NetcdfInterpretor { +class NetcdfXYpointsInterpretor : public NetcdfInterpretor { public: NetcdfXYpointsInterpretor(); virtual ~NetcdfXYpointsInterpretor() override; @@ -117,6 +117,9 @@ class NetcdfXYpointsInterpretor : public NetcdfInterpretor { protected: //! Method to print string about this class on to a stream of type ostream (virtual). virtual void print(ostream&) const override; + // Specail case for date in x axis . + double minDate_; + double maxDate_; private: //! Copy constructor - No copy allowed diff --git a/src/libMagWrapper/MagPlus.cc b/src/libMagWrapper/MagPlus.cc index 084b0d620..064ed0212 100644 --- a/src/libMagWrapper/MagPlus.cc +++ b/src/libMagWrapper/MagPlus.cc @@ -50,6 +50,7 @@ #include "ImportPlotWrapper.h" #include "InputDataWrapper.h" #include "TableDecoderWrapper.h" +#include "BoxPlotDecoderWrapper.h" #include "LegendVisitorWrapper.h" #include "TextVisitor.h" @@ -58,6 +59,7 @@ #include "GraphPlottingWrapper.h" #include "MultiVisdef.h" #include "SymbolPlottingWrapper.h" +#include "BoxPlotVisualiserWrapper.h" #include "WindWrapper.h" #include "EmagramGrid.h" @@ -209,6 +211,8 @@ MagPlus::MagPlus() : root_(0), superpage_(-1), geographical_(true), mode_(intera sceneCreators_["INPUT_GEO_VECTORS"] = &MagPlus::input; sceneCreators_["INPUT_XY_BINNING"] = &MagPlus::input; sceneCreators_["INPUT_GEO_BINNING"] = &MagPlus::input; + sceneCreators_["INPUT_BOXPLOT"] = &MagPlus::inputBoxplot; + sceneCreators_["TABLE_XY_POINTS"] = &MagPlus::table; sceneCreators_["TABLE_GEO_POINTS"] = &MagPlus::table; @@ -237,6 +241,7 @@ MagPlus::MagPlus() : root_(0), superpage_(-1), geographical_(true), mode_(intera sceneCreators_["PSYMB"] = &MagPlus::symbol; sceneCreators_["MSYMB"] = &MagPlus::symbol; sceneCreators_["PSYMBPLUS"] = &MagPlus::symbol; + sceneCreators_["MBOXPLOT"] = &MagPlus::boxplot; sceneCreators_["PWIND"] = &MagPlus::wind; sceneCreators_["MWIND"] = &MagPlus::wind; sceneCreators_["MGRAPH"] = &MagPlus::graph; @@ -1416,6 +1421,20 @@ bool MagPlus::bufr(magics::MagRequest& in) { setIconInfo(in, *obs.object()); return false; // do not exit } + +bool MagPlus::inputBoxplot(magics::MagRequest& in) { + + in.print(); + VisualAction* action = new VisualAction(); + top()->push_back(action); + push(action); + + BoxPlotDecoderWrapper boxplot; + boxplot.set(in); + top()->data(boxplot.object()); + setIconInfo(in, *boxplot.object()); + return false; // do not exit +} bool MagPlus::symbol(magics::MagRequest& in) { if (in.countValues("SYMBOL_INPUT_MARKER_LIST")) { in("SYMBOL_MARKER") = in("SYMBOL_INPUT_MARKER_LIST"); @@ -1472,6 +1491,17 @@ bool MagPlus::obs(magics::MagRequest& in) { + return false; // do not exit +} +bool MagPlus::boxplot(magics::MagRequest& in) { + + BoxPlotVisualiserWrapper visdef; + + visdef.set(in); + + MagLog::dev() << "add boxplot visualiser" << *visdef.object() << endl; + top()->visdef(visdef.object()); + pop(); return false; // do not exit } bool MagPlus::dataloop(magics::MagRequest& in) { diff --git a/src/libMagWrapper/MagPlus.h b/src/libMagWrapper/MagPlus.h index db8f6cd3c..81f26849a 100644 --- a/src/libMagWrapper/MagPlus.h +++ b/src/libMagWrapper/MagPlus.h @@ -114,6 +114,7 @@ class MagPlus : public stack { bool raster(magics::MagRequest&); bool input(magics::MagRequest&); + bool inputBoxplot(magics::MagRequest&); bool table(magics::MagRequest&); bool binning(magics::MagRequest&); @@ -123,6 +124,7 @@ class MagPlus : public stack { bool import(magics::MagRequest&); bool obs(magics::MagRequest&); bool graph(magics::MagRequest&); + bool boxplot(magics::MagRequest&); bool multi(magics::MagRequest&); bool ptext(magics::MagRequest&); diff --git a/src/params/Axis.xml b/src/params/Axis.xml index af2609c17..64e33e2c7 100644 --- a/src/params/Axis.xml +++ b/src/params/Axis.xml @@ -478,5 +478,34 @@ does it submit to any jurisdiction. values="high/medium/low"> Quality of the font + + List of highlighted values + + + Colour of highlighted values lines + + + Line style of of highlighted values lines + + + Thickness of of highlighted values lines + diff --git a/src/params/BoxPlotVisualiser.xml b/src/params/BoxPlotVisualiser.xml index a2a8dad1b..654aa52b3 100644 --- a/src/params/BoxPlotVisualiser.xml +++ b/src/params/BoxPlotVisualiser.xml @@ -9,7 +9,6 @@ does it submit to any jurisdiction. The following parameters allow the user to define both the data diff --git a/src/params/ColourTechnique.xml b/src/params/ColourTechnique.xml index f3a6bc32a..57542be31 100644 --- a/src/params/ColourTechnique.xml +++ b/src/params/ColourTechnique.xml @@ -7,6 +7,25 @@ granted to it by virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. --> - + + + + Colour to use below the out of bound minimum value + + + + Colour to use below the out of bound maximum value + + diff --git a/src/params/GribDecoder.xml b/src/params/GribDecoder.xml index 2d98d6eef..e5c6b729b 100644 --- a/src/params/GribDecoder.xml +++ b/src/params/GribDecoder.xml @@ -35,9 +35,7 @@ does it submit to any jurisdiction. to="string" default="grib_input_file_name" from="string" - name="grib_colour_component_file_name"> - - The name of the input file containing the u-component of wind +CountSelection The name of the input file containing the u-component of wind - Maximum level for which shading is required - Highest level for contours to be drawn - New Magics: Parameter contour_max_level sent to new Magics[LevelSelection]. - Magics++0.3 + Lowest level for contours to be drawn - New Magics: Parameter contour_min_level sent to new Magics[LevelSelection]. - Magics++0.3 - - Highest level for contours to be shaded + Out of bound minimum value : below that the out_of_bound_min_colour will be used + - Lowest level for contours to be shaded + Out of bound maximun value : above that the out_of_bound_max_colour will be used + diff --git a/src/params/NetcdfInterpretor.xml b/src/params/NetcdfInterpretor.xml index 031cc2eb6..5f349a2c3 100644 --- a/src/params/NetcdfInterpretor.xml +++ b/src/params/NetcdfInterpretor.xml @@ -269,12 +269,18 @@ does it submit to any jurisdiction. from="string" name="netcdf_matrix_interpretation" values='automatic/direct/transposed'> - Magics++2.4 This can speed up the reading of the matrix. Automatic : No Hint : Magics will create the matrix from the values of the parameters netcdf_x_variable and netcdf_y_variable. Direct : Little hint for Magics : it can load the matrix direcly Transposed : Little hint for Magics : It has to transpose the Matrix + + Ignore or not missing value when setting automatic projection: useful for tiemseries containing missing values. + diff --git a/src/params/NetcdfXYpointsInterpretor.xml b/src/params/NetcdfXYpointsInterpretor.xml index 17681a0f7..7c976295c 100644 --- a/src/params/NetcdfXYpointsInterpretor.xml +++ b/src/params/NetcdfXYpointsInterpretor.xml @@ -13,5 +13,9 @@ does it submit to any jurisdiction. directory="decoders" prefix="netcdf" action="pnetcdf" - include="NetcdfGeopointsInterpretor.h"> + include="NetcdfGeopointsInterpretor.h"> + + + + diff --git a/src/params/NoBoxPlot.xml b/src/params/NoBoxPlot.xml new file mode 100644 index 000000000..de1625af7 --- /dev/null +++ b/src/params/NoBoxPlot.xml @@ -0,0 +1,15 @@ + + + + diff --git a/src/params/NoBoxPlotBox.xml b/src/params/NoBoxPlotBox.xml new file mode 100644 index 000000000..6e28745db --- /dev/null +++ b/src/params/NoBoxPlotBox.xml @@ -0,0 +1,15 @@ + + + + diff --git a/src/params/NoBoxPlotWhisker.xml b/src/params/NoBoxPlotWhisker.xml new file mode 100644 index 000000000..ef2de0bff --- /dev/null +++ b/src/params/NoBoxPlotWhisker.xml @@ -0,0 +1,15 @@ + + + + diff --git a/src/visualisers/Axis.cc b/src/visualisers/Axis.cc index 1e2520016..a5c213472 100644 --- a/src/visualisers/Axis.cc +++ b/src/visualisers/Axis.cc @@ -389,6 +389,7 @@ void VerticalAxis::label(VerticalAxisVisitor& axis) { + bool out = false; if (magCompare(label_position_, "inter_tick")) { @@ -529,6 +530,25 @@ void VerticalAxis::title(VerticalAxisVisitor& out) { out.push_back(text); } +void HorizontalAxis::highlight(DrawingVisitor& out) const { + if ( highlighted_values_.empty() ) + return; + double bottom = out.minY(); + double top = out.maxY(); + const Transformation& transformation = out.transformation(); + + for ( auto highlight = highlighted_values_.begin(); highlight != highlighted_values_.end(); ++highlight ) { + Polyline* high = new Polyline(); + high->push_back(PaperPoint(transformation.x(*highlight), bottom)); + high->push_back(PaperPoint(transformation.x(*highlight), top)); + high->setColour(*highlighted_values_colour_); + high->setLineStyle(highlighted_values_style_); + high->setThickness(highlighted_values_thickness_); + out.push_back(high); + } +} + + void HorizontalAxis::grid(DrawingVisitor& out) const { double bottom = out.minY(); double top = out.maxY(); @@ -597,6 +617,26 @@ void HorizontalAxis::grid(DrawingVisitor& out) const { } } +void VerticalAxis::highlight(DrawingVisitor& out) const { + if ( highlighted_values_.empty() ) + return; + double left = out.minX(); + double right = out.maxX(); + const Transformation& transformation = out.transformation(); + + for ( auto highlight = highlighted_values_.begin(); highlight != highlighted_values_.end(); ++highlight ) { + Polyline* high = new Polyline(); + high->push_back(PaperPoint(left, transformation.y(*highlight))); + high->push_back(PaperPoint(right, transformation.y(*highlight))); + high->setColour(*highlighted_values_colour_); + high->setLineStyle(highlighted_values_style_); + high->setThickness(highlighted_values_thickness_); + out.push_back(high); + } + + +} + void VerticalAxis::grid(DrawingVisitor& out) const { double left = out.minX(); double right = out.maxX(); diff --git a/src/visualisers/Axis.h b/src/visualisers/Axis.h index 1b64f46d7..c3ec33b67 100644 --- a/src/visualisers/Axis.h +++ b/src/visualisers/Axis.h @@ -71,6 +71,9 @@ class Axis : public BasicSceneObject, public AxisAttributes { virtual void grid(DrawingVisitor&) const {} + virtual void highlight(DrawingVisitor&) const {} + + string createLabel(const AxisItem&); double min() const { return method_->min(); } @@ -136,6 +139,7 @@ class HorizontalAxis : public Axis { method_->prepare(*this, items_); } grid(visitor); + highlight(visitor); } void visit(TopAxisVisitor& visitor) override { @@ -167,6 +171,9 @@ class HorizontalAxis : public Axis { void tip(BottomAxisVisitor& out) const override; void grid(DrawingVisitor&) const override; + + void highlight(DrawingVisitor&) const override; + }; class VerticalAxis : public Axis { @@ -192,6 +199,7 @@ class VerticalAxis : public Axis { method_->prepare(*this, items_); } grid(visitor); + highlight(visitor); } void visit(LeftAxisVisitor& visitor) override { if (magCompare(position_, "left")) @@ -220,6 +228,9 @@ class VerticalAxis : public Axis { void tip(RightAxisVisitor& out) const override; void grid(DrawingVisitor&) const override; + + void highlight(DrawingVisitor&) const override; + }; } // namespace magics diff --git a/src/visualisers/CalculateColourTechnique.h b/src/visualisers/CalculateColourTechnique.h index 392ae13a1..522e3aba8 100644 --- a/src/visualisers/CalculateColourTechnique.h +++ b/src/visualisers/CalculateColourTechnique.h @@ -39,6 +39,11 @@ class CalculateColourTechnique : public ColourTechnique, public CalculateColourT void set(const ColourTechniqueInterface&) override; + void copy(const CalculateColourTechnique&) { + CalculateColourTechniqueAttributes::copy(*this); + ColourTechniqueAttributes::copy(*this); + } + virtual ColourTechnique* clone() const override { CalculateColourTechnique* object = new CalculateColourTechnique(); diff --git a/src/visualisers/ColourTechnique.cc b/src/visualisers/ColourTechnique.cc index 4f5ac6b23..5b31581b8 100644 --- a/src/visualisers/ColourTechnique.cc +++ b/src/visualisers/ColourTechnique.cc @@ -45,13 +45,35 @@ void ColourTechnique::print(ostream& out) const { void ColourTechnique::prepare(LevelSelection& out, LevelSelection& levels, bool rainbow) { if (levels.empty()) return; + + clear(); bands_.clear(); ColourTable table; + if (rainbow) set(out, levels, table, levels.size() + 1); - else - set(out, levels, table, levels.size()); + else { + + LevelSelection newlevels; + int count = levels.size(); + if (out.minOutOfBond()) { + table.push_back(*oob_min_colour_); + count--; + } + if (out.maxOutOfBond()) { + count--; + } + set(out, levels, table, count); + if (out.maxOutOfBond()) { + table.push_back(*oob_max_colour_); + count--; + } + } + cout << " ------------------------------ " << endl; + + + if (table.empty()) table.push_back(Colour("none")); @@ -91,6 +113,8 @@ void ColourTechnique::prepare(LevelSelection& out, LevelSelection& levels, bool if (!rainbow) bands_.insert(make_pair(Interval(levels.back(), levels.back() + EPSILON), left)); + + MagLog::dev() << levels.back() << "<<" << left << "<<" << levels.back() + EPSILON << endl; } @@ -182,14 +206,14 @@ PaletteColourTechnique::~PaletteColourTechnique() {} -void PaletteColourTechnique::set(LevelSelection& out, LevelSelection& in, ColourTable& table, int nb) { +void PaletteColourTechnique::set(LevelSelection&, LevelSelection& in, ColourTable& table, int nb) { PaletteLibrary library; vector colours; Palette palette; string name = palette_; library.find(name, palette); - + if (palette.colours_.empty()) { MagLog::warning() << "Could not load palette " << palette_ << ": using a default one " << endl; colours.push_back("blue"); diff --git a/src/visualisers/ColourTechnique.h b/src/visualisers/ColourTechnique.h index 99e915e00..bfc794c19 100644 --- a/src/visualisers/ColourTechnique.h +++ b/src/visualisers/ColourTechnique.h @@ -59,7 +59,8 @@ class ColourTechniqueInterface { }; -class ColourTechnique : public map { +class ColourTechnique : public map, + public ColourTechniqueAttributes { public: ColourTechnique(); virtual ~ColourTechnique(); @@ -124,6 +125,13 @@ class PaletteColourTechnique : public ColourTechnique, void set(const ColourTechniqueInterface&) override; + virtual void copy(const PaletteColourTechnique&) { + PaletteColourTechniqueAttributes::copy(*this); + ColourTechniqueAttributes::copy(*this); + } + + + virtual ColourTechnique* clone() const override { PaletteColourTechnique* object = new PaletteColourTechnique(); diff --git a/src/visualisers/CountSelectionType.cc b/src/visualisers/CountSelectionType.cc index 555541cd7..4b225e9dd 100644 --- a/src/visualisers/CountSelectionType.cc +++ b/src/visualisers/CountSelectionType.cc @@ -32,15 +32,56 @@ CountSelectionType::CountSelectionType() {} void CountSelectionType::calculate(double min, double max, bool) { + + clear(); - double maxi = (max_ > 1000000000) ? max : max_; - double mini = (min_ < -1000000000) ? min : min_; + + + vector minbounds = { min, oob_min_, min_, }; + vector maxbounds = { max, oob_max_, max_ }; + + for (auto i = maxbounds.begin(); i != maxbounds.end(); ++i) { + cout << "max " << *i << endl; + } + + for (auto i = minbounds.begin(); i != minbounds.end(); ++i) { + cout << "min " << *i << endl; + } + + auto mini = *std::max_element(minbounds.begin(), minbounds.end()); + auto maxi = *std::min_element(maxbounds.begin(), maxbounds.end()); + + minOutOfBond_ = oob_min_ > std::max(min, min_); + maxOutOfBond_ = oob_max_ < std::min(max, max_); + + int i = 0; - i += (max_ > 1000000000) ? 1 : 0; - i += (min_ < -1000000000) ? 1 : 0; + if ( minOutOfBond_ ) { + cout << "minOutOfBond_" << endl; + i++; + } + + if ( maxOutOfBond_ ) { + cout << "maxOutOfBond_" << endl; + i++; + } + + + // if ( mini > oob_min_ ) + // i++; + // if ( maxi < oob_max_ ) + // i++; + + // i += ( same(maxi, 1.0e+21) ) ? 1 : 0; + // i += ( same(mini, -1.0e+21) ) ? 1 : 0; + + + cout << mini << " " << maxi << " " << i << endl; + + double nb = levelCount_ - 1; if (same(maxi, mini)) { push_back(mini); @@ -152,13 +193,22 @@ void CountSelectionType::calculate(double min, double max, bool) { MagLog::debug() << "New size-->" << size() << endl; } - MagLog::debug() << "count=" << levelCount_ << ", tolerance=" << tolerance_ << ", result=" << size() << endl; + if ( minOutOfBond_ ) { + insert(begin(), std::max(min, min_)); + cout << " add " << std::max(min, min_) << endl; + } + + if ( maxOutOfBond_ ) { + push_back(std::min(max, max_)); + } + + cout << "count=" << levelCount_ << ", tolerance=" << tolerance_ << ", result=" << size() << endl; ostringstream level; for (const_iterator l = begin(); l != end(); ++l) level << *l << " "; - MagLog::debug() << level.str() << endl; + cout << level.str() << endl; } diff --git a/src/visualisers/GradientsColourTechnique.h b/src/visualisers/GradientsColourTechnique.h index b56af53f5..defd94808 100644 --- a/src/visualisers/GradientsColourTechnique.h +++ b/src/visualisers/GradientsColourTechnique.h @@ -38,6 +38,12 @@ class GradientsColourTechnique : public ColourTechnique, public GradientsColourT bool accept(const string& node) override { return GradientsColourTechniqueAttributes::accept(node); } void set(const ColourTechniqueInterface&) override; + + void copy(const GradientsColourTechnique&) { + GradientsColourTechniqueAttributes::copy(*this); + ColourTechniqueAttributes::copy(*this); + } + virtual ColourTechnique* clone() const override { diff --git a/src/visualisers/IntervalSelectionType.cc b/src/visualisers/IntervalSelectionType.cc index c39a3307a..66e39ea52 100644 --- a/src/visualisers/IntervalSelectionType.cc +++ b/src/visualisers/IntervalSelectionType.cc @@ -44,23 +44,32 @@ void IntervalSelectionType::calculate(double min, double max, bool shading) { clear(); std::set levels; + vector minbounds = { min, oob_min_, min_, }; + vector maxbounds = { max, oob_max_, max_ }; - double lmax, lmin; - if (shading) { - if (max_shade_ < min_shade_) - MagLog::warning() << "contour_shade_max_level (" << max_shade_ << ") < contour_shade_min_level (" - << min_shade_ << "): Please check your code" << endl; - if (same(max_, 1.0e+21)) { - max_ = max_shade_; - } - if (same(min_, -1.0e+21)) { - min_ = min_shade_; - } + for (auto i = maxbounds.begin(); i != maxbounds.end(); ++i) { + cout << "max " << *i << endl; } + for (auto i = minbounds.begin(); i != minbounds.end(); ++i) { + cout << "min " << *i << endl; + } - lmax = same(max_, 1.0e+21) ? max : max_; - lmin = same(min_, -1.0e+21) ? min : min_; + auto lmin = *std::max_element(minbounds.begin(), minbounds.end()); + auto lmax = *std::min_element(maxbounds.begin(), maxbounds.end()); + + minOutOfBond_ = oob_min_ > std::max(min, min_); + maxOutOfBond_ = oob_max_ < std::min(max, max_); + if ( minOutOfBond_ ) { + lmin = oob_min_; + levels.insert(min); + cout << "HERE" << endl; + } + + if ( maxOutOfBond_ ) { + lmax = oob_max_; + levels.insert(max); + } levels.insert(lmin); @@ -93,7 +102,7 @@ void IntervalSelectionType::calculate(double min, double max, bool shading) { push_back(*level); } out << "]" << endl; - MagLog::dev() << out.str() << endl; + cout << out.str() << endl; // Now make sure that the reference is inside the interval .. } diff --git a/src/visualisers/IsoShading.h b/src/visualisers/IsoShading.h index ff1d8e7e2..9f6ebfdb6 100644 --- a/src/visualisers/IsoShading.h +++ b/src/visualisers/IsoShading.h @@ -131,7 +131,7 @@ class IsoShading : public NoIsoShading, public IsoShadingAttributes { virtual bool operator()(LevelSelection& list) override { LevelSelection filter; for (LevelSelection::const_iterator level = list.begin(); level != list.end(); ++level) - if (this->min_ <= *level && *level <= this->max_) + if (shade_min_ <= *level && *level <= shade_max_) filter.push_back(*level); @@ -141,6 +141,8 @@ class IsoShading : public NoIsoShading, public IsoShadingAttributes { if (!filter.empty() && (filter.back() == filter.front())) filter.push_back(filter.front()); + + return (*this->technique_).prepare(filter, *this->colourMethod_); } diff --git a/src/visualisers/LevelListSelectionType.cc b/src/visualisers/LevelListSelectionType.cc index 3db25b1af..26d7c88a0 100644 --- a/src/visualisers/LevelListSelectionType.cc +++ b/src/visualisers/LevelListSelectionType.cc @@ -40,15 +40,31 @@ void LevelListSelectionType::print(ostream& out) const { } -void LevelListSelectionType::calculate(double, double, bool) { +void LevelListSelectionType::calculate(double min, double max, bool) { clear(); + + minOutOfBond_ = same(min_, -1.0e+21) && !same(oob_min_, -1.0e+21); + maxOutOfBond_ = same(max_, 1.0e+21) && !same(oob_max_, 1.0e+21); + double mini = min_; + double maxi = max_; + if (minOutOfBond_) { + push_back(min); + push_back(oob_min_); + mini = oob_min_; + } + + if (maxOutOfBond_) { + maxi = oob_max_; + } + + doublearray::const_iterator last = list_.begin(); double prevVal = min_; for (doublearray::const_iterator val = list_.begin(); val != list_.end(); ++val) { MagLog::dev() << "LevelListSelectionType::calculate(double min, double max)--->" << *val << "\n"; - if (min_ <= *val && *val <= max_) { + if (mini <= *val && *val <= maxi) { if (*val < prevVal) { MagLog::error() << " level list values should increase, but " << *val << " follows " << prevVal << endl; break; @@ -58,6 +74,11 @@ void LevelListSelectionType::calculate(double, double, bool) { } ++last; } + if (maxOutOfBond_) { + push_back(oob_max_); + push_back(max); + } + // Just in case add another level to close the last interval ! if (last != list_.end()) @@ -72,5 +93,5 @@ void LevelListSelectionType::calculate(double, double, bool) { sep = ", "; } print << "]"; - MagLog::dev() << print.str() << endl; + cout << print.str() << endl; } diff --git a/src/visualisers/LevelSelection.h b/src/visualisers/LevelSelection.h index ca9e5b3b6..218d342b6 100644 --- a/src/visualisers/LevelSelection.h +++ b/src/visualisers/LevelSelection.h @@ -58,9 +58,15 @@ class LevelSelection : public LevelSelectionAttributes, public doublearray { virtual double reference(int) const; virtual void thinLevels(int frequency, vector&) const; + bool minOutOfBond() { return minOutOfBond_; } + bool maxOutOfBond() { return maxOutOfBond_; } + protected: //! Method to print string about this class on to a stream of type ostream (virtual). virtual void print(ostream&) const override; + bool minOutOfBond_; + bool maxOutOfBond_; +; private: //! Copy constructor - No copy allowed @@ -74,6 +80,7 @@ class LevelSelection : public LevelSelectionAttributes, public doublearray { p.print(s); return s; } + }; template <> diff --git a/src/visualisers/ListColourTechnique.h b/src/visualisers/ListColourTechnique.h index 789f90441..c71465377 100644 --- a/src/visualisers/ListColourTechnique.h +++ b/src/visualisers/ListColourTechnique.h @@ -41,6 +41,12 @@ class ListColourTechnique : public ColourTechnique, public ListColourTechniqueAt object->copy(*this); return object; } + void copy(const ListColourTechnique&) { + ListColourTechniqueAttributes::copy(*this); + ColourTechniqueAttributes::copy(*this); + } + + virtual void set(LevelSelection&, LevelSelection&, ColourTable&, int) override; void set(const ColourTechniqueInterface&) override; From d720bbc67fefa1cdc650213c3e4ddc2e7cc856f3 Mon Sep 17 00:00:00 2001 From: Sandor Kertesz Date: Wed, 1 Jun 2022 08:56:17 +0100 Subject: [PATCH 05/66] Temporary fix to make metview build MAGP-616 --- src/libMagWrapper/MagPlus.cc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/libMagWrapper/MagPlus.cc b/src/libMagWrapper/MagPlus.cc index 064ed0212..2d855f4af 100644 --- a/src/libMagWrapper/MagPlus.cc +++ b/src/libMagWrapper/MagPlus.cc @@ -43,6 +43,9 @@ #include "ObsDecoderWrapper.h" #include "ObsPlottingWrapper.h" +#if 0 +#include "BoxPlotDecoderWrapper.h" +#endif #include "ContourWrapper.h" #include "GeoJSonWrapper.h" @@ -50,16 +53,18 @@ #include "ImportPlotWrapper.h" #include "InputDataWrapper.h" #include "TableDecoderWrapper.h" -#include "BoxPlotDecoderWrapper.h" #include "LegendVisitorWrapper.h" #include "TextVisitor.h" #include "TextVisitorWrapper.h" +#if 0 +#include "BoxPlotVisualiserWrapper.h" +#endif + #include "GraphPlottingWrapper.h" #include "MultiVisdef.h" #include "SymbolPlottingWrapper.h" -#include "BoxPlotVisualiserWrapper.h" #include "WindWrapper.h" #include "EmagramGrid.h" @@ -241,7 +246,7 @@ MagPlus::MagPlus() : root_(0), superpage_(-1), geographical_(true), mode_(intera sceneCreators_["PSYMB"] = &MagPlus::symbol; sceneCreators_["MSYMB"] = &MagPlus::symbol; sceneCreators_["PSYMBPLUS"] = &MagPlus::symbol; - sceneCreators_["MBOXPLOT"] = &MagPlus::boxplot; + sceneCreators_["MBOXPLOT"] = &MagPlus::boxplot; sceneCreators_["PWIND"] = &MagPlus::wind; sceneCreators_["MWIND"] = &MagPlus::wind; sceneCreators_["MGRAPH"] = &MagPlus::graph; @@ -828,7 +833,6 @@ bool MagPlus::binning(magics::MagRequest& in) { } bool MagPlus::grib(magics::MagRequest& in) { - MagLog::dev() << "add grib" << endl; in.print(); @@ -988,7 +992,6 @@ void MagPlus::setIconInfo(magics::MagRequest& mv, MetviewIcon& object) { } bool MagPlus::gribloop(magics::MagRequest& in) { - MagLog::dev() << "add gribloop" << endl; in.print(); string loop("loop"); @@ -1403,7 +1406,6 @@ bool MagPlus::geojson(magics::MagRequest& in) { } bool MagPlus::bufr(magics::MagRequest& in) { - /* // Extract the path .. magics::MagRequest record = in("RECORD"); @@ -1423,7 +1425,7 @@ bool MagPlus::bufr(magics::MagRequest& in) { } bool MagPlus::inputBoxplot(magics::MagRequest& in) { - +#if 0 in.print(); VisualAction* action = new VisualAction(); top()->push_back(action); @@ -1433,6 +1435,7 @@ bool MagPlus::inputBoxplot(magics::MagRequest& in) { boxplot.set(in); top()->data(boxplot.object()); setIconInfo(in, *boxplot.object()); +#endif return false; // do not exit } bool MagPlus::symbol(magics::MagRequest& in) { @@ -1480,7 +1483,6 @@ bool MagPlus::graph(magics::MagRequest& in) { } bool MagPlus::obs(magics::MagRequest& in) { - ObsPlottingWrapper visdef; visdef.set(in); @@ -1490,11 +1492,10 @@ bool MagPlus::obs(magics::MagRequest& in) { pop(); - return false; // do not exit } bool MagPlus::boxplot(magics::MagRequest& in) { - +#if 0 BoxPlotVisualiserWrapper visdef; visdef.set(in); @@ -1502,6 +1503,7 @@ bool MagPlus::boxplot(magics::MagRequest& in) { MagLog::dev() << "add boxplot visualiser" << *visdef.object() << endl; top()->visdef(visdef.object()); pop(); +#endif return false; // do not exit } bool MagPlus::dataloop(magics::MagRequest& in) { @@ -1814,9 +1816,9 @@ void MagPlus::notify(MagicsEvent& event) { } void MagPlus::unregisterObserver(MagicsObserver* observer) { - // observers_.erase( - // std::remove_if(observers_.begin(), observers_.end(), bind2nd(std::equal_to(), observer)), - // observers_.end()); + // observers_.erase( + // std::remove_if(observers_.begin(), observers_.end(), bind2nd(std::equal_to(), observer)), + // observers_.end()); } void setDouble(const string& key, const ParamJSon& json, MagRequest& out) { From e3f24ffdc6d6305c33a2f516006a40c4551a66bc Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 7 Jun 2022 18:41:28 +0100 Subject: [PATCH 06/66] BoxPlot Cleaning --- src/attributes/BoxPlotVisualiserAttributes.cc | 175 ++++++++++++++---- src/attributes/BoxPlotVisualiserAttributes.h | 25 ++- src/attributes/BoxPlotVisualiserWrapper.cc | 172 ++++++++++------- src/attributes/BoxPlotVisualiserWrapper.h | 2 - src/params/BoxPlotVisualiser.xml | 157 ++++++++++++++-- src/params/CMakeLists.txt | 6 - src/visualisers/BoxPlotVisualiser.cc | 165 ++++++++++++++++- src/visualisers/BoxPlotVisualiser.h | 10 +- src/visualisers/CMakeLists.txt | 3 - 9 files changed, 580 insertions(+), 135 deletions(-) diff --git a/src/attributes/BoxPlotVisualiserAttributes.cc b/src/attributes/BoxPlotVisualiserAttributes.cc index 1dc1b647d..0e953ae15 100644 --- a/src/attributes/BoxPlotVisualiserAttributes.cc +++ b/src/attributes/BoxPlotVisualiserAttributes.cc @@ -25,9 +25,28 @@ using namespace magics; BoxPlotVisualiserAttributes::BoxPlotVisualiserAttributes(): - - box_(MagTranslator().magics("boxplot_box")), - whisker_(MagTranslator().magics("boxplot_whisker")) + box_(ParameterManager::getBool("boxplot_box")), + box_width_(ParameterManager::getDouble("boxplot_box_width")), + box_border_(ParameterManager::getBool("boxplot_box_border")), + box_border_thickness_(ParameterManager::getInt("boxplot_box_border_thickness")), + median_(ParameterManager::getBool("boxplot_median")), + median_thickness_(ParameterManager::getInt("boxplot_median_thickness")), + whisker_(ParameterManager::getString("boxplot_whisker")), + whisker_box_width_(ParameterManager::getDouble("boxplot_whisker_box_width")), + whisker_box_border_(ParameterManager::getBool("boxplot_whisker_box_border")), + whisker_box_border_thickness_(ParameterManager::getInt("boxplot_whisker_box_border_thickness")), + whisker_line_thickness_(ParameterManager::getInt("boxplot_whisker_line_thickness")) + , + box_colour_(MagTranslator().magics("boxplot_box_colour")), + box_border_colour_(MagTranslator().magics("boxplot_box_border_colour")), + box_border_style_(MagTranslator().magics("boxplot_box_border_line_style")), + median_colour_(MagTranslator().magics("boxplot_median_colour")), + median_style_(MagTranslator().magics("boxplot_median_line_style")), + whisker_box_colour_(MagTranslator().magics("boxplot_whisker_box_colour")), + whisker_box_border_colour_(MagTranslator().magics("boxplot_whisker_box_border_colour")), + whisker_box_border_style_(MagTranslator().magics("boxplot_whisker_box_border_line_style")), + whisker_line_colour_(MagTranslator().magics("boxplot_whisker_line_colour")), + whisker_line_style_(MagTranslator().magics("boxplot_whisker_line_style")) { } @@ -45,16 +64,54 @@ void BoxPlotVisualiserAttributes::set(const std::map& params) int i = 0; prefix[i++] = ""; + setAttribute(prefix, "boxplot_box", box_, params); + setAttribute(prefix, "boxplot_box_width", box_width_, params); + setAttribute(prefix, "boxplot_box_border", box_border_, params); + setAttribute(prefix, "boxplot_box_border_thickness", box_border_thickness_, params); + setAttribute(prefix, "boxplot_median", median_, params); + setAttribute(prefix, "boxplot_median_thickness", median_thickness_, params); + setAttribute(prefix, "boxplot_whisker", whisker_, params); + setAttribute(prefix, "boxplot_whisker_box_width", whisker_box_width_, params); + setAttribute(prefix, "boxplot_whisker_box_border", whisker_box_border_, params); + setAttribute(prefix, "boxplot_whisker_box_border_thickness", whisker_box_border_thickness_, params); + setAttribute(prefix, "boxplot_whisker_line_thickness", whisker_line_thickness_, params); - setMember(prefix, "boxplot_box", box_, params); - setMember(prefix, "boxplot_whisker", whisker_, params); + setMember(prefix, "boxplot_box_colour", box_colour_, params); + setMember(prefix, "boxplot_box_border_colour", box_border_colour_, params); + setAttribute(prefix, "boxplot_box_border_line_style", box_border_style_, params); + setMember(prefix, "boxplot_median_colour", median_colour_, params); + setAttribute(prefix, "boxplot_median_line_style", median_style_, params); + setMember(prefix, "boxplot_whisker_box_colour", whisker_box_colour_, params); + setMember(prefix, "boxplot_whisker_box_border_colour", whisker_box_border_colour_, params); + setAttribute(prefix, "boxplot_whisker_box_border_line_style", whisker_box_border_style_, params); + setMember(prefix, "boxplot_whisker_line_colour", whisker_line_colour_, params); + setAttribute(prefix, "boxplot_whisker_line_style", whisker_line_style_, params); } void BoxPlotVisualiserAttributes::copy(const BoxPlotVisualiserAttributes& other) { - box_ = unique_ptr(other.box_->clone()); - whisker_ = unique_ptr(other.whisker_->clone()); + box_ = other.box_; + box_width_ = other.box_width_; + box_border_ = other.box_border_; + box_border_thickness_ = other.box_border_thickness_; + median_ = other.median_; + median_thickness_ = other.median_thickness_; + whisker_ = other.whisker_; + whisker_box_width_ = other.whisker_box_width_; + whisker_box_border_ = other.whisker_box_border_; + whisker_box_border_thickness_ = other.whisker_box_border_thickness_; + whisker_line_thickness_ = other.whisker_line_thickness_; + box_colour_ = unique_ptr(other.box_colour_->clone()); + box_border_colour_ = unique_ptr(other.box_border_colour_->clone()); + box_border_style_ = other.box_border_style_; + median_colour_ = unique_ptr(other.median_colour_->clone()); + median_style_ = other.median_style_; + whisker_box_colour_ = unique_ptr(other.whisker_box_colour_->clone()); + whisker_box_border_colour_ = unique_ptr(other.whisker_box_border_colour_->clone()); + whisker_box_border_style_ = other.whisker_box_border_style_; + whisker_line_colour_ = unique_ptr(other.whisker_line_colour_->clone()); + whisker_line_style_ = other.whisker_line_style_; } @@ -64,10 +121,6 @@ bool BoxPlotVisualiserAttributes::accept(const string& node) if ( magCompare(node, "boxplot") ) return true; - if ( acceptNode(node, box_) ) - return true; - if ( acceptNode(node, whisker_) ) - return true; return false; } @@ -86,14 +139,10 @@ void BoxPlotVisualiserAttributes::set(const XmlNode& node) if ( apply ) set(node.attributes()); else { - setMember(node.name(), box_, node); - setMember(node.name(), whisker_, node); } for (auto &elt : node.elements()) { - setMember(elt->name(), box_, *elt); - setMember(elt->name(), whisker_, *elt); } } @@ -101,8 +150,27 @@ void BoxPlotVisualiserAttributes::set(const XmlNode& node) void BoxPlotVisualiserAttributes::print(ostream& out) const { out << "Attributes["; - out << " box = " << *box_; - out << " whisker = " << *whisker_; + out << " box = " << box_; + out << " box_width = " << box_width_; + out << " box_border = " << box_border_; + out << " box_border_thickness = " << box_border_thickness_; + out << " median = " << median_; + out << " median_thickness = " << median_thickness_; + out << " whisker = " << whisker_; + out << " whisker_box_width = " << whisker_box_width_; + out << " whisker_box_border = " << whisker_box_border_; + out << " whisker_box_border_thickness = " << whisker_box_border_thickness_; + out << " whisker_line_thickness = " << whisker_line_thickness_; + out << " box_colour = " << *box_colour_; + out << " box_border_colour = " << *box_border_colour_; + out << " box_border_style = " << box_border_style_; + out << " median_colour = " << *median_colour_; + out << " median_style = " << median_style_; + out << " whisker_box_colour = " << *whisker_box_colour_; + out << " whisker_box_border_colour = " << *whisker_box_border_colour_; + out << " whisker_box_border_style = " << whisker_box_border_style_; + out << " whisker_line_colour = " << *whisker_line_colour_; + out << " whisker_line_style = " << whisker_line_style_; out << "]" << "\n"; } @@ -111,23 +179,68 @@ void BoxPlotVisualiserAttributes::toxml(ostream& out) const { out << "\"boxplot\""; out << ", \"boxplot_box\":"; - box_->toxml(out); + niceprint(out,box_); + out << ", \"boxplot_box_width\":"; + niceprint(out,box_width_); + out << ", \"boxplot_box_border\":"; + niceprint(out,box_border_); + out << ", \"boxplot_box_border_thickness\":"; + niceprint(out,box_border_thickness_); + out << ", \"boxplot_median\":"; + niceprint(out,median_); + out << ", \"boxplot_median_thickness\":"; + niceprint(out,median_thickness_); out << ", \"boxplot_whisker\":"; - whisker_->toxml(out); + niceprint(out,whisker_); + out << ", \"boxplot_whisker_box_width\":"; + niceprint(out,whisker_box_width_); + out << ", \"boxplot_whisker_box_border\":"; + niceprint(out,whisker_box_border_); + out << ", \"boxplot_whisker_box_border_thickness\":"; + niceprint(out,whisker_box_border_thickness_); + out << ", \"boxplot_whisker_line_thickness\":"; + niceprint(out,whisker_line_thickness_); + out << ", \"boxplot_box_colour\":"; + niceprint(out, *box_colour_); + out << ", \"boxplot_box_border_colour\":"; + niceprint(out, *box_border_colour_); + out << ", \"boxplot_box_border_line_style\":"; + niceprint(out, box_border_style_); + out << ", \"boxplot_median_colour\":"; + niceprint(out, *median_colour_); + out << ", \"boxplot_median_line_style\":"; + niceprint(out, median_style_); + out << ", \"boxplot_whisker_box_colour\":"; + niceprint(out, *whisker_box_colour_); + out << ", \"boxplot_whisker_box_border_colour\":"; + niceprint(out, *whisker_box_border_colour_); + out << ", \"boxplot_whisker_box_border_line_style\":"; + niceprint(out, whisker_box_border_style_); + out << ", \"boxplot_whisker_line_colour\":"; + niceprint(out, *whisker_line_colour_); + out << ", \"boxplot_whisker_line_style\":"; + niceprint(out, whisker_line_style_); } static MagicsParameter boxplot_box("boxplot_box", "on"); +static MagicsParameter boxplot_box_width("boxplot_box_width", 1.0); +static MagicsParameter boxplot_box_border("boxplot_box_border", "on"); +static MagicsParameter boxplot_box_border_thickness("boxplot_box_border_thickness", 1); +static MagicsParameter boxplot_median("boxplot_median", "on"); +static MagicsParameter boxplot_median_thickness("boxplot_median_thickness", 3); static MagicsParameter boxplot_whisker("boxplot_whisker", "line"); -#include "BoxPlotItem.h" -#include "BoxPlotBasicItem.h" -static SimpleObjectMaker box_BoxPlotBox("box"); -static SimpleObjectMaker on_BoxPlotBox("on"); -static SimpleObjectMaker noBox_NoBoxPlotBox("noBox"); -static SimpleObjectMaker off_NoBoxPlotBox("off"); -static SimpleObjectMaker whiskerbox_BoxPlotWhiskerBox("whiskerbox"); -static SimpleObjectMaker box_BoxPlotWhiskerBox("box"); -static SimpleObjectMaker nowhisker_NoBoxPlotWhisker("nowhisker"); -static SimpleObjectMaker off_NoBoxPlotWhisker("off"); -static SimpleObjectMaker whiskerline_BoxPlotWhiskerLine("whiskerline"); -static SimpleObjectMaker line_BoxPlotWhiskerLine("line"); +static MagicsParameter boxplot_whisker_box_width("boxplot_whisker_box_width", 0.25); +static MagicsParameter boxplot_whisker_box_border("boxplot_whisker_box_border", "on"); +static MagicsParameter boxplot_whisker_box_border_thickness("boxplot_whisker_box_border_thickness", 1); +static MagicsParameter boxplot_whisker_line_thickness("boxplot_whisker_line_thickness", 3); +static MagicsParameter boxplot_box_colour("boxplot_box_colour", "sky"); +static MagicsParameter boxplot_box_border_colour("boxplot_box_border_colour", "navy"); +static MagicsParameter boxplot_box_border_line_style("boxplot_box_border_line_style", "solid"); +static MagicsParameter boxplot_median_colour("boxplot_median_colour", "navy"); +static MagicsParameter boxplot_median_line_style("boxplot_median_line_style", "solid"); +static MagicsParameter boxplot_whisker_box_colour("boxplot_whisker_box_colour", "sky"); +static MagicsParameter boxplot_whisker_box_border_colour("boxplot_whisker_box_border_colour", "navy"); +static MagicsParameter boxplot_whisker_box_border_line_style("boxplot_whisker_box_border_line_style", "solid"); +static MagicsParameter boxplot_whisker_line_colour("boxplot_whisker_line_colour", "navy"); +static MagicsParameter boxplot_whisker_line_style("boxplot_whisker_line_style", "solid"); diff --git a/src/attributes/BoxPlotVisualiserAttributes.h b/src/attributes/BoxPlotVisualiserAttributes.h index 2b3f2b6de..13f968c3a 100644 --- a/src/attributes/BoxPlotVisualiserAttributes.h +++ b/src/attributes/BoxPlotVisualiserAttributes.h @@ -25,7 +25,7 @@ #define BoxPlotVisualiserAttributes_H #include "magics.h" -#include "BoxPlotBasicItem.h" +#include "Colour.h" namespace magics { class XmlNode; @@ -51,8 +51,27 @@ class BoxPlotVisualiserAttributes virtual void toxml(std::ostream& out) const; // -- members: string tag_; - unique_ptr box_; - unique_ptr whisker_; + bool box_; + double box_width_; + bool box_border_; + int box_border_thickness_; + bool median_; + int median_thickness_; + string whisker_; + double whisker_box_width_; + bool whisker_box_border_; + int whisker_box_border_thickness_; + int whisker_line_thickness_; + unique_ptr box_colour_; + unique_ptr box_border_colour_; + LineStyle box_border_style_; + unique_ptr median_colour_; + LineStyle median_style_; + unique_ptr whisker_box_colour_; + unique_ptr whisker_box_border_colour_; + LineStyle whisker_box_border_style_; + unique_ptr whisker_line_colour_; + LineStyle whisker_line_style_; private: diff --git a/src/attributes/BoxPlotVisualiserWrapper.cc b/src/attributes/BoxPlotVisualiserWrapper.cc index 9773f40fa..5ae9e286f 100644 --- a/src/attributes/BoxPlotVisualiserWrapper.cc +++ b/src/attributes/BoxPlotVisualiserWrapper.cc @@ -55,43 +55,113 @@ void BoxPlotVisualiserWrapper::set(const MagRequest& request) + if (request.countValues("BOXPLOT_BOX") ) { + string box_value = request("BOXPLOT_BOX"); + + boxplotvisualiser_->box_ = MagTranslator()(box_value); + + } + if (request.countValues("BOXPLOT_BOX_WIDTH") ) { + double box_width_value = request("BOXPLOT_BOX_WIDTH"); + boxplotvisualiser_->box_width_ = box_width_value; + } + if (request.countValues("BOXPLOT_BOX_BORDER") ) { + string box_border_value = request("BOXPLOT_BOX_BORDER"); + + boxplotvisualiser_->box_border_ = MagTranslator()(box_border_value); + + } + if (request.countValues("BOXPLOT_BOX_BORDER_THICKNESS") ) { + int box_border_thickness_value = request("BOXPLOT_BOX_BORDER_THICKNESS"); + boxplotvisualiser_->box_border_thickness_ = box_border_thickness_value; + } + if (request.countValues("BOXPLOT_MEDIAN") ) { + string median_value = request("BOXPLOT_MEDIAN"); + + boxplotvisualiser_->median_ = MagTranslator()(median_value); + + } + if (request.countValues("BOXPLOT_MEDIAN_THICKNESS") ) { + int median_thickness_value = request("BOXPLOT_MEDIAN_THICKNESS"); + boxplotvisualiser_->median_thickness_ = median_thickness_value; + } + if (request.countValues("BOXPLOT_WHISKER") ) { + string whisker_value = request("BOXPLOT_WHISKER"); + boxplotvisualiser_->whisker_ = whisker_value; + } + if (request.countValues("BOXPLOT_WHISKER_BOX_WIDTH") ) { + double whisker_box_width_value = request("BOXPLOT_WHISKER_BOX_WIDTH"); + boxplotvisualiser_->whisker_box_width_ = whisker_box_width_value; + } + if (request.countValues("BOXPLOT_WHISKER_BOX_BORDER") ) { + string whisker_box_border_value = request("BOXPLOT_WHISKER_BOX_BORDER"); + + boxplotvisualiser_->whisker_box_border_ = MagTranslator()(whisker_box_border_value); + + } + if (request.countValues("BOXPLOT_WHISKER_BOX_BORDER_THICKNESS") ) { + int whisker_box_border_thickness_value = request("BOXPLOT_WHISKER_BOX_BORDER_THICKNESS"); + boxplotvisualiser_->whisker_box_border_thickness_ = whisker_box_border_thickness_value; + } + if (request.countValues("BOXPLOT_WHISKER_LINE_THICKNESS") ) { + int whisker_line_thickness_value = request("BOXPLOT_WHISKER_LINE_THICKNESS"); + boxplotvisualiser_->whisker_line_thickness_ = whisker_line_thickness_value; + } + if (request.countValues("BOXPLOT_BOX_COLOUR") ) { + string box_colour_value = request("BOXPLOT_BOX_COLOUR"); + boxplotvisualiser_->box_colour_ = unique_ptr(MagTranslator()(box_colour_value)); + } + + if (request.countValues("BOXPLOT_BOX_BORDER_COLOUR") ) { + string box_border_colour_value = request("BOXPLOT_BOX_BORDER_COLOUR"); + boxplotvisualiser_->box_border_colour_ = unique_ptr(MagTranslator()(box_border_colour_value)); + } + + + if (request.countValues("BOXPLOT_BOX_BORDER_LINE_STYLE") ) { + string box_border_style_value = request("BOXPLOT_BOX_BORDER_LINE_STYLE"); + boxplotvisualiser_->box_border_style_ = MagTranslator()(box_border_style_value); + } + + if (request.countValues("BOXPLOT_MEDIAN_COLOUR") ) { + string median_colour_value = request("BOXPLOT_MEDIAN_COLOUR"); + boxplotvisualiser_->median_colour_ = unique_ptr(MagTranslator()(median_colour_value)); + } + - string box_value = request.countValues("BOXPLOT_BOX") ? (string) request("BOXPLOT_BOX") : "on"; - MagLog::debug() << " BOXPLOT_BOX set to " << box_value << endl; - NoBoxPlotBoxWrapper* box_wrapper = 0; - try - { - box_wrapper = SimpleFactory::create(box_value); + if (request.countValues("BOXPLOT_MEDIAN_LINE_STYLE") ) { + string median_style_value = request("BOXPLOT_MEDIAN_LINE_STYLE"); + boxplotvisualiser_->median_style_ = MagTranslator()(median_style_value); + } + + if (request.countValues("BOXPLOT_WHISKER_BOX_COLOUR") ) { + string whisker_box_colour_value = request("BOXPLOT_WHISKER_BOX_COLOUR"); + boxplotvisualiser_->whisker_box_colour_ = unique_ptr(MagTranslator()(whisker_box_colour_value)); } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << box_value << "] is not a valid value for box: reset to default -> [on]" << endl; - box_wrapper = SimpleFactory::create("on"); + + if (request.countValues("BOXPLOT_WHISKER_BOX_BORDER_COLOUR") ) { + string whisker_box_border_colour_value = request("BOXPLOT_WHISKER_BOX_BORDER_COLOUR"); + boxplotvisualiser_->whisker_box_border_colour_ = unique_ptr(MagTranslator()(whisker_box_border_colour_value)); } - box_wrapper->set(request); - boxplotvisualiser_->box_ = unique_ptr(box_wrapper->object()); - delete box_wrapper; + - string whisker_value = request.countValues("BOXPLOT_WHISKER") ? (string) request("BOXPLOT_WHISKER") : "line"; - MagLog::debug() << " BOXPLOT_WHISKER set to " << whisker_value << endl; - NoBoxPlotWhiskerWrapper* whisker_wrapper = 0; - try - { - whisker_wrapper = SimpleFactory::create(whisker_value); + if (request.countValues("BOXPLOT_WHISKER_BOX_BORDER_LINE_STYLE") ) { + string whisker_box_border_style_value = request("BOXPLOT_WHISKER_BOX_BORDER_LINE_STYLE"); + boxplotvisualiser_->whisker_box_border_style_ = MagTranslator()(whisker_box_border_style_value); } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << whisker_value << "] is not a valid value for whisker: reset to default -> [line]" << endl; - whisker_wrapper = SimpleFactory::create("line"); + + if (request.countValues("BOXPLOT_WHISKER_LINE_COLOUR") ) { + string whisker_line_colour_value = request("BOXPLOT_WHISKER_LINE_COLOUR"); + boxplotvisualiser_->whisker_line_colour_ = unique_ptr(MagTranslator()(whisker_line_colour_value)); } - whisker_wrapper->set(request); - boxplotvisualiser_->whisker_ = unique_ptr(whisker_wrapper->object()); - delete whisker_wrapper; + + + if (request.countValues("BOXPLOT_WHISKER_LINE_STYLE") ) { + string whisker_line_style_value = request("BOXPLOT_WHISKER_LINE_STYLE"); + boxplotvisualiser_->whisker_line_style_ = MagTranslator()(whisker_line_style_value); + } + } @@ -101,55 +171,13 @@ void BoxPlotVisualiserWrapper::print(ostream& out) const } -#include "BoxPlotBoxWrapper.h" -static SimpleObjectMaker BoxPlotVisualiser_boxplot_box_box ("box"); -static SimpleObjectMaker BoxPlotVisualiser_boxplot_box_box_wrapper ("box"); - - -#include "BoxPlotBoxWrapper.h" -static SimpleObjectMaker BoxPlotVisualiser_boxplot_box_on ("on"); -static SimpleObjectMaker BoxPlotVisualiser_boxplot_box_on_wrapper ("on"); - - -#include "NoBoxPlotBoxWrapper.h" - -static SimpleObjectMaker BoxPlotVisualiser_boxplot_box_noBox_Wrapper("noBox"); - - -#include "NoBoxPlotBoxWrapper.h" - -static SimpleObjectMaker BoxPlotVisualiser_boxplot_box_off_Wrapper("off"); - - - -#include "BoxPlotWhiskerBoxWrapper.h" -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_whiskerbox ("whiskerbox"); -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_whiskerbox_wrapper ("whiskerbox"); - - -#include "BoxPlotWhiskerBoxWrapper.h" -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_box ("box"); -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_box_wrapper ("box"); - - -#include "NoBoxPlotWhiskerWrapper.h" - -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_nowhisker_Wrapper("nowhisker"); -#include "NoBoxPlotWhiskerWrapper.h" -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_off_Wrapper("off"); -#include "BoxPlotWhiskerLineWrapper.h" -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_whiskerline ("whiskerline"); -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_whiskerline_wrapper ("whiskerline"); -#include "BoxPlotWhiskerLineWrapper.h" -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_line ("line"); -static SimpleObjectMaker BoxPlotVisualiser_boxplot_whisker_line_wrapper ("line"); diff --git a/src/attributes/BoxPlotVisualiserWrapper.h b/src/attributes/BoxPlotVisualiserWrapper.h index b3a87ca33..5d42c19ea 100644 --- a/src/attributes/BoxPlotVisualiserWrapper.h +++ b/src/attributes/BoxPlotVisualiserWrapper.h @@ -39,8 +39,6 @@ -#include "NoBoxPlotBoxWrapper.h" -#include "NoBoxPlotWhiskerWrapper.h" namespace magics { diff --git a/src/params/BoxPlotVisualiser.xml b/src/params/BoxPlotVisualiser.xml index 654aa52b3..3a2f38dca 100644 --- a/src/params/BoxPlotVisualiser.xml +++ b/src/params/BoxPlotVisualiser.xml @@ -17,24 +17,157 @@ does it submit to any jurisdiction. name="boxplot_box" default="on" member="box" - to="NoBoxPlotBox" - include="BoxPlotBasicItem.h"> + to="bool"> + Turns the plotting of the box on or off - - - Magics++1.3 + + + + Colour of the box + + + Width of the box in centimeters + + + Determines whether the box border is drawn or not + + + Colour of the box border + + + Thickness of the box border + + + Line style of the box border + + + Determines whether the median line is drawn or not + + + Colour of the median line + + + Thickness of the median line + + + Line style of the median line - Determines whether the whiskers are shown as lines, boxes or not at all - - - - Magics++1.3 + to="string" + values="box/off/line" + > + Determines whether the whiskers are shown as lines, boxes or not at all + + + + Colour of the whisker box + + + Width of the whisker box in centimeters + + + Determines whether the whisker box border is drawn or not + + + + Colour of the whisker box border + + + Thickness of the whisker box border + + + Line style of the whisker box border + + + Colour of the whisker line + + + Thickness of the whisker line + + + Line style of the whisker line diff --git a/src/params/CMakeLists.txt b/src/params/CMakeLists.txt index 557516946..2e2866519 100644 --- a/src/params/CMakeLists.txt +++ b/src/params/CMakeLists.txt @@ -208,13 +208,7 @@ YRegularCoordinate.xml ) list( APPEND _magics_xmls BoxPlotBox.xml - BoxPlotBoxBorder.xml - BoxPlotDecoder.xml - BoxPlotMedian.xml BoxPlotVisualiser.xml - BoxPlotWhiskerBorder.xml - BoxPlotWhiskerBox.xml - BoxPlotWhiskerLine.xml CdfGraph.xml EpsCloud.xml EpsDirection.xml diff --git a/src/visualisers/BoxPlotVisualiser.cc b/src/visualisers/BoxPlotVisualiser.cc index 37fc16ba1..7bd4c279c 100644 --- a/src/visualisers/BoxPlotVisualiser.cc +++ b/src/visualisers/BoxPlotVisualiser.cc @@ -66,8 +66,8 @@ void BoxPlotVisualiser::operator()(Data& data, BasicGraphicsObjectContainer& vis return; - box_->cm(user); - whisker_->cm(user); + cm_ = user; + for (const auto& point : points) { @@ -80,13 +80,168 @@ void BoxPlotVisualiser::operator()(Data& data, BasicGraphicsObjectContainer& vis } - (*box_)(visitor, *point); + box(visitor, *point); - whisker_->top(visitor, *point); - whisker_->bottom(visitor, *point); + if ( magCompare(whisker_, "line")) { + whisker_line_top(visitor, *point); + whisker_line_bottom(visitor, *point); + } + if ( magCompare(whisker_, "box")) { + whisker_box_top(visitor, *point); + whisker_box_bottom(visitor, *point); + } } + + + } void BoxPlotVisualiser::visit(LegendVisitor&) { // Not Yet! } + + +void BoxPlotVisualiser::box(BasicGraphicsObjectContainer& visitor, const CustomisedPoint& point) const { + if ( !box_) + return; + const Transformation& transformation = visitor.transformation(); + Polyline* box = new Polyline(); + box->setFilled(true); + box->setFillColour(*box_colour_); + box->setShading(new FillShadingProperties()); + + double width = (box_width_ * cm_) / 2; // Could later be expressed in % + CustomisedPoint::const_iterator upper = point.find("upper"); + CustomisedPoint::const_iterator lower = point.find("lower"); + CustomisedPoint::const_iterator x = point.find("x"); + if (x == point.end() || upper == point.end() || lower == point.end()) + return; + box->push_back(transformation(UserPoint(x->second - width, upper->second))); + box->push_back(transformation(UserPoint(x->second + width, upper->second))); + box->push_back(transformation(UserPoint(x->second + width, lower->second))); + box->push_back(transformation(UserPoint(x->second - width, lower->second))); + box->push_back(transformation(UserPoint(x->second - width, upper->second))); + + box_border(*box); + visitor.push_back(box); + + CustomisedPoint::const_iterator median = point.find("median"); + + if (median == point.end()) + return; + + if ( median_ ) { + Polyline* line = new Polyline(); + + line->push_back(transformation(UserPoint(x->second - width, median->second))); + line->push_back(transformation(UserPoint(x->second + width, median->second))); + + line->setColour(*median_colour_); + line->setLineStyle(median_style_); + line->setThickness(median_thickness_); + visitor.push_back(line); + } +} + +void BoxPlotVisualiser::box_border(Polyline& box) const { + if (!box_border_) + return; + box.setColour(*box_border_colour_); + box.setLineStyle(box_border_style_); + box.setThickness(box_border_thickness_); +} + + + + +void BoxPlotVisualiser::whisker_box_top(BasicGraphicsObjectContainer& visitor, const CustomisedPoint& point) const { + const Transformation& transformation = visitor.transformation(); + Polyline* whisker = new Polyline(); + whisker->setFilled(true); + whisker->setFillColour(*whisker_box_colour_); + whisker->setShading(new FillShadingProperties()); + double width = (whisker_box_width_ * cm_) / 2; // Could later be expressed in % + CustomisedPoint::const_iterator max = point.find("max"); + CustomisedPoint::const_iterator upper = point.find("upper"); + CustomisedPoint::const_iterator x = point.find("x"); + if (x == point.end() || max == point.end() || upper == point.end()) + return; + whisker->push_back(transformation(UserPoint(x->second - width, max->second))); + whisker->push_back(transformation(UserPoint(x->second + width, max->second))); + whisker->push_back(transformation(UserPoint(x->second + width, upper->second))); + whisker->push_back(transformation(UserPoint(x->second - width, upper->second))); + whisker->push_back(transformation(UserPoint(x->second - width, max->second))); + + whisker_border(*whisker); + visitor.push_back(whisker); +} + +void BoxPlotVisualiser::whisker_box_bottom(BasicGraphicsObjectContainer& visitor, const CustomisedPoint& point) const { + + const Transformation& transformation = visitor.transformation(); + Polyline* whisker = new Polyline(); + whisker->setFilled(true); + whisker->setFillColour(*whisker_box_colour_); + whisker->setShading(new FillShadingProperties()); + double width = (whisker_box_width_ * cm_) / 2; // Could later be expressed in % + CustomisedPoint::const_iterator min = point.find("min"); + CustomisedPoint::const_iterator lower = point.find("lower"); + CustomisedPoint::const_iterator x = point.find("x"); + if (x == point.end() || min == point.end() || lower == point.end()) + return; + whisker->push_back(transformation(UserPoint(x->second - width, min->second))); + whisker->push_back(transformation(UserPoint(x->second + width, min->second))); + whisker->push_back(transformation(UserPoint(x->second + width, lower->second))); + whisker->push_back(transformation(UserPoint(x->second - width, lower->second))); + whisker->push_back(transformation(UserPoint(x->second - width, min->second))); + + whisker_border(*whisker); + visitor.push_back(whisker); +} + + +void BoxPlotVisualiser::whisker_line_top(BasicGraphicsObjectContainer& visitor, const CustomisedPoint& point) const { + const Transformation& transformation = visitor.transformation(); + Polyline* whisker = new Polyline(); + whisker->setColour(*whisker_box_colour_); + whisker->setLineStyle(whisker_line_style_); + whisker->setThickness(whisker_line_thickness_); + + CustomisedPoint::const_iterator max = point.find("max"); + CustomisedPoint::const_iterator upper = point.find("upper"); + CustomisedPoint::const_iterator x = point.find("x"); + if (x == point.end() || max == point.end() || upper == point.end()) + return; + whisker->push_back(transformation(UserPoint(x->second, max->second))); + whisker->push_back(transformation(UserPoint(x->second, upper->second))); + + + visitor.push_back(whisker); +} + +void BoxPlotVisualiser::whisker_line_bottom(BasicGraphicsObjectContainer& visitor, const CustomisedPoint& point) const { + const Transformation& transformation = visitor.transformation(); + Polyline* whisker = new Polyline(); + whisker->setColour(*whisker_line_colour_); + whisker->setLineStyle(whisker_line_style_); + whisker->setThickness(whisker_line_thickness_); + + CustomisedPoint::const_iterator min = point.find("min"); + CustomisedPoint::const_iterator lower = point.find("lower"); + CustomisedPoint::const_iterator x = point.find("x"); + if (x == point.end() || min == point.end() || lower == point.end()) + return; + whisker->push_back(transformation(UserPoint(x->second, min->second))); + whisker->push_back(transformation(UserPoint(x->second, lower->second))); + + + visitor.push_back(whisker); +} + +void BoxPlotVisualiser::whisker_border(Polyline& whisker) const { + if ( ! whisker_box_border_ ) + return; + whisker.setColour(*whisker_box_border_colour_); + whisker.setLineStyle(whisker_box_border_style_); + whisker.setThickness(whisker_box_border_thickness_); +} \ No newline at end of file diff --git a/src/visualisers/BoxPlotVisualiser.h b/src/visualisers/BoxPlotVisualiser.h index c738d120a..a6919b056 100644 --- a/src/visualisers/BoxPlotVisualiser.h +++ b/src/visualisers/BoxPlotVisualiser.h @@ -57,7 +57,15 @@ class BoxPlotVisualiser : public BoxPlotVisualiserAttributes, public Visdef { virtual void print(ostream&) const override; double resolution_; - + void box(BasicGraphicsObjectContainer& visitor, const CustomisedPoint& point) const; + void box_border(Polyline&) const; + void whisker_line_top(BasicGraphicsObjectContainer&, const CustomisedPoint&) const; + void whisker_line_bottom(BasicGraphicsObjectContainer&, const CustomisedPoint&) const; + void whisker_box_top(BasicGraphicsObjectContainer&, const CustomisedPoint&) const; + void whisker_box_bottom(BasicGraphicsObjectContainer&, const CustomisedPoint&) const; + void whisker_border(Polyline&) const; + + double cm_; private: //! Copy constructor - No copy allowed BoxPlotVisualiser(const BoxPlotVisualiser&); diff --git a/src/visualisers/CMakeLists.txt b/src/visualisers/CMakeLists.txt index 4923f16b1..9b90eae1f 100644 --- a/src/visualisers/CMakeLists.txt +++ b/src/visualisers/CMakeLists.txt @@ -22,9 +22,6 @@ Bar.h BothValuePlotMethod.h Boundaries.cc Boundaries.h -BoxPlotBasicItem.h -BoxPlotItem.cc -BoxPlotItem.h BoxPlotVisualiser.cc BoxPlotVisualiser.h CalculateColourTechnique.cc From c57bc6b8d1bb721ae3b6828c57979f810a71432c Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 7 Jun 2022 18:50:46 +0100 Subject: [PATCH 07/66] BoxPlot Cleaning --- src/params/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/params/CMakeLists.txt b/src/params/CMakeLists.txt index 2e2866519..020e67d18 100644 --- a/src/params/CMakeLists.txt +++ b/src/params/CMakeLists.txt @@ -207,8 +207,9 @@ YLogarithmicCoordinate.xml YRegularCoordinate.xml ) -list( APPEND _magics_xmls BoxPlotBox.xml +list( APPEND _magics_xmls BoxPlotVisualiser.xml + BoxPlotDecoder.xml CdfGraph.xml EpsCloud.xml EpsDirection.xml From bbbb3905c9a4f70db89f32ea69008ab9d2005b6a Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 7 Jun 2022 18:52:51 +0100 Subject: [PATCH 08/66] BoxPlot Cleaning --- src/params/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/params/CMakeLists.txt b/src/params/CMakeLists.txt index 020e67d18..981e9f44e 100644 --- a/src/params/CMakeLists.txt +++ b/src/params/CMakeLists.txt @@ -13,6 +13,8 @@ BinaryObject.xml BinningObject.xml BothValuePlotMethod.xml Boundaries.xml +BoxPlotVisualiser.xml +BoxPlotDecoder.xml CalculateColourTechnique.xml GradientsColourTechnique.xml PaletteColourTechnique.xml @@ -208,8 +210,7 @@ YRegularCoordinate.xml ) list( APPEND _magics_xmls - BoxPlotVisualiser.xml - BoxPlotDecoder.xml + CdfGraph.xml EpsCloud.xml EpsDirection.xml From 3366bfd89a2fac0312a200a80695ccbcd0dbe7f5 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 8 Jun 2022 10:57:15 +0100 Subject: [PATCH 09/66] Cleaning BoxPlot Visualiser [MAGP-616] --- src/attributes/BoxPlotBoxAttributes.cc | 146 ----------------- src/attributes/BoxPlotBoxAttributes.h | 69 -------- src/attributes/BoxPlotBoxBorderAttributes.cc | 121 -------------- src/attributes/BoxPlotBoxBorderAttributes.h | 67 -------- src/attributes/BoxPlotBoxBorderWrapper.cc | 91 ---------- src/attributes/BoxPlotBoxBorderWrapper.h | 93 ----------- src/attributes/BoxPlotBoxWrapper.cc | 155 ------------------ src/attributes/BoxPlotBoxWrapper.h | 93 ----------- src/attributes/BoxPlotMedianAttributes.cc | 121 -------------- src/attributes/BoxPlotMedianAttributes.h | 67 -------- src/attributes/BoxPlotMedianWrapper.cc | 91 ---------- src/attributes/BoxPlotMedianWrapper.h | 93 ----------- .../BoxPlotWhiskerBorderAttributes.cc | 123 -------------- .../BoxPlotWhiskerBorderAttributes.h | 67 -------- src/attributes/BoxPlotWhiskerBorderWrapper.cc | 84 ---------- src/attributes/BoxPlotWhiskerBorderWrapper.h | 91 ---------- src/attributes/BoxPlotWhiskerBoxAttributes.cc | 132 --------------- src/attributes/BoxPlotWhiskerBoxAttributes.h | 68 -------- src/attributes/BoxPlotWhiskerBoxWrapper.cc | 116 ------------- src/attributes/BoxPlotWhiskerBoxWrapper.h | 92 ----------- .../BoxPlotWhiskerLineAttributes.cc | 122 -------------- src/attributes/BoxPlotWhiskerLineAttributes.h | 67 -------- src/attributes/BoxPlotWhiskerLineWrapper.cc | 84 ---------- src/attributes/BoxPlotWhiskerLineWrapper.h | 91 ---------- src/attributes/NoBoxPlotAttributes.cc | 99 ----------- src/attributes/NoBoxPlotAttributes.h | 63 ------- src/attributes/NoBoxPlotBoxAttributes.cc | 99 ----------- src/attributes/NoBoxPlotBoxAttributes.h | 63 ------- .../NoBoxPlotBoxBorderAttributes.cc | 100 ----------- src/attributes/NoBoxPlotBoxBorderAttributes.h | 63 ------- src/attributes/NoBoxPlotBoxBorderWrapper.cc | 67 -------- src/attributes/NoBoxPlotBoxBorderWrapper.h | 91 ---------- src/attributes/NoBoxPlotBoxWrapper.cc | 67 -------- src/attributes/NoBoxPlotBoxWrapper.h | 91 ---------- src/attributes/NoBoxPlotMedianAttributes.cc | 100 ----------- src/attributes/NoBoxPlotMedianAttributes.h | 63 ------- src/attributes/NoBoxPlotMedianWrapper.cc | 67 -------- src/attributes/NoBoxPlotMedianWrapper.h | 91 ---------- src/attributes/NoBoxPlotWhiskerAttributes.cc | 99 ----------- src/attributes/NoBoxPlotWhiskerAttributes.h | 63 ------- src/attributes/NoBoxPlotWhiskerWrapper.cc | 67 -------- src/attributes/NoBoxPlotWhiskerWrapper.h | 91 ---------- src/attributes/NoBoxPlotWrapper.cc | 67 -------- src/attributes/NoBoxPlotWrapper.h | 91 ---------- src/params/BoxPlotBox.xml | 51 ------ src/params/BoxPlotBoxBorder.xml | 38 ----- src/params/BoxPlotMedian.xml | 38 ----- src/params/BoxPlotWhiskerBorder.xml | 33 ---- src/params/BoxPlotWhiskerBox.xml | 36 ---- src/params/BoxPlotWhiskerLine.xml | 33 ---- src/visualisers/BoxPlotVisualiser.cc | 2 +- 51 files changed, 1 insertion(+), 4176 deletions(-) delete mode 100644 src/attributes/BoxPlotBoxAttributes.cc delete mode 100644 src/attributes/BoxPlotBoxAttributes.h delete mode 100644 src/attributes/BoxPlotBoxBorderAttributes.cc delete mode 100644 src/attributes/BoxPlotBoxBorderAttributes.h delete mode 100644 src/attributes/BoxPlotBoxBorderWrapper.cc delete mode 100644 src/attributes/BoxPlotBoxBorderWrapper.h delete mode 100644 src/attributes/BoxPlotBoxWrapper.cc delete mode 100644 src/attributes/BoxPlotBoxWrapper.h delete mode 100644 src/attributes/BoxPlotMedianAttributes.cc delete mode 100644 src/attributes/BoxPlotMedianAttributes.h delete mode 100644 src/attributes/BoxPlotMedianWrapper.cc delete mode 100644 src/attributes/BoxPlotMedianWrapper.h delete mode 100644 src/attributes/BoxPlotWhiskerBorderAttributes.cc delete mode 100644 src/attributes/BoxPlotWhiskerBorderAttributes.h delete mode 100644 src/attributes/BoxPlotWhiskerBorderWrapper.cc delete mode 100644 src/attributes/BoxPlotWhiskerBorderWrapper.h delete mode 100644 src/attributes/BoxPlotWhiskerBoxAttributes.cc delete mode 100644 src/attributes/BoxPlotWhiskerBoxAttributes.h delete mode 100644 src/attributes/BoxPlotWhiskerBoxWrapper.cc delete mode 100644 src/attributes/BoxPlotWhiskerBoxWrapper.h delete mode 100644 src/attributes/BoxPlotWhiskerLineAttributes.cc delete mode 100644 src/attributes/BoxPlotWhiskerLineAttributes.h delete mode 100644 src/attributes/BoxPlotWhiskerLineWrapper.cc delete mode 100644 src/attributes/BoxPlotWhiskerLineWrapper.h delete mode 100644 src/attributes/NoBoxPlotAttributes.cc delete mode 100644 src/attributes/NoBoxPlotAttributes.h delete mode 100644 src/attributes/NoBoxPlotBoxAttributes.cc delete mode 100644 src/attributes/NoBoxPlotBoxAttributes.h delete mode 100644 src/attributes/NoBoxPlotBoxBorderAttributes.cc delete mode 100644 src/attributes/NoBoxPlotBoxBorderAttributes.h delete mode 100644 src/attributes/NoBoxPlotBoxBorderWrapper.cc delete mode 100644 src/attributes/NoBoxPlotBoxBorderWrapper.h delete mode 100644 src/attributes/NoBoxPlotBoxWrapper.cc delete mode 100644 src/attributes/NoBoxPlotBoxWrapper.h delete mode 100644 src/attributes/NoBoxPlotMedianAttributes.cc delete mode 100644 src/attributes/NoBoxPlotMedianAttributes.h delete mode 100644 src/attributes/NoBoxPlotMedianWrapper.cc delete mode 100644 src/attributes/NoBoxPlotMedianWrapper.h delete mode 100644 src/attributes/NoBoxPlotWhiskerAttributes.cc delete mode 100644 src/attributes/NoBoxPlotWhiskerAttributes.h delete mode 100644 src/attributes/NoBoxPlotWhiskerWrapper.cc delete mode 100644 src/attributes/NoBoxPlotWhiskerWrapper.h delete mode 100644 src/attributes/NoBoxPlotWrapper.cc delete mode 100644 src/attributes/NoBoxPlotWrapper.h delete mode 100644 src/params/BoxPlotBox.xml delete mode 100644 src/params/BoxPlotBoxBorder.xml delete mode 100644 src/params/BoxPlotMedian.xml delete mode 100644 src/params/BoxPlotWhiskerBorder.xml delete mode 100644 src/params/BoxPlotWhiskerBox.xml delete mode 100644 src/params/BoxPlotWhiskerLine.xml diff --git a/src/attributes/BoxPlotBoxAttributes.cc b/src/attributes/BoxPlotBoxAttributes.cc deleted file mode 100644 index 93a26a82e..000000000 --- a/src/attributes/BoxPlotBoxAttributes.cc +++ /dev/null @@ -1,146 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotBoxAttributes.h - \\brief Definition of BoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "BoxPlotBoxAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -BoxPlotBoxAttributes::BoxPlotBoxAttributes(): - width_(ParameterManager::getDouble("boxplot_box_width")) - , - colour_(MagTranslator().magics("boxplot_box_colour")), - border_(MagTranslator().magics("boxplot_box_border")), - median_(MagTranslator().magics("boxplot_median")) - -{ -} - - -BoxPlotBoxAttributes::~BoxPlotBoxAttributes() -{ - -} - - -void BoxPlotBoxAttributes::set(const std::map& params) -{ - vector prefix(2); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_box"; - - setAttribute(prefix, "boxplot_box_width", width_, params); - - setMember(prefix, "boxplot_box_colour", colour_, params); - setMember(prefix, "boxplot_box_border", border_, params); - setMember(prefix, "boxplot_median", median_, params); - -} - -void BoxPlotBoxAttributes::copy(const BoxPlotBoxAttributes& other) -{ - width_ = other.width_; - colour_ = unique_ptr(other.colour_->clone()); - border_ = unique_ptr(other.border_->clone()); - median_ = unique_ptr(other.median_->clone()); - -} - - -bool BoxPlotBoxAttributes::accept(const string& node) -{ - - if ( magCompare(node, "box") ) - return true; - if ( acceptNode(node, border_) ) - return true; - if ( acceptNode(node, median_) ) - return true; - - return false; -} - -void BoxPlotBoxAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "box") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - setMember(node.name(), border_, node); - setMember(node.name(), median_, node); - - } - for (auto &elt : node.elements()) - { - setMember(elt->name(), border_, *elt); - setMember(elt->name(), median_, *elt); - - } -} - -void BoxPlotBoxAttributes::print(ostream& out) const -{ - out << "Attributes["; - out << " width = " << width_; - out << " colour = " << *colour_; - out << " border = " << *border_; - out << " median = " << *median_; - - out << "]" << "\n"; -} - -void BoxPlotBoxAttributes::toxml(ostream& out) const -{ - out << "\"box\""; - out << ", \"boxplot_box_width\":"; - niceprint(out,width_); - out << ", \"boxplot_box_colour\":"; - niceprint(out, *colour_); - out << ", \"boxplot_box_border\":"; - border_->toxml(out); - out << ", \"boxplot_median\":"; - median_->toxml(out); - -} - -static MagicsParameter boxplot_box_width("boxplot_box_width", 1.0); -static MagicsParameter boxplot_box_colour("boxplot_box_colour", "sky"); -static MagicsParameter boxplot_box_border("boxplot_box_border", "on"); -static MagicsParameter boxplot_median("boxplot_median", "on"); -#include "BoxPlotItem.h" -#include "BoxPlotBasicItem.h" -static SimpleObjectMaker border_BoxPlotBoxBorder("border"); -static SimpleObjectMaker on_BoxPlotBoxBorder("on"); -static SimpleObjectMaker noborder_NoBoxPlotBoxBorder("noborder"); -static SimpleObjectMaker off_NoBoxPlotBoxBorder("off"); -static SimpleObjectMaker median_BoxPlotMedian("median"); -static SimpleObjectMaker on_BoxPlotMedian("on"); -static SimpleObjectMaker nomedian_NoBoxPlotMedian("nomedian"); -static SimpleObjectMaker off_NoBoxPlotMedian("off"); diff --git a/src/attributes/BoxPlotBoxAttributes.h b/src/attributes/BoxPlotBoxAttributes.h deleted file mode 100644 index 5c8a80869..000000000 --- a/src/attributes/BoxPlotBoxAttributes.h +++ /dev/null @@ -1,69 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotBoxAttributes.h - \brief Definition of BoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotBoxAttributes_H -#define BoxPlotBoxAttributes_H - -#include "magics.h" -#include "Colour.h" -#include "BoxPlotBasicItem.h" -namespace magics { - -class XmlNode; -class BoxPlotBoxAttributes -{ -public: -// -- constructor - BoxPlotBoxAttributes(); - -// -- destructor - virtual ~BoxPlotBoxAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const BoxPlotBoxAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - double width_; - unique_ptr colour_; - unique_ptr border_; - unique_ptr median_; - - -private: - friend ostream& operator<<(ostream& s,const BoxPlotBoxAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/BoxPlotBoxBorderAttributes.cc b/src/attributes/BoxPlotBoxBorderAttributes.cc deleted file mode 100644 index 34fb3d96b..000000000 --- a/src/attributes/BoxPlotBoxBorderAttributes.cc +++ /dev/null @@ -1,121 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotBoxBorderAttributes.h - \\brief Definition of BoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "BoxPlotBoxBorderAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -BoxPlotBoxBorderAttributes::BoxPlotBoxBorderAttributes(): - thickness_(ParameterManager::getInt("boxplot_box_border_thickness")) - , - colour_(MagTranslator().magics("boxplot_box_border_colour")), - style_(MagTranslator().magics("boxplot_box_border_line_style")) - -{ -} - - -BoxPlotBoxBorderAttributes::~BoxPlotBoxBorderAttributes() -{ - -} - - -void BoxPlotBoxBorderAttributes::set(const std::map& params) -{ - vector prefix(2); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_box_border"; - - setAttribute(prefix, "boxplot_box_border_thickness", thickness_, params); - - setMember(prefix, "boxplot_box_border_colour", colour_, params); - setAttribute(prefix, "boxplot_box_border_line_style", style_, params); - -} - -void BoxPlotBoxBorderAttributes::copy(const BoxPlotBoxBorderAttributes& other) -{ - thickness_ = other.thickness_; - colour_ = unique_ptr(other.colour_->clone()); - style_ = other.style_; - -} - - -bool BoxPlotBoxBorderAttributes::accept(const string& node) -{ - - if ( magCompare(node, "box_border") ) - return true; - - return false; -} - -void BoxPlotBoxBorderAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "box_border") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void BoxPlotBoxBorderAttributes::print(ostream& out) const -{ - out << "Attributes["; - out << " thickness = " << thickness_; - out << " colour = " << *colour_; - out << " style = " << style_; - - out << "]" << "\n"; -} - -void BoxPlotBoxBorderAttributes::toxml(ostream& out) const -{ - out << "\"box_border\""; - out << ", \"boxplot_box_border_thickness\":"; - niceprint(out,thickness_); - out << ", \"boxplot_box_border_colour\":"; - niceprint(out, *colour_); - out << ", \"boxplot_box_border_line_style\":"; - niceprint(out, style_); - -} - -static MagicsParameter boxplot_box_border_thickness("boxplot_box_border_thickness", 1); -static MagicsParameter boxplot_box_border_colour("boxplot_box_border_colour", "navy"); -static MagicsParameter boxplot_box_border_line_style("boxplot_box_border_line_style", "solid"); diff --git a/src/attributes/BoxPlotBoxBorderAttributes.h b/src/attributes/BoxPlotBoxBorderAttributes.h deleted file mode 100644 index 9a1009d8f..000000000 --- a/src/attributes/BoxPlotBoxBorderAttributes.h +++ /dev/null @@ -1,67 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotBoxBorderAttributes.h - \brief Definition of BoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotBoxBorderAttributes_H -#define BoxPlotBoxBorderAttributes_H - -#include "magics.h" -#include "Colour.h" -namespace magics { - -class XmlNode; -class BoxPlotBoxBorderAttributes -{ -public: -// -- constructor - BoxPlotBoxBorderAttributes(); - -// -- destructor - virtual ~BoxPlotBoxBorderAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const BoxPlotBoxBorderAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - int thickness_; - unique_ptr colour_; - LineStyle style_; - - -private: - friend ostream& operator<<(ostream& s,const BoxPlotBoxBorderAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/BoxPlotBoxBorderWrapper.cc b/src/attributes/BoxPlotBoxBorderWrapper.cc deleted file mode 100644 index 4c8993bd9..000000000 --- a/src/attributes/BoxPlotBoxBorderWrapper.cc +++ /dev/null @@ -1,91 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotBoxBorderAttributes.h - \\brief Definition of BoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "BoxPlotBoxBorderWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -BoxPlotBoxBorderWrapper::BoxPlotBoxBorderWrapper(): boxplotboxborder_(new BoxPlotBoxBorder()) - - -{ - - - - NoBoxPlotBoxBorderWrapper::object(boxplotboxborder_); - - -} -BoxPlotBoxBorderWrapper::BoxPlotBoxBorderWrapper(BoxPlotBoxBorder* boxplotboxborder): boxplotboxborder_(boxplotboxborder) -{ - - - NoBoxPlotBoxBorderWrapper::object(boxplotboxborder_); - -} - -BoxPlotBoxBorderWrapper::~BoxPlotBoxBorderWrapper() -{ - -} - -void BoxPlotBoxBorderWrapper::set(const MagRequest& request) -{ - - - - NoBoxPlotBoxBorderWrapper::set(request); - - - if (request.countValues("BOXPLOT_BOX_BORDER_THICKNESS") ) { - int thickness_value = request("BOXPLOT_BOX_BORDER_THICKNESS"); - boxplotboxborder_->thickness_ = thickness_value; - } - - if (request.countValues("BOXPLOT_BOX_BORDER_COLOUR") ) { - string colour_value = request("BOXPLOT_BOX_BORDER_COLOUR"); - boxplotboxborder_->colour_ = unique_ptr(MagTranslator()(colour_value)); - } - - - if (request.countValues("BOXPLOT_BOX_BORDER_LINE_STYLE") ) { - string style_value = request("BOXPLOT_BOX_BORDER_LINE_STYLE"); - boxplotboxborder_->style_ = MagTranslator()(style_value); - } - - -} - -void BoxPlotBoxBorderWrapper::print(ostream& out) const -{ - out << "BoxPlotBoxBorderWrapper[]"; -} - - - - diff --git a/src/attributes/BoxPlotBoxBorderWrapper.h b/src/attributes/BoxPlotBoxBorderWrapper.h deleted file mode 100644 index 6a9a0667d..000000000 --- a/src/attributes/BoxPlotBoxBorderWrapper.h +++ /dev/null @@ -1,93 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotBoxBorderAttributes.h - \brief Definition of BoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotBoxBorderWrapper_H -#define BoxPlotBoxBorderWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - -#include "NoBoxPlotBoxBorderWrapper.h" - - - - - - - - -namespace magics { - -class MagRequest; - - -class BoxPlotBoxBorderWrapper: public NoBoxPlotBoxBorderWrapper - -{ -public: -// -- constructor - BoxPlotBoxBorderWrapper(); - BoxPlotBoxBorderWrapper(BoxPlotBoxBorder*); -// -- destructor - virtual ~BoxPlotBoxBorderWrapper(); - virtual void set(const MagRequest&); - - BoxPlotBoxBorder* me() { return boxplotboxborder_; } - - virtual BoxPlotBoxBorder* object() { return boxplotboxborder_; } - - - virtual void object(BoxPlotBoxBorder* o) { - // Remember to delete the previous object - boxplotboxborder_ = o; - NoBoxPlotBoxBorderWrapper::object(o); - - - } - - - -protected: - BoxPlotBoxBorder* boxplotboxborder_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const BoxPlotBoxBorderWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/BoxPlotBoxWrapper.cc b/src/attributes/BoxPlotBoxWrapper.cc deleted file mode 100644 index ba0db189f..000000000 --- a/src/attributes/BoxPlotBoxWrapper.cc +++ /dev/null @@ -1,155 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotBoxAttributes.h - \\brief Definition of BoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "BoxPlotBoxWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -BoxPlotBoxWrapper::BoxPlotBoxWrapper(): boxplotbox_(new BoxPlotBox()) - - -{ - - - - -} -BoxPlotBoxWrapper::BoxPlotBoxWrapper(BoxPlotBox* boxplotbox): boxplotbox_(boxplotbox) -{ - - -} - -BoxPlotBoxWrapper::~BoxPlotBoxWrapper() -{ - -} - -void BoxPlotBoxWrapper::set(const MagRequest& request) -{ - - - - if (request.countValues("BOXPLOT_BOX_WIDTH") ) { - double width_value = request("BOXPLOT_BOX_WIDTH"); - boxplotbox_->width_ = width_value; - } - - if (request.countValues("BOXPLOT_BOX_COLOUR") ) { - string colour_value = request("BOXPLOT_BOX_COLOUR"); - boxplotbox_->colour_ = unique_ptr(MagTranslator()(colour_value)); - } - - - string border_value = request.countValues("BOXPLOT_BOX_BORDER") ? (string) request("BOXPLOT_BOX_BORDER") : "on"; - MagLog::debug() << " BOXPLOT_BOX_BORDER set to " << border_value << endl; - NoBoxPlotBoxBorderWrapper* border_wrapper = 0; - try - { - border_wrapper = SimpleFactory::create(border_value); - } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << border_value << "] is not a valid value for border: reset to default -> [on]" << endl; - border_wrapper = SimpleFactory::create("on"); - } - border_wrapper->set(request); - boxplotbox_->border_ = unique_ptr(border_wrapper->object()); - delete border_wrapper; - - string median_value = request.countValues("BOXPLOT_MEDIAN") ? (string) request("BOXPLOT_MEDIAN") : "on"; - MagLog::debug() << " BOXPLOT_MEDIAN set to " << median_value << endl; - NoBoxPlotMedianWrapper* median_wrapper = 0; - try - { - median_wrapper = SimpleFactory::create(median_value); - } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << median_value << "] is not a valid value for median: reset to default -> [on]" << endl; - median_wrapper = SimpleFactory::create("on"); - } - median_wrapper->set(request); - boxplotbox_->median_ = unique_ptr(median_wrapper->object()); - delete median_wrapper; - -} - -void BoxPlotBoxWrapper::print(ostream& out) const -{ - out << "BoxPlotBoxWrapper[]"; -} - - - -#include "BoxPlotBoxBorderWrapper.h" -static SimpleObjectMaker BoxPlotBox_boxplot_box_border_border ("border"); -static SimpleObjectMaker BoxPlotBox_boxplot_box_border_border_wrapper ("border"); - - -#include "BoxPlotBoxBorderWrapper.h" -static SimpleObjectMaker BoxPlotBox_boxplot_box_border_on ("on"); -static SimpleObjectMaker BoxPlotBox_boxplot_box_border_on_wrapper ("on"); - - -#include "NoBoxPlotBoxBorderWrapper.h" - -static SimpleObjectMaker BoxPlotBox_boxplot_box_border_noborder_Wrapper("noborder"); - - -#include "NoBoxPlotBoxBorderWrapper.h" - -static SimpleObjectMaker BoxPlotBox_boxplot_box_border_off_Wrapper("off"); - - - -#include "BoxPlotMedianWrapper.h" -static SimpleObjectMaker BoxPlotBox_boxplot_median_median ("median"); -static SimpleObjectMaker BoxPlotBox_boxplot_median_median_wrapper ("median"); - - -#include "BoxPlotMedianWrapper.h" -static SimpleObjectMaker BoxPlotBox_boxplot_median_on ("on"); -static SimpleObjectMaker BoxPlotBox_boxplot_median_on_wrapper ("on"); - - -#include "NoBoxPlotMedianWrapper.h" - -static SimpleObjectMaker BoxPlotBox_boxplot_median_nomedian_Wrapper("nomedian"); - - -#include "NoBoxPlotMedianWrapper.h" - -static SimpleObjectMaker BoxPlotBox_boxplot_median_off_Wrapper("off"); - - - diff --git a/src/attributes/BoxPlotBoxWrapper.h b/src/attributes/BoxPlotBoxWrapper.h deleted file mode 100644 index 4997d8a6e..000000000 --- a/src/attributes/BoxPlotBoxWrapper.h +++ /dev/null @@ -1,93 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotBoxAttributes.h - \brief Definition of BoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotBoxWrapper_H -#define BoxPlotBoxWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - - - - - - -#include "NoBoxPlotBoxBorderWrapper.h" -#include "NoBoxPlotMedianWrapper.h" - - -namespace magics { - -class MagRequest; - - - -class BoxPlotBoxWrapper - -{ -public: -// -- constructor - BoxPlotBoxWrapper(); - BoxPlotBoxWrapper(BoxPlotBox*); -// -- destructor - virtual ~BoxPlotBoxWrapper(); - virtual void set(const MagRequest&); - - BoxPlotBox* me() { return boxplotbox_; } - - virtual BoxPlotBox* object() { return boxplotbox_; } - - - virtual void object(BoxPlotBox* o) { - // Remember to delete the previous object - boxplotbox_ = o; - - - } - - - -protected: - BoxPlotBox* boxplotbox_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const BoxPlotBoxWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/BoxPlotMedianAttributes.cc b/src/attributes/BoxPlotMedianAttributes.cc deleted file mode 100644 index d1503228e..000000000 --- a/src/attributes/BoxPlotMedianAttributes.cc +++ /dev/null @@ -1,121 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotMedianAttributes.h - \\brief Definition of BoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "BoxPlotMedianAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -BoxPlotMedianAttributes::BoxPlotMedianAttributes(): - thickness_(ParameterManager::getInt("boxplot_median_thickness")) - , - colour_(MagTranslator().magics("boxplot_median_colour")), - style_(MagTranslator().magics("boxplot_median_line_style")) - -{ -} - - -BoxPlotMedianAttributes::~BoxPlotMedianAttributes() -{ - -} - - -void BoxPlotMedianAttributes::set(const std::map& params) -{ - vector prefix(2); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_median"; - - setAttribute(prefix, "boxplot_median_thickness", thickness_, params); - - setMember(prefix, "boxplot_median_colour", colour_, params); - setAttribute(prefix, "boxplot_median_line_style", style_, params); - -} - -void BoxPlotMedianAttributes::copy(const BoxPlotMedianAttributes& other) -{ - thickness_ = other.thickness_; - colour_ = unique_ptr(other.colour_->clone()); - style_ = other.style_; - -} - - -bool BoxPlotMedianAttributes::accept(const string& node) -{ - - if ( magCompare(node, "median") ) - return true; - - return false; -} - -void BoxPlotMedianAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "median") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void BoxPlotMedianAttributes::print(ostream& out) const -{ - out << "Attributes["; - out << " thickness = " << thickness_; - out << " colour = " << *colour_; - out << " style = " << style_; - - out << "]" << "\n"; -} - -void BoxPlotMedianAttributes::toxml(ostream& out) const -{ - out << "\"median\""; - out << ", \"boxplot_median_thickness\":"; - niceprint(out,thickness_); - out << ", \"boxplot_median_colour\":"; - niceprint(out, *colour_); - out << ", \"boxplot_median_line_style\":"; - niceprint(out, style_); - -} - -static MagicsParameter boxplot_median_thickness("boxplot_median_thickness", 3); -static MagicsParameter boxplot_median_colour("boxplot_median_colour", "navy"); -static MagicsParameter boxplot_median_line_style("boxplot_median_line_style", "solid"); diff --git a/src/attributes/BoxPlotMedianAttributes.h b/src/attributes/BoxPlotMedianAttributes.h deleted file mode 100644 index b75f4389c..000000000 --- a/src/attributes/BoxPlotMedianAttributes.h +++ /dev/null @@ -1,67 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotMedianAttributes.h - \brief Definition of BoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotMedianAttributes_H -#define BoxPlotMedianAttributes_H - -#include "magics.h" -#include "Colour.h" -namespace magics { - -class XmlNode; -class BoxPlotMedianAttributes -{ -public: -// -- constructor - BoxPlotMedianAttributes(); - -// -- destructor - virtual ~BoxPlotMedianAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const BoxPlotMedianAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - int thickness_; - unique_ptr colour_; - LineStyle style_; - - -private: - friend ostream& operator<<(ostream& s,const BoxPlotMedianAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/BoxPlotMedianWrapper.cc b/src/attributes/BoxPlotMedianWrapper.cc deleted file mode 100644 index 33e839efd..000000000 --- a/src/attributes/BoxPlotMedianWrapper.cc +++ /dev/null @@ -1,91 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotMedianAttributes.h - \\brief Definition of BoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "BoxPlotMedianWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -BoxPlotMedianWrapper::BoxPlotMedianWrapper(): boxplotmedian_(new BoxPlotMedian()) - - -{ - - - - NoBoxPlotMedianWrapper::object(boxplotmedian_); - - -} -BoxPlotMedianWrapper::BoxPlotMedianWrapper(BoxPlotMedian* boxplotmedian): boxplotmedian_(boxplotmedian) -{ - - - NoBoxPlotMedianWrapper::object(boxplotmedian_); - -} - -BoxPlotMedianWrapper::~BoxPlotMedianWrapper() -{ - -} - -void BoxPlotMedianWrapper::set(const MagRequest& request) -{ - - - - NoBoxPlotMedianWrapper::set(request); - - - if (request.countValues("BOXPLOT_MEDIAN_THICKNESS") ) { - int thickness_value = request("BOXPLOT_MEDIAN_THICKNESS"); - boxplotmedian_->thickness_ = thickness_value; - } - - if (request.countValues("BOXPLOT_MEDIAN_COLOUR") ) { - string colour_value = request("BOXPLOT_MEDIAN_COLOUR"); - boxplotmedian_->colour_ = unique_ptr(MagTranslator()(colour_value)); - } - - - if (request.countValues("BOXPLOT_MEDIAN_LINE_STYLE") ) { - string style_value = request("BOXPLOT_MEDIAN_LINE_STYLE"); - boxplotmedian_->style_ = MagTranslator()(style_value); - } - - -} - -void BoxPlotMedianWrapper::print(ostream& out) const -{ - out << "BoxPlotMedianWrapper[]"; -} - - - - diff --git a/src/attributes/BoxPlotMedianWrapper.h b/src/attributes/BoxPlotMedianWrapper.h deleted file mode 100644 index be54a7947..000000000 --- a/src/attributes/BoxPlotMedianWrapper.h +++ /dev/null @@ -1,93 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotMedianAttributes.h - \brief Definition of BoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotMedianWrapper_H -#define BoxPlotMedianWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - -#include "NoBoxPlotMedianWrapper.h" - - - - - - - - -namespace magics { - -class MagRequest; - - -class BoxPlotMedianWrapper: public NoBoxPlotMedianWrapper - -{ -public: -// -- constructor - BoxPlotMedianWrapper(); - BoxPlotMedianWrapper(BoxPlotMedian*); -// -- destructor - virtual ~BoxPlotMedianWrapper(); - virtual void set(const MagRequest&); - - BoxPlotMedian* me() { return boxplotmedian_; } - - virtual BoxPlotMedian* object() { return boxplotmedian_; } - - - virtual void object(BoxPlotMedian* o) { - // Remember to delete the previous object - boxplotmedian_ = o; - NoBoxPlotMedianWrapper::object(o); - - - } - - - -protected: - BoxPlotMedian* boxplotmedian_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const BoxPlotMedianWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/BoxPlotWhiskerBorderAttributes.cc b/src/attributes/BoxPlotWhiskerBorderAttributes.cc deleted file mode 100644 index b5e881a75..000000000 --- a/src/attributes/BoxPlotWhiskerBorderAttributes.cc +++ /dev/null @@ -1,123 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotWhiskerBorderAttributes.h - \\brief Definition of BoxPlotWhiskerBorder Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "BoxPlotWhiskerBorderAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -BoxPlotWhiskerBorderAttributes::BoxPlotWhiskerBorderAttributes(): - thickness_(ParameterManager::getInt("boxplot_whisker_box_border_thickness")) - , - colour_(MagTranslator().magics("boxplot_whisker_box_border_colour")), - style_(MagTranslator().magics("boxplot_whisker_box_border_line_style")) - -{ -} - - -BoxPlotWhiskerBorderAttributes::~BoxPlotWhiskerBorderAttributes() -{ - -} - - -void BoxPlotWhiskerBorderAttributes::set(const std::map& params) -{ - vector prefix(4); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_whisker"; - prefix[i++] = "boxplot_whisker_box"; - prefix[i++] = "boxplot_whisker_box_border"; - - setAttribute(prefix, "boxplot_whisker_box_border_thickness", thickness_, params); - - setMember(prefix, "boxplot_whisker_box_border_colour", colour_, params); - setAttribute(prefix, "boxplot_whisker_box_border_line_style", style_, params); - -} - -void BoxPlotWhiskerBorderAttributes::copy(const BoxPlotWhiskerBorderAttributes& other) -{ - thickness_ = other.thickness_; - colour_ = unique_ptr(other.colour_->clone()); - style_ = other.style_; - -} - - -bool BoxPlotWhiskerBorderAttributes::accept(const string& node) -{ - - if ( magCompare(node, "whisker_border") ) - return true; - - return false; -} - -void BoxPlotWhiskerBorderAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "whisker_border") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void BoxPlotWhiskerBorderAttributes::print(ostream& out) const -{ - out << "Attributes["; - out << " thickness = " << thickness_; - out << " colour = " << *colour_; - out << " style = " << style_; - - out << "]" << "\n"; -} - -void BoxPlotWhiskerBorderAttributes::toxml(ostream& out) const -{ - out << "\"whisker_border\""; - out << ", \"boxplot_whisker_box_border_thickness\":"; - niceprint(out,thickness_); - out << ", \"boxplot_whisker_box_border_colour\":"; - niceprint(out, *colour_); - out << ", \"boxplot_whisker_box_border_line_style\":"; - niceprint(out, style_); - -} - -static MagicsParameter boxplot_whisker_box_border_thickness("boxplot_whisker_box_border_thickness", 1); -static MagicsParameter boxplot_whisker_box_border_colour("boxplot_whisker_box_border_colour", "navy"); -static MagicsParameter boxplot_whisker_box_border_line_style("boxplot_whisker_box_border_line_style", "solid"); diff --git a/src/attributes/BoxPlotWhiskerBorderAttributes.h b/src/attributes/BoxPlotWhiskerBorderAttributes.h deleted file mode 100644 index b33eca0d1..000000000 --- a/src/attributes/BoxPlotWhiskerBorderAttributes.h +++ /dev/null @@ -1,67 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotWhiskerBorderAttributes.h - \brief Definition of BoxPlotWhiskerBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotWhiskerBorderAttributes_H -#define BoxPlotWhiskerBorderAttributes_H - -#include "magics.h" -#include "Colour.h" -namespace magics { - -class XmlNode; -class BoxPlotWhiskerBorderAttributes -{ -public: -// -- constructor - BoxPlotWhiskerBorderAttributes(); - -// -- destructor - virtual ~BoxPlotWhiskerBorderAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const BoxPlotWhiskerBorderAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - int thickness_; - unique_ptr colour_; - LineStyle style_; - - -private: - friend ostream& operator<<(ostream& s,const BoxPlotWhiskerBorderAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/BoxPlotWhiskerBorderWrapper.cc b/src/attributes/BoxPlotWhiskerBorderWrapper.cc deleted file mode 100644 index 1af523001..000000000 --- a/src/attributes/BoxPlotWhiskerBorderWrapper.cc +++ /dev/null @@ -1,84 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotWhiskerBorderAttributes.h - \\brief Definition of BoxPlotWhiskerBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "BoxPlotWhiskerBorderWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -BoxPlotWhiskerBorderWrapper::BoxPlotWhiskerBorderWrapper(): boxplotwhiskerborder_(new BoxPlotWhiskerBorder()) - - -{ - - - - -} -BoxPlotWhiskerBorderWrapper::BoxPlotWhiskerBorderWrapper(BoxPlotWhiskerBorder* boxplotwhiskerborder): boxplotwhiskerborder_(boxplotwhiskerborder) -{ - - -} - -BoxPlotWhiskerBorderWrapper::~BoxPlotWhiskerBorderWrapper() -{ - -} - -void BoxPlotWhiskerBorderWrapper::set(const MagRequest& request) -{ - - - - if (request.countValues("BOXPLOT_WHISKER_BOX_BORDER_THICKNESS") ) { - int thickness_value = request("BOXPLOT_WHISKER_BOX_BORDER_THICKNESS"); - boxplotwhiskerborder_->thickness_ = thickness_value; - } - - if (request.countValues("BOXPLOT_WHISKER_BOX_BORDER_COLOUR") ) { - string colour_value = request("BOXPLOT_WHISKER_BOX_BORDER_COLOUR"); - boxplotwhiskerborder_->colour_ = unique_ptr(MagTranslator()(colour_value)); - } - - - if (request.countValues("BOXPLOT_WHISKER_BOX_BORDER_LINE_STYLE") ) { - string style_value = request("BOXPLOT_WHISKER_BOX_BORDER_LINE_STYLE"); - boxplotwhiskerborder_->style_ = MagTranslator()(style_value); - } - - -} - -void BoxPlotWhiskerBorderWrapper::print(ostream& out) const -{ - out << "BoxPlotWhiskerBorderWrapper[]"; -} - - - - diff --git a/src/attributes/BoxPlotWhiskerBorderWrapper.h b/src/attributes/BoxPlotWhiskerBorderWrapper.h deleted file mode 100644 index 5575b5199..000000000 --- a/src/attributes/BoxPlotWhiskerBorderWrapper.h +++ /dev/null @@ -1,91 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotWhiskerBorderAttributes.h - \brief Definition of BoxPlotWhiskerBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotWhiskerBorderWrapper_H -#define BoxPlotWhiskerBorderWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotWhiskerBorder.h" - - - - - - - - - - -namespace magics { - -class MagRequest; - - - -class BoxPlotWhiskerBorderWrapper - -{ -public: -// -- constructor - BoxPlotWhiskerBorderWrapper(); - BoxPlotWhiskerBorderWrapper(BoxPlotWhiskerBorder*); -// -- destructor - virtual ~BoxPlotWhiskerBorderWrapper(); - virtual void set(const MagRequest&); - - BoxPlotWhiskerBorder* me() { return boxplotwhiskerborder_; } - - virtual BoxPlotWhiskerBorder* object() { return boxplotwhiskerborder_; } - - - virtual void object(BoxPlotWhiskerBorder* o) { - // Remember to delete the previous object - boxplotwhiskerborder_ = o; - - - } - - - -protected: - BoxPlotWhiskerBorder* boxplotwhiskerborder_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const BoxPlotWhiskerBorderWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/BoxPlotWhiskerBoxAttributes.cc b/src/attributes/BoxPlotWhiskerBoxAttributes.cc deleted file mode 100644 index 4277a3362..000000000 --- a/src/attributes/BoxPlotWhiskerBoxAttributes.cc +++ /dev/null @@ -1,132 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotWhiskerBoxAttributes.h - \\brief Definition of BoxPlotWhiskerBox Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "BoxPlotWhiskerBoxAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -BoxPlotWhiskerBoxAttributes::BoxPlotWhiskerBoxAttributes(): - width_(ParameterManager::getDouble("boxplot_whisker_box_width")) - , - colour_(MagTranslator().magics("boxplot_whisker_box_colour")), - border_(MagTranslator().magics("boxplot_whisker_box_border")) - -{ -} - - -BoxPlotWhiskerBoxAttributes::~BoxPlotWhiskerBoxAttributes() -{ - -} - - -void BoxPlotWhiskerBoxAttributes::set(const std::map& params) -{ - vector prefix(3); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_whisker"; - prefix[i++] = "boxplot_whisker_box"; - - setAttribute(prefix, "boxplot_whisker_box_width", width_, params); - - setMember(prefix, "boxplot_whisker_box_colour", colour_, params); - setMember(prefix, "boxplot_whisker_box_border", border_, params); - -} - -void BoxPlotWhiskerBoxAttributes::copy(const BoxPlotWhiskerBoxAttributes& other) -{ - width_ = other.width_; - colour_ = unique_ptr(other.colour_->clone()); - border_ = unique_ptr(other.border_->clone()); - -} - - -bool BoxPlotWhiskerBoxAttributes::accept(const string& node) -{ - - if ( magCompare(node, "whisker_box") ) - return true; - if ( acceptNode(node, border_) ) - return true; - - return false; -} - -void BoxPlotWhiskerBoxAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "whisker_box") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - setMember(node.name(), border_, node); - - } - for (auto &elt : node.elements()) - { - setMember(elt->name(), border_, *elt); - - } -} - -void BoxPlotWhiskerBoxAttributes::print(ostream& out) const -{ - out << "Attributes["; - out << " width = " << width_; - out << " colour = " << *colour_; - out << " border = " << *border_; - - out << "]" << "\n"; -} - -void BoxPlotWhiskerBoxAttributes::toxml(ostream& out) const -{ - out << "\"whisker_box\""; - out << ", \"boxplot_whisker_box_width\":"; - niceprint(out,width_); - out << ", \"boxplot_whisker_box_colour\":"; - niceprint(out, *colour_); - out << ", \"boxplot_whisker_box_border\":"; - border_->toxml(out); - -} - -static MagicsParameter boxplot_whisker_box_width("boxplot_whisker_box_width", 0.25); -static MagicsParameter boxplot_whisker_box_colour("boxplot_whisker_box_colour", "sky"); -static MagicsParameter boxplot_whisker_box_border("boxplot_whisker_box_border", "on"); -#include "BoxPlotItem.h" -#include "BoxPlotBasicItem.h" -static SimpleObjectMaker border_BoxPlotWhiskerBorder("border"); -static SimpleObjectMaker on_BoxPlotWhiskerBorder("on"); -static SimpleObjectMaker noborder_NoBoxPlotWhiskerBorder("noborder"); -static SimpleObjectMaker off_NoBoxPlotWhiskerBorder("off"); diff --git a/src/attributes/BoxPlotWhiskerBoxAttributes.h b/src/attributes/BoxPlotWhiskerBoxAttributes.h deleted file mode 100644 index b0263b408..000000000 --- a/src/attributes/BoxPlotWhiskerBoxAttributes.h +++ /dev/null @@ -1,68 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotWhiskerBoxAttributes.h - \brief Definition of BoxPlotWhiskerBox Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotWhiskerBoxAttributes_H -#define BoxPlotWhiskerBoxAttributes_H - -#include "magics.h" -#include "Colour.h" -#include "BoxPlotBasicItem.h" -namespace magics { - -class XmlNode; -class BoxPlotWhiskerBoxAttributes -{ -public: -// -- constructor - BoxPlotWhiskerBoxAttributes(); - -// -- destructor - virtual ~BoxPlotWhiskerBoxAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const BoxPlotWhiskerBoxAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - double width_; - unique_ptr colour_; - unique_ptr border_; - - -private: - friend ostream& operator<<(ostream& s,const BoxPlotWhiskerBoxAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/BoxPlotWhiskerBoxWrapper.cc b/src/attributes/BoxPlotWhiskerBoxWrapper.cc deleted file mode 100644 index de0a33629..000000000 --- a/src/attributes/BoxPlotWhiskerBoxWrapper.cc +++ /dev/null @@ -1,116 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotWhiskerBoxAttributes.h - \\brief Definition of BoxPlotWhiskerBox Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "BoxPlotWhiskerBoxWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -BoxPlotWhiskerBoxWrapper::BoxPlotWhiskerBoxWrapper(): boxplotwhiskerbox_(new BoxPlotWhiskerBox()) - - -{ - - - - -} -BoxPlotWhiskerBoxWrapper::BoxPlotWhiskerBoxWrapper(BoxPlotWhiskerBox* boxplotwhiskerbox): boxplotwhiskerbox_(boxplotwhiskerbox) -{ - - -} - -BoxPlotWhiskerBoxWrapper::~BoxPlotWhiskerBoxWrapper() -{ - -} - -void BoxPlotWhiskerBoxWrapper::set(const MagRequest& request) -{ - - - - if (request.countValues("BOXPLOT_WHISKER_BOX_WIDTH") ) { - double width_value = request("BOXPLOT_WHISKER_BOX_WIDTH"); - boxplotwhiskerbox_->width_ = width_value; - } - - if (request.countValues("BOXPLOT_WHISKER_BOX_COLOUR") ) { - string colour_value = request("BOXPLOT_WHISKER_BOX_COLOUR"); - boxplotwhiskerbox_->colour_ = unique_ptr(MagTranslator()(colour_value)); - } - - - string border_value = request.countValues("BOXPLOT_WHISKER_BOX_BORDER") ? (string) request("BOXPLOT_WHISKER_BOX_BORDER") : "on"; - MagLog::debug() << " BOXPLOT_WHISKER_BOX_BORDER set to " << border_value << endl; - NoBoxPlotWhiskerBorderWrapper* border_wrapper = 0; - try - { - border_wrapper = SimpleFactory::create(border_value); - } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << border_value << "] is not a valid value for border: reset to default -> [on]" << endl; - border_wrapper = SimpleFactory::create("on"); - } - border_wrapper->set(request); - boxplotwhiskerbox_->border_ = unique_ptr(border_wrapper->object()); - delete border_wrapper; - -} - -void BoxPlotWhiskerBoxWrapper::print(ostream& out) const -{ - out << "BoxPlotWhiskerBoxWrapper[]"; -} - - - -#include "BoxPlotWhiskerBorderWrapper.h" -static SimpleObjectMaker BoxPlotWhiskerBox_boxplot_whisker_box_border_border ("border"); -static SimpleObjectMaker BoxPlotWhiskerBox_boxplot_whisker_box_border_border_wrapper ("border"); - - -#include "BoxPlotWhiskerBorderWrapper.h" -static SimpleObjectMaker BoxPlotWhiskerBox_boxplot_whisker_box_border_on ("on"); -static SimpleObjectMaker BoxPlotWhiskerBox_boxplot_whisker_box_border_on_wrapper ("on"); - - -#include "NoBoxPlotWhiskerBorderWrapper.h" - -static SimpleObjectMaker BoxPlotWhiskerBox_boxplot_whisker_box_border_noborder_Wrapper("noborder"); - - -#include "NoBoxPlotWhiskerBorderWrapper.h" - -static SimpleObjectMaker BoxPlotWhiskerBox_boxplot_whisker_box_border_off_Wrapper("off"); - - - diff --git a/src/attributes/BoxPlotWhiskerBoxWrapper.h b/src/attributes/BoxPlotWhiskerBoxWrapper.h deleted file mode 100644 index 6d5da7401..000000000 --- a/src/attributes/BoxPlotWhiskerBoxWrapper.h +++ /dev/null @@ -1,92 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotWhiskerBoxAttributes.h - \brief Definition of BoxPlotWhiskerBox Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotWhiskerBoxWrapper_H -#define BoxPlotWhiskerBoxWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotWhiskerBox.h" - - - - - - - - -#include "NoBoxPlotWhiskerBorderWrapper.h" - - -namespace magics { - -class MagRequest; - - - -class BoxPlotWhiskerBoxWrapper - -{ -public: -// -- constructor - BoxPlotWhiskerBoxWrapper(); - BoxPlotWhiskerBoxWrapper(BoxPlotWhiskerBox*); -// -- destructor - virtual ~BoxPlotWhiskerBoxWrapper(); - virtual void set(const MagRequest&); - - BoxPlotWhiskerBox* me() { return boxplotwhiskerbox_; } - - virtual BoxPlotWhiskerBox* object() { return boxplotwhiskerbox_; } - - - virtual void object(BoxPlotWhiskerBox* o) { - // Remember to delete the previous object - boxplotwhiskerbox_ = o; - - - } - - - -protected: - BoxPlotWhiskerBox* boxplotwhiskerbox_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const BoxPlotWhiskerBoxWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/BoxPlotWhiskerLineAttributes.cc b/src/attributes/BoxPlotWhiskerLineAttributes.cc deleted file mode 100644 index 4d291e96f..000000000 --- a/src/attributes/BoxPlotWhiskerLineAttributes.cc +++ /dev/null @@ -1,122 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotWhiskerLineAttributes.h - \\brief Definition of BoxPlotWhiskerLine Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "BoxPlotWhiskerLineAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -BoxPlotWhiskerLineAttributes::BoxPlotWhiskerLineAttributes(): - thickness_(ParameterManager::getInt("boxplot_whisker_line_thickness")) - , - colour_(MagTranslator().magics("boxplot_whisker_line_colour")), - style_(MagTranslator().magics("boxplot_whisker_line_style")) - -{ -} - - -BoxPlotWhiskerLineAttributes::~BoxPlotWhiskerLineAttributes() -{ - -} - - -void BoxPlotWhiskerLineAttributes::set(const std::map& params) -{ - vector prefix(3); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_whisker"; - prefix[i++] = "boxplot_whisker_line"; - - setAttribute(prefix, "boxplot_whisker_line_thickness", thickness_, params); - - setMember(prefix, "boxplot_whisker_line_colour", colour_, params); - setAttribute(prefix, "boxplot_whisker_line_style", style_, params); - -} - -void BoxPlotWhiskerLineAttributes::copy(const BoxPlotWhiskerLineAttributes& other) -{ - thickness_ = other.thickness_; - colour_ = unique_ptr(other.colour_->clone()); - style_ = other.style_; - -} - - -bool BoxPlotWhiskerLineAttributes::accept(const string& node) -{ - - if ( magCompare(node, "whisker_line") ) - return true; - - return false; -} - -void BoxPlotWhiskerLineAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "whisker_line") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void BoxPlotWhiskerLineAttributes::print(ostream& out) const -{ - out << "Attributes["; - out << " thickness = " << thickness_; - out << " colour = " << *colour_; - out << " style = " << style_; - - out << "]" << "\n"; -} - -void BoxPlotWhiskerLineAttributes::toxml(ostream& out) const -{ - out << "\"whisker_line\""; - out << ", \"boxplot_whisker_line_thickness\":"; - niceprint(out,thickness_); - out << ", \"boxplot_whisker_line_colour\":"; - niceprint(out, *colour_); - out << ", \"boxplot_whisker_line_style\":"; - niceprint(out, style_); - -} - -static MagicsParameter boxplot_whisker_line_thickness("boxplot_whisker_line_thickness", 3); -static MagicsParameter boxplot_whisker_line_colour("boxplot_whisker_line_colour", "navy"); -static MagicsParameter boxplot_whisker_line_style("boxplot_whisker_line_style", "solid"); diff --git a/src/attributes/BoxPlotWhiskerLineAttributes.h b/src/attributes/BoxPlotWhiskerLineAttributes.h deleted file mode 100644 index ed7d910a9..000000000 --- a/src/attributes/BoxPlotWhiskerLineAttributes.h +++ /dev/null @@ -1,67 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotWhiskerLineAttributes.h - \brief Definition of BoxPlotWhiskerLine Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotWhiskerLineAttributes_H -#define BoxPlotWhiskerLineAttributes_H - -#include "magics.h" -#include "Colour.h" -namespace magics { - -class XmlNode; -class BoxPlotWhiskerLineAttributes -{ -public: -// -- constructor - BoxPlotWhiskerLineAttributes(); - -// -- destructor - virtual ~BoxPlotWhiskerLineAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const BoxPlotWhiskerLineAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - int thickness_; - unique_ptr colour_; - LineStyle style_; - - -private: - friend ostream& operator<<(ostream& s,const BoxPlotWhiskerLineAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/BoxPlotWhiskerLineWrapper.cc b/src/attributes/BoxPlotWhiskerLineWrapper.cc deleted file mode 100644 index bb17b8055..000000000 --- a/src/attributes/BoxPlotWhiskerLineWrapper.cc +++ /dev/null @@ -1,84 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file BoxPlotWhiskerLineAttributes.h - \\brief Definition of BoxPlotWhiskerLine Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "BoxPlotWhiskerLineWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -BoxPlotWhiskerLineWrapper::BoxPlotWhiskerLineWrapper(): boxplotwhiskerline_(new BoxPlotWhiskerLine()) - - -{ - - - - -} -BoxPlotWhiskerLineWrapper::BoxPlotWhiskerLineWrapper(BoxPlotWhiskerLine* boxplotwhiskerline): boxplotwhiskerline_(boxplotwhiskerline) -{ - - -} - -BoxPlotWhiskerLineWrapper::~BoxPlotWhiskerLineWrapper() -{ - -} - -void BoxPlotWhiskerLineWrapper::set(const MagRequest& request) -{ - - - - if (request.countValues("BOXPLOT_WHISKER_LINE_THICKNESS") ) { - int thickness_value = request("BOXPLOT_WHISKER_LINE_THICKNESS"); - boxplotwhiskerline_->thickness_ = thickness_value; - } - - if (request.countValues("BOXPLOT_WHISKER_LINE_COLOUR") ) { - string colour_value = request("BOXPLOT_WHISKER_LINE_COLOUR"); - boxplotwhiskerline_->colour_ = unique_ptr(MagTranslator()(colour_value)); - } - - - if (request.countValues("BOXPLOT_WHISKER_LINE_STYLE") ) { - string style_value = request("BOXPLOT_WHISKER_LINE_STYLE"); - boxplotwhiskerline_->style_ = MagTranslator()(style_value); - } - - -} - -void BoxPlotWhiskerLineWrapper::print(ostream& out) const -{ - out << "BoxPlotWhiskerLineWrapper[]"; -} - - - - diff --git a/src/attributes/BoxPlotWhiskerLineWrapper.h b/src/attributes/BoxPlotWhiskerLineWrapper.h deleted file mode 100644 index 1696ec867..000000000 --- a/src/attributes/BoxPlotWhiskerLineWrapper.h +++ /dev/null @@ -1,91 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileBoxPlotWhiskerLineAttributes.h - \brief Definition of BoxPlotWhiskerLine Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef BoxPlotWhiskerLineWrapper_H -#define BoxPlotWhiskerLineWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotWhiskerLine.h" - - - - - - - - - - -namespace magics { - -class MagRequest; - - - -class BoxPlotWhiskerLineWrapper - -{ -public: -// -- constructor - BoxPlotWhiskerLineWrapper(); - BoxPlotWhiskerLineWrapper(BoxPlotWhiskerLine*); -// -- destructor - virtual ~BoxPlotWhiskerLineWrapper(); - virtual void set(const MagRequest&); - - BoxPlotWhiskerLine* me() { return boxplotwhiskerline_; } - - virtual BoxPlotWhiskerLine* object() { return boxplotwhiskerline_; } - - - virtual void object(BoxPlotWhiskerLine* o) { - // Remember to delete the previous object - boxplotwhiskerline_ = o; - - - } - - - -protected: - BoxPlotWhiskerLine* boxplotwhiskerline_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const BoxPlotWhiskerLineWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/NoBoxPlotAttributes.cc b/src/attributes/NoBoxPlotAttributes.cc deleted file mode 100644 index a6d8d0c29..000000000 --- a/src/attributes/NoBoxPlotAttributes.cc +++ /dev/null @@ -1,99 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotAttributes.h - \\brief Definition of NoBoxPlot Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "NoBoxPlotAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -NoBoxPlotAttributes::NoBoxPlotAttributes() - - -{ -} - - -NoBoxPlotAttributes::~NoBoxPlotAttributes() -{ - -} - - -void NoBoxPlotAttributes::set(const std::map& params) -{ - vector prefix(1); - int i = 0; - prefix[i++] = "boxplot"; - - - -} - -void NoBoxPlotAttributes::copy(const NoBoxPlotAttributes& other) -{ - -} - - -bool NoBoxPlotAttributes::accept(const string& node) -{ - - if ( magCompare(node, "boxplot") ) - return true; - - return false; -} - -void NoBoxPlotAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "boxplot") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void NoBoxPlotAttributes::print(ostream& out) const -{ - out << "Attributes["; - - out << "]" << "\n"; -} - -void NoBoxPlotAttributes::toxml(ostream& out) const -{ - out << "\"boxplot\""; - -} - diff --git a/src/attributes/NoBoxPlotAttributes.h b/src/attributes/NoBoxPlotAttributes.h deleted file mode 100644 index 018ed8932..000000000 --- a/src/attributes/NoBoxPlotAttributes.h +++ /dev/null @@ -1,63 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotAttributes.h - \brief Definition of NoBoxPlot Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotAttributes_H -#define NoBoxPlotAttributes_H - -#include "magics.h" -namespace magics { - -class XmlNode; -class NoBoxPlotAttributes -{ -public: -// -- constructor - NoBoxPlotAttributes(); - -// -- destructor - virtual ~NoBoxPlotAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const NoBoxPlotAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - - -private: - friend ostream& operator<<(ostream& s,const NoBoxPlotAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/NoBoxPlotBoxAttributes.cc b/src/attributes/NoBoxPlotBoxAttributes.cc deleted file mode 100644 index c215ddd1e..000000000 --- a/src/attributes/NoBoxPlotBoxAttributes.cc +++ /dev/null @@ -1,99 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotBoxAttributes.h - \\brief Definition of NoBoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "NoBoxPlotBoxAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -NoBoxPlotBoxAttributes::NoBoxPlotBoxAttributes() - - -{ -} - - -NoBoxPlotBoxAttributes::~NoBoxPlotBoxAttributes() -{ - -} - - -void NoBoxPlotBoxAttributes::set(const std::map& params) -{ - vector prefix(1); - int i = 0; - prefix[i++] = "boxplot"; - - - -} - -void NoBoxPlotBoxAttributes::copy(const NoBoxPlotBoxAttributes& other) -{ - -} - - -bool NoBoxPlotBoxAttributes::accept(const string& node) -{ - - if ( magCompare(node, "boxplot") ) - return true; - - return false; -} - -void NoBoxPlotBoxAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "boxplot") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void NoBoxPlotBoxAttributes::print(ostream& out) const -{ - out << "Attributes["; - - out << "]" << "\n"; -} - -void NoBoxPlotBoxAttributes::toxml(ostream& out) const -{ - out << "\"boxplot\""; - -} - diff --git a/src/attributes/NoBoxPlotBoxAttributes.h b/src/attributes/NoBoxPlotBoxAttributes.h deleted file mode 100644 index ddb177109..000000000 --- a/src/attributes/NoBoxPlotBoxAttributes.h +++ /dev/null @@ -1,63 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotBoxAttributes.h - \brief Definition of NoBoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotBoxAttributes_H -#define NoBoxPlotBoxAttributes_H - -#include "magics.h" -namespace magics { - -class XmlNode; -class NoBoxPlotBoxAttributes -{ -public: -// -- constructor - NoBoxPlotBoxAttributes(); - -// -- destructor - virtual ~NoBoxPlotBoxAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const NoBoxPlotBoxAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - - -private: - friend ostream& operator<<(ostream& s,const NoBoxPlotBoxAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/NoBoxPlotBoxBorderAttributes.cc b/src/attributes/NoBoxPlotBoxBorderAttributes.cc deleted file mode 100644 index fdfea170c..000000000 --- a/src/attributes/NoBoxPlotBoxBorderAttributes.cc +++ /dev/null @@ -1,100 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotBoxBorderAttributes.h - \\brief Definition of NoBoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "NoBoxPlotBoxBorderAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -NoBoxPlotBoxBorderAttributes::NoBoxPlotBoxBorderAttributes() - - -{ -} - - -NoBoxPlotBoxBorderAttributes::~NoBoxPlotBoxBorderAttributes() -{ - -} - - -void NoBoxPlotBoxBorderAttributes::set(const std::map& params) -{ - vector prefix(2); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_median"; - - - -} - -void NoBoxPlotBoxBorderAttributes::copy(const NoBoxPlotBoxBorderAttributes& other) -{ - -} - - -bool NoBoxPlotBoxBorderAttributes::accept(const string& node) -{ - - if ( magCompare(node, "median") ) - return true; - - return false; -} - -void NoBoxPlotBoxBorderAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "median") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void NoBoxPlotBoxBorderAttributes::print(ostream& out) const -{ - out << "Attributes["; - - out << "]" << "\n"; -} - -void NoBoxPlotBoxBorderAttributes::toxml(ostream& out) const -{ - out << "\"median\""; - -} - diff --git a/src/attributes/NoBoxPlotBoxBorderAttributes.h b/src/attributes/NoBoxPlotBoxBorderAttributes.h deleted file mode 100644 index cd9e91048..000000000 --- a/src/attributes/NoBoxPlotBoxBorderAttributes.h +++ /dev/null @@ -1,63 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotBoxBorderAttributes.h - \brief Definition of NoBoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotBoxBorderAttributes_H -#define NoBoxPlotBoxBorderAttributes_H - -#include "magics.h" -namespace magics { - -class XmlNode; -class NoBoxPlotBoxBorderAttributes -{ -public: -// -- constructor - NoBoxPlotBoxBorderAttributes(); - -// -- destructor - virtual ~NoBoxPlotBoxBorderAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const NoBoxPlotBoxBorderAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - - -private: - friend ostream& operator<<(ostream& s,const NoBoxPlotBoxBorderAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/NoBoxPlotBoxBorderWrapper.cc b/src/attributes/NoBoxPlotBoxBorderWrapper.cc deleted file mode 100644 index 14fb00eb2..000000000 --- a/src/attributes/NoBoxPlotBoxBorderWrapper.cc +++ /dev/null @@ -1,67 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotBoxBorderAttributes.h - \\brief Definition of NoBoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "NoBoxPlotBoxBorderWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -NoBoxPlotBoxBorderWrapper::NoBoxPlotBoxBorderWrapper(): noboxplotboxborder_(new NoBoxPlotBoxBorder()) - - -{ - - - - -} -NoBoxPlotBoxBorderWrapper::NoBoxPlotBoxBorderWrapper(NoBoxPlotBoxBorder* noboxplotboxborder): noboxplotboxborder_(noboxplotboxborder) -{ - - -} - -NoBoxPlotBoxBorderWrapper::~NoBoxPlotBoxBorderWrapper() -{ - -} - -void NoBoxPlotBoxBorderWrapper::set(const MagRequest& request) -{ - - - - - -} - -void NoBoxPlotBoxBorderWrapper::print(ostream& out) const -{ - out << "NoBoxPlotBoxBorderWrapper[]"; -} - - diff --git a/src/attributes/NoBoxPlotBoxBorderWrapper.h b/src/attributes/NoBoxPlotBoxBorderWrapper.h deleted file mode 100644 index bde7f82f2..000000000 --- a/src/attributes/NoBoxPlotBoxBorderWrapper.h +++ /dev/null @@ -1,91 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotBoxBorderAttributes.h - \brief Definition of NoBoxPlotBoxBorder Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotBoxBorderWrapper_H -#define NoBoxPlotBoxBorderWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - - - - - - - - -namespace magics { - -class MagRequest; - - - -class NoBoxPlotBoxBorderWrapper - -{ -public: -// -- constructor - NoBoxPlotBoxBorderWrapper(); - NoBoxPlotBoxBorderWrapper(NoBoxPlotBoxBorder*); -// -- destructor - virtual ~NoBoxPlotBoxBorderWrapper(); - virtual void set(const MagRequest&); - - NoBoxPlotBoxBorder* me() { return noboxplotboxborder_; } - - virtual NoBoxPlotBoxBorder* object() { return noboxplotboxborder_; } - - - virtual void object(NoBoxPlotBoxBorder* o) { - // Remember to delete the previous object - noboxplotboxborder_ = o; - - - } - - - -protected: - NoBoxPlotBoxBorder* noboxplotboxborder_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const NoBoxPlotBoxBorderWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/NoBoxPlotBoxWrapper.cc b/src/attributes/NoBoxPlotBoxWrapper.cc deleted file mode 100644 index 5458c6002..000000000 --- a/src/attributes/NoBoxPlotBoxWrapper.cc +++ /dev/null @@ -1,67 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotBoxAttributes.h - \\brief Definition of NoBoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "NoBoxPlotBoxWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -NoBoxPlotBoxWrapper::NoBoxPlotBoxWrapper(): noboxplotbox_(new NoBoxPlotBox()) - - -{ - - - - -} -NoBoxPlotBoxWrapper::NoBoxPlotBoxWrapper(NoBoxPlotBox* noboxplotbox): noboxplotbox_(noboxplotbox) -{ - - -} - -NoBoxPlotBoxWrapper::~NoBoxPlotBoxWrapper() -{ - -} - -void NoBoxPlotBoxWrapper::set(const MagRequest& request) -{ - - - - - -} - -void NoBoxPlotBoxWrapper::print(ostream& out) const -{ - out << "NoBoxPlotBoxWrapper[]"; -} - - diff --git a/src/attributes/NoBoxPlotBoxWrapper.h b/src/attributes/NoBoxPlotBoxWrapper.h deleted file mode 100644 index 7d573a447..000000000 --- a/src/attributes/NoBoxPlotBoxWrapper.h +++ /dev/null @@ -1,91 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotBoxAttributes.h - \brief Definition of NoBoxPlotBox Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotBoxWrapper_H -#define NoBoxPlotBoxWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - - - - - - - - -namespace magics { - -class MagRequest; - - - -class NoBoxPlotBoxWrapper - -{ -public: -// -- constructor - NoBoxPlotBoxWrapper(); - NoBoxPlotBoxWrapper(NoBoxPlotBox*); -// -- destructor - virtual ~NoBoxPlotBoxWrapper(); - virtual void set(const MagRequest&); - - NoBoxPlotBox* me() { return noboxplotbox_; } - - virtual NoBoxPlotBox* object() { return noboxplotbox_; } - - - virtual void object(NoBoxPlotBox* o) { - // Remember to delete the previous object - noboxplotbox_ = o; - - - } - - - -protected: - NoBoxPlotBox* noboxplotbox_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const NoBoxPlotBoxWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/NoBoxPlotMedianAttributes.cc b/src/attributes/NoBoxPlotMedianAttributes.cc deleted file mode 100644 index 50dcf6f01..000000000 --- a/src/attributes/NoBoxPlotMedianAttributes.cc +++ /dev/null @@ -1,100 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotMedianAttributes.h - \\brief Definition of NoBoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "NoBoxPlotMedianAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -NoBoxPlotMedianAttributes::NoBoxPlotMedianAttributes() - - -{ -} - - -NoBoxPlotMedianAttributes::~NoBoxPlotMedianAttributes() -{ - -} - - -void NoBoxPlotMedianAttributes::set(const std::map& params) -{ - vector prefix(2); - int i = 0; - prefix[i++] = "boxplot"; - prefix[i++] = "boxplot_median"; - - - -} - -void NoBoxPlotMedianAttributes::copy(const NoBoxPlotMedianAttributes& other) -{ - -} - - -bool NoBoxPlotMedianAttributes::accept(const string& node) -{ - - if ( magCompare(node, "median") ) - return true; - - return false; -} - -void NoBoxPlotMedianAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "median") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void NoBoxPlotMedianAttributes::print(ostream& out) const -{ - out << "Attributes["; - - out << "]" << "\n"; -} - -void NoBoxPlotMedianAttributes::toxml(ostream& out) const -{ - out << "\"median\""; - -} - diff --git a/src/attributes/NoBoxPlotMedianAttributes.h b/src/attributes/NoBoxPlotMedianAttributes.h deleted file mode 100644 index 3a6b29a1c..000000000 --- a/src/attributes/NoBoxPlotMedianAttributes.h +++ /dev/null @@ -1,63 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotMedianAttributes.h - \brief Definition of NoBoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotMedianAttributes_H -#define NoBoxPlotMedianAttributes_H - -#include "magics.h" -namespace magics { - -class XmlNode; -class NoBoxPlotMedianAttributes -{ -public: -// -- constructor - NoBoxPlotMedianAttributes(); - -// -- destructor - virtual ~NoBoxPlotMedianAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const NoBoxPlotMedianAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - - -private: - friend ostream& operator<<(ostream& s,const NoBoxPlotMedianAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/NoBoxPlotMedianWrapper.cc b/src/attributes/NoBoxPlotMedianWrapper.cc deleted file mode 100644 index b3011118d..000000000 --- a/src/attributes/NoBoxPlotMedianWrapper.cc +++ /dev/null @@ -1,67 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotMedianAttributes.h - \\brief Definition of NoBoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "NoBoxPlotMedianWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -NoBoxPlotMedianWrapper::NoBoxPlotMedianWrapper(): noboxplotmedian_(new NoBoxPlotMedian()) - - -{ - - - - -} -NoBoxPlotMedianWrapper::NoBoxPlotMedianWrapper(NoBoxPlotMedian* noboxplotmedian): noboxplotmedian_(noboxplotmedian) -{ - - -} - -NoBoxPlotMedianWrapper::~NoBoxPlotMedianWrapper() -{ - -} - -void NoBoxPlotMedianWrapper::set(const MagRequest& request) -{ - - - - - -} - -void NoBoxPlotMedianWrapper::print(ostream& out) const -{ - out << "NoBoxPlotMedianWrapper[]"; -} - - diff --git a/src/attributes/NoBoxPlotMedianWrapper.h b/src/attributes/NoBoxPlotMedianWrapper.h deleted file mode 100644 index 97b82f4ba..000000000 --- a/src/attributes/NoBoxPlotMedianWrapper.h +++ /dev/null @@ -1,91 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotMedianAttributes.h - \brief Definition of NoBoxPlotMedian Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotMedianWrapper_H -#define NoBoxPlotMedianWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - - - - - - - - -namespace magics { - -class MagRequest; - - - -class NoBoxPlotMedianWrapper - -{ -public: -// -- constructor - NoBoxPlotMedianWrapper(); - NoBoxPlotMedianWrapper(NoBoxPlotMedian*); -// -- destructor - virtual ~NoBoxPlotMedianWrapper(); - virtual void set(const MagRequest&); - - NoBoxPlotMedian* me() { return noboxplotmedian_; } - - virtual NoBoxPlotMedian* object() { return noboxplotmedian_; } - - - virtual void object(NoBoxPlotMedian* o) { - // Remember to delete the previous object - noboxplotmedian_ = o; - - - } - - - -protected: - NoBoxPlotMedian* noboxplotmedian_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const NoBoxPlotMedianWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/NoBoxPlotWhiskerAttributes.cc b/src/attributes/NoBoxPlotWhiskerAttributes.cc deleted file mode 100644 index dc6d49cb1..000000000 --- a/src/attributes/NoBoxPlotWhiskerAttributes.cc +++ /dev/null @@ -1,99 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotWhiskerAttributes.h - \\brief Definition of NoBoxPlotWhisker Attributes class. - - This file is automatically generated. - Do Not Edit! -*/ - -#include "NoBoxPlotWhiskerAttributes.h" -#include "MagicsParameter.h" -#include "ParameterSettings.h" - -using namespace magics; - -NoBoxPlotWhiskerAttributes::NoBoxPlotWhiskerAttributes() - - -{ -} - - -NoBoxPlotWhiskerAttributes::~NoBoxPlotWhiskerAttributes() -{ - -} - - -void NoBoxPlotWhiskerAttributes::set(const std::map& params) -{ - vector prefix(1); - int i = 0; - prefix[i++] = "boxplot"; - - - -} - -void NoBoxPlotWhiskerAttributes::copy(const NoBoxPlotWhiskerAttributes& other) -{ - -} - - -bool NoBoxPlotWhiskerAttributes::accept(const string& node) -{ - - if ( magCompare(node, "boxplot") ) - return true; - - return false; -} - -void NoBoxPlotWhiskerAttributes::set(const XmlNode& node) -{ - bool apply = false; - - if ( this->accept(node.name()) == false ) - return; - - if ( magCompare(node.name(), "boxplot") ) - apply = true; - - - if ( apply ) - set(node.attributes()); - else { - - } - for (auto &elt : node.elements()) - { - - } -} - -void NoBoxPlotWhiskerAttributes::print(ostream& out) const -{ - out << "Attributes["; - - out << "]" << "\n"; -} - -void NoBoxPlotWhiskerAttributes::toxml(ostream& out) const -{ - out << "\"boxplot\""; - -} - diff --git a/src/attributes/NoBoxPlotWhiskerAttributes.h b/src/attributes/NoBoxPlotWhiskerAttributes.h deleted file mode 100644 index 6beadab70..000000000 --- a/src/attributes/NoBoxPlotWhiskerAttributes.h +++ /dev/null @@ -1,63 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotWhiskerAttributes.h - \brief Definition of NoBoxPlotWhisker Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotWhiskerAttributes_H -#define NoBoxPlotWhiskerAttributes_H - -#include "magics.h" -namespace magics { - -class XmlNode; -class NoBoxPlotWhiskerAttributes -{ -public: -// -- constructor - NoBoxPlotWhiskerAttributes(); - -// -- destructor - virtual ~NoBoxPlotWhiskerAttributes(); - - virtual void set(const std::map&); - virtual void set(const XmlNode&); - virtual void copy(const NoBoxPlotWhiskerAttributes&); - virtual bool accept(const std::string&); - - void setTag(const std::string& tag) { tag_ = tag; } - -public: - // -- method - virtual void print(std::ostream&) const; - virtual void toxml(std::ostream& out) const; - // -- members: - string tag_; - - -private: - friend ostream& operator<<(ostream& s,const NoBoxPlotWhiskerAttributes& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif - diff --git a/src/attributes/NoBoxPlotWhiskerWrapper.cc b/src/attributes/NoBoxPlotWhiskerWrapper.cc deleted file mode 100644 index 8bd638cb1..000000000 --- a/src/attributes/NoBoxPlotWhiskerWrapper.cc +++ /dev/null @@ -1,67 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotWhiskerAttributes.h - \\brief Definition of NoBoxPlotWhisker Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "NoBoxPlotWhiskerWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -NoBoxPlotWhiskerWrapper::NoBoxPlotWhiskerWrapper(): noboxplotwhisker_(new NoBoxPlotWhisker()) - - -{ - - - - -} -NoBoxPlotWhiskerWrapper::NoBoxPlotWhiskerWrapper(NoBoxPlotWhisker* noboxplotwhisker): noboxplotwhisker_(noboxplotwhisker) -{ - - -} - -NoBoxPlotWhiskerWrapper::~NoBoxPlotWhiskerWrapper() -{ - -} - -void NoBoxPlotWhiskerWrapper::set(const MagRequest& request) -{ - - - - - -} - -void NoBoxPlotWhiskerWrapper::print(ostream& out) const -{ - out << "NoBoxPlotWhiskerWrapper[]"; -} - - diff --git a/src/attributes/NoBoxPlotWhiskerWrapper.h b/src/attributes/NoBoxPlotWhiskerWrapper.h deleted file mode 100644 index 7258f3f1a..000000000 --- a/src/attributes/NoBoxPlotWhiskerWrapper.h +++ /dev/null @@ -1,91 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotWhiskerAttributes.h - \brief Definition of NoBoxPlotWhisker Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotWhiskerWrapper_H -#define NoBoxPlotWhiskerWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - - - - - - - - -namespace magics { - -class MagRequest; - - - -class NoBoxPlotWhiskerWrapper - -{ -public: -// -- constructor - NoBoxPlotWhiskerWrapper(); - NoBoxPlotWhiskerWrapper(NoBoxPlotWhisker*); -// -- destructor - virtual ~NoBoxPlotWhiskerWrapper(); - virtual void set(const MagRequest&); - - NoBoxPlotWhisker* me() { return noboxplotwhisker_; } - - virtual NoBoxPlotWhisker* object() { return noboxplotwhisker_; } - - - virtual void object(NoBoxPlotWhisker* o) { - // Remember to delete the previous object - noboxplotwhisker_ = o; - - - } - - - -protected: - NoBoxPlotWhisker* noboxplotwhisker_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const NoBoxPlotWhiskerWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/attributes/NoBoxPlotWrapper.cc b/src/attributes/NoBoxPlotWrapper.cc deleted file mode 100644 index 5b48f7a6d..000000000 --- a/src/attributes/NoBoxPlotWrapper.cc +++ /dev/null @@ -1,67 +0,0 @@ - -/****************************** LICENSE ******************************* - - * (C) Copyright 1996-2017 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \\file NoBoxPlotAttributes.h - \\brief Definition of NoBoxPlot Attributes class. - - This file is automatically generated. - Do Not Edit! - -*/ - -#include "MagRequest.h" -#include "NoBoxPlotWrapper.h" -#include "MagicsParameter.h" -#include "Factory.h" -#include "MagTranslator.h" -#include "MagicsGlobal.h" - -using namespace magics; - - - -NoBoxPlotWrapper::NoBoxPlotWrapper(): noboxplot_(new NoBoxPlot()) - - -{ - - - - -} -NoBoxPlotWrapper::NoBoxPlotWrapper(NoBoxPlot* noboxplot): noboxplot_(noboxplot) -{ - - -} - -NoBoxPlotWrapper::~NoBoxPlotWrapper() -{ - -} - -void NoBoxPlotWrapper::set(const MagRequest& request) -{ - - - - - -} - -void NoBoxPlotWrapper::print(ostream& out) const -{ - out << "NoBoxPlotWrapper[]"; -} - - diff --git a/src/attributes/NoBoxPlotWrapper.h b/src/attributes/NoBoxPlotWrapper.h deleted file mode 100644 index d634b7542..000000000 --- a/src/attributes/NoBoxPlotWrapper.h +++ /dev/null @@ -1,91 +0,0 @@ - -/******************************* LICENSE ******************************* - - * (C) Copyright 1996-2016 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - - ******************************* LICENSE *******************************/ - -/*! \fileNoBoxPlotAttributes.h - \brief Definition of NoBoxPlot Attributes class. - - This file is automatically generated. - Do Not Edit! - - Generated: -*/ - - -#ifndef NoBoxPlotWrapper_H -#define NoBoxPlotWrapper_H - -#include "magics.h" -#include "ParameterManager.h" -#include "Factory.h" - - - -#include "BoxPlotItem.h" - - - - - - - - - - -namespace magics { - -class MagRequest; - - - -class NoBoxPlotWrapper - -{ -public: -// -- constructor - NoBoxPlotWrapper(); - NoBoxPlotWrapper(NoBoxPlot*); -// -- destructor - virtual ~NoBoxPlotWrapper(); - virtual void set(const MagRequest&); - - NoBoxPlot* me() { return noboxplot_; } - - virtual NoBoxPlot* object() { return noboxplot_; } - - - virtual void object(NoBoxPlot* o) { - // Remember to delete the previous object - noboxplot_ = o; - - - } - - - -protected: - NoBoxPlot* noboxplot_; - - -// -- method - virtual void print(ostream&) const; - - -private: - string tag_; - friend ostream& operator<<(ostream& s,const NoBoxPlotWrapper& p) - { p.print(s); return s; } -}; - -} // namespace magics - -#endif \ No newline at end of file diff --git a/src/params/BoxPlotBox.xml b/src/params/BoxPlotBox.xml deleted file mode 100644 index b329d2649..000000000 --- a/src/params/BoxPlotBox.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Colour of the box - - - Width of the box in centimeters - - - Determines whether the box border is drawn or not - - - - - Determines whether the median line is drawn or not - - - Magics++1.3 - - - diff --git a/src/params/BoxPlotBoxBorder.xml b/src/params/BoxPlotBoxBorder.xml deleted file mode 100644 index b7acc4ff9..000000000 --- a/src/params/BoxPlotBoxBorder.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Colour of the box border - - - Thickness of the box border - - - Line style of the box border - - - diff --git a/src/params/BoxPlotMedian.xml b/src/params/BoxPlotMedian.xml deleted file mode 100644 index eb6a146ea..000000000 --- a/src/params/BoxPlotMedian.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Colour of the median line - - - Thickness of the median line - - - Line style of the median line - - - diff --git a/src/params/BoxPlotWhiskerBorder.xml b/src/params/BoxPlotWhiskerBorder.xml deleted file mode 100644 index 8e4fed9c9..000000000 --- a/src/params/BoxPlotWhiskerBorder.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Colour of the whisker box border - - - Thickness of the whisker box border - - - Line style of the whisker box border - - - diff --git a/src/params/BoxPlotWhiskerBox.xml b/src/params/BoxPlotWhiskerBox.xml deleted file mode 100644 index f058aff7a..000000000 --- a/src/params/BoxPlotWhiskerBox.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Colour of the whisker box - - - Width of the whisker box in centimeters - - - Determines whether the whisker box border is drawn or not - - - - - diff --git a/src/params/BoxPlotWhiskerLine.xml b/src/params/BoxPlotWhiskerLine.xml deleted file mode 100644 index c57a27977..000000000 --- a/src/params/BoxPlotWhiskerLine.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Colour of the whisker line - - - Thickness of the whisker line - - - Line style of the whisker line - - - diff --git a/src/visualisers/BoxPlotVisualiser.cc b/src/visualisers/BoxPlotVisualiser.cc index 7bd4c279c..dae7b8f84 100644 --- a/src/visualisers/BoxPlotVisualiser.cc +++ b/src/visualisers/BoxPlotVisualiser.cc @@ -203,7 +203,7 @@ void BoxPlotVisualiser::whisker_box_bottom(BasicGraphicsObjectContainer& visito void BoxPlotVisualiser::whisker_line_top(BasicGraphicsObjectContainer& visitor, const CustomisedPoint& point) const { const Transformation& transformation = visitor.transformation(); Polyline* whisker = new Polyline(); - whisker->setColour(*whisker_box_colour_); + whisker->setColour(*whisker_line_colour_); whisker->setLineStyle(whisker_line_style_); whisker->setThickness(whisker_line_thickness_); From 3c9f032eb8d8c8b36a43382a1e6afdadab8ce1df Mon Sep 17 00:00:00 2001 From: Sandor Kertesz Date: Wed, 8 Jun 2022 14:27:11 +0100 Subject: [PATCH 10/66] Boxplot: make plotting possible from Metview MAGP-616 --- src/libMagWrapper/MagPlus.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libMagWrapper/MagPlus.cc b/src/libMagWrapper/MagPlus.cc index 2d855f4af..bcdb602dd 100644 --- a/src/libMagWrapper/MagPlus.cc +++ b/src/libMagWrapper/MagPlus.cc @@ -43,9 +43,7 @@ #include "ObsDecoderWrapper.h" #include "ObsPlottingWrapper.h" -#if 0 #include "BoxPlotDecoderWrapper.h" -#endif #include "ContourWrapper.h" #include "GeoJSonWrapper.h" @@ -58,9 +56,9 @@ #include "TextVisitor.h" #include "TextVisitorWrapper.h" -#if 0 + #include "BoxPlotVisualiserWrapper.h" -#endif + #include "GraphPlottingWrapper.h" #include "MultiVisdef.h" @@ -1425,7 +1423,6 @@ bool MagPlus::bufr(magics::MagRequest& in) { } bool MagPlus::inputBoxplot(magics::MagRequest& in) { -#if 0 in.print(); VisualAction* action = new VisualAction(); top()->push_back(action); @@ -1435,7 +1432,7 @@ bool MagPlus::inputBoxplot(magics::MagRequest& in) { boxplot.set(in); top()->data(boxplot.object()); setIconInfo(in, *boxplot.object()); -#endif + return false; // do not exit } bool MagPlus::symbol(magics::MagRequest& in) { @@ -1495,7 +1492,6 @@ bool MagPlus::obs(magics::MagRequest& in) { return false; // do not exit } bool MagPlus::boxplot(magics::MagRequest& in) { -#if 0 BoxPlotVisualiserWrapper visdef; visdef.set(in); @@ -1503,7 +1499,7 @@ bool MagPlus::boxplot(magics::MagRequest& in) { MagLog::dev() << "add boxplot visualiser" << *visdef.object() << endl; top()->visdef(visdef.object()); pop(); -#endif + return false; // do not exit } bool MagPlus::dataloop(magics::MagRequest& in) { From feaf0182c89e7d02efad456b39e8734211689c93 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 8 Jun 2022 19:08:25 +0100 Subject: [PATCH 11/66] OutOfBound --- src/attributes/IsoShadingAttributes.cc | 16 +---- src/attributes/IsoShadingAttributes.h | 2 - src/attributes/IsoShadingWrapper.cc | 8 --- src/attributes/LevelSelectionAttributes.cc | 14 ++++ src/attributes/LevelSelectionAttributes.h | 2 + src/attributes/LevelSelectionWrapper.cc | 8 +++ src/params/IsoShading.xml | 16 +---- src/params/LevelSelection.xml | 18 +++++ src/visualisers/CountSelectionType.cc | 81 ++++++++++------------ src/visualisers/IntervalSelectionType.cc | 56 ++++++++------- src/visualisers/IsoShading.h | 21 +++--- src/visualisers/LevelListSelectionType.cc | 29 ++++++-- 12 files changed, 145 insertions(+), 126 deletions(-) diff --git a/src/attributes/IsoShadingAttributes.cc b/src/attributes/IsoShadingAttributes.cc index c33ae9e27..8d855cd25 100644 --- a/src/attributes/IsoShadingAttributes.cc +++ b/src/attributes/IsoShadingAttributes.cc @@ -25,9 +25,7 @@ using namespace magics; IsoShadingAttributes::IsoShadingAttributes(): - shade_max_(ParameterManager::getDouble("contour_shade_max_level")), - shade_min_(ParameterManager::getDouble("contour_shade_min_level")) - , + technique_(MagTranslator().magics("contour_shade_technique")), colourMethod_(MagTranslator().magics("contour_shade_colour_method")) @@ -51,8 +49,6 @@ void IsoShadingAttributes::set(const std::map& params) prefix[i++] = "contour_shade"; prefix[i++] = "contour_shade"; - setAttribute(prefix, "contour_shade_max_level", shade_max_, params); - setAttribute(prefix, "contour_shade_min_level", shade_min_, params); setMember(prefix, "contour_shade_technique", technique_, params); setMember(prefix, "contour_shade_colour_method", colourMethod_, params); @@ -61,8 +57,6 @@ void IsoShadingAttributes::set(const std::map& params) void IsoShadingAttributes::copy(const IsoShadingAttributes& other) { - shade_max_ = other.shade_max_; - shade_min_ = other.shade_min_; technique_ = unique_ptr(other.technique_->clone()); colourMethod_ = unique_ptr(other.colourMethod_->clone()); @@ -111,8 +105,6 @@ void IsoShadingAttributes::set(const XmlNode& node) void IsoShadingAttributes::print(ostream& out) const { out << "Attributes["; - out << " shade_max = " << shade_max_; - out << " shade_min = " << shade_min_; out << " technique = " << *technique_; out << " colourMethod = " << *colourMethod_; @@ -122,10 +114,6 @@ void IsoShadingAttributes::print(ostream& out) const void IsoShadingAttributes::toxml(ostream& out) const { out << "\"shading\""; - out << ", \"contour_shade_max_level\":"; - niceprint(out,shade_max_); - out << ", \"contour_shade_min_level\":"; - niceprint(out,shade_min_); out << ", \"contour_shade_technique\":"; technique_->toxml(out); out << ", \"contour_shade_colour_method\":"; @@ -133,8 +121,6 @@ void IsoShadingAttributes::toxml(ostream& out) const } -static MagicsParameter contour_shade_max_level("contour_shade_max_level", 1.0e+21); -static MagicsParameter contour_shade_min_level("contour_shade_min_level", -1.0e+21); static MagicsParameter contour_shade_technique("contour_shade_technique", "polygon_shading"); static MagicsParameter contour_shade_colour_method("contour_shade_colour_method", "calculate"); #include "PolyShadingTechnique.h" diff --git a/src/attributes/IsoShadingAttributes.h b/src/attributes/IsoShadingAttributes.h index f6f724e97..6dceef32a 100644 --- a/src/attributes/IsoShadingAttributes.h +++ b/src/attributes/IsoShadingAttributes.h @@ -52,8 +52,6 @@ class IsoShadingAttributes virtual void toxml(std::ostream& out) const; // -- members: string tag_; - double shade_max_; - double shade_min_; unique_ptr technique_; unique_ptr colourMethod_; diff --git a/src/attributes/IsoShadingWrapper.cc b/src/attributes/IsoShadingWrapper.cc index 992d2a3de..0f160de6d 100644 --- a/src/attributes/IsoShadingWrapper.cc +++ b/src/attributes/IsoShadingWrapper.cc @@ -62,14 +62,6 @@ void IsoShadingWrapper::set(const MagRequest& request) NoIsoShadingWrapper::set(request); - if (request.countValues("CONTOUR_SHADE_MAX_LEVEL") ) { - double shade_max_value = request("CONTOUR_SHADE_MAX_LEVEL"); - isoshading_->shade_max_ = shade_max_value; - } - if (request.countValues("CONTOUR_SHADE_MIN_LEVEL") ) { - double shade_min_value = request("CONTOUR_SHADE_MIN_LEVEL"); - isoshading_->shade_min_ = shade_min_value; - } string technique_value = request.countValues("CONTOUR_SHADE_TECHNIQUE") ? (string) request("CONTOUR_SHADE_TECHNIQUE") : "polygon_shading"; diff --git a/src/attributes/LevelSelectionAttributes.cc b/src/attributes/LevelSelectionAttributes.cc index 27e22b9b9..6f83ad279 100644 --- a/src/attributes/LevelSelectionAttributes.cc +++ b/src/attributes/LevelSelectionAttributes.cc @@ -27,6 +27,8 @@ using namespace magics; LevelSelectionAttributes::LevelSelectionAttributes(): max_(ParameterManager::getDouble("contour_max_level")), min_(ParameterManager::getDouble("contour_min_level")), + shade_max_(ParameterManager::getDouble("contour_shade_max_level")), + shade_min_(ParameterManager::getDouble("contour_shade_min_level")), oob_min_(ParameterManager::getDouble("contour_out_of_bound_min")), oob_max_(ParameterManager::getDouble("contour_out_of_bound_max")) @@ -49,6 +51,8 @@ void LevelSelectionAttributes::set(const std::map& params) setAttribute(prefix, "contour_max_level", max_, params); setAttribute(prefix, "contour_min_level", min_, params); + setAttribute(prefix, "contour_shade_max_level", shade_max_, params); + setAttribute(prefix, "contour_shade_min_level", shade_min_, params); setAttribute(prefix, "contour_out_of_bound_min", oob_min_, params); setAttribute(prefix, "contour_out_of_bound_max", oob_max_, params); @@ -59,6 +63,8 @@ void LevelSelectionAttributes::copy(const LevelSelectionAttributes& other) { max_ = other.max_; min_ = other.min_; + shade_max_ = other.shade_max_; + shade_min_ = other.shade_min_; oob_min_ = other.oob_min_; oob_max_ = other.oob_max_; @@ -101,6 +107,8 @@ void LevelSelectionAttributes::print(ostream& out) const out << "Attributes["; out << " max = " << max_; out << " min = " << min_; + out << " shade_max = " << shade_max_; + out << " shade_min = " << shade_min_; out << " oob_min = " << oob_min_; out << " oob_max = " << oob_max_; @@ -114,6 +122,10 @@ void LevelSelectionAttributes::toxml(ostream& out) const niceprint(out,max_); out << ", \"contour_min_level\":"; niceprint(out,min_); + out << ", \"contour_shade_max_level\":"; + niceprint(out,shade_max_); + out << ", \"contour_shade_min_level\":"; + niceprint(out,shade_min_); out << ", \"contour_out_of_bound_min\":"; niceprint(out,oob_min_); out << ", \"contour_out_of_bound_max\":"; @@ -123,5 +135,7 @@ void LevelSelectionAttributes::toxml(ostream& out) const static MagicsParameter contour_max_level("contour_max_level", 1.0e+21); static MagicsParameter contour_min_level("contour_min_level", -1.0e+21); +static MagicsParameter contour_shade_max_level("contour_shade_max_level", 1.0e+21); +static MagicsParameter contour_shade_min_level("contour_shade_min_level", -1.0e+21); static MagicsParameter contour_out_of_bound_min("contour_out_of_bound_min", -1.0e+21); static MagicsParameter contour_out_of_bound_max("contour_out_of_bound_max", 1.0e+21); diff --git a/src/attributes/LevelSelectionAttributes.h b/src/attributes/LevelSelectionAttributes.h index b1e50046b..700f67428 100644 --- a/src/attributes/LevelSelectionAttributes.h +++ b/src/attributes/LevelSelectionAttributes.h @@ -52,6 +52,8 @@ class LevelSelectionAttributes string tag_; double max_; double min_; + double shade_max_; + double shade_min_; double oob_min_; double oob_max_; diff --git a/src/attributes/LevelSelectionWrapper.cc b/src/attributes/LevelSelectionWrapper.cc index 05d0c0d78..89285d892 100644 --- a/src/attributes/LevelSelectionWrapper.cc +++ b/src/attributes/LevelSelectionWrapper.cc @@ -63,6 +63,14 @@ void LevelSelectionWrapper::set(const MagRequest& request) double min_value = request("CONTOUR_MIN_LEVEL"); levelselection_->min_ = min_value; } + if (request.countValues("CONTOUR_SHADE_MAX_LEVEL") ) { + double shade_max_value = request("CONTOUR_SHADE_MAX_LEVEL"); + levelselection_->shade_max_ = shade_max_value; + } + if (request.countValues("CONTOUR_SHADE_MIN_LEVEL") ) { + double shade_min_value = request("CONTOUR_SHADE_MIN_LEVEL"); + levelselection_->shade_min_ = shade_min_value; + } if (request.countValues("CONTOUR_OUT_OF_BOUND_MIN") ) { double oob_min_value = request("CONTOUR_OUT_OF_BOUND_MIN"); levelselection_->oob_min_ = oob_min_value; diff --git a/src/params/IsoShading.xml b/src/params/IsoShading.xml index 81ab780f4..b483f9c48 100644 --- a/src/params/IsoShading.xml +++ b/src/params/IsoShading.xml @@ -31,22 +31,8 @@ does it submit to any jurisdiction. visible="no"> - - - - Maximum level for which shading is required - - - Minimum level for which shading is required + Lowest level for contours to be drawn + + Maximimum level for which shading is required + + + + Minimum level for which shading is required + + minbounds = { min, oob_min_, min_, }; - vector maxbounds = { max, oob_max_, max_ }; - - for (auto i = maxbounds.begin(); i != maxbounds.end(); ++i) { - cout << "max " << *i << endl; - } + double min_level=min; + double max_level=max; - for (auto i = minbounds.begin(); i != minbounds.end(); ++i) { - cout << "min " << *i << endl; - } + if ( MINSET(min_) ) + min_level = min_; + + if ( MAXSET(max_) ) + max_level = max_; - auto mini = *std::max_element(minbounds.begin(), minbounds.end()); - auto maxi = *std::min_element(maxbounds.begin(), maxbounds.end()); + if ( shading && MINSET(shade_min_) ) + min_level = shade_min_; - minOutOfBond_ = oob_min_ > std::max(min, min_); - maxOutOfBond_ = oob_max_ < std::min(max, max_); + if ( shading && MAXSET(shade_max_) ) + max_level = shade_max_; + minOutOfBond_ = oob_min_ > min_level; + maxOutOfBond_ = oob_max_ < max_level; int i = 0; - if ( minOutOfBond_ ) { - cout << "minOutOfBond_" << endl; i++; + } - + if ( maxOutOfBond_ ) { - cout << "maxOutOfBond_" << endl; - i++; + i++; } - - // if ( mini > oob_min_ ) - // i++; - // if ( maxi < oob_max_ ) - // i++; - - // i += ( same(maxi, 1.0e+21) ) ? 1 : 0; - // i += ( same(mini, -1.0e+21) ) ? 1 : 0; + i += ( MINSET(min_level) ) ? 1 : 0; + i += ( MAXSET(max_level) ) ? 1 : 0; - cout << mini << " " << maxi << " " << i << endl; + cout << min_level << " " << max_level << " " << i << endl; double nb = levelCount_ - 1; - if (same(maxi, mini)) { - push_back(mini); + if (same(max_level, min_level)) { + push_back(min_level); return; } - double step = (maxi - mini) / nb; + double step = (max_level - min_level) / nb; double toleranceProportion = (double)tolerance_ / (double)(levelCount_ + 1 + i); // tolerance as a proportion of the number of levels @@ -95,7 +88,7 @@ void CountSelectionType::calculate(double min, double max, bool) { // number of levels we will not actually plot, ie the min/max contours). if (same(step, 0)) { // Only one isoline! - push_back(mini); + push_back(min_level); return; } @@ -147,12 +140,12 @@ void CountSelectionType::calculate(double min, double max, bool) { inc *= istep; // convert back into proper range - double first = floor(mini / inc) * inc; + double first = floor(min_level / inc) * inc; - while (first > mini) + while (first > min_level) first -= inc; - push_back(mini); + push_back(min_level); first += inc; double epsilon = inc / 10000.0; while (same(epsilon, 0)) { @@ -161,18 +154,18 @@ void CountSelectionType::calculate(double min, double max, bool) { } - for (double val = first; val < maxi; val += inc) { + for (double val = first; val < max_level; val += inc) { // special case - if the value is close to zero then set it to precisely zero to avoid later formatting issues if (fabs(val) < epsilon) push_back(0.0); - else if (same(val, maxi)) - push_back(maxi); + else if (same(val, max_level)) + push_back(max_level); else push_back(val); } - if (maxi != back()) - push_back(maxi); + if (max_level != back()) + push_back(max_level); int si = static_cast(size()); @@ -182,11 +175,11 @@ void CountSelectionType::calculate(double min, double max, bool) { if (si - i < levelCount_ - tolerance_ || si - i > levelCount_ + tolerance_) { MagLog::debug() << "Not using nice levels[" << levelCount_ << ", " << tolerance_ << "]-->" << size() << endl; clear(); - step = (maxi - mini) / (levelCount_ - 1); - double val = mini; + step = (max_level - min_level) / (levelCount_ - 1); + double val = min_level; while (1) { push_back(val); - if (same(val, maxi) || val > maxi) + if (same(val, max_level) || val > max_level) break; val += step; } diff --git a/src/visualisers/IntervalSelectionType.cc b/src/visualisers/IntervalSelectionType.cc index 66e39ea52..c4e10c572 100644 --- a/src/visualisers/IntervalSelectionType.cc +++ b/src/visualisers/IntervalSelectionType.cc @@ -40,56 +40,60 @@ void IntervalSelectionType::print(ostream& out) const { out << "]"; } +#define MINSET(v) !same(v, -1.0e+21) +#define MAXSET(v) !same(v, +1.0e+21) void IntervalSelectionType::calculate(double min, double max, bool shading) { clear(); std::set levels; - vector minbounds = { min, oob_min_, min_, }; - vector maxbounds = { max, oob_max_, max_ }; + double min_level=min; + double max_level=max; - for (auto i = maxbounds.begin(); i != maxbounds.end(); ++i) { - cout << "max " << *i << endl; - } - - for (auto i = minbounds.begin(); i != minbounds.end(); ++i) { - cout << "min " << *i << endl; - } + if ( MINSET(min_) ) + min_level = min_; + + if ( MAXSET(max_) ) + max_level = max_; - auto lmin = *std::max_element(minbounds.begin(), minbounds.end()); - auto lmax = *std::min_element(maxbounds.begin(), maxbounds.end()); + if ( shading && MINSET(shade_min_) ) + min_level = shade_min_; - minOutOfBond_ = oob_min_ > std::max(min, min_); - maxOutOfBond_ = oob_max_ < std::min(max, max_); + if ( shading && MAXSET(shade_max_) ) + max_level = shade_max_; + + + minOutOfBond_ = oob_min_ > min_level; + maxOutOfBond_ = oob_max_ < max_level; if ( minOutOfBond_ ) { - lmin = oob_min_; - levels.insert(min); - cout << "HERE" << endl; + levels.insert(min_level); + min_level = oob_min_; } if ( maxOutOfBond_ ) { - lmax = oob_max_; - levels.insert(max); + levels.insert(max_level); + max_level = oob_max_; } + - levels.insert(lmin); - levels.insert(lmax); + levels.insert(min_level); + levels.insert(max_level); double level = reference_; double newref; int i = 1; - while (level < lmax && !same(level, lmax)) { - if (level > lmin) + while (level < max_level && !same(level, max_level)) { + if (level > min_level) levels.insert(level); level = reference_ + (i * interval_); i++; } level = reference_; i = 1; - while (level > lmin && !same(level, lmin)) { - if (level < lmax) + while (level > min_level && !same(level, min_level)) { + if (level < max_level) levels.insert(level); level = reference_ - (i * interval_); i++; @@ -102,9 +106,9 @@ void IntervalSelectionType::calculate(double min, double max, bool shading) { push_back(*level); } out << "]" << endl; - cout << out.str() << endl; + // cout << out.str() << endl; - // Now make sure that the reference is inside the interval .. + } double IntervalSelectionType::reference(int freq) const { diff --git a/src/visualisers/IsoShading.h b/src/visualisers/IsoShading.h index 9f6ebfdb6..1bbe70ab3 100644 --- a/src/visualisers/IsoShading.h +++ b/src/visualisers/IsoShading.h @@ -129,22 +129,21 @@ class IsoShading : public NoIsoShading, public IsoShadingAttributes { virtual bool needClipping() override { return (*this->technique_).needClipping(); } virtual bool operator()(LevelSelection& list) override { - LevelSelection filter; - for (LevelSelection::const_iterator level = list.begin(); level != list.end(); ++level) - if (shade_min_ <= *level && *level <= shade_max_) - filter.push_back(*level); + // LevelSelection filter; + // for (LevelSelection::const_iterator level = list.begin(); level != list.end(); ++level) + // if (shade_min_ <= *level && *level <= shade_max_) { + // filter.push_back(*level); + // cout << shade_min_ << " < " << *level << " < " << shade_max_ << endl; + // } - (*this->colourMethod_).prepare(list, filter); + (*this->colourMethod_).prepare(list, list); + if (!list.empty() && (list.back() == list.front())) + list.push_back(list.front()); - if (!filter.empty() && (filter.back() == filter.front())) - filter.push_back(filter.front()); - - - - return (*this->technique_).prepare(filter, *this->colourMethod_); + return (*this->technique_).prepare(list, *this->colourMethod_); } // returns true, if the contouring lines have to be created... False, is the shading is finished... virtual void visit(LegendVisitor& legend) override { diff --git a/src/visualisers/LevelListSelectionType.cc b/src/visualisers/LevelListSelectionType.cc index 26d7c88a0..939c92a01 100644 --- a/src/visualisers/LevelListSelectionType.cc +++ b/src/visualisers/LevelListSelectionType.cc @@ -39,23 +39,42 @@ void LevelListSelectionType::print(ostream& out) const { out << "]"; } +#define MINSET(v) !same(v, -1.0e+21) +#define MAXSET(v) !same(v, +1.0e+21) -void LevelListSelectionType::calculate(double min, double max, bool) { +void LevelListSelectionType::calculate(double min, double max, bool shading) { clear(); + double min_level=min; + double max_level=max; + + if ( MINSET(min_) ) + min_level = min_; + + if ( MAXSET(max_) ) + max_level = max_; + + if ( shading && MINSET(shade_min_) ) + min_level = shade_min_; + + if ( shading && MAXSET(shade_max_) ) + max_level = shade_max_; + + minOutOfBond_ = oob_min_ > min_level; + maxOutOfBond_ = oob_max_ < max_level; + - minOutOfBond_ = same(min_, -1.0e+21) && !same(oob_min_, -1.0e+21); - maxOutOfBond_ = same(max_, 1.0e+21) && !same(oob_max_, 1.0e+21); + double mini = min_; double maxi = max_; if (minOutOfBond_) { push_back(min); push_back(oob_min_); - mini = oob_min_; + min_level = oob_min_; } if (maxOutOfBond_) { - maxi = oob_max_; + max_level = oob_max_; } From 74e66595e07e7d65db2bfe6559bf0d48b4178815 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Sat, 11 Jun 2022 08:43:46 +0100 Subject: [PATCH 12/66] work in progress push for hackathon --- src/web/GeoJSon.cc | 18 ++++++++------ tools/xml2milana.py | 60 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/src/web/GeoJSon.cc b/src/web/GeoJSon.cc index 68e1fc8a8..0000a41b1 100644 --- a/src/web/GeoJSon.cc +++ b/src/web/GeoJSon.cc @@ -94,7 +94,6 @@ class GeoObject { vector objects_; virtual GeoObject* push_back(GeoObject* o) { objects_.push_back(o); - o->parent_ = this; return o; } @@ -134,6 +133,8 @@ class GeoFeature : public GeoObject { virtual ~GeoFeature() {} + + void boundingBox(double& min, double& max) { min = 900000; max = -min; @@ -211,11 +212,9 @@ class GeoPoint : public GeoObject { while (lon_ > max) lon_ -= 360; } - - UserPoint* point = new UserPoint(lon_, lat_, tonumber(getProperty("value", "0")), false, false, getProperty("name")); - + cout << "pushing " << *point << endl; out.push_back(point); } void shift(PointsList& out, double value) { @@ -499,6 +498,7 @@ void GeoJSon::features(const Value& value) { } } void GeoJSon::geometry(const Value& value) { + dig(value); } @@ -515,19 +515,19 @@ void GeoJSon::dig(const Value& value) { // Find the type : string type = find(object, "type"); - + GeoObject* previous = current_; if (type != "") { GeoObject* current = SimpleObjectMaker::create(type); previous = current_; current_ = (current_) ? current_->push_back(current) : current; + current_ = current; if (!parent_) parent_ = current_; } for (auto entry = object.begin(); entry != object.end(); ++entry) { map::iterator method = methods_.find(entry->first); - if (method != methods_.end()) { ((this->*method->second)(entry->second)); } @@ -584,20 +584,22 @@ void GeoJSon::decode() { void GeoJSon::points(const Transformation& transformation, vector& points) { decode(); + cout << " GeoJSon::points" << endl; } PointsHandler& GeoJSon::points(const Transformation& transformation, bool) { decode(); pointsHandlers_.push_back(new PointsHandler(*this)); return *(pointsHandlers_.back()); + cout << " GeoJSon::points khfkjdhgjkh" << endl; + } void GeoJSon::customisedPoints(const Transformation&, const std::set& needs, CustomisedPointsList& out, bool) { decode(); - - if (parent_) { parent_->create(needs, out); parent_->shift(needs, out); } + cout << " GeoJSon::poincustomisedPointsts" << endl; } diff --git a/tools/xml2milana.py b/tools/xml2milana.py index 060fab4f3..837c5e595 100644 --- a/tools/xml2milana.py +++ b/tools/xml2milana.py @@ -1,10 +1,60 @@ import xmltodict -with open("../src/params/CoastPlotting.xml") as fd: - definition = xmltodict.parse(fd) +import ipywidgets as widgets -print definition +with open("../src/params/BoxPlotVisualiser.xml") as fd: + l = fd.read() + definition = xmltodict.parse(l) -for params in definition["magics"]["class"]: - print params + +print (definition["magics"]["class"]) + +def boolean(data): + name = data["@name"] + return 'widgets.ToggleButtons(description={}, options = ["on", "off"])'.format(name) + +def colour(data): + name = data["@name"] + return 'widgets.DropDown(description={}, options = ["red", "blue", "green", "navy", "pink"])'.format(name) + +def style(data): + name = data["@name"] + return 'widgets.DropDown(description={}, options = ["dash", "solid", "dot"])'.format(name) + + +def choice(data): + name = data["@name"] + values = data.get("@values", None) + if values: + return 'widgets.DropDown(description={}, options = {})'.format(name, values.split("/")) + return "" + + +def ignore(data): + name = data["@name"] + + return "ignore" + +def float(data): + name = data["@name"] + return 'widgets.IntSlider(description={}'.format(name) + +def int(data): + name = data["@name"] + return 'widgets.FloatSlider(description={}'.format(name) + +helpers = { + "bool" : boolean, + "Colour" : colour, + "float" : float, + "int" : int, + "LineStyle" : style, + "string" : choice, +} + + +for e in definition["magics"]["class"]["parameter"]: + print (e["@name"], e["@to"]) + to = e["@to"] + print(helpers.get(to, ignore)(e)) \ No newline at end of file From db23ed04eaccef1d68f9b82dd5474921678c4932 Mon Sep 17 00:00:00 2001 From: Stephan Siemen Date: Sun, 12 Jun 2022 09:22:52 +0100 Subject: [PATCH 13/66] SYMBOL - add a primitive duck symbol For 2022 Vis Hackathon --- share/magics/symbols.svg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/share/magics/symbols.svg b/share/magics/symbols.svg index 9fcc7014e..3c0d20aa4 100644 --- a/share/magics/symbols.svg +++ b/share/magics/symbols.svg @@ -7,6 +7,14 @@ + + + + + + + + From 28b1641fd5a4cb487d349ecb7c244b2fcf12bbd9 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sun, 12 Jun 2022 13:33:26 +0100 Subject: [PATCH 14/66] Pass by const ref --- src/visualisers/VisDefInfo.cc | 10 +++++----- src/visualisers/VisDefInfo.h | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/visualisers/VisDefInfo.cc b/src/visualisers/VisDefInfo.cc index c1611caf0..1654040df 100644 --- a/src/visualisers/VisDefInfo.cc +++ b/src/visualisers/VisDefInfo.cc @@ -21,7 +21,7 @@ // //=============================================================== -VisDefInfoBase::VisDefInfoBase(string fConf, DataType dataType) : fConf_(fConf), dataType_(dataType) { +VisDefInfoBase::VisDefInfoBase(const string& fConf, DataType dataType) : fConf_(fConf), dataType_(dataType) { loaded_ = false; dataTypeName_[GribType] = "GRIB"; } @@ -38,7 +38,7 @@ void VisDefInfoBase::clear() { items_.clear(); } -VisDefInfoItem* VisDefInfoBase::addItem(string name) { +VisDefInfoItem* VisDefInfoBase::addItem(const string& name) { VisDefInfoItem* item = new VisDefInfoItem(name); items_.push_back(item); return item; @@ -70,7 +70,7 @@ void VisDefInfoBase::collectKeys() { //=============================================================== -ObstatVisDefInfo::ObstatVisDefInfo(string fConf, DataType dataType) : VisDefInfoBase(fConf, dataType) { +ObstatVisDefInfo::ObstatVisDefInfo(const string& fConf, DataType dataType) : VisDefInfoBase(fConf, dataType) { fConf_ = buildSharePath("ObstatGribVisDef.txt"); loadItems(); @@ -201,7 +201,7 @@ void ObstatVisDefInfo::getAttributes(MetaDataCollector& meta, map> num; @@ -217,7 +217,7 @@ string ObstatVisDefInfo::removeZerosFromNumber(string s) { // //=================================================== -VisDefInfoBase* VisDefInfoFactory::makeItem(string type) { +VisDefInfoBase* VisDefInfoFactory::makeItem(const string& type) { if (type == "ObstatGrib") { return new ObstatVisDefInfo("", VisDefInfoBase::GribType); } diff --git a/src/visualisers/VisDefInfo.h b/src/visualisers/VisDefInfo.h index beae7a080..a63b4747f 100644 --- a/src/visualisers/VisDefInfo.h +++ b/src/visualisers/VisDefInfo.h @@ -30,13 +30,13 @@ class MetaDataCollector; class VisDefInfoItem { public: - VisDefInfoItem(string name) : name_(name){}; + VisDefInfoItem(const string& name) : name_(name){}; - string name() { return name_; } + string name() const { return name_; } const map >& keys() const { return keys_; } const map& attributes() const { return attributes_; } - void addKey(string name, string value) { keys_[name].push_back(value); } - void addAttribute(string name, string value) { attributes_[name] = value; } + void addKey(const string& name, const string& value) { keys_[name].push_back(value); } + void addAttribute(const string& name, const string& value) { attributes_[name] = value; } public: string name_; @@ -53,9 +53,9 @@ class VisDefInfoBase { virtual ~VisDefInfoBase(); - VisDefInfoItem* addItem(string); + VisDefInfoItem* addItem(const string&); const vector& keys() { return keys_; } - string type() { return type_; } + string type() const { return type_; } // virtual vector visDefFile(MvKeyProfile*,int) {return QStringList() ;} // virtual MvRequest visDefRequest(MvKeyProfile*,int) {return MvRequest() ;} @@ -63,14 +63,14 @@ class VisDefInfoBase { virtual void getAttributes(MetaDataCollector&, map&) {} - bool isLoaded() { return loaded_; } + bool isLoaded() const { return loaded_; } void clear(); void deleteItem(int); virtual void loadItems() = 0; virtual void saveItems() = 0; protected: - VisDefInfoBase(string, DataType); + VisDefInfoBase(const string&, DataType); void collectKeys(); string fConf_; @@ -98,7 +98,7 @@ class VisDefInfoBase { class ObstatVisDefInfo : public VisDefInfoBase { public: - ObstatVisDefInfo(string, DataType); + ObstatVisDefInfo(const string&, DataType); ~ObstatVisDefInfo() override{}; void getAttributes(MetaDataCollector&, map&) override; @@ -106,13 +106,13 @@ class ObstatVisDefInfo : public VisDefInfoBase { void saveItems() override{}; protected: - string removeZerosFromNumber(string); + string removeZerosFromNumber(const string&); }; class VisDefInfoFactory { public: VisDefInfoFactory(){}; - static VisDefInfoBase* makeItem(string); + static VisDefInfoBase* makeItem(const string&); }; } // namespace magics From 4f06c63447d1a4100f7525c5159b8555315d478d Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Sun, 12 Jun 2022 16:36:31 +0100 Subject: [PATCH 15/66] hackathon --- share/magics/symbols.svg | 6 +-- src/attributes/GeoJSonAttributes.cc | 12 ++++- src/attributes/GeoJSonAttributes.h | 1 + src/attributes/GeoJSonWrapper.cc | 4 ++ src/basic/FortranMagics.cc | 10 ++++ src/params/GeoJSon.xml | 7 +++ src/visualisers/ObsItemFamily.cc | 71 +++++++++++++++++++++++++---- src/visualisers/ObsItemFamily.h | 12 +++-- src/visualisers/ObsPlotting.cc | 6 ++- src/visualisers/ObsTable.cc | 4 ++ src/web/GeoJSon.cc | 44 ++++++++++++++---- src/web/GeoJSon.h | 2 + 12 files changed, 150 insertions(+), 29 deletions(-) diff --git a/share/magics/symbols.svg b/share/magics/symbols.svg index 3c0d20aa4..ad3889d35 100644 --- a/share/magics/symbols.svg +++ b/share/magics/symbols.svg @@ -8,11 +8,11 @@ - - + + - + diff --git a/src/attributes/GeoJSonAttributes.cc b/src/attributes/GeoJSonAttributes.cc index 28f0bda4e..2c3672dd4 100644 --- a/src/attributes/GeoJSonAttributes.cc +++ b/src/attributes/GeoJSonAttributes.cc @@ -28,8 +28,9 @@ GeoJSonAttributes::GeoJSonAttributes(): type_(ParameterManager::getString("geojson_input_type")), path_(ParameterManager::getString("geojson_input_filename")), input_(ParameterManager::getString("geojson_input")), - binning_resolution_(ParameterManager::getDouble("geojson_binning_grid_resolution")) - + binning_resolution_(ParameterManager::getDouble("geojson_binning_grid_resolution")), + value_(ParameterManager::getString("geojson_value_property")) + { } @@ -51,7 +52,9 @@ void GeoJSonAttributes::set(const std::map& params) setAttribute(prefix, "geojson_input_filename", path_, params); setAttribute(prefix, "geojson_input", input_, params); setAttribute(prefix, "geojson_binning_grid_resolution", binning_resolution_, params); + setAttribute(prefix, "geojson_value_property", value_, params); + cout << value_ << endl; } @@ -61,6 +64,7 @@ void GeoJSonAttributes::copy(const GeoJSonAttributes& other) path_ = other.path_; input_ = other.input_; binning_resolution_ = other.binning_resolution_; + value_ = other.value_; } @@ -103,6 +107,7 @@ void GeoJSonAttributes::print(ostream& out) const out << " path = " << path_; out << " input = " << input_; out << " binning_resolution = " << binning_resolution_; + out << " value = " << value_; out << "]" << "\n"; } @@ -118,6 +123,8 @@ void GeoJSonAttributes::toxml(ostream& out) const niceprint(out,input_); out << ", \"geojson_binning_grid_resolution\":"; niceprint(out,binning_resolution_); + out << ", \"geojson_value_property\":"; + niceprint(out,value_); } @@ -125,3 +132,4 @@ static MagicsParameter geojson_input_type("geojson_input_type", "file"); static MagicsParameter geojson_input_filename("geojson_input_filename", ""); static MagicsParameter geojson_input("geojson_input", "{}"); static MagicsParameter geojson_binning_grid_resolution("geojson_binning_grid_resolution", 1.); +static MagicsParameter geojson_value_property("geojson_value_property", "value"); diff --git a/src/attributes/GeoJSonAttributes.h b/src/attributes/GeoJSonAttributes.h index 739fa73df..c9e43bff0 100644 --- a/src/attributes/GeoJSonAttributes.h +++ b/src/attributes/GeoJSonAttributes.h @@ -54,6 +54,7 @@ class GeoJSonAttributes string path_; string input_; double binning_resolution_; + string value_; private: diff --git a/src/attributes/GeoJSonWrapper.cc b/src/attributes/GeoJSonWrapper.cc index 1d9b3bd32..e95e78ee2 100644 --- a/src/attributes/GeoJSonWrapper.cc +++ b/src/attributes/GeoJSonWrapper.cc @@ -71,6 +71,10 @@ void GeoJSonWrapper::set(const MagRequest& request) double binning_resolution_value = request("GEOJSON_BINNING_GRID_RESOLUTION"); geojson_->binning_resolution_ = binning_resolution_value; } + if (request.countValues("GEOJSON_VALUE_PROPERTY") ) { + string value_value = request("GEOJSON_VALUE_PROPERTY"); + geojson_->value_ = value_value; + } } diff --git a/src/basic/FortranMagics.cc b/src/basic/FortranMagics.cc index a6b424299..576e5d00c 100644 --- a/src/basic/FortranMagics.cc +++ b/src/basic/FortranMagics.cc @@ -429,6 +429,14 @@ void FortranMagics::ptephi() { } void FortranMagics::pobs() { actions(); + + // HACK + action_->visdef(new ObsPlotting()); + + cout << "FortranMagics::pobs() {" << endl; + return; + + action_ = new VisualAction(); ObsDecoder* obs = new ObsDecoder(); if (obs->defined()) { @@ -822,6 +830,8 @@ void FortranMagics::ptext() { void FortranMagics::psymb() { actions(); + + string mode; string wind; ParameterManager::get("symbol_position_mode", mode); diff --git a/src/params/GeoJSon.xml b/src/params/GeoJSon.xml index 8c539088b..7d98c8c64 100644 --- a/src/params/GeoJSon.xml +++ b/src/params/GeoJSon.xml @@ -42,5 +42,12 @@ does it submit to any jurisdiction. name="geojson_binning_grid_resolution"> String containing the GeoJson data + + String containing the GeoJson data + diff --git a/src/visualisers/ObsItemFamily.cc b/src/visualisers/ObsItemFamily.cc index 0cfa52e18..7956243cc 100644 --- a/src/visualisers/ObsItemFamily.cc +++ b/src/visualisers/ObsItemFamily.cc @@ -53,10 +53,12 @@ void ObsWind::visit(std::set& tokens) { return; tokens.insert(speed_); tokens.insert(direction_); + + } void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { - if (!owner_->wind_visible_) - return; + // if (!owner_->wind_visible_) + // return; map::iterator it = point.begin(); map::iterator en = point.end(); @@ -65,6 +67,8 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { // F} Colour colour = owner_->wind_colour_->automatic() ? *owner_->colour_ : *owner_->wind_colour_; + + CustomisedPoint::const_iterator speed = point.find(speed_); if (speed == point.end()) return; @@ -72,11 +76,27 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { if (direction == point.end()) return; + + + if ( speed->second < 1. ) + colour = Colour("green"); + + if ( speed->second > 1.5 && speed->second <2 ) + colour = Colour("yellow"); + if ( speed->second > 2.5 && speed->second <3 ) + colour = Colour("orange"); + if ( speed->second > 3.5 && speed->second <4 ) + colour = Colour("red"); + if ( speed->second > 4 ) + colour = Colour("purple"); + + FlagItem* flag = new FlagItem(); flag->setColour(colour); - flag->length(owner_->size_ * 2.5); // Size to be adjusted later! + flag->setThickness(2); + flag->length(owner_->size_ * 2.); // Size to be adjusted later! - const string origin = "circle"; + const string origin = "duck"; // FMagLog::debug() << "OBS ITEM - ObsWind - Lon/Lat: " << point.longitude() << " / " << point.latitude() @@ -84,7 +104,7 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { // F << "\n\tcloud amount: " << point["total_cloud"] << " -> " << origin << std::endl; - flag->setOriginHeight(owner_->ring_size_); + flag->setOriginHeight(owner_->ring_size_ * 3); flag->setOriginMarker(origin); flag->x(0); flag->y(0); @@ -412,6 +432,23 @@ void ObsPresentWeather::visit(std::set& tokens) { static map presentweather; void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { + vector colour_list = { "none", "none", "none", "none", "cream", "cream", "cream", "cream", +"cream", "cream","yellow", "yellow", "yellow", "red", "kelly_green", +"kelly_green", "kelly_green", "red", "red", "red", "kelly_green", +"kelly_green", "white", "white", "red", "kelly_green", "white", +"red", "yellow", "red", "cream", "cream", "cream", "cream", "cream", +"cream", "white", "white", "white", "white", "yellow", "yellow", +"yellow", "yellow", "yellow", "yellow", "yellow", "yellow", "yellow", +"yellow", "kelly_green", "kelly_green", "kelly_green", "kelly_green", +"kelly_green", "kelly_green", "red", "red", "kelly_green", +"kelly_green", "kelly_green", "kelly_green", "kelly_green", +"kelly_green", "kelly_green", "kelly_green", "red", "red", "white", +"white", "white", "white","white", "white", "white", "white", "red", +"red", "red", "orange", "kelly_green", "kelly_green", "kelly_green", +"white", "white","white", "white", "red", "red", "red", "red", "red", +"red", "red", "red", "red", "red", "red", "red", "red"}; + + if (!owner_->present_ww_visible_) return; if (presentweather.empty()) { @@ -448,6 +485,7 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol presentweather[183] = "ww_81"; presentweather[189] = "ww_89"; } + CustomisedPoint::const_iterator value = point.find("present_weather"); if (value == point.end()) return; @@ -457,10 +495,18 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol return; string ww; + Colour colour = owner_->present_ww_colour_->automatic() ? *owner_->colour_ : *owner_->present_ww_colour_; + + string c = colour.name(); + if (value->second < 100) { ostringstream os; os << "ww_" << setw(2) << setfill('0') << value->second; ww = os.str(); + + c = colour_list[value->second]; + colour = Colour(c); + } else { map::iterator w = presentweather.find(value->second); @@ -471,17 +517,18 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol else ww = w->second; } - + cout << "Present Weather->" << ww << endl; if (ww.empty()) return; SymbolItem* object = new SymbolItem(); object->x(column_); object->y(row_); - Colour colour = owner_->present_ww_colour_->automatic() ? *owner_->colour_ : *owner_->present_ww_colour_; - object->colour(colour); + cout << "Present Weather->" << ww << endl; + + object->colour(colour); object->symbol(ww); // FMagLog::debug() << "\tPresent Weather--->" << ww << " in " << colour << "\n"; // time->setJustification(MRIGHT); @@ -623,9 +670,10 @@ void ObsIdentifier::visit(std::set&) { } void ObsIdentifier::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { - if (!owner_->identifier_visible_) - return; + // if (!owner_->identifier_visible_) + // return; TextItem* time = new TextItem(); + cout << "ObsIdentifier::operator()" << point.identifier() << endl; #ifdef OBS_DEBUG_ // FMagLog::debug() << "Identification for " << point.identifier() << "at[" << column_ << ", " << row_ << "]" << // endl; @@ -637,6 +685,7 @@ void ObsIdentifier::operator()(CustomisedPoint& point, ComplexSymbol& symbol) co time->x(column_); time->y(row_); time->text(point.identifier()); + cout << point.identifier() << endl; // time->setJustification(MRIGHT); time->font(font); @@ -1072,6 +1121,8 @@ void ObsString::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const } + text = "Duck-->°"; + TextItem* object = new TextItem(); object->x(column_); object->y(row_); diff --git a/src/visualisers/ObsItemFamily.h b/src/visualisers/ObsItemFamily.h index 846fab09e..854cea8f2 100644 --- a/src/visualisers/ObsItemFamily.h +++ b/src/visualisers/ObsItemFamily.h @@ -46,14 +46,16 @@ class ObsStationRing : public ObsItemBox { } void operator()(CustomisedPoint&, ComplexSymbol& symbol) const override { - if (!owner_->station_ring_visible_) - return; + + // if (!owner_->station_ring_visible_) + // return; SymbolItem* station = new SymbolItem(); station->x(column_); station->y(row_); station->colour(*owner_->station_ring_colour_); - station->symbol("circle"); - station->height(owner_->ring_size_); + // station->symbol("N_8"); + station->symbol("duck"); + station->height(owner_->ring_size_*2); symbol.add(station); } @@ -109,7 +111,7 @@ class ObsWind : public ObsItemBox { column_ = atoi(find(def, "column").c_str()); colour_ = find(def, "colour"); speed_ = find(def, "wind_speed", "wind_speed"); - direction_ = find(def, "wind_direction", "wind_direction"); + direction_ = find(def, "wind_direction", "wind_to_direction"); } protected: diff --git a/src/visualisers/ObsPlotting.cc b/src/visualisers/ObsPlotting.cc index 08fd1f460..5f9b82be6 100644 --- a/src/visualisers/ObsPlotting.cc +++ b/src/visualisers/ObsPlotting.cc @@ -43,7 +43,7 @@ void ObsPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { std::set needs; std::set info; multimap types; - + cout << "ObsPlotting::operator()" << endl; info.insert("type"); data.getInfo(info, types); @@ -73,10 +73,14 @@ void ObsPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { out.push_back(new ClearObject()); + + + for (multimap::const_iterator type = types.find("type"); type != types.end(); ++type) { try { const ObsTemplate& obs = ObsTable::getTemplate(type->second); for (const auto& val : values) { + cout << type->second << " " << val->type() << endl; if (type->second == val->type()) { obs(*val, out); } diff --git a/src/visualisers/ObsTable.cc b/src/visualisers/ObsTable.cc index 825ed745b..3130fe9ef 100644 --- a/src/visualisers/ObsTable.cc +++ b/src/visualisers/ObsTable.cc @@ -131,6 +131,8 @@ const ObsTemplate& ObsTable::get(const string& type) { void ObsTemplate::operator()(CustomisedPoint& obs, BasicGraphicsObjectContainer& out) const { + + cout << "ObsTemplate" << endl; if (empty()) return; // Nothing to display. @@ -149,6 +151,8 @@ void ObsTemplate::operator()(CustomisedPoint& obs, BasicGraphicsObjectContainer& out.push_back(symbol); + + for (const_iterator item = begin(); item != end(); ++item) (*(*item))(obs, *symbol); } diff --git a/src/web/GeoJSon.cc b/src/web/GeoJSon.cc index 0000a41b1..5daf53684 100644 --- a/src/web/GeoJSon.cc +++ b/src/web/GeoJSon.cc @@ -92,6 +92,7 @@ class GeoObject { } } vector objects_; + string value_; virtual GeoObject* push_back(GeoObject* o) { objects_.push_back(o); o->parent_ = this; @@ -213,8 +214,8 @@ class GeoPoint : public GeoObject { lon_ -= 360; } UserPoint* point = - new UserPoint(lon_, lat_, tonumber(getProperty("value", "0")), false, false, getProperty("name")); - cout << "pushing " << *point << endl; + new UserPoint(lon_, lat_, tonumber(getProperty(value_, "0")), false, false, getProperty("name")); + out.push_back(point); } void shift(PointsList& out, double value) { @@ -225,15 +226,25 @@ class GeoPoint : public GeoObject { } void set(const std::set& needs, CustomisedPoint& point) { + if (value_ == "value") { + point.type("mosmix"); + } + + else + point.type(value_); for (std::set::iterator need = needs.begin(); need != needs.end(); ++need) { + string value = getProperty(*need); + if (value.empty()) continue; point.insert(make_pair(*need, tonumber(value))); } + } void create(const std::set& needs, CustomisedPointsList& out) { + CustomisedPoint* point = new CustomisedPoint(lon_, lat_, getProperty("name")); set(needs, *point); out.push_back(point); @@ -266,7 +277,7 @@ class MultiLineString : public GeoObject { } vector > > lines_; void create(PointsList& out, const string& ref) { - double value = tonumber(getProperty("value", "0")); + double value = tonumber(getProperty(value_, "0")); string name = getProperty("name"); for (vector > >::iterator line = lines_.begin(); line != lines_.end(); ++line) { for (vector >::iterator point = line->begin(); point != line->end(); ++point) { @@ -277,7 +288,7 @@ class MultiLineString : public GeoObject { } } void shift(PointsList& out) { - double value = tonumber(getProperty("value", "0")); + double value = tonumber(getProperty(value_, "0")); string name = getProperty("name"); for (vector > >::iterator line = lines_.begin(); line != lines_.end(); ++line) { for (vector >::iterator point = line->begin(); point != line->end(); ++point) { @@ -519,6 +530,7 @@ void GeoJSon::dig(const Value& value) { GeoObject* previous = current_; if (type != "") { GeoObject* current = SimpleObjectMaker::create(type); + current->value_ = value_; previous = current_; current_ = (current_) ? current_->push_back(current) : current; current_ = current; @@ -572,7 +584,7 @@ void GeoJSon::decode() { if (MagicsGlobal::strict()) { throw; } - MagLog::error() << "Could not processed the file: " << path_ << ": " << e.what() << endl; + MagLog::error() << "GEOJSON:Could not processed the file: " << path_ << ": " << e.what() << endl; abort(); } if (parent_) { @@ -584,22 +596,38 @@ void GeoJSon::decode() { void GeoJSon::points(const Transformation& transformation, vector& points) { decode(); - cout << " GeoJSon::points" << endl; } PointsHandler& GeoJSon::points(const Transformation& transformation, bool) { decode(); pointsHandlers_.push_back(new PointsHandler(*this)); return *(pointsHandlers_.back()); - cout << " GeoJSon::points khfkjdhgjkh" << endl; } void GeoJSon::customisedPoints(const Transformation&, const std::set& needs, CustomisedPointsList& out, bool) { decode(); + cout << "GeoJSon::customisedPoints" << endl; + for (auto need = needs.begin(); need != needs.end(); ++need) + cout << "need " << *need << endl; if (parent_) { parent_->create(needs, out); parent_->shift(needs, out); } - cout << " GeoJSon::poincustomisedPointsts" << endl; +} +void GeoJSon::getInfo(const std::set& what, + multimap& info) +{ + // Hack should be read for the data + if (value_ == "value") { + info.insert(make_pair("type", "mosmix")); + cout << "MOSMIX" << endl; + } + else { + cout << "TYPE-->" << value_ << endl; + info.insert(make_pair("type", value_)); + } + + + } diff --git a/src/web/GeoJSon.h b/src/web/GeoJSon.h index 66db165fd..ffaebdf20 100644 --- a/src/web/GeoJSon.h +++ b/src/web/GeoJSon.h @@ -62,6 +62,8 @@ class GeoJSon : public Data, public PointsList, public GeoJSonAttributes { GeoObject* current_; GeoObject* parent_; Matrix* matrix_; + void getInfo(const std::set& what, multimap& info) override;; + private: //! Copy constructor - No copy allowed From 0ed2ba0e18e54215fbc73866736d0bc44e664eeb Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 27 Jun 2022 11:50:33 +0100 Subject: [PATCH 16/66] Symbolplotting + OutOfBound --- src/attributes/SymbolPlottingAttributes.cc | 28 +++++-------------- src/attributes/SymbolPlottingAttributes.h | 4 +-- src/attributes/SymbolPlottingWrapper.cc | 16 ++--------- src/common/Proj4Projection.cc | 11 ++++---- src/common/Proj4Projection.h | 7 +++-- src/common/Transformation.h | 2 +- src/params/SymbolPlotting.xml | 27 +++++------------- src/visualisers/ColourTechnique.cc | 9 +++++- src/visualisers/GradientsColourTechnique.cc | 10 +++---- src/visualisers/IsoShading.h | 6 ---- src/visualisers/LevelListSelectionType.cc | 31 +++++++++++---------- src/visualisers/SymbolAdvancedTableMode.cc | 10 ++++--- src/visualisers/SymbolAdvancedTableMode.h | 2 +- src/visualisers/SymbolMode.cc | 11 ++++---- src/visualisers/SymbolMode.h | 15 +++++++--- src/visualisers/SymbolPlotting.cc | 26 +++++++++++------ 16 files changed, 99 insertions(+), 116 deletions(-) diff --git a/src/attributes/SymbolPlottingAttributes.cc b/src/attributes/SymbolPlottingAttributes.cc index 151edc3d1..2d1fbd6df 100644 --- a/src/attributes/SymbolPlottingAttributes.cc +++ b/src/attributes/SymbolPlottingAttributes.cc @@ -26,9 +26,7 @@ using namespace magics; SymbolPlottingAttributes::SymbolPlottingAttributes(): legend_(ParameterManager::getBool("legend")), - scaling_method_(ParameterManager::getBool("symbol_scaling_method")), - scaling_level_0_(ParameterManager::getDouble("symbol_scaling_level_0_height")), - scaling_factor_(ParameterManager::getDouble("symbol_scaling_factor")), + unit_method_(ParameterManager::getString("symbol_height_unit")), type_(ParameterManager::getString("symbol_type")), marker_mode_(ParameterManager::getString("symbol_marker_mode")), format_(ParameterManager::getString("symbol_format")), @@ -63,9 +61,7 @@ void SymbolPlottingAttributes::set(const std::map& params) prefix[i++] = "symbol"; setAttribute(prefix, "legend", legend_, params); - setAttribute(prefix, "symbol_scaling_method", scaling_method_, params); - setAttribute(prefix, "symbol_scaling_level_0_height", scaling_level_0_, params); - setAttribute(prefix, "symbol_scaling_factor", scaling_factor_, params); + setAttribute(prefix, "symbol_height_unit", unit_method_, params); setAttribute(prefix, "symbol_type", type_, params); setAttribute(prefix, "symbol_marker_mode", marker_mode_, params); setAttribute(prefix, "symbol_format", format_, params); @@ -88,9 +84,7 @@ void SymbolPlottingAttributes::set(const std::map& params) void SymbolPlottingAttributes::copy(const SymbolPlottingAttributes& other) { legend_ = other.legend_; - scaling_method_ = other.scaling_method_; - scaling_level_0_ = other.scaling_level_0_; - scaling_factor_ = other.scaling_factor_; + unit_method_ = other.unit_method_; type_ = other.type_; marker_mode_ = other.marker_mode_; format_ = other.format_; @@ -149,9 +143,7 @@ void SymbolPlottingAttributes::print(ostream& out) const { out << "Attributes["; out << " legend = " << legend_; - out << " scaling_method = " << scaling_method_; - out << " scaling_level_0 = " << scaling_level_0_; - out << " scaling_factor = " << scaling_factor_; + out << " unit_method = " << unit_method_; out << " type = " << type_; out << " marker_mode = " << marker_mode_; out << " format = " << format_; @@ -176,12 +168,8 @@ void SymbolPlottingAttributes::toxml(ostream& out) const out << "\"symbol\""; out << ", \"legend\":"; niceprint(out,legend_); - out << ", \"symbol_scaling_method\":"; - niceprint(out,scaling_method_); - out << ", \"symbol_scaling_level_0_height\":"; - niceprint(out,scaling_level_0_); - out << ", \"symbol_scaling_factor\":"; - niceprint(out,scaling_factor_); + out << ", \"symbol_height_unit\":"; + niceprint(out,unit_method_); out << ", \"symbol_type\":"; niceprint(out,type_); out << ", \"symbol_marker_mode\":"; @@ -216,9 +204,7 @@ void SymbolPlottingAttributes::toxml(ostream& out) const } static MagicsParameter legend("legend", "off"); -static MagicsParameter symbol_scaling_method("symbol_scaling_method", "off"); -static MagicsParameter symbol_scaling_level_0_height("symbol_scaling_level_0_height", 0.1); -static MagicsParameter symbol_scaling_factor("symbol_scaling_factor", 4.); +static MagicsParameter symbol_height_unit("symbol_height_unit", "cm"); static MagicsParameter symbol_type("symbol_type", "number"); static MagicsParameter symbol_marker_mode("symbol_marker_mode", "index"); static MagicsParameter symbol_format("symbol_format", "(automatic)"); diff --git a/src/attributes/SymbolPlottingAttributes.h b/src/attributes/SymbolPlottingAttributes.h index 72ca920a5..ea7239de8 100644 --- a/src/attributes/SymbolPlottingAttributes.h +++ b/src/attributes/SymbolPlottingAttributes.h @@ -53,9 +53,7 @@ class SymbolPlottingAttributes // -- members: string tag_; bool legend_; - bool scaling_method_; - double scaling_level_0_; - double scaling_factor_; + string unit_method_; string type_; string marker_mode_; string format_; diff --git a/src/attributes/SymbolPlottingWrapper.cc b/src/attributes/SymbolPlottingWrapper.cc index a490b0cd0..f643d7423 100644 --- a/src/attributes/SymbolPlottingWrapper.cc +++ b/src/attributes/SymbolPlottingWrapper.cc @@ -61,19 +61,9 @@ void SymbolPlottingWrapper::set(const MagRequest& request) symbolplotting_->legend_ = MagTranslator()(legend_value); } - if (request.countValues("SYMBOL_SCALING_METHOD") ) { - string scaling_method_value = request("SYMBOL_SCALING_METHOD"); - - symbolplotting_->scaling_method_ = MagTranslator()(scaling_method_value); - - } - if (request.countValues("SYMBOL_SCALING_LEVEL_0_HEIGHT") ) { - double scaling_level_0_value = request("SYMBOL_SCALING_LEVEL_0_HEIGHT"); - symbolplotting_->scaling_level_0_ = scaling_level_0_value; - } - if (request.countValues("SYMBOL_SCALING_FACTOR") ) { - double scaling_factor_value = request("SYMBOL_SCALING_FACTOR"); - symbolplotting_->scaling_factor_ = scaling_factor_value; + if (request.countValues("SYMBOL_HEIGHT_UNIT") ) { + string unit_method_value = request("SYMBOL_HEIGHT_UNIT"); + symbolplotting_->unit_method_ = unit_method_value; } if (request.countValues("SYMBOL_TYPE") ) { string type_value = request("SYMBOL_TYPE"); diff --git a/src/common/Proj4Projection.cc b/src/common/Proj4Projection.cc index 5fe8a9174..ebe810fb7 100644 --- a/src/common/Proj4Projection.cc +++ b/src/common/Proj4Projection.cc @@ -1324,12 +1324,12 @@ double Proj4Projection::patchDistance(double res) const { double x1 = 0; double y1 = 60; double x2 = 0; - double y2 = 61; - fast_reproject(x1, y1); - fast_reproject(x2, y2); + double y2 = 60+res; - double degree = ((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)); - return 1000000000; + fast_reproject(y1, x1); + fast_reproject(y2, x2); + + return sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2))); } void Proj4Projection::collect(MetaDataCollector& collector) const { @@ -1418,7 +1418,6 @@ void Proj4Projection::setMinMaxX(double min, double max) { } - diff --git a/src/common/Proj4Projection.h b/src/common/Proj4Projection.h index de6d3cf31..76f4a69ab 100644 --- a/src/common/Proj4Projection.h +++ b/src/common/Proj4Projection.h @@ -387,12 +387,13 @@ class Proj4EPSG4326 : public Proj4Projection { class Proj4Automatic : public Proj4Projection { public: Proj4Automatic(); - void aspectRatio(double&, double&); + void aspectRatio(double&, double&) override; - void init(); + void init() override; - void setNewPCBox(double minx, double miny, double maxx, double maxy); + void setNewPCBox(double minx, double miny, + double maxx, double maxy) override; virtual void setExtend() override; diff --git a/src/common/Transformation.h b/src/common/Transformation.h index 2ef59f1ae..34ab70fc4 100644 --- a/src/common/Transformation.h +++ b/src/common/Transformation.h @@ -188,7 +188,7 @@ class Transformation { virtual bool fast_reproject(double& x, double& y) const { return true; } - virtual double patchDistance(double) const { NOTIMP; } + virtual double patchDistance(double x) const { return x; } virtual PaperPoint operator()(const PaperPoint& xy) const { return xy; } virtual void operator()(const UserPoint& geo, Polyline& out) const; diff --git a/src/params/SymbolPlotting.xml b/src/params/SymbolPlotting.xml index bce0be08f..9168e5276 100644 --- a/src/params/SymbolPlotting.xml +++ b/src/params/SymbolPlotting.xml @@ -29,27 +29,14 @@ does it submit to any jurisdiction. Turn legend on or off (ON/OFF) : New Parameter! - - Turn legend on or off (ON/OFF) : New Parameter! - - - - Turn legend on or off (ON/OFF) : New Parameter! - - - Turn legend on or off (ON/OFF) : New Parameter! + name="symbol_height_unit" + values= "cm/geograhical"> + if set to geographical, the height will be interpreted in degres of latitude + technique_).needClipping(); } virtual bool operator()(LevelSelection& list) override { - // LevelSelection filter; - // for (LevelSelection::const_iterator level = list.begin(); level != list.end(); ++level) - // if (shade_min_ <= *level && *level <= shade_max_) { - // filter.push_back(*level); - // cout << shade_min_ << " < " << *level << " < " << shade_max_ << endl; - // } (*this->colourMethod_).prepare(list, list); diff --git a/src/visualisers/LevelListSelectionType.cc b/src/visualisers/LevelListSelectionType.cc index 939c92a01..1833e91f7 100644 --- a/src/visualisers/LevelListSelectionType.cc +++ b/src/visualisers/LevelListSelectionType.cc @@ -45,9 +45,11 @@ void LevelListSelectionType::print(ostream& out) const { void LevelListSelectionType::calculate(double min, double max, bool shading) { clear(); - double min_level=min; - double max_level=max; + double min_level=list_.front(); + double max_level=list_.back(); + cout << min << " " << min_ << " " << shade_min_ << " " << oob_min_ << endl; + cout << max << " " << max_ << " " << shade_max_ << " " << oob_max_ << endl; if ( MINSET(min_) ) min_level = min_; @@ -60,13 +62,14 @@ void LevelListSelectionType::calculate(double min, double max, bool shading) { if ( shading && MAXSET(shade_max_) ) max_level = shade_max_; + + minOutOfBond_ = oob_min_ > min_level; maxOutOfBond_ = oob_max_ < max_level; - double mini = min_; - double maxi = max_; + if (minOutOfBond_) { push_back(min); push_back(oob_min_); @@ -83,7 +86,7 @@ void LevelListSelectionType::calculate(double min, double max, bool shading) { double prevVal = min_; for (doublearray::const_iterator val = list_.begin(); val != list_.end(); ++val) { MagLog::dev() << "LevelListSelectionType::calculate(double min, double max)--->" << *val << "\n"; - if (mini <= *val && *val <= maxi) { + if (min_level <= *val && *val <= max_level) { if (*val < prevVal) { MagLog::error() << " level list values should increase, but " << *val << " follows " << prevVal << endl; break; @@ -104,13 +107,13 @@ void LevelListSelectionType::calculate(double min, double max, bool shading) { push_back(*last); - ostringstream print; - print << "LevelListSelectionType::calculate-->"; - string sep = "["; - for (vector::const_iterator val = begin(); val != end(); ++val) { - print << sep << *val; - sep = ", "; - } - print << "]"; - cout << print.str() << endl; + // ostringstream print; + // print << "LevelListSelectionType::calculate-->"; + // string sep = "["; + // for (vector::const_iterator val = begin(); val != end(); ++val) { + // print << sep << *val; + // sep = ", "; + // } + // print << "]"; + // cout << print.str() << endl; } diff --git a/src/visualisers/SymbolAdvancedTableMode.cc b/src/visualisers/SymbolAdvancedTableMode.cc index 76a440539..e60f75aea 100644 --- a/src/visualisers/SymbolAdvancedTableMode.cc +++ b/src/visualisers/SymbolAdvancedTableMode.cc @@ -69,8 +69,9 @@ bool SymbolAdvancedTableMode::accept(double value) const { void SymbolAdvancedTableMode::prepare() {} -void SymbolAdvancedTableMode::adjust(double min, double max, bool scale, const Transformation& transformation, +void SymbolAdvancedTableMode::adjust(double min, double max, const Transformation& transformation, double scaling) { + static map texthandlers; if (texthandlers.empty()) { texthandlers["none"] = TextPosition::NONE; @@ -79,6 +80,7 @@ void SymbolAdvancedTableMode::adjust(double min, double max, bool scale, const T texthandlers["bottom"] = TextPosition::BELOW; texthandlers["right"] = TextPosition::RIGHT; } + scaling_ = scaling; map_.clear(); MagLog::dev() << "Data going from " << min << " to " << max << endl; levels_->set(*this); @@ -93,6 +95,8 @@ void SymbolAdvancedTableMode::adjust(double min, double max, bool scale, const T colourMethod_->prepare(*levels_, *levels_); height_method_->prepare(*levels_); + + if (markers_.empty()) { markers_.push_back(15); } @@ -131,9 +135,7 @@ void SymbolAdvancedTableMode::adjust(double min, double max, bool scale, const T MagLog::debug() << "[" << *level << ", " << *(level + 1) << "]=" << *marker << "(marker)" << *text << "(text)" << endl; - double height = height_method_->height(*level); - if (scale) - height = transformation.ratio() * height * scaling; + double height = height_method_->height(*level) * scaling_; SymbolProperties properties; if (index) properties = SymbolProperties(colourMethod_->right(*level), height, *marker, *text); diff --git a/src/visualisers/SymbolAdvancedTableMode.h b/src/visualisers/SymbolAdvancedTableMode.h index 07a9c3d9c..1dd4e23c4 100644 --- a/src/visualisers/SymbolAdvancedTableMode.h +++ b/src/visualisers/SymbolAdvancedTableMode.h @@ -68,7 +68,7 @@ class SymbolAdvancedTableMode : public SymbolMode, object->copy(*this); return object; } - void adjust(double, double, bool, const Transformation&, double) override; + void adjust(double, double, const Transformation&, double) override; void copy(const SymbolAdvancedTableMode& other) { SymbolAdvancedTableModeAttributes::copy(other); SymbolModeAttributes::copy(other); diff --git a/src/visualisers/SymbolMode.cc b/src/visualisers/SymbolMode.cc index b824be43b..814056220 100644 --- a/src/visualisers/SymbolMode.cc +++ b/src/visualisers/SymbolMode.cc @@ -31,7 +31,7 @@ using namespace magics; -SymbolMode::SymbolMode() {} +SymbolMode::SymbolMode(): scaling_(1) {} SymbolMode::~SymbolMode() {} @@ -77,7 +77,7 @@ void SymbolIndividualMode::properties() const { if (magCompare(type_, "number")) { position = TextPosition::NONE; properties_.colour_ = *colour_; - properties_.height_ = height_; + properties_.height_ = height_*scaling_; } else { string type = lowerCase(text_position_); @@ -89,7 +89,7 @@ void SymbolIndividualMode::properties() const { } else { properties_.colour_ = *colour_; - properties_.height_ = height_; + properties_.height_ = height_*scaling_; } } if (magCompare(marker_mode_, "image")) { @@ -183,7 +183,7 @@ void SymbolTableMode::prepare() { int index = 0; for (doublearray::const_iterator min = min_.begin(); min != min_.end(); ++min) { - map_[Interval(*min, *max)] = SymbolProperties(Colour(*colour), *height, *symbol); + map_[Interval(*min, *max)] = SymbolProperties(Colour(*colour), *height*scaling_, *symbol); map_[Interval(*min, *max)].blanking_ = parent_->text_blanking_; if (++colour == colour_.end()) --colour; @@ -247,8 +247,7 @@ void SymbolIndividualMode::visit(LegendVisitor& legend) { symbol->setHeight(legend_height_); legend.add(new SimpleSymbolEntry(legend_text_, symbol)); } -void SymbolIndividualMode::adjust(double, double, bool, const Transformation&, double) {} -void SymbolTableMode::adjust(double, double, bool, const Transformation&, double) {} + void SymbolIndividualMode::visit(Data& data, LegendVisitor& legend) { Symbol* symbol = properties_.symbol("marker"); if (legend_height_ != -1) diff --git a/src/visualisers/SymbolMode.h b/src/visualisers/SymbolMode.h index c032e8e73..e1046fc7e 100644 --- a/src/visualisers/SymbolMode.h +++ b/src/visualisers/SymbolMode.h @@ -71,7 +71,9 @@ class SymbolMode : public SymbolModeAttributes { virtual void visit(Data&, HistoVisitor&); - virtual void adjust(double, double, bool, const Transformation&, double) {} + virtual void adjust(double, double, const Transformation&, double scaling) { + scaling_ = scaling; + } void set(const string& type) { type_ = type; } protected: @@ -79,6 +81,7 @@ class SymbolMode : public SymbolModeAttributes { virtual void print(ostream&) const override; SymbolPlotting* parent_; string type_; + double scaling_; private: //! Copy constructor - No copy allowed @@ -118,7 +121,7 @@ class SymbolIndividualMode : public SymbolMode, public SymbolIndividualModeAttri return object; } - void adjust(double, double, bool, const Transformation&, double) override; + virtual void visit(LegendVisitor&) override; void prepare() override { update(); @@ -129,6 +132,11 @@ class SymbolIndividualMode : public SymbolMode, public SymbolIndividualModeAttri SymbolProperties operator()(double) const override { return properties_; } void visit(Data&, LegendVisitor&) override; + void adjust(double, double, const Transformation&, double scaling) override { + scaling_ = scaling; + properties(); + } + protected: //! Method to print string about this class on to a stream of type ostream (virtual). virtual void print(ostream&) const override; @@ -184,8 +192,7 @@ class SymbolTableMode : public SymbolMode, public SymbolTableModeAttributes { } virtual bool accept(const string& node) override { return SymbolTableModeAttributes::accept(node); } - void adjust(double, double, bool, const Transformation&, double) override; - + void visit(LegendVisitor&) override; void visit(Data&, LegendVisitor&) override; void visit(Data&, HistoVisitor&) override; diff --git a/src/visualisers/SymbolPlotting.cc b/src/visualisers/SymbolPlotting.cc index 46283bcbf..834b0dd06 100644 --- a/src/visualisers/SymbolPlotting.cc +++ b/src/visualisers/SymbolPlotting.cc @@ -45,12 +45,9 @@ void SymbolPlotting::print(ostream& out) const { } double SymbolPlotting::height(const Transformation& transformation, double height) { - if (scaling_method_ == false) - return height; + - // get Area ! - - return transformation.ratio() * scaling_level_0_ * scaling_factor_; + return height; } void SymbolPlotting::getReady(const LegendVisitor& legend) { @@ -131,6 +128,21 @@ void SymbolPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { check.push_back("both"); check.push_back("marker_text"); + const Transformation& transformation = out.transformation(); + + // cout << "absolut width " << out.absoluteWidth() << endl; + // cout << "absolut height " << out.absoluteHeight() << endl; + // cout << "pcminy " << transformation.getMinPCY() << endl; + // cout << "pcmaxy " << transformation.getMaxPCY() << endl; + + // cout << "unit " << unit_method_ << endl; + + double factor = ( out.absoluteHeight()*transformation.patchDistance(1))/(transformation.getMaxPCY()-transformation.getMinPCY()) ; + // cout << "sacle--> " << factor << endl; + // cout << "patch--> " << transformation.patchDistance(1) << endl; + factor = magCompare(unit_method_, "geographical") ? + ( out.absoluteHeight()*transformation.patchDistance(1))/(transformation.getMaxPCY()-transformation.getMinPCY()) : 1; + bool valid = false; for (vector::iterator c = check.begin(); c != check.end(); ++c) { @@ -156,7 +168,7 @@ void SymbolPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { // Some Mode need to know the min and max of the data, in order to adjust the // computation of the levels - (*mode_).adjust(points.min(), points.max(), scaling_method_, transformation, scaling_factor_); + (*mode_).adjust(points.min(), points.max(), transformation, factor); if (legend_only_) return; @@ -164,8 +176,6 @@ void SymbolPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { while (points.more()) { PaperPoint xy = transformation(points.current()); (*this)(xy, out); - - points.advance(); } From ff9ef5cb74b653069487cf72d79d08eaab262d9f Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 28 Jun 2022 14:08:52 +0100 Subject: [PATCH 17/66] OutOfBound + fix legend for symbolplotting in geographical units --- src/attributes/ColourTechniqueAttributes.cc | 24 +- src/attributes/ColourTechniqueAttributes.h | 5 +- src/attributes/ColourTechniqueWrapper.cc | 14 +- src/basic/LegendVisitor.cc | 353 +++++--------------- src/basic/LegendVisitor.h | 29 +- src/params/ColourTechnique.xml | 8 +- src/visualisers/ColourTechnique.cc | 29 +- src/visualisers/ColourTechnique.h | 6 + src/visualisers/PolyShadingTechnique.h | 2 + src/visualisers/SymbolAdvancedTableMode.cc | 3 +- src/visualisers/SymbolMode.cc | 3 +- 11 files changed, 148 insertions(+), 328 deletions(-) diff --git a/src/attributes/ColourTechniqueAttributes.cc b/src/attributes/ColourTechniqueAttributes.cc index 0a5211b76..77857f215 100644 --- a/src/attributes/ColourTechniqueAttributes.cc +++ b/src/attributes/ColourTechniqueAttributes.cc @@ -25,9 +25,9 @@ using namespace magics; ColourTechniqueAttributes::ColourTechniqueAttributes(): + oob_min_colour_(ParameterManager::getString("contour_out_of_bound_min_colour")), + oob_max_colour_(ParameterManager::getString("contour_out_of_bound_max_colour")) - oob_min_colour_(MagTranslator().magics("contour_out_of_bound_min_colour")), - oob_max_colour_(MagTranslator().magics("contour_out_of_bound_max_colour")) { } @@ -45,16 +45,16 @@ void ColourTechniqueAttributes::set(const std::map& params) int i = 0; prefix[i++] = ""; + setAttribute(prefix, "contour_out_of_bound_min_colour", oob_min_colour_, params); + setAttribute(prefix, "contour_out_of_bound_max_colour", oob_max_colour_, params); - setMember(prefix, "contour_out_of_bound_min_colour", oob_min_colour_, params); - setMember(prefix, "contour_out_of_bound_max_colour", oob_max_colour_, params); } void ColourTechniqueAttributes::copy(const ColourTechniqueAttributes& other) { - oob_min_colour_ = unique_ptr(other.oob_min_colour_->clone()); - oob_max_colour_ = unique_ptr(other.oob_max_colour_->clone()); + oob_min_colour_ = other.oob_min_colour_; + oob_max_colour_ = other.oob_max_colour_; } @@ -93,8 +93,8 @@ void ColourTechniqueAttributes::set(const XmlNode& node) void ColourTechniqueAttributes::print(ostream& out) const { out << "Attributes["; - out << " oob_min_colour = " << *oob_min_colour_; - out << " oob_max_colour = " << *oob_max_colour_; + out << " oob_min_colour = " << oob_min_colour_; + out << " oob_max_colour = " << oob_max_colour_; out << "]" << "\n"; } @@ -103,11 +103,11 @@ void ColourTechniqueAttributes::toxml(ostream& out) const { out << "\"\""; out << ", \"contour_out_of_bound_min_colour\":"; - niceprint(out, *oob_min_colour_); + niceprint(out,oob_min_colour_); out << ", \"contour_out_of_bound_max_colour\":"; - niceprint(out, *oob_max_colour_); + niceprint(out,oob_max_colour_); } -static MagicsParameter contour_out_of_bound_min_colour("contour_out_of_bound_min_colour", "blue"); -static MagicsParameter contour_out_of_bound_max_colour("contour_out_of_bound_max_colour", "red"); +static MagicsParameter contour_out_of_bound_min_colour("contour_out_of_bound_min_colour", "automatic"); +static MagicsParameter contour_out_of_bound_max_colour("contour_out_of_bound_max_colour", "automatic"); diff --git a/src/attributes/ColourTechniqueAttributes.h b/src/attributes/ColourTechniqueAttributes.h index e67443055..f4d011342 100644 --- a/src/attributes/ColourTechniqueAttributes.h +++ b/src/attributes/ColourTechniqueAttributes.h @@ -25,7 +25,6 @@ #define ColourTechniqueAttributes_H #include "magics.h" -#include "Colour.h" namespace magics { class XmlNode; @@ -51,8 +50,8 @@ class ColourTechniqueAttributes virtual void toxml(std::ostream& out) const; // -- members: string tag_; - unique_ptr oob_min_colour_; - unique_ptr oob_max_colour_; + string oob_min_colour_; + string oob_max_colour_; private: diff --git a/src/attributes/ColourTechniqueWrapper.cc b/src/attributes/ColourTechniqueWrapper.cc index 5a5c5b179..740661f99 100644 --- a/src/attributes/ColourTechniqueWrapper.cc +++ b/src/attributes/ColourTechniqueWrapper.cc @@ -55,17 +55,15 @@ void ColourTechniqueWrapper::set(const MagRequest& request) - if (request.countValues("CONTOUR_OUT_OF_BOUND_MIN_COLOUR") ) { string oob_min_colour_value = request("CONTOUR_OUT_OF_BOUND_MIN_COLOUR"); - colourtechnique_->oob_min_colour_ = unique_ptr(MagTranslator()(oob_min_colour_value)); - } - + colourtechnique_->oob_min_colour_ = oob_min_colour_value; + } if (request.countValues("CONTOUR_OUT_OF_BOUND_MAX_COLOUR") ) { string oob_max_colour_value = request("CONTOUR_OUT_OF_BOUND_MAX_COLOUR"); - colourtechnique_->oob_max_colour_ = unique_ptr(MagTranslator()(oob_max_colour_value)); - } - + colourtechnique_->oob_max_colour_ = oob_max_colour_value; + } + } @@ -75,5 +73,3 @@ void ColourTechniqueWrapper::print(ostream& out) const } - - diff --git a/src/basic/LegendVisitor.cc b/src/basic/LegendVisitor.cc index a176a0964..39cab0928 100644 --- a/src/basic/LegendVisitor.cc +++ b/src/basic/LegendVisitor.cc @@ -727,58 +727,50 @@ void BoxEntry::set(const PaperPoint& point, BasicGraphicsObjectContainer& legend PaperPoint p = centreSymbolBox(point); double x = p.x(); double y = p.y(); - box_->push_back(PaperPoint(x - width, y - height)); - box_->push_back(PaperPoint(x - width, y + height)); - box_->push_back(PaperPoint(x + width, y + height)); - box_->push_back(PaperPoint(x + width, y - height)); - box_->push_back(PaperPoint(x - width, y - height)); - box_->setColour(Colour("black")); - - LegendVisitor::addLegendInfo("legend_entry_colour", box_->getFillColour().rgb()); - LegendVisitor::addLegendInfo("legend_entry_min_text", from()); - LegendVisitor::addLegendInfo("legend_entry_max_text", to()); - LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); - - legend.push_back(box_); -} - -void OOBEntry::set(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { - MagLog::debug() << "OOBEntry--->set at " << point << endl; - double width = computeWidth(0.8) / 2; - double height = 0.4; - PaperPoint p = centreSymbolBox(point); - double x = p.x(); - double y = p.y(); - - if ( type_ ==Type::MIN ) { - box_->push_back(PaperPoint(x - width, y + (height/2))); + if ( isOobMin() ) { + box_->push_back(PaperPoint(x - width, y)); box_->push_back(PaperPoint(x + width, y + height)); box_->push_back(PaperPoint(x + width, y - height)); - box_->push_back(PaperPoint(x - width, y + (height/2))); + box_->push_back(PaperPoint(x - width, y)); + LegendVisitor::addLegendInfo("legend_entry_min_text", ""); + LegendVisitor::addLegendInfo("legend_entry_max_text", to()); + LegendVisitor::addLegendInfo("legend_entry_type", "min_out_of_bond"); } + else if ( isOobMax() ) { + box_->push_back(PaperPoint(x - width, y - height)); + box_->push_back(PaperPoint(x - width, y + height)); + box_->push_back(PaperPoint(x + width, y)); + box_->push_back(PaperPoint(x - width, y - height)); + LegendVisitor::addLegendInfo("legend_entry_min_text", from()); + LegendVisitor::addLegendInfo("legend_entry_max_text", ""); + LegendVisitor::addLegendInfo("legend_entry_type", "max_out_of_bond"); + } + else { box_->push_back(PaperPoint(x - width, y - height)); box_->push_back(PaperPoint(x - width, y + height)); - box_->push_back(PaperPoint(x + width, y + (height/2))); + box_->push_back(PaperPoint(x + width, y + height)); + box_->push_back(PaperPoint(x + width, y - height)); box_->push_back(PaperPoint(x - width, y - height)); + box_->setColour(Colour("black")); + LegendVisitor::addLegendInfo("legend_entry_min_text", from()); + LegendVisitor::addLegendInfo("legend_entry_max_text", to()); + LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); } box_->setColour(Colour("black")); - LegendVisitor::addLegendInfo("legend_entry_colour", box_->getFillColour().rgb()); - LegendVisitor::addLegendInfo("legend_entry_min_text", from()); - LegendVisitor::addLegendInfo("legend_entry_max_text", to()); - LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); - legend.push_back(box_); } + + void BoxEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { double width = 1; double height = 0.4; double x = point.x(); double y = point.y(); - if (text_) { + if (text_ && !isOobMin()) { Text* from = new Text(); from->push_back(PaperPoint(x - width, y - height - 0.25)); from->setVerticalAlign(VerticalAlign::BOTTOM); @@ -802,41 +794,60 @@ void BoxEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& leg from->addText(bottom.str(), font_); } } - if (last_) { - Text* to = new Text(); - to->setAngle(angle_); - to->setVerticalAlign(VerticalAlign::BOTTOM); - to->push_back(PaperPoint(x + width, y - height - 0.25)); - legend.push_back(to); - if (automatic_) { - if (!userMax_) { - ostringstream to; - to << MagicsFormat(format_, to_); - maxText_ = to.str(); - } - to->addText(maxText_, font_); - } - else - to->addText(userText_, font_); - } + Polyline* top = new Polyline(); - top->push_back(PaperPoint(x - (width * 1.), y + (height * 2))); - top->push_back(PaperPoint(x + (width * 1.), y + (height * 2))); top->setColour(borderColour_); top->setThickness(2); - Polyline* bottom = new Polyline(); - bottom->push_back(PaperPoint(x - width, y - height)); - bottom->push_back(PaperPoint(x + width, y - height)); bottom->setColour(borderColour_); bottom->setThickness(2); - box_->push_back(PaperPoint(x - width, y - height)); - box_->push_back(PaperPoint(x - width, y + height + height)); - box_->push_back(PaperPoint(x + width, y + height + height)); - box_->push_back(PaperPoint(x + width, y - height)); - box_->push_back(PaperPoint(x - width, y - height)); + if ( isOobMin() ) { + top->push_back(PaperPoint(x, y)); + top->push_back(PaperPoint(x + (width * 1.), y + (height * 2))); + + bottom->push_back(PaperPoint(x, y)); + bottom->push_back(PaperPoint(x + width, y - height)); + + box_->push_back(PaperPoint(x, y)); + box_->push_back(PaperPoint(x + width, y + height + height)); + box_->push_back(PaperPoint(x + width, y - height)); + box_->push_back(PaperPoint(x, y)); + } + else if ( isOobMax() ) { + top->push_back(PaperPoint(x - (width * 1.), y + (height * 2))); + top->push_back(PaperPoint(x , y)); + + bottom->push_back(PaperPoint(x - width, y - height)); + bottom->push_back(PaperPoint(x, y)); + + box_->push_back(PaperPoint(x - width, y - height)); + box_->push_back(PaperPoint(x - width, y + height + height)); + box_->push_back(PaperPoint(x , y)); + box_->push_back(PaperPoint(x - width, y - height)); + + } + else { + top->push_back(PaperPoint(x - (width * 1.), y + (height * 2))); + top->push_back(PaperPoint(x + (width * 1.), y + (height * 2))); + + bottom->push_back(PaperPoint(x - width, y - height)); + bottom->push_back(PaperPoint(x + width, y - height)); + + box_->push_back(PaperPoint(x - width, y - height)); + box_->push_back(PaperPoint(x - width, y + height + height)); + box_->push_back(PaperPoint(x + width, y + height + height)); + box_->push_back(PaperPoint(x + width, y - height)); + box_->push_back(PaperPoint(x - width, y - height)); + + } + + + + + + // Small check Colour colour = (borderColour_.automatic()) ? box_->getFillColour() : borderColour_; @@ -851,61 +862,13 @@ void BoxEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& leg legend.push_back(top); legend.push_back(bottom); - if (last_) { + if (last_ && !oob_max_) { Polyline* right = new Polyline(); right->push_back(PaperPoint(x + width, y - height)); right->push_back(PaperPoint(x + width, y + (height * 2))); right->setColour(borderColour_); right->setThickness(2); legend.push_back(right); - } - - if (first_) { - Polyline* left = new Polyline(); - left->push_back(PaperPoint(x - width, y - height)); - left->push_back(PaperPoint(x - width, y + (height * 2))); - left->setColour(borderColour_); - left->setThickness(2); - legend.push_back(left); - } - - LegendVisitor::addLegendInfo("legend_entry_colour", box_->getFillColour().rgb()); - LegendVisitor::addLegendInfo("legend_entry_min_text", from()); - LegendVisitor::addLegendInfo("legend_entry_max_text", to()); - LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); -} - -void OOBEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { - double width = 1; - double height = 0.4; - double x = point.x(); - double y = point.y(); - - if (text_) { - Text* from = new Text(); - from->push_back(PaperPoint(x - width, y - height - 0.25)); - from->setVerticalAlign(VerticalAlign::BOTTOM); - from->setAngle(angle_); - legend.push_back(from); - - if (automatic_) { - if (!userMin_) { - ostringstream bottom; - bottom << MagicsFormat(format_, from_); - minText_ = bottom.str(); - } - - from->addText(minText_, font_); - } - else if (!last_) - from->addText(userText_, font_); - else if (userMax_) { - ostringstream bottom; - bottom << MagicsFormat(format_, from_); - from->addText(bottom.str(), font_); - } - } - if (last_) { Text* to = new Text(); to->setAngle(angle_); to->setVerticalAlign(VerticalAlign::BOTTOM); @@ -923,53 +886,7 @@ void OOBEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& leg to->addText(userText_, font_); } - Polyline* top = new Polyline(); - top->push_back(PaperPoint(x - (width * 1.), y + (height * 2))); - top->push_back(PaperPoint(x + (width * 1.), y + (height * 2))); - top->setColour(borderColour_); - top->setThickness(2); - - Polyline* bottom = new Polyline(); - bottom->push_back(PaperPoint(x - width, y - height)); - bottom->push_back(PaperPoint(x + width, y - height)); - bottom->setColour(borderColour_); - bottom->setThickness(2); - - if ( type_ ==Type::MIN ) { - box_->push_back(PaperPoint(x - width, y + (height/2))); - box_->push_back(PaperPoint(x + width, y + height)); - box_->push_back(PaperPoint(x + width, y - height)); - box_->push_back(PaperPoint(x - width, y + (height/2))); - } - else { - box_->push_back(PaperPoint(x - width, y - height)); - box_->push_back(PaperPoint(x - width, y + height)); - box_->push_back(PaperPoint(x + width, y + (height/2))); - box_->push_back(PaperPoint(x - width, y - height)); - } - // Small check - Colour colour = (borderColour_.automatic()) ? box_->getFillColour() : borderColour_; - - if (box_->getFillColour() == Colour("none")) { - box_->setFilled(false); - colour = Colour("black"); - } - box_->setColour(colour); - - legend.push_back(box_); - legend.push_back(top); - legend.push_back(bottom); - - if (last_) { - Polyline* right = new Polyline(); - right->push_back(PaperPoint(x + width, y - height)); - right->push_back(PaperPoint(x + width, y + (height * 2))); - right->setColour(borderColour_); - right->setThickness(2); - legend.push_back(right); - } - - if (first_) { + if (first_ && !oob_min_) { Polyline* left = new Polyline(); left->push_back(PaperPoint(x - width, y - height)); left->push_back(PaperPoint(x - width, y + (height * 2))); @@ -984,6 +901,13 @@ void OOBEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& leg LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); } + + + + + + + void BoxEntry::rowHisto(const PaperPoint& point, BasicGraphicsObjectContainer& legend, const Colour& colour) { // ShadingProperties* shading = box_->getShading(); // Normall the pilyline left the low value on their left! @@ -1254,120 +1178,7 @@ void BoxEntry::columnBox(const PaperPoint& point, BasicGraphicsObjectContainer& LegendVisitor::addLegendInfo("legend_entry_max_text", to()); LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); } - -void OOBEntry::columnBox(const PaperPoint& point, BasicGraphicsObjectContainer& legend) { - double width = computeWidth(0.8) / 2; - double height = 0.5; - PaperPoint p = centreSymbolBox(point); - double x = p.x(); - double y = p.y(); - PaperPoint pt = leftTextBox(point); - - if (text_) { - Text* from = new Text(); - from->setJustification(Justification::LEFT); - from->setVerticalAlign(VerticalAlign::HALF); - if (automatic_) { - if (!userMin_) { - ostringstream bottom; - bottom << MagicsFormat(format_, from_); - minText_ = bottom.str(); - } - - from->addText(minText_, font_); - } - else if (!last_) - from->addText(userText_, font_); - else { - if (automatic_ || userMax_) { - ostringstream bottom; - bottom << MagicsFormat(format_, from_); - from->addText(bottom.str(), font_); - } - } - PaperPoint pfrom(pt); - pfrom.y_ = y - height; - from->push_back(pfrom); - from->setAngle(angle_); - legend.push_back(from); - } - if (last_) { - Text* to = new Text(); - to->setVerticalAlign(VerticalAlign::HALF); - to->setJustification(Justification::LEFT); - to->setAngle(angle_); - - if (automatic_) { - if (maxText_.empty()) { - ostringstream to; - to << MagicsFormat(format_, to_); - maxText_ = to.str(); - } - to->addText(maxText_, font_); - } - else - to->addText(userText_, font_); - PaperPoint pto(pt); - pto.y_ = y + height; - to->push_back(pto); - legend.push_back(to); - } - if ( type_ ==Type::MIN ) { - box_->push_back(PaperPoint(x - width, y + (height/2))); - box_->push_back(PaperPoint(x + width, y + height)); - box_->push_back(PaperPoint(x + width, y - height)); - box_->push_back(PaperPoint(x - width, y + (height/2))); - } - else { - box_->push_back(PaperPoint(x - width, y - height)); - box_->push_back(PaperPoint(x - width, y + height)); - box_->push_back(PaperPoint(x + width, y + (height/2))); - box_->push_back(PaperPoint(x - width, y - height)); - } - Colour colour = (borderColour_.automatic()) ? box_->getFillColour() : borderColour_; - if (box_->getFillColour() == Colour("none")) { - box_->setFilled(false); - } - box_->setColour(colour); - legend.push_back(box_); - - Polyline* left = new Polyline(); - left->push_back(PaperPoint(x - width, y - (height * 1.1))); - left->push_back(PaperPoint(x - width, y + (height * 1.1))); - left->setColour(borderColour_); - left->setThickness(2); - - Polyline* right = new Polyline(); - right->push_back(PaperPoint(x + width, y - height * 1.1)); - right->push_back(PaperPoint(x + width, y + (height * 1.1))); - right->setColour(borderColour_); - right->setThickness(2); - - legend.push_back(left); - legend.push_back(right); - - if (last_) { - Polyline* top = new Polyline(); - top->push_back(PaperPoint(x - width, y + (height))); - top->push_back(PaperPoint(x + width, y + (height))); - top->setColour(borderColour_); - top->setThickness(2); - legend.push_back(top); - } - if (first_) { - Polyline* bottom = new Polyline(); - bottom->push_back(PaperPoint(x - width, y - height)); - bottom->push_back(PaperPoint(x + width, y - height)); - bottom->setColour(borderColour_); - bottom->setThickness(2); - legend.push_back(bottom); - } - - LegendVisitor::addLegendInfo("legend_entry_colour", box_->getFillColour().rgb()); - LegendVisitor::addLegendInfo("legend_entry_min_text", from()); - LegendVisitor::addLegendInfo("legend_entry_max_text", to()); - LegendVisitor::addLegendInfo("legend_entry_type", "colorbar"); -} + void BoxEntry::columnHisto(const PaperPoint& point, BasicGraphicsObjectContainer& legend, const Colour& colour) { MagLog::debug() << "BoxEntry--->set at " << point << endl; @@ -1798,4 +1609,4 @@ DoubleLineEntry::~DoubleLineEntry() {} //{ { delete line1_; delete line2_; } LineEntry::~LineEntry() {} CdfEntry::~CdfEntry() {} //{ delete line_;} RainbowEntry::~RainbowEntry() {} //{ delete line_;} -OOBEntry::~OOBEntry() {} //{ delete box_; } + diff --git a/src/basic/LegendVisitor.h b/src/basic/LegendVisitor.h index 5fda3d7e9..1ccddc4c0 100644 --- a/src/basic/LegendVisitor.h +++ b/src/basic/LegendVisitor.h @@ -45,6 +45,8 @@ class LegendEntry { LegendEntry(const string& label) : last_(false), first_(false), + oob_max_(false), + oob_min_(false), text_(true), label_(label), fromto_(false), @@ -56,6 +58,8 @@ class LegendEntry { LegendEntry(double label) : last_(false), first_(false), + oob_max_(false), + oob_min_(false), text_(true), label_(""), fromto_(false), @@ -69,6 +73,8 @@ class LegendEntry { LegendEntry(double min, double max) : last_(false), first_(false), + oob_max_(false), + oob_min_(false), text_(true), label_(""), fromto_(false), @@ -117,7 +123,10 @@ class LegendEntry { void angle(double angle) { angle_ = angle; } void set(const LegendVisitor&); void last() { last_ = true; } + void oob(bool oob_min, bool oob_max) { oob_min_ = oob_min, oob_max_ = oob_max; } bool isLast() { return last_; } + bool isOobMin() { return first_ && oob_min_; } + bool isOobMax() { return last_ && oob_max_; } bool isFirst() { return first_; } void first() { first_ = true; } void notext() { text_ = false; } @@ -157,6 +166,8 @@ class LegendEntry { protected: bool last_; bool first_; + bool oob_max_; + bool oob_min_; bool text_; bool automatic_; // True if the tlegend text is generated automaticaly from the value. mutable string label_; @@ -367,24 +378,6 @@ class BoxEntry : public LegendEntry { Colour colour() override; }; -class OOBEntry : public BoxEntry { -public: - enum class Type { MIN, MAX }; - OOBEntry(const string label, Type type, Polyline* box = 0) : - BoxEntry(label, box), type_(type) {} - OOBEntry(const double label, Type type, Polyline* box = 0) : - BoxEntry(label, box), type_(type) { format(label); } - OOBEntry(double min, double max, Type type, Polyline* box = 0) : - BoxEntry(min, max, box), type_(type) { format(min, max); } - ~OOBEntry() override; - void set(const PaperPoint&, BasicGraphicsObjectContainer&) override; - void rowBox(const PaperPoint&, BasicGraphicsObjectContainer&) override; - void columnBox(const PaperPoint&, BasicGraphicsObjectContainer&) override; - -protected: - Type type_; - -}; class LegendVisitor : public LayoutVisitor, diff --git a/src/params/ColourTechnique.xml b/src/params/ColourTechnique.xml index 57542be31..d0e223401 100644 --- a/src/params/ColourTechnique.xml +++ b/src/params/ColourTechnique.xml @@ -11,18 +11,18 @@ does it submit to any jurisdiction. Colour to use below the out of bound minimum value Colour to use below the out of bound maximum value diff --git a/src/visualisers/ColourTechnique.cc b/src/visualisers/ColourTechnique.cc index f3e6e314b..619927aa9 100644 --- a/src/visualisers/ColourTechnique.cc +++ b/src/visualisers/ColourTechnique.cc @@ -29,7 +29,9 @@ using namespace magics; -ColourTechnique::ColourTechnique() : policy_(ListPolicy::LASTONE) {} +ColourTechnique::ColourTechnique() : policy_(ListPolicy::LASTONE), + minOutOfBound_(false), maxOutOfBound_(false) + {} ColourTechnique::~ColourTechnique() {} @@ -51,6 +53,11 @@ void ColourTechnique::prepare(LevelSelection& out, LevelSelection& levels, bool bands_.clear(); ColourTable table; + + + minOutOfBound_ = out.minOutOfBond(); + maxOutOfBound_ = out.maxOutOfBond(); + if (rainbow) @@ -59,18 +66,22 @@ void ColourTechnique::prepare(LevelSelection& out, LevelSelection& levels, bool LevelSelection newlevels; int count = levels.size(); - if (out.minOutOfBond()) { - table.push_back(*oob_min_colour_); - count--; - } - if (out.maxOutOfBond()) { + if (out.minOutOfBond()) count--; + + if (out.maxOutOfBond()) count--; count--; - } + set(out, levels, table, count); + if (out.minOutOfBond()) { + Colour min_colour = magCompare(oob_min_colour_, "automatic") ? + table.front().colour() : Colour(oob_min_colour_); + table.insert(table.begin(), min_colour); + } if (out.maxOutOfBond()) { - table.push_back(*oob_max_colour_); - count--; + Colour max_colour = magCompare(oob_max_colour_, "automatic") ? + table.back().colour() : Colour(oob_max_colour_); + table.push_back(max_colour); } } diff --git a/src/visualisers/ColourTechnique.h b/src/visualisers/ColourTechnique.h index bfc794c19..75c3778b6 100644 --- a/src/visualisers/ColourTechnique.h +++ b/src/visualisers/ColourTechnique.h @@ -87,6 +87,9 @@ class ColourTechnique : public map, void visit(LegendVisitor&); ListPolicy getPolicy() const { return policy_; } + bool minOutOfBound() const { return minOutOfBound_; } + bool maxOutOfBound() const { return maxOutOfBound_; } + protected: //! Method to print string about this class on to a stream of type ostream (virtual). virtual void print(ostream&) const; @@ -95,6 +98,9 @@ class ColourTechnique : public map, map > ranges_; double maxLevel_; + bool minOutOfBound_; + bool maxOutOfBound_; + ListPolicy policy_; diff --git a/src/visualisers/PolyShadingTechnique.h b/src/visualisers/PolyShadingTechnique.h index d4e544a8c..5724699c8 100644 --- a/src/visualisers/PolyShadingTechnique.h +++ b/src/visualisers/PolyShadingTechnique.h @@ -141,9 +141,11 @@ struct LegendEntryBuilder { box->setColour(colours_.right(min)); LegendEntry* entry = new BoxEntry(min, max, box); + entry->oob(colours_.minOutOfBound(), colours_.maxOutOfBound()); if (first_) { first_ = false; entry->first(); + } for (vector::iterator val = legend_.values_list_.begin(); val != legend_.values_list_.end(); ++val) { if (min <= *val && *val < max) { diff --git a/src/visualisers/SymbolAdvancedTableMode.cc b/src/visualisers/SymbolAdvancedTableMode.cc index e60f75aea..6b31fa7a9 100644 --- a/src/visualisers/SymbolAdvancedTableMode.cc +++ b/src/visualisers/SymbolAdvancedTableMode.cc @@ -227,7 +227,8 @@ void SymbolAdvancedTableMode::visit(Data& data, LegendVisitor& legend) { Symbol* symbol = new Symbol(); (*symbol).setColour(interval->second.colour_); (*symbol).setSymbol(interval->second.marker_); - (*symbol).setHeight(interval->second.height_); + // (*symbol).setHeight(interval->second.height_); + (*symbol).setHeight(0.5); string str = data.legendText(interval->first.min_, interval->first.max_); if (str.empty()) { diff --git a/src/visualisers/SymbolMode.cc b/src/visualisers/SymbolMode.cc index 814056220..9918fa190 100644 --- a/src/visualisers/SymbolMode.cc +++ b/src/visualisers/SymbolMode.cc @@ -244,7 +244,8 @@ void SymbolIndividualMode::visit(LegendVisitor& legend) { Symbol* symbol = properties_.symbol("marker"); // overwrite with the legend_height if set.. if (legend_height_ != -1) - symbol->setHeight(legend_height_); + // symbol->setHeight(legend_height_); + symbol->setHeight(0.5); legend.add(new SimpleSymbolEntry(legend_text_, symbol)); } From bdbb9b68f3582e48a66d646ae161e203193ca507 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 29 Jun 2022 17:16:14 +0100 Subject: [PATCH 18/66] OutOfBound : Fix issue with number of colour + remove print --- src/visualisers/ColourTechnique.cc | 2 +- src/visualisers/LevelListSelectionType.cc | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/visualisers/ColourTechnique.cc b/src/visualisers/ColourTechnique.cc index 619927aa9..5a063675a 100644 --- a/src/visualisers/ColourTechnique.cc +++ b/src/visualisers/ColourTechnique.cc @@ -69,7 +69,7 @@ void ColourTechnique::prepare(LevelSelection& out, LevelSelection& levels, bool if (out.minOutOfBond()) count--; if (out.maxOutOfBond()) count--; - count--; + set(out, levels, table, count); diff --git a/src/visualisers/LevelListSelectionType.cc b/src/visualisers/LevelListSelectionType.cc index 1833e91f7..1f400d8d6 100644 --- a/src/visualisers/LevelListSelectionType.cc +++ b/src/visualisers/LevelListSelectionType.cc @@ -48,8 +48,7 @@ void LevelListSelectionType::calculate(double min, double max, bool shading) { double min_level=list_.front(); double max_level=list_.back(); - cout << min << " " << min_ << " " << shade_min_ << " " << oob_min_ << endl; - cout << max << " " << max_ << " " << shade_max_ << " " << oob_max_ << endl; + if ( MINSET(min_) ) min_level = min_; From f7bf3cd8d4263e3fca719051eac869cf851a2bda Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 6 Jul 2022 19:22:42 +0100 Subject: [PATCH 19/66] SuumerOfCode: Fix issue with metadata and legend --- src/basic/LegendVisitor.cc | 5 +++++ src/visualisers/LegendMethod.cc | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/basic/LegendVisitor.cc b/src/basic/LegendVisitor.cc index 39cab0928..af4ed6669 100644 --- a/src/basic/LegendVisitor.cc +++ b/src/basic/LegendVisitor.cc @@ -186,6 +186,9 @@ void DoubleLineEntry::columnBox(const PaperPoint& point, BasicGraphicsObjectCont void LegendVisitor::build() { legend_ = new LegendLayout(); + LegendVisitor::legendEntriesInfo_.clear(); + LegendVisitor::legendInfo_.clear(); + legend_->x(view_x_); legend_->y(view_y_); legend_->width(view_width_); @@ -279,6 +282,7 @@ void LegendVisitor::build() { continue; legendEntriesInfo_.push_back(map()); + (magCompare(direction_, "column")) ? (*method_).column(*entry, position->x(), position->y(), *legend, *legend_) : (*method_).row(*entry, position->x(), position->y(), *legend, *legend_); @@ -1573,6 +1577,7 @@ void LegendVisitor::visit(MetaDataVisitor& visitor) { ostringstream out; out << "{"; string c1 = ""; + for (auto& entry : legendInfo_) { out << c1 << "\"" << entry.first << "\":\"" << entry.second << "\""; c1 = ","; diff --git a/src/visualisers/LegendMethod.cc b/src/visualisers/LegendMethod.cc index 8c97904b0..e10ee24bd 100644 --- a/src/visualisers/LegendMethod.cc +++ b/src/visualisers/LegendMethod.cc @@ -67,6 +67,10 @@ void ContinuousLegendMethod::row(LegendEntry& entry, double x, double y, Text& l } labelCount_++; + LegendVisitor::legendInfo_.insert(make_pair("legend_display_type", "continuous")); + LegendVisitor::legendInfo_.insert(make_pair("legend_label_frequency", tostring(label_frequency_))); + + } void ContinuousLegendMethod::column(LegendEntry& entry, double x, double y, Text& legend, From c9cd8798c4c19696217c65296e593ef7d6f70f48 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Sun, 12 Jun 2022 16:36:31 +0100 Subject: [PATCH 20/66] hackathon --- share/magics/symbols.svg | 6 +-- src/attributes/GeoJSonAttributes.cc | 12 ++++- src/attributes/GeoJSonAttributes.h | 1 + src/attributes/GeoJSonWrapper.cc | 4 ++ src/basic/FortranMagics.cc | 10 ++++ src/params/GeoJSon.xml | 7 +++ src/visualisers/ObsItemFamily.cc | 71 +++++++++++++++++++++++++---- src/visualisers/ObsItemFamily.h | 12 +++-- src/visualisers/ObsPlotting.cc | 6 ++- src/visualisers/ObsTable.cc | 4 ++ src/web/GeoJSon.cc | 44 ++++++++++++++---- src/web/GeoJSon.h | 2 + 12 files changed, 150 insertions(+), 29 deletions(-) diff --git a/share/magics/symbols.svg b/share/magics/symbols.svg index 3c0d20aa4..ad3889d35 100644 --- a/share/magics/symbols.svg +++ b/share/magics/symbols.svg @@ -8,11 +8,11 @@ - - + + - + diff --git a/src/attributes/GeoJSonAttributes.cc b/src/attributes/GeoJSonAttributes.cc index 28f0bda4e..2c3672dd4 100644 --- a/src/attributes/GeoJSonAttributes.cc +++ b/src/attributes/GeoJSonAttributes.cc @@ -28,8 +28,9 @@ GeoJSonAttributes::GeoJSonAttributes(): type_(ParameterManager::getString("geojson_input_type")), path_(ParameterManager::getString("geojson_input_filename")), input_(ParameterManager::getString("geojson_input")), - binning_resolution_(ParameterManager::getDouble("geojson_binning_grid_resolution")) - + binning_resolution_(ParameterManager::getDouble("geojson_binning_grid_resolution")), + value_(ParameterManager::getString("geojson_value_property")) + { } @@ -51,7 +52,9 @@ void GeoJSonAttributes::set(const std::map& params) setAttribute(prefix, "geojson_input_filename", path_, params); setAttribute(prefix, "geojson_input", input_, params); setAttribute(prefix, "geojson_binning_grid_resolution", binning_resolution_, params); + setAttribute(prefix, "geojson_value_property", value_, params); + cout << value_ << endl; } @@ -61,6 +64,7 @@ void GeoJSonAttributes::copy(const GeoJSonAttributes& other) path_ = other.path_; input_ = other.input_; binning_resolution_ = other.binning_resolution_; + value_ = other.value_; } @@ -103,6 +107,7 @@ void GeoJSonAttributes::print(ostream& out) const out << " path = " << path_; out << " input = " << input_; out << " binning_resolution = " << binning_resolution_; + out << " value = " << value_; out << "]" << "\n"; } @@ -118,6 +123,8 @@ void GeoJSonAttributes::toxml(ostream& out) const niceprint(out,input_); out << ", \"geojson_binning_grid_resolution\":"; niceprint(out,binning_resolution_); + out << ", \"geojson_value_property\":"; + niceprint(out,value_); } @@ -125,3 +132,4 @@ static MagicsParameter geojson_input_type("geojson_input_type", "file"); static MagicsParameter geojson_input_filename("geojson_input_filename", ""); static MagicsParameter geojson_input("geojson_input", "{}"); static MagicsParameter geojson_binning_grid_resolution("geojson_binning_grid_resolution", 1.); +static MagicsParameter geojson_value_property("geojson_value_property", "value"); diff --git a/src/attributes/GeoJSonAttributes.h b/src/attributes/GeoJSonAttributes.h index 739fa73df..c9e43bff0 100644 --- a/src/attributes/GeoJSonAttributes.h +++ b/src/attributes/GeoJSonAttributes.h @@ -54,6 +54,7 @@ class GeoJSonAttributes string path_; string input_; double binning_resolution_; + string value_; private: diff --git a/src/attributes/GeoJSonWrapper.cc b/src/attributes/GeoJSonWrapper.cc index 1d9b3bd32..e95e78ee2 100644 --- a/src/attributes/GeoJSonWrapper.cc +++ b/src/attributes/GeoJSonWrapper.cc @@ -71,6 +71,10 @@ void GeoJSonWrapper::set(const MagRequest& request) double binning_resolution_value = request("GEOJSON_BINNING_GRID_RESOLUTION"); geojson_->binning_resolution_ = binning_resolution_value; } + if (request.countValues("GEOJSON_VALUE_PROPERTY") ) { + string value_value = request("GEOJSON_VALUE_PROPERTY"); + geojson_->value_ = value_value; + } } diff --git a/src/basic/FortranMagics.cc b/src/basic/FortranMagics.cc index a6b424299..576e5d00c 100644 --- a/src/basic/FortranMagics.cc +++ b/src/basic/FortranMagics.cc @@ -429,6 +429,14 @@ void FortranMagics::ptephi() { } void FortranMagics::pobs() { actions(); + + // HACK + action_->visdef(new ObsPlotting()); + + cout << "FortranMagics::pobs() {" << endl; + return; + + action_ = new VisualAction(); ObsDecoder* obs = new ObsDecoder(); if (obs->defined()) { @@ -822,6 +830,8 @@ void FortranMagics::ptext() { void FortranMagics::psymb() { actions(); + + string mode; string wind; ParameterManager::get("symbol_position_mode", mode); diff --git a/src/params/GeoJSon.xml b/src/params/GeoJSon.xml index 8c539088b..7d98c8c64 100644 --- a/src/params/GeoJSon.xml +++ b/src/params/GeoJSon.xml @@ -42,5 +42,12 @@ does it submit to any jurisdiction. name="geojson_binning_grid_resolution"> String containing the GeoJson data + + String containing the GeoJson data + diff --git a/src/visualisers/ObsItemFamily.cc b/src/visualisers/ObsItemFamily.cc index 0cfa52e18..7956243cc 100644 --- a/src/visualisers/ObsItemFamily.cc +++ b/src/visualisers/ObsItemFamily.cc @@ -53,10 +53,12 @@ void ObsWind::visit(std::set& tokens) { return; tokens.insert(speed_); tokens.insert(direction_); + + } void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { - if (!owner_->wind_visible_) - return; + // if (!owner_->wind_visible_) + // return; map::iterator it = point.begin(); map::iterator en = point.end(); @@ -65,6 +67,8 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { // F} Colour colour = owner_->wind_colour_->automatic() ? *owner_->colour_ : *owner_->wind_colour_; + + CustomisedPoint::const_iterator speed = point.find(speed_); if (speed == point.end()) return; @@ -72,11 +76,27 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { if (direction == point.end()) return; + + + if ( speed->second < 1. ) + colour = Colour("green"); + + if ( speed->second > 1.5 && speed->second <2 ) + colour = Colour("yellow"); + if ( speed->second > 2.5 && speed->second <3 ) + colour = Colour("orange"); + if ( speed->second > 3.5 && speed->second <4 ) + colour = Colour("red"); + if ( speed->second > 4 ) + colour = Colour("purple"); + + FlagItem* flag = new FlagItem(); flag->setColour(colour); - flag->length(owner_->size_ * 2.5); // Size to be adjusted later! + flag->setThickness(2); + flag->length(owner_->size_ * 2.); // Size to be adjusted later! - const string origin = "circle"; + const string origin = "duck"; // FMagLog::debug() << "OBS ITEM - ObsWind - Lon/Lat: " << point.longitude() << " / " << point.latitude() @@ -84,7 +104,7 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { // F << "\n\tcloud amount: " << point["total_cloud"] << " -> " << origin << std::endl; - flag->setOriginHeight(owner_->ring_size_); + flag->setOriginHeight(owner_->ring_size_ * 3); flag->setOriginMarker(origin); flag->x(0); flag->y(0); @@ -412,6 +432,23 @@ void ObsPresentWeather::visit(std::set& tokens) { static map presentweather; void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { + vector colour_list = { "none", "none", "none", "none", "cream", "cream", "cream", "cream", +"cream", "cream","yellow", "yellow", "yellow", "red", "kelly_green", +"kelly_green", "kelly_green", "red", "red", "red", "kelly_green", +"kelly_green", "white", "white", "red", "kelly_green", "white", +"red", "yellow", "red", "cream", "cream", "cream", "cream", "cream", +"cream", "white", "white", "white", "white", "yellow", "yellow", +"yellow", "yellow", "yellow", "yellow", "yellow", "yellow", "yellow", +"yellow", "kelly_green", "kelly_green", "kelly_green", "kelly_green", +"kelly_green", "kelly_green", "red", "red", "kelly_green", +"kelly_green", "kelly_green", "kelly_green", "kelly_green", +"kelly_green", "kelly_green", "kelly_green", "red", "red", "white", +"white", "white", "white","white", "white", "white", "white", "red", +"red", "red", "orange", "kelly_green", "kelly_green", "kelly_green", +"white", "white","white", "white", "red", "red", "red", "red", "red", +"red", "red", "red", "red", "red", "red", "red", "red"}; + + if (!owner_->present_ww_visible_) return; if (presentweather.empty()) { @@ -448,6 +485,7 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol presentweather[183] = "ww_81"; presentweather[189] = "ww_89"; } + CustomisedPoint::const_iterator value = point.find("present_weather"); if (value == point.end()) return; @@ -457,10 +495,18 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol return; string ww; + Colour colour = owner_->present_ww_colour_->automatic() ? *owner_->colour_ : *owner_->present_ww_colour_; + + string c = colour.name(); + if (value->second < 100) { ostringstream os; os << "ww_" << setw(2) << setfill('0') << value->second; ww = os.str(); + + c = colour_list[value->second]; + colour = Colour(c); + } else { map::iterator w = presentweather.find(value->second); @@ -471,17 +517,18 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol else ww = w->second; } - + cout << "Present Weather->" << ww << endl; if (ww.empty()) return; SymbolItem* object = new SymbolItem(); object->x(column_); object->y(row_); - Colour colour = owner_->present_ww_colour_->automatic() ? *owner_->colour_ : *owner_->present_ww_colour_; - object->colour(colour); + cout << "Present Weather->" << ww << endl; + + object->colour(colour); object->symbol(ww); // FMagLog::debug() << "\tPresent Weather--->" << ww << " in " << colour << "\n"; // time->setJustification(MRIGHT); @@ -623,9 +670,10 @@ void ObsIdentifier::visit(std::set&) { } void ObsIdentifier::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { - if (!owner_->identifier_visible_) - return; + // if (!owner_->identifier_visible_) + // return; TextItem* time = new TextItem(); + cout << "ObsIdentifier::operator()" << point.identifier() << endl; #ifdef OBS_DEBUG_ // FMagLog::debug() << "Identification for " << point.identifier() << "at[" << column_ << ", " << row_ << "]" << // endl; @@ -637,6 +685,7 @@ void ObsIdentifier::operator()(CustomisedPoint& point, ComplexSymbol& symbol) co time->x(column_); time->y(row_); time->text(point.identifier()); + cout << point.identifier() << endl; // time->setJustification(MRIGHT); time->font(font); @@ -1072,6 +1121,8 @@ void ObsString::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const } + text = "Duck-->°"; + TextItem* object = new TextItem(); object->x(column_); object->y(row_); diff --git a/src/visualisers/ObsItemFamily.h b/src/visualisers/ObsItemFamily.h index 846fab09e..854cea8f2 100644 --- a/src/visualisers/ObsItemFamily.h +++ b/src/visualisers/ObsItemFamily.h @@ -46,14 +46,16 @@ class ObsStationRing : public ObsItemBox { } void operator()(CustomisedPoint&, ComplexSymbol& symbol) const override { - if (!owner_->station_ring_visible_) - return; + + // if (!owner_->station_ring_visible_) + // return; SymbolItem* station = new SymbolItem(); station->x(column_); station->y(row_); station->colour(*owner_->station_ring_colour_); - station->symbol("circle"); - station->height(owner_->ring_size_); + // station->symbol("N_8"); + station->symbol("duck"); + station->height(owner_->ring_size_*2); symbol.add(station); } @@ -109,7 +111,7 @@ class ObsWind : public ObsItemBox { column_ = atoi(find(def, "column").c_str()); colour_ = find(def, "colour"); speed_ = find(def, "wind_speed", "wind_speed"); - direction_ = find(def, "wind_direction", "wind_direction"); + direction_ = find(def, "wind_direction", "wind_to_direction"); } protected: diff --git a/src/visualisers/ObsPlotting.cc b/src/visualisers/ObsPlotting.cc index 08fd1f460..5f9b82be6 100644 --- a/src/visualisers/ObsPlotting.cc +++ b/src/visualisers/ObsPlotting.cc @@ -43,7 +43,7 @@ void ObsPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { std::set needs; std::set info; multimap types; - + cout << "ObsPlotting::operator()" << endl; info.insert("type"); data.getInfo(info, types); @@ -73,10 +73,14 @@ void ObsPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { out.push_back(new ClearObject()); + + + for (multimap::const_iterator type = types.find("type"); type != types.end(); ++type) { try { const ObsTemplate& obs = ObsTable::getTemplate(type->second); for (const auto& val : values) { + cout << type->second << " " << val->type() << endl; if (type->second == val->type()) { obs(*val, out); } diff --git a/src/visualisers/ObsTable.cc b/src/visualisers/ObsTable.cc index 825ed745b..3130fe9ef 100644 --- a/src/visualisers/ObsTable.cc +++ b/src/visualisers/ObsTable.cc @@ -131,6 +131,8 @@ const ObsTemplate& ObsTable::get(const string& type) { void ObsTemplate::operator()(CustomisedPoint& obs, BasicGraphicsObjectContainer& out) const { + + cout << "ObsTemplate" << endl; if (empty()) return; // Nothing to display. @@ -149,6 +151,8 @@ void ObsTemplate::operator()(CustomisedPoint& obs, BasicGraphicsObjectContainer& out.push_back(symbol); + + for (const_iterator item = begin(); item != end(); ++item) (*(*item))(obs, *symbol); } diff --git a/src/web/GeoJSon.cc b/src/web/GeoJSon.cc index 0000a41b1..5daf53684 100644 --- a/src/web/GeoJSon.cc +++ b/src/web/GeoJSon.cc @@ -92,6 +92,7 @@ class GeoObject { } } vector objects_; + string value_; virtual GeoObject* push_back(GeoObject* o) { objects_.push_back(o); o->parent_ = this; @@ -213,8 +214,8 @@ class GeoPoint : public GeoObject { lon_ -= 360; } UserPoint* point = - new UserPoint(lon_, lat_, tonumber(getProperty("value", "0")), false, false, getProperty("name")); - cout << "pushing " << *point << endl; + new UserPoint(lon_, lat_, tonumber(getProperty(value_, "0")), false, false, getProperty("name")); + out.push_back(point); } void shift(PointsList& out, double value) { @@ -225,15 +226,25 @@ class GeoPoint : public GeoObject { } void set(const std::set& needs, CustomisedPoint& point) { + if (value_ == "value") { + point.type("mosmix"); + } + + else + point.type(value_); for (std::set::iterator need = needs.begin(); need != needs.end(); ++need) { + string value = getProperty(*need); + if (value.empty()) continue; point.insert(make_pair(*need, tonumber(value))); } + } void create(const std::set& needs, CustomisedPointsList& out) { + CustomisedPoint* point = new CustomisedPoint(lon_, lat_, getProperty("name")); set(needs, *point); out.push_back(point); @@ -266,7 +277,7 @@ class MultiLineString : public GeoObject { } vector > > lines_; void create(PointsList& out, const string& ref) { - double value = tonumber(getProperty("value", "0")); + double value = tonumber(getProperty(value_, "0")); string name = getProperty("name"); for (vector > >::iterator line = lines_.begin(); line != lines_.end(); ++line) { for (vector >::iterator point = line->begin(); point != line->end(); ++point) { @@ -277,7 +288,7 @@ class MultiLineString : public GeoObject { } } void shift(PointsList& out) { - double value = tonumber(getProperty("value", "0")); + double value = tonumber(getProperty(value_, "0")); string name = getProperty("name"); for (vector > >::iterator line = lines_.begin(); line != lines_.end(); ++line) { for (vector >::iterator point = line->begin(); point != line->end(); ++point) { @@ -519,6 +530,7 @@ void GeoJSon::dig(const Value& value) { GeoObject* previous = current_; if (type != "") { GeoObject* current = SimpleObjectMaker::create(type); + current->value_ = value_; previous = current_; current_ = (current_) ? current_->push_back(current) : current; current_ = current; @@ -572,7 +584,7 @@ void GeoJSon::decode() { if (MagicsGlobal::strict()) { throw; } - MagLog::error() << "Could not processed the file: " << path_ << ": " << e.what() << endl; + MagLog::error() << "GEOJSON:Could not processed the file: " << path_ << ": " << e.what() << endl; abort(); } if (parent_) { @@ -584,22 +596,38 @@ void GeoJSon::decode() { void GeoJSon::points(const Transformation& transformation, vector& points) { decode(); - cout << " GeoJSon::points" << endl; } PointsHandler& GeoJSon::points(const Transformation& transformation, bool) { decode(); pointsHandlers_.push_back(new PointsHandler(*this)); return *(pointsHandlers_.back()); - cout << " GeoJSon::points khfkjdhgjkh" << endl; } void GeoJSon::customisedPoints(const Transformation&, const std::set& needs, CustomisedPointsList& out, bool) { decode(); + cout << "GeoJSon::customisedPoints" << endl; + for (auto need = needs.begin(); need != needs.end(); ++need) + cout << "need " << *need << endl; if (parent_) { parent_->create(needs, out); parent_->shift(needs, out); } - cout << " GeoJSon::poincustomisedPointsts" << endl; +} +void GeoJSon::getInfo(const std::set& what, + multimap& info) +{ + // Hack should be read for the data + if (value_ == "value") { + info.insert(make_pair("type", "mosmix")); + cout << "MOSMIX" << endl; + } + else { + cout << "TYPE-->" << value_ << endl; + info.insert(make_pair("type", value_)); + } + + + } diff --git a/src/web/GeoJSon.h b/src/web/GeoJSon.h index 66db165fd..ffaebdf20 100644 --- a/src/web/GeoJSon.h +++ b/src/web/GeoJSon.h @@ -62,6 +62,8 @@ class GeoJSon : public Data, public PointsList, public GeoJSonAttributes { GeoObject* current_; GeoObject* parent_; Matrix* matrix_; + void getInfo(const std::set& what, multimap& info) override;; + private: //! Copy constructor - No copy allowed From b0cfa820f0c97ecd9fcab7cb5373849fb2b444cc Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 10 Aug 2022 15:25:42 +0200 Subject: [PATCH 21/66] ObsPlotting : Hackathon 2022 support for more GeojSOn visualisation --- src/attributes/ObsPlottingAttributes.cc | 16 +-- src/attributes/ObsPlottingAttributes.h | 2 +- src/attributes/ObsPlottingWrapper.cc | 10 +- src/basic/FortranMagics.cc | 34 +++---- src/basic/FortranMagics.h | 1 + src/params/ObsPlotting.xml | 2 +- src/visualisers/ObsItemFamily.cc | 128 ++++++++++++------------ src/visualisers/ObsItemFamily.h | 15 +-- src/visualisers/ObsPlotting.cc | 2 - src/visualisers/ObsTable.cc | 5 +- src/visualisers/ObsTable.h | 3 + src/web/GeoJSon.cc | 15 +-- src/web/GeoJSon.h | 2 +- 13 files changed, 108 insertions(+), 127 deletions(-) diff --git a/src/attributes/ObsPlottingAttributes.cc b/src/attributes/ObsPlottingAttributes.cc index 5dea86ef3..32f909c72 100644 --- a/src/attributes/ObsPlottingAttributes.cc +++ b/src/attributes/ObsPlottingAttributes.cc @@ -48,6 +48,7 @@ ObsPlottingAttributes::ObsPlottingAttributes(): time_plot_visible_(ParameterManager::getBool("obs_time")), visibility_visible_(ParameterManager::getBool("obs_visibility")), wind_visible_(ParameterManager::getBool("obs_wind")), + wind_colour_(ParameterManager::getString("obs_wind_colour")), wind_projected_(ParameterManager::getBool("obs_wind_projected")) , colour_(MagTranslator().magics("obs_colour")), @@ -68,8 +69,7 @@ ObsPlottingAttributes::ObsPlottingAttributes(): waves_colour_(MagTranslator().magics("obs_waves_colour")), past_ww_colour_(MagTranslator().magics("obs_past_weather_colour")), time_plot_colour_(MagTranslator().magics("obs_time_colour")), - visibility_colour_(MagTranslator().magics("obs_visibility_colour")), - wind_colour_(MagTranslator().magics("obs_wind_colour")) + visibility_colour_(MagTranslator().magics("obs_visibility_colour")) { } @@ -110,6 +110,7 @@ void ObsPlottingAttributes::set(const std::map& params) setAttribute(prefix, "obs_time", time_plot_visible_, params); setAttribute(prefix, "obs_visibility", visibility_visible_, params); setAttribute(prefix, "obs_wind", wind_visible_, params); + setAttribute(prefix, "obs_wind_colour", wind_colour_, params); setAttribute(prefix, "obs_wind_projected", wind_projected_, params); setMember(prefix, "obs_colour", colour_, params); @@ -131,7 +132,6 @@ void ObsPlottingAttributes::set(const std::map& params) setMember(prefix, "obs_past_weather_colour", past_ww_colour_, params); setMember(prefix, "obs_time_colour", time_plot_colour_, params); setMember(prefix, "obs_visibility_colour", visibility_colour_, params); - setMember(prefix, "obs_wind_colour", wind_colour_, params); } @@ -160,6 +160,7 @@ void ObsPlottingAttributes::copy(const ObsPlottingAttributes& other) time_plot_visible_ = other.time_plot_visible_; visibility_visible_ = other.visibility_visible_; wind_visible_ = other.wind_visible_; + wind_colour_ = other.wind_colour_; wind_projected_ = other.wind_projected_; colour_ = unique_ptr(other.colour_->clone()); present_ww_colour_ = unique_ptr(other.present_ww_colour_->clone()); @@ -180,7 +181,6 @@ void ObsPlottingAttributes::copy(const ObsPlottingAttributes& other) past_ww_colour_ = unique_ptr(other.past_ww_colour_->clone()); time_plot_colour_ = unique_ptr(other.time_plot_colour_->clone()); visibility_colour_ = unique_ptr(other.visibility_colour_->clone()); - wind_colour_ = unique_ptr(other.wind_colour_->clone()); } @@ -242,6 +242,7 @@ void ObsPlottingAttributes::print(ostream& out) const out << " time_plot_visible = " << time_plot_visible_; out << " visibility_visible = " << visibility_visible_; out << " wind_visible = " << wind_visible_; + out << " wind_colour = " << wind_colour_; out << " wind_projected = " << wind_projected_; out << " colour = " << *colour_; out << " present_ww_colour = " << *present_ww_colour_; @@ -262,7 +263,6 @@ void ObsPlottingAttributes::print(ostream& out) const out << " past_ww_colour = " << *past_ww_colour_; out << " time_plot_colour = " << *time_plot_colour_; out << " visibility_colour = " << *visibility_colour_; - out << " wind_colour = " << *wind_colour_; out << "]" << "\n"; } @@ -316,6 +316,8 @@ void ObsPlottingAttributes::toxml(ostream& out) const niceprint(out,visibility_visible_); out << ", \"obs_wind\":"; niceprint(out,wind_visible_); + out << ", \"obs_wind_colour\":"; + niceprint(out,wind_colour_); out << ", \"obs_wind_projected\":"; niceprint(out,wind_projected_); out << ", \"obs_colour\":"; @@ -356,8 +358,6 @@ void ObsPlottingAttributes::toxml(ostream& out) const niceprint(out, *time_plot_colour_); out << ", \"obs_visibility_colour\":"; niceprint(out, *visibility_colour_); - out << ", \"obs_wind_colour\":"; - niceprint(out, *wind_colour_); } @@ -384,6 +384,7 @@ static MagicsParameter obs_past_weather("obs_past_weather", "on"); static MagicsParameter obs_time("obs_time", "off"); static MagicsParameter obs_visibility("obs_visibility", "on"); static MagicsParameter obs_wind("obs_wind", "on"); +static MagicsParameter obs_wind_colour("obs_wind_colour", "automatic"); static MagicsParameter obs_wind_projected("obs_wind_projected", "on"); static MagicsParameter obs_colour("obs_colour", "black"); static MagicsParameter obs_present_weather_colour("obs_present_weather_colour", "automatic"); @@ -404,4 +405,3 @@ static MagicsParameter obs_waves_colour("obs_waves_colour", "black"); static MagicsParameter obs_past_weather_colour("obs_past_weather_colour", "red"); static MagicsParameter obs_time_colour("obs_time_colour", "automatic"); static MagicsParameter obs_visibility_colour("obs_visibility_colour", "automatic"); -static MagicsParameter obs_wind_colour("obs_wind_colour", "automatic"); diff --git a/src/attributes/ObsPlottingAttributes.h b/src/attributes/ObsPlottingAttributes.h index 34fe6b67e..f2eb58cbb 100644 --- a/src/attributes/ObsPlottingAttributes.h +++ b/src/attributes/ObsPlottingAttributes.h @@ -74,6 +74,7 @@ class ObsPlottingAttributes bool time_plot_visible_; bool visibility_visible_; bool wind_visible_; + string wind_colour_; bool wind_projected_; unique_ptr colour_; unique_ptr present_ww_colour_; @@ -94,7 +95,6 @@ class ObsPlottingAttributes unique_ptr past_ww_colour_; unique_ptr time_plot_colour_; unique_ptr visibility_colour_; - unique_ptr wind_colour_; private: diff --git a/src/attributes/ObsPlottingWrapper.cc b/src/attributes/ObsPlottingWrapper.cc index dad253bac..adcd4eab3 100644 --- a/src/attributes/ObsPlottingWrapper.cc +++ b/src/attributes/ObsPlottingWrapper.cc @@ -186,6 +186,10 @@ void ObsPlottingWrapper::set(const MagRequest& request) obsplotting_->wind_visible_ = MagTranslator()(wind_visible_value); + } + if (request.countValues("OBS_WIND_COLOUR") ) { + string wind_colour_value = request("OBS_WIND_COLOUR"); + obsplotting_->wind_colour_ = wind_colour_value; } if (request.countValues("OBS_WIND_PROJECTED") ) { string wind_projected_value = request("OBS_WIND_PROJECTED"); @@ -289,11 +293,6 @@ void ObsPlottingWrapper::set(const MagRequest& request) obsplotting_->visibility_colour_ = unique_ptr(MagTranslator()(visibility_colour_value)); } - if (request.countValues("OBS_WIND_COLOUR") ) { - string wind_colour_value = request("OBS_WIND_COLOUR"); - obsplotting_->wind_colour_ = unique_ptr(MagTranslator()(wind_colour_value)); - } - } @@ -320,6 +319,5 @@ void ObsPlottingWrapper::print(ostream& out) const - diff --git a/src/basic/FortranMagics.cc b/src/basic/FortranMagics.cc index 576e5d00c..061f418c7 100644 --- a/src/basic/FortranMagics.cc +++ b/src/basic/FortranMagics.cc @@ -102,9 +102,11 @@ void FortranMagics::reset() { empty_ = true; gribindex_ = 0; legend_todo_ = false; + symbolinput_todo_ = false; matrixinput_todo_ = false; polyinput_todo_ = false; + obsinput_todo_ = false; while (actions_.size()) { @@ -430,26 +432,22 @@ void FortranMagics::ptephi() { void FortranMagics::pobs() { actions(); - // HACK - action_->visdef(new ObsPlotting()); - - cout << "FortranMagics::pobs() {" << endl; - return; - - - action_ = new VisualAction(); - ObsDecoder* obs = new ObsDecoder(); - if (obs->defined()) { - action_->data(obs); - top()->push_back(action_); - action_->visdef(new ObsPlotting()); - return; + if (!action_ || obsinput_todo_ ) { + action_ = new VisualAction(); + ObsDecoder* obs = new ObsDecoder(); + if (obs->defined()) { + action_->data(obs); + top()->push_back(action_); + + } + else { + action_ = new VisualAction(); + action_->data(new ObsJSon()); + top()->push_back(action_); + } } - action_ = new VisualAction(); - action_->data(new ObsJSon()); - top()->push_back(action_); action_->visdef(new ObsPlotting()); - return; + } #include "MatrixTestDecoder.h" diff --git a/src/basic/FortranMagics.h b/src/basic/FortranMagics.h index ae4ef9435..cd9179e14 100644 --- a/src/basic/FortranMagics.h +++ b/src/basic/FortranMagics.h @@ -151,6 +151,7 @@ class FortranMagics : public std::stack { bool symbolinput_todo_; bool matrixinput_todo_; bool polyinput_todo_; + bool obsinput_todo_; private: FortranMagics(); diff --git a/src/params/ObsPlotting.xml b/src/params/ObsPlotting.xml index 002408a5f..d034808bf 100644 --- a/src/params/ObsPlotting.xml +++ b/src/params/ObsPlotting.xml @@ -331,7 +331,7 @@ does it submit to any jurisdiction. diff --git a/src/visualisers/ObsItemFamily.cc b/src/visualisers/ObsItemFamily.cc index 7956243cc..4734f0f94 100644 --- a/src/visualisers/ObsItemFamily.cc +++ b/src/visualisers/ObsItemFamily.cc @@ -41,6 +41,15 @@ void ObsItemBox::set(const map& def) { key_ = find(def, "key", ""); format_ = find(def, "format", ""); justification_ = translate(find(def, "justification", "centre")); + +} + +void ObsWind::set(const map& def) { + row_ = atoi(find(def, "row").c_str()); + column_ = atoi(find(def, "column").c_str()); + colour_ = find(def, "colour"); + speed_ = find(def, "wind_speed", "wind_speed"); + direction_ = find(def, "wind_direction", "wind_direction"); } @@ -57,17 +66,15 @@ void ObsWind::visit(std::set& tokens) { } void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { - // if (!owner_->wind_visible_) - // return; + if (!owner_->wind_visible_) + return; map::iterator it = point.begin(); map::iterator en = point.end(); - // for (; it != en; ++it) { - // F MagLog::debug() << " >>> " << it->first << " -> " << it->second << endl; - // F} - Colour colour = owner_->wind_colour_->automatic() ? *owner_->colour_ : *owner_->wind_colour_; + + string colouring = (colour_.size() ) ? colour_ : owner_->wind_colour_; + Colour colour; - CustomisedPoint::const_iterator speed = point.find(speed_); if (speed == point.end()) @@ -75,36 +82,35 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { CustomisedPoint::const_iterator direction = point.find(direction_); if (direction == point.end()) return; - - - - if ( speed->second < 1. ) - colour = Colour("green"); - if ( speed->second > 1.5 && speed->second <2 ) - colour = Colour("yellow"); - if ( speed->second > 2.5 && speed->second <3 ) - colour = Colour("orange"); - if ( speed->second > 3.5 && speed->second <4 ) - colour = Colour("red"); - if ( speed->second > 4 ) - colour = Colour("purple"); - + if ( magCompare(colouring, "automatic") ) + colour = *owner_->colour_; + if ( magCompare(colouring, "coloured_wind") ) + { + if ( speed->second < 1. ) + colour = Colour("green"); + if ( speed->second > 1.5 && speed->second <2 ) + colour = Colour("yellow"); + if ( speed->second > 2.5 && speed->second <3 ) + colour = Colour("orange"); + if ( speed->second > 3.5 && speed->second <4 ) + colour = Colour("red"); + if ( speed->second > 4 ) + colour = Colour("purple"); + } + else { + colour = Colour(owner_->wind_colour_); + } FlagItem* flag = new FlagItem(); flag->setColour(colour); flag->setThickness(2); flag->length(owner_->size_ * 2.); // Size to be adjusted later! - const string origin = "duck"; - + const string origin = "circle"; // Duck for hackathon - // FMagLog::debug() << "OBS ITEM - ObsWind - Lon/Lat: " << point.longitude() << " / " << point.latitude() - // F << "\n\twind_speed: " << point[speed_] << "\n\twind_direction: " << point[direction_] - // F << "\n\tcloud amount: " << point["total_cloud"] << " -> " << origin << std::endl; - - flag->setOriginHeight(owner_->ring_size_ * 3); + flag->setOriginHeight(owner_->ring_size_); flag->setOriginMarker(origin); flag->x(0); flag->y(0); @@ -144,18 +150,18 @@ void ObsCloudAndWind::setOrigins() { void ObsCloudAndWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { if (!owner_->wind_visible_) return; + + + string colouring = owner_->wind_colour_; + Colour colour; - Colour colour = owner_->wind_colour_->automatic() ? *owner_->colour_ : *owner_->wind_colour_; map::iterator it = point.begin(); map::iterator en = point.end(); - // Ffor (; it != en; ++it) { - // F MagLog::debug() << " >>> " << it->first << " -> " << it->second << endl; - // F} + symbol.setHeight(owner_->size_); int total_cloud = maground((point["total_cloud"] / 100.) * 8); - // FMagLog::debug() << "total_cloud-->" << point["total_cloud"] << "--->" << total_cloud << endl; map::const_iterator marker = origins_.find(total_cloud); string origin; @@ -172,6 +178,26 @@ void ObsCloudAndWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) CustomisedPoint::const_iterator idirection = point.find("wind_direction"); double direction = (idirection == point.end()) ? 0 : idirection->second; + if ( magCompare(colouring, "automatic") ) + colour = *owner_->colour_; + if ( magCompare(colouring, "coloured_wind") ) + { + if ( speed < 1. ) + colour = Colour("green"); + if ( speed > 1.5 && speed <2 ) + colour = Colour("yellow"); + if ( speed > 2.5 && speed <3 ) + colour = Colour("orange"); + if ( speed > 3.5 && speed <4 ) + colour = Colour("red"); + if ( speed > 4 ) + colour = Colour("purple"); + } + else { + colour = Colour(owner_->wind_colour_); + } + + if (speed == 0 && direction == 0) { // No wind information ...Just plot the nebulosity SymbolItem* object = new SymbolItem(); @@ -196,11 +222,7 @@ void ObsCloudAndWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) flag->thickness(1.5); - // FMagLog::debug() << "OBS ITEM - ObsWind - Lon/Lat: " << point.longitude() << " / " << point.latitude() - // F << "\n\twind_speed: " << point["wind_speed"] - // F << "\n\twind_direction: " << point["wind_direction"] - // F << "\n\tcloud amount: " << point["total_cloud"] << "--->" << total_cloud << "--->" << origin - // F << std::endl; + flag->setOriginHeight(owner_->ring_size_ * 1.75); flag->setOriginMarker(origin); @@ -254,7 +276,6 @@ void ObsPressure::operator()(CustomisedPoint& point, ComplexSymbol& symbol) cons object->text(os.str()); - // FMagLog::debug() << "\tPressure: " << value->second << " = " << pressure << " -> " << os.str() << "\n"; object->font(font); symbol.add(object); @@ -339,7 +360,6 @@ void ObsPressureTendency::operator()(CustomisedPoint& point, ComplexSymbol& symb oss << "a_" << value->second; tendancy->symbol(oss.str()); - // FMagLog::debug() << "\tPressure tendency--->" << oss.str() << "\n"; tendancy->height(owner_->size_ * 0.8); // A bit too big ! symbol.add(tendancy); @@ -369,7 +389,6 @@ void ObsDewPoint::operator()(CustomisedPoint& point, ComplexSymbol& symbol) cons // The temperature is displayed in Celsius. const double tempe = maground(value->second - 273.15); - // FMagLog::debug() << "\tDewPoint--->" << point["dewpoint_2meters"] << " = " << tempe << "\n"; object->text(tostring(tempe)); object->font(font); @@ -415,7 +434,6 @@ void ObsVisibility::operator()(CustomisedPoint& point, ComplexSymbol& symbol) co object->text(val); - // FMagLog::debug() << "\tVisibility: " << vv << " = " << val << "\n"; font.size(owner_->size_); object->font(font); @@ -517,21 +535,18 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol else ww = w->second; } - cout << "Present Weather->" << ww << endl; if (ww.empty()) return; SymbolItem* object = new SymbolItem(); object->x(column_); object->y(row_); - cout << "Present Weather->" << ww << endl; object->colour(colour); object->symbol(ww); - // FMagLog::debug() << "\tPresent Weather--->" << ww << " in " << colour << "\n"; - // time->setJustification(MRIGHT); + object->height(owner_->size_); symbol.add(object); } @@ -579,7 +594,6 @@ void ObsTimePlot::operator()(CustomisedPoint& point, ComplexSymbol& symbol) cons if (value == point.end()) return; - // FMagLog::debug() << "\tTimePlot: " << value->second << "at[" << column_ << ", " << row_ << "]" << endl; Colour colour = owner_->time_plot_colour_->automatic() ? *owner_->colour_ : *owner_->time_plot_colour_; @@ -613,7 +627,6 @@ void ObsHeight::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const return; double geop = maground(value->second / 98.1); - // FMagLog::debug() << "\tGeopotential: " << geop << "at[" << column_ << ", " << row_ << "]" << endl; Colour colour = owner_->height_colour_->automatic() ? *owner_->colour_ : *owner_->height_colour_; TextItem* height = new TextItem(); MagFont font("sansserif"); @@ -644,9 +657,7 @@ void ObsThickness::operator()(CustomisedPoint& point, ComplexSymbol& symbol) con if (value == point.end()) return; const double thickness = maground(value->second / 98.1); -#ifdef OBS_DEBUG_ - // FMagLog::debug() << "\tThickness: " << thickness << "at[" << column_ << ", " << row_ << "]" << endl; -#endif + Colour colour = owner_->thickness_colour_->automatic() ? *owner_->colour_ : *owner_->thickness_colour_; TextItem* object = new TextItem(); MagFont font("sansserif"); @@ -670,14 +681,10 @@ void ObsIdentifier::visit(std::set&) { } void ObsIdentifier::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { - // if (!owner_->identifier_visible_) - // return; + if (!owner_->identifier_visible_) + return; TextItem* time = new TextItem(); - cout << "ObsIdentifier::operator()" << point.identifier() << endl; -#ifdef OBS_DEBUG_ - // FMagLog::debug() << "Identification for " << point.identifier() << "at[" << column_ << ", " << row_ << "]" << - // endl; -#endif + Colour colour = owner_->identifier_colour_->automatic() ? *owner_->colour_ : *owner_->identifier_colour_; MagFont font("sansserif"); font.colour(colour); @@ -685,7 +692,6 @@ void ObsIdentifier::operator()(CustomisedPoint& point, ComplexSymbol& symbol) co time->x(column_); time->y(row_); time->text(point.identifier()); - cout << point.identifier() << endl; // time->setJustification(MRIGHT); time->font(font); @@ -961,7 +967,6 @@ void ObsCloud::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { cloud->colour(*owner_->medium_colour_); cloud->symbol(medium->second); - // FMagLog::debug() << "\tMedium Cloud--->" << value->second << " --> " << medium->second << "\n"; cloud->height(owner_->size_); symbol.add(cloud); @@ -979,7 +984,6 @@ void ObsCloud::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { cloud->colour(*owner_->high_colour_); cloud->symbol(high->second); - // FMagLog::debug() << "\tHigh Cloud--->" << value->second << "-->" << high->second << "\n"; cloud->height(owner_->size_); symbol.add(cloud); @@ -1006,7 +1010,6 @@ void ObsDemoItem1::visit(std::set& tokens) { void ObsDemoItem1::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { if (point.find("temperature") == point.end()) { - // FMagLog::debug() << "No info for temperature given!" << endl; return; } @@ -1195,7 +1198,6 @@ void ObsWave::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { if (period == point.end() || height == point.end()) return; - // FMagLog::debug() << "\theight: " << height->second << " period " << period->second << "\n"; // height of waves in units of 0.5 double h = maground(height->second / 0.5); double p = maground(period->second); diff --git a/src/visualisers/ObsItemFamily.h b/src/visualisers/ObsItemFamily.h index 854cea8f2..86e0dbbb5 100644 --- a/src/visualisers/ObsItemFamily.h +++ b/src/visualisers/ObsItemFamily.h @@ -47,14 +47,13 @@ class ObsStationRing : public ObsItemBox { void operator()(CustomisedPoint&, ComplexSymbol& symbol) const override { - // if (!owner_->station_ring_visible_) - // return; + if (!owner_->station_ring_visible_) + return; SymbolItem* station = new SymbolItem(); station->x(column_); station->y(row_); station->colour(*owner_->station_ring_colour_); - // station->symbol("N_8"); - station->symbol("duck"); + station->symbol("N_8"); station->height(owner_->ring_size_*2); symbol.add(station); } @@ -106,13 +105,7 @@ class ObsWind : public ObsItemBox { void visit(std::set& tokens) override; virtual void operator()(CustomisedPoint&, ComplexSymbol&) const override; - virtual void set(const map& def) override { - row_ = atoi(find(def, "row").c_str()); - column_ = atoi(find(def, "column").c_str()); - colour_ = find(def, "colour"); - speed_ = find(def, "wind_speed", "wind_speed"); - direction_ = find(def, "wind_direction", "wind_to_direction"); - } + void set(const map& def) override; protected: string speed_; diff --git a/src/visualisers/ObsPlotting.cc b/src/visualisers/ObsPlotting.cc index 5f9b82be6..30bfd4220 100644 --- a/src/visualisers/ObsPlotting.cc +++ b/src/visualisers/ObsPlotting.cc @@ -43,7 +43,6 @@ void ObsPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { std::set needs; std::set info; multimap types; - cout << "ObsPlotting::operator()" << endl; info.insert("type"); data.getInfo(info, types); @@ -80,7 +79,6 @@ void ObsPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { try { const ObsTemplate& obs = ObsTable::getTemplate(type->second); for (const auto& val : values) { - cout << type->second << " " << val->type() << endl; if (type->second == val->type()) { obs(*val, out); } diff --git a/src/visualisers/ObsTable.cc b/src/visualisers/ObsTable.cc index 3130fe9ef..4e21845aa 100644 --- a/src/visualisers/ObsTable.cc +++ b/src/visualisers/ObsTable.cc @@ -112,8 +112,7 @@ void ObsTable::add(const string& tag, const map& def) { if (MagicsGlobal::strict()) { throw; } - // FMagLog::dev() << "cannot find ObsItem for : " << tag << "\n"; - cout << "cannot find ObsItem for : " << tag << "\n"; + MagLog::warning() << "cannot find ObsItem for : " << tag << "\n"; } } } @@ -132,7 +131,7 @@ const ObsTemplate& ObsTable::get(const string& type) { void ObsTemplate::operator()(CustomisedPoint& obs, BasicGraphicsObjectContainer& out) const { - cout << "ObsTemplate" << endl; + if (empty()) return; // Nothing to display. diff --git a/src/visualisers/ObsTable.h b/src/visualisers/ObsTable.h index 67d2011b4..606c46634 100644 --- a/src/visualisers/ObsTable.h +++ b/src/visualisers/ObsTable.h @@ -28,6 +28,9 @@ class ObsTemplate : public vector { columns_ = (val != def.end()) ? atoi(val->second.c_str()) : 3; val = def.find("rows"); rows_ = (val != def.end()) ? atoi(val->second.c_str()) : 3; + cout << "ObsTemplate->" << size() << endl; + for (const_iterator item = begin(); item != end(); ++item) + (*item)->set(def); } virtual ~ObsTemplate() {} void visit(std::set& tokens) const { diff --git a/src/web/GeoJSon.cc b/src/web/GeoJSon.cc index 5daf53684..310ba7215 100644 --- a/src/web/GeoJSon.cc +++ b/src/web/GeoJSon.cc @@ -607,9 +607,7 @@ PointsHandler& GeoJSon::points(const Transformation& transformation, bool) { void GeoJSon::customisedPoints(const Transformation&, const std::set& needs, CustomisedPointsList& out, bool) { decode(); - cout << "GeoJSon::customisedPoints" << endl; - for (auto need = needs.begin(); need != needs.end(); ++need) - cout << "need " << *need << endl; + if (parent_) { parent_->create(needs, out); parent_->shift(needs, out); @@ -618,16 +616,7 @@ void GeoJSon::customisedPoints(const Transformation&, const std::set& ne void GeoJSon::getInfo(const std::set& what, multimap& info) { - // Hack should be read for the data - if (value_ == "value") { - info.insert(make_pair("type", "mosmix")); - cout << "MOSMIX" << endl; - } - else { - cout << "TYPE-->" << value_ << endl; + info.insert(make_pair("type", value_)); - } - - } diff --git a/src/web/GeoJSon.h b/src/web/GeoJSon.h index ffaebdf20..9d5340527 100644 --- a/src/web/GeoJSon.h +++ b/src/web/GeoJSon.h @@ -62,7 +62,7 @@ class GeoJSon : public Data, public PointsList, public GeoJSonAttributes { GeoObject* current_; GeoObject* parent_; Matrix* matrix_; - void getInfo(const std::set& what, multimap& info) override;; + void getInfo(const std::set& what, multimap& info) override; private: From 609a144c06b6115c58757680c0cc5e565ddf6db6 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 5 Sep 2022 14:34:10 +0100 Subject: [PATCH 22/66] Fix issues with level_selection_type=count fix issue with observation plotting --- src/attributes/ObsPlottingAttributes.cc | 21 ++++++---- src/attributes/ObsPlottingAttributes.h | 3 +- src/attributes/ObsPlottingWrapper.cc | 14 ++++--- src/params/ObsPlotting.xml | 11 ++++- src/visualisers/CountSelectionType.cc | 54 ++++++++++++------------- src/visualisers/ObsItemFamily.cc | 22 +++++----- src/visualisers/ObsTable.h | 1 - 7 files changed, 68 insertions(+), 58 deletions(-) diff --git a/src/attributes/ObsPlottingAttributes.cc b/src/attributes/ObsPlottingAttributes.cc index 32f909c72..70c0a50d3 100644 --- a/src/attributes/ObsPlottingAttributes.cc +++ b/src/attributes/ObsPlottingAttributes.cc @@ -29,6 +29,7 @@ ObsPlottingAttributes::ObsPlottingAttributes(): size_(ParameterManager::getDouble("obs_size")), ring_size_(ParameterManager::getDouble("obs_ring_size")), present_ww_visible_(ParameterManager::getBool("obs_present_weather")), + present_ww_colour_(ParameterManager::getString("obs_present_weather_colour")), pressure_visible_(ParameterManager::getBool("obs_pressure")), upper_air_visible_(ParameterManager::getBool("obs_upper_air_pressure")), pressure_tendency_visible_(ParameterManager::getBool("obs_pressure_tendency")), @@ -49,10 +50,10 @@ ObsPlottingAttributes::ObsPlottingAttributes(): visibility_visible_(ParameterManager::getBool("obs_visibility")), wind_visible_(ParameterManager::getBool("obs_wind")), wind_colour_(ParameterManager::getString("obs_wind_colour")), + wind_thickness_(ParameterManager::getInt("obs_wind_thickness")), wind_projected_(ParameterManager::getBool("obs_wind_projected")) , colour_(MagTranslator().magics("obs_colour")), - present_ww_colour_(MagTranslator().magics("obs_present_weather_colour")), pressure_colour_(MagTranslator().magics("obs_pressure_colour")), upper_air_colour_(MagTranslator().magics("obs_upper_air_pressure_colour")), pressure_tendency_colour_(MagTranslator().magics("obs_pressure_tendency_colour")), @@ -91,6 +92,7 @@ void ObsPlottingAttributes::set(const std::map& params) setAttribute(prefix, "obs_size", size_, params); setAttribute(prefix, "obs_ring_size", ring_size_, params); setAttribute(prefix, "obs_present_weather", present_ww_visible_, params); + setAttribute(prefix, "obs_present_weather_colour", present_ww_colour_, params); setAttribute(prefix, "obs_pressure", pressure_visible_, params); setAttribute(prefix, "obs_upper_air_pressure", upper_air_visible_, params); setAttribute(prefix, "obs_pressure_tendency", pressure_tendency_visible_, params); @@ -111,10 +113,10 @@ void ObsPlottingAttributes::set(const std::map& params) setAttribute(prefix, "obs_visibility", visibility_visible_, params); setAttribute(prefix, "obs_wind", wind_visible_, params); setAttribute(prefix, "obs_wind_colour", wind_colour_, params); + setAttribute(prefix, "obs_wind_thickness", wind_thickness_, params); setAttribute(prefix, "obs_wind_projected", wind_projected_, params); setMember(prefix, "obs_colour", colour_, params); - setMember(prefix, "obs_present_weather_colour", present_ww_colour_, params); setMember(prefix, "obs_pressure_colour", pressure_colour_, params); setMember(prefix, "obs_upper_air_pressure_colour", upper_air_colour_, params); setMember(prefix, "obs_pressure_tendency_colour", pressure_tendency_colour_, params); @@ -141,6 +143,7 @@ void ObsPlottingAttributes::copy(const ObsPlottingAttributes& other) size_ = other.size_; ring_size_ = other.ring_size_; present_ww_visible_ = other.present_ww_visible_; + present_ww_colour_ = other.present_ww_colour_; pressure_visible_ = other.pressure_visible_; upper_air_visible_ = other.upper_air_visible_; pressure_tendency_visible_ = other.pressure_tendency_visible_; @@ -161,9 +164,9 @@ void ObsPlottingAttributes::copy(const ObsPlottingAttributes& other) visibility_visible_ = other.visibility_visible_; wind_visible_ = other.wind_visible_; wind_colour_ = other.wind_colour_; + wind_thickness_ = other.wind_thickness_; wind_projected_ = other.wind_projected_; colour_ = unique_ptr(other.colour_->clone()); - present_ww_colour_ = unique_ptr(other.present_ww_colour_->clone()); pressure_colour_ = unique_ptr(other.pressure_colour_->clone()); upper_air_colour_ = unique_ptr(other.upper_air_colour_->clone()); pressure_tendency_colour_ = unique_ptr(other.pressure_tendency_colour_->clone()); @@ -223,6 +226,7 @@ void ObsPlottingAttributes::print(ostream& out) const out << " size = " << size_; out << " ring_size = " << ring_size_; out << " present_ww_visible = " << present_ww_visible_; + out << " present_ww_colour = " << present_ww_colour_; out << " pressure_visible = " << pressure_visible_; out << " upper_air_visible = " << upper_air_visible_; out << " pressure_tendency_visible = " << pressure_tendency_visible_; @@ -243,9 +247,9 @@ void ObsPlottingAttributes::print(ostream& out) const out << " visibility_visible = " << visibility_visible_; out << " wind_visible = " << wind_visible_; out << " wind_colour = " << wind_colour_; + out << " wind_thickness = " << wind_thickness_; out << " wind_projected = " << wind_projected_; out << " colour = " << *colour_; - out << " present_ww_colour = " << *present_ww_colour_; out << " pressure_colour = " << *pressure_colour_; out << " upper_air_colour = " << *upper_air_colour_; out << " pressure_tendency_colour = " << *pressure_tendency_colour_; @@ -278,6 +282,8 @@ void ObsPlottingAttributes::toxml(ostream& out) const niceprint(out,ring_size_); out << ", \"obs_present_weather\":"; niceprint(out,present_ww_visible_); + out << ", \"obs_present_weather_colour\":"; + niceprint(out,present_ww_colour_); out << ", \"obs_pressure\":"; niceprint(out,pressure_visible_); out << ", \"obs_upper_air_pressure\":"; @@ -318,12 +324,12 @@ void ObsPlottingAttributes::toxml(ostream& out) const niceprint(out,wind_visible_); out << ", \"obs_wind_colour\":"; niceprint(out,wind_colour_); + out << ", \"obs_wind_thickness\":"; + niceprint(out,wind_thickness_); out << ", \"obs_wind_projected\":"; niceprint(out,wind_projected_); out << ", \"obs_colour\":"; niceprint(out, *colour_); - out << ", \"obs_present_weather_colour\":"; - niceprint(out, *present_ww_colour_); out << ", \"obs_pressure_colour\":"; niceprint(out, *pressure_colour_); out << ", \"obs_upper_air_pressure_colour\":"; @@ -365,6 +371,7 @@ static MagicsParameter obs_distance_apart("obs_distance_apart", 1.0); static MagicsParameter obs_size("obs_size", 0.25); static MagicsParameter obs_ring_size("obs_ring_size", -1); static MagicsParameter obs_present_weather("obs_present_weather", "on"); +static MagicsParameter obs_present_weather_colour("obs_present_weather_colour", "automatic"); static MagicsParameter obs_pressure("obs_pressure", "on"); static MagicsParameter obs_upper_air_pressure("obs_upper_air_pressure", "off"); static MagicsParameter obs_pressure_tendency("obs_pressure_tendency", "on"); @@ -385,9 +392,9 @@ static MagicsParameter obs_time("obs_time", "off"); static MagicsParameter obs_visibility("obs_visibility", "on"); static MagicsParameter obs_wind("obs_wind", "on"); static MagicsParameter obs_wind_colour("obs_wind_colour", "automatic"); +static MagicsParameter obs_wind_thickness("obs_wind_thickness", 1); static MagicsParameter obs_wind_projected("obs_wind_projected", "on"); static MagicsParameter obs_colour("obs_colour", "black"); -static MagicsParameter obs_present_weather_colour("obs_present_weather_colour", "automatic"); static MagicsParameter obs_pressure_colour("obs_pressure_colour", "automatic"); static MagicsParameter obs_upper_air_pressure_colour("obs_upper_air_pressure_colour", "automatic"); static MagicsParameter obs_pressure_tendency_colour("obs_pressure_tendency_colour", "red"); diff --git a/src/attributes/ObsPlottingAttributes.h b/src/attributes/ObsPlottingAttributes.h index f2eb58cbb..154c0afbc 100644 --- a/src/attributes/ObsPlottingAttributes.h +++ b/src/attributes/ObsPlottingAttributes.h @@ -55,6 +55,7 @@ class ObsPlottingAttributes double size_; double ring_size_; bool present_ww_visible_; + string present_ww_colour_; bool pressure_visible_; bool upper_air_visible_; bool pressure_tendency_visible_; @@ -75,9 +76,9 @@ class ObsPlottingAttributes bool visibility_visible_; bool wind_visible_; string wind_colour_; + int wind_thickness_; bool wind_projected_; unique_ptr colour_; - unique_ptr present_ww_colour_; unique_ptr pressure_colour_; unique_ptr upper_air_colour_; unique_ptr pressure_tendency_colour_; diff --git a/src/attributes/ObsPlottingWrapper.cc b/src/attributes/ObsPlottingWrapper.cc index adcd4eab3..5b712d310 100644 --- a/src/attributes/ObsPlottingWrapper.cc +++ b/src/attributes/ObsPlottingWrapper.cc @@ -72,6 +72,10 @@ void ObsPlottingWrapper::set(const MagRequest& request) obsplotting_->present_ww_visible_ = MagTranslator()(present_ww_visible_value); + } + if (request.countValues("OBS_PRESENT_WEATHER_COLOUR") ) { + string present_ww_colour_value = request("OBS_PRESENT_WEATHER_COLOUR"); + obsplotting_->present_ww_colour_ = present_ww_colour_value; } if (request.countValues("OBS_PRESSURE") ) { string pressure_visible_value = request("OBS_PRESSURE"); @@ -191,6 +195,10 @@ void ObsPlottingWrapper::set(const MagRequest& request) string wind_colour_value = request("OBS_WIND_COLOUR"); obsplotting_->wind_colour_ = wind_colour_value; } + if (request.countValues("OBS_WIND_THICKNESS") ) { + int wind_thickness_value = request("OBS_WIND_THICKNESS"); + obsplotting_->wind_thickness_ = wind_thickness_value; + } if (request.countValues("OBS_WIND_PROJECTED") ) { string wind_projected_value = request("OBS_WIND_PROJECTED"); @@ -203,11 +211,6 @@ void ObsPlottingWrapper::set(const MagRequest& request) obsplotting_->colour_ = unique_ptr(MagTranslator()(colour_value)); } - if (request.countValues("OBS_PRESENT_WEATHER_COLOUR") ) { - string present_ww_colour_value = request("OBS_PRESENT_WEATHER_COLOUR"); - obsplotting_->present_ww_colour_ = unique_ptr(MagTranslator()(present_ww_colour_value)); - } - if (request.countValues("OBS_PRESSURE_COLOUR") ) { string pressure_colour_value = request("OBS_PRESSURE_COLOUR"); obsplotting_->pressure_colour_ = unique_ptr(MagTranslator()(pressure_colour_value)); @@ -319,5 +322,4 @@ void ObsPlottingWrapper::print(ostream& out) const - diff --git a/src/params/ObsPlotting.xml b/src/params/ObsPlotting.xml index d034808bf..82a9bca78 100644 --- a/src/params/ObsPlotting.xml +++ b/src/params/ObsPlotting.xml @@ -51,11 +51,11 @@ does it submit to any jurisdiction. - Colour used to display the present weather + Colour used to display the present weather. [automatic] will use [obs_colour], [coloured_present_weather] will use the calssical colours for the symbols Colour used to display wind + + Thickness of the wind flags + min_level; - maxOutOfBond_ = oob_max_ < max_level; + minOutOfBond_ = oob_min_ > min_limit; + maxOutOfBond_ = oob_max_ < max_limit; int i = 0; if ( minOutOfBond_ ) { @@ -66,18 +69,13 @@ void CountSelectionType::calculate(double min, double max, bool shading) { i++; } - i += ( MINSET(min_level) ) ? 1 : 0; - i += ( MAXSET(max_level) ) ? 1 : 0; - - - cout << min_level << " " << max_level << " " << i << endl; + i += ( MINSET(min_limit) ) ? 1 : 0; + i += ( MAXSET(max_limit) ) ? 1 : 0; - - double nb = levelCount_ - 1; - if (same(max_level, min_level)) { - push_back(min_level); + if (same(max_limit, min_limit)) { + push_back(min_limit); return; } double step = (max_level - min_level) / nb; @@ -88,7 +86,7 @@ void CountSelectionType::calculate(double min, double max, bool shading) { // number of levels we will not actually plot, ie the min/max contours). if (same(step, 0)) { // Only one isoline! - push_back(min_level); + push_back(min_limit); return; } @@ -139,13 +137,12 @@ void CountSelectionType::calculate(double min, double max, bool shading) { inc *= istep; // convert back into proper range + double first = floor(min_limit / inc) * inc; - double first = floor(min_level / inc) * inc; - - while (first > min_level) + while (first > min_limit) first -= inc; - push_back(min_level); + push_back(min_limit); first += inc; double epsilon = inc / 10000.0; while (same(epsilon, 0)) { @@ -154,18 +151,18 @@ void CountSelectionType::calculate(double min, double max, bool shading) { } - for (double val = first; val < max_level; val += inc) { + for (double val = first; val < max_limit; val += inc) { // special case - if the value is close to zero then set it to precisely zero to avoid later formatting issues if (fabs(val) < epsilon) push_back(0.0); - else if (same(val, max_level)) - push_back(max_level); + else if (same(val, max_limit)) + push_back(max_limit); else push_back(val); } - if (max_level != back()) - push_back(max_level); + if (max_limit != back()) + push_back(max_limit); int si = static_cast(size()); @@ -178,8 +175,9 @@ void CountSelectionType::calculate(double min, double max, bool shading) { step = (max_level - min_level) / (levelCount_ - 1); double val = min_level; while (1) { + if ( val >= min_limit && val <= max_limit ) push_back(val); - if (same(val, max_level) || val > max_level) + if (same(val, max_limit) || val > max_limit) break; val += step; } @@ -195,13 +193,13 @@ void CountSelectionType::calculate(double min, double max, bool shading) { push_back(std::min(max, max_)); } - cout << "count=" << levelCount_ << ", tolerance=" << tolerance_ << ", result=" << size() << endl; + MagLog::debug() << "count=" << levelCount_ << ", tolerance=" << tolerance_ << ", result=" << size() << endl; ostringstream level; for (const_iterator l = begin(); l != end(); ++l) level << *l << " "; - cout << level.str() << endl; + MagLog::debug() << level.str() << endl; } diff --git a/src/visualisers/ObsItemFamily.cc b/src/visualisers/ObsItemFamily.cc index 4734f0f94..91ffae21b 100644 --- a/src/visualisers/ObsItemFamily.cc +++ b/src/visualisers/ObsItemFamily.cc @@ -104,7 +104,7 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { FlagItem* flag = new FlagItem(); flag->setColour(colour); - flag->setThickness(2); + flag->setThickness(owner_->wind_thickness_); flag->length(owner_->size_ * 2.); // Size to be adjusted later! const string origin = "circle"; // Duck for hackathon @@ -513,18 +513,19 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol return; string ww; - Colour colour = owner_->present_ww_colour_->automatic() ? *owner_->colour_ : *owner_->present_ww_colour_; + string colour = owner_->present_ww_colour_; + + if ( magCompare(colour, "automatic") ) + colour = owner_->colour_->name(); + - string c = colour.name(); if (value->second < 100) { ostringstream os; os << "ww_" << setw(2) << setfill('0') << value->second; ww = os.str(); - - c = colour_list[value->second]; - colour = Colour(c); - + if ( magCompare(colour, "coloured_present_weather") ) + colour = colour_list[value->second]; } else { map::iterator w = presentweather.find(value->second); @@ -541,10 +542,7 @@ void ObsPresentWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol object->x(column_); object->y(row_); - - - - object->colour(colour); + object->colour(Colour(colour)); object->symbol(ww); object->height(owner_->size_); @@ -1124,8 +1122,6 @@ void ObsString::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const } - text = "Duck-->°"; - TextItem* object = new TextItem(); object->x(column_); object->y(row_); diff --git a/src/visualisers/ObsTable.h b/src/visualisers/ObsTable.h index 606c46634..088d19337 100644 --- a/src/visualisers/ObsTable.h +++ b/src/visualisers/ObsTable.h @@ -28,7 +28,6 @@ class ObsTemplate : public vector { columns_ = (val != def.end()) ? atoi(val->second.c_str()) : 3; val = def.find("rows"); rows_ = (val != def.end()) ? atoi(val->second.c_str()) : 3; - cout << "ObsTemplate->" << size() << endl; for (const_iterator item = begin(); item != end(); ++item) (*item)->set(def); } From 69ba86d57919620d35eb53ef658db44424ad1989 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 9 Sep 2022 19:59:49 +0100 Subject: [PATCH 23/66] Fix issue with metview test suite : netcdf_type= geopoint was not intrepreting properly missing data. --- src/decoders/NetcdfGeopointsInterpretor.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/decoders/NetcdfGeopointsInterpretor.cc b/src/decoders/NetcdfGeopointsInterpretor.cc index e11322257..dcdf48771 100644 --- a/src/decoders/NetcdfGeopointsInterpretor.cc +++ b/src/decoders/NetcdfGeopointsInterpretor.cc @@ -65,6 +65,8 @@ bool NetcdfGeopointsInterpretor::interpretAsPoints(PointsList& list, const Trans setDim(netcdf, longitude_, longitudes, first, last); setDim(netcdf, latitude_, latitudes, first, last); + double missing = netcdf.getMissing(field_, missing_attribute_); + vector::iterator lat = latitudes.begin(); vector::iterator lon = longitudes.begin(); vector::const_iterator val = values.begin(); @@ -89,8 +91,10 @@ bool NetcdfGeopointsInterpretor::interpretAsPoints(PointsList& list, const Trans lat = latitudes.begin(); lon = longitudes.begin(); while (lat != latitudes.end() && lon != longitudes.end() && val != values.end()) { - UserPoint* geo = new UserPoint(*lon, *lat, *val); - list.push_back(geo); + if ( !same(*val, missing) ) { + UserPoint* geo = new UserPoint(*lon, *lat, *val); + list.push_back(geo); + } lon++; lat++; val++; @@ -256,7 +260,7 @@ bool NetcdfXYpointsInterpretor::interpretAsPoints(PointsList& list, const Transf double xmissing = netcdf.getMissing(x_, missing_attribute_); double ymissing = netcdf.getMissing(y_, missing_attribute_); - + double missing = netcdf.getMissing(field_, missing_attribute_); vector::iterator x = xs.begin(); vector::iterator y = ys.begin(); vector::const_iterator val = values.begin(); @@ -267,7 +271,7 @@ bool NetcdfXYpointsInterpretor::interpretAsPoints(PointsList& list, const Transf value = *val; val++; } - if (!same(*x, xmissing) || !same(*y, ymissing)) { + if (!same(*x, xmissing) || !same(*y, ymissing) || same(value, missing)) { UserPoint* xy = new UserPoint(*x, *y, value); if (projection.in(*xy)) list.push_back(xy); @@ -310,6 +314,7 @@ bool NetcdfXYpointsInterpretor::interpretAsPoints(PointsList& list, const std::s double xmissing = netcdf.getMissing(x_, missing_attribute_); double ymissing = netcdf.getMissing(y_, missing_attribute_); + double missing = netcdf.getMissing(field_, missing_attribute_); baseDateX_ = ""; @@ -333,7 +338,7 @@ bool NetcdfXYpointsInterpretor::interpretAsPoints(PointsList& list, const std::s val++; } if (!same(*y, ymissing) || !same(*x, xmissing)) { - list.push_back(new UserPoint(*x, *y, value, (same(*y, ymissing) || same(*x, xmissing)))); + list.push_back(new UserPoint(*x, *y, value, (same(*y, ymissing) || same(*x, xmissing) || same(value, missing)))); } x++; From e7e4f81ff7778f988d95c2a6f221b5a0c8f40afd Mon Sep 17 00:00:00 2001 From: Sandor Kertesz Date: Wed, 14 Sep 2022 14:11:55 +0100 Subject: [PATCH 24/66] Streamline direction is inconsistent MAGP-1349 --- .gitignore | 3 + src/common/Polyline.h | 2 + src/common/Transformation.cc | 1 - src/drivers/BaseDriver.cc | 213 +++++++++++++++++++++++------ src/drivers/BaseDriver.h | 3 + src/visualisers/CalcStreamlines.cc | 187 +++++++++++++++++++++++++ src/visualisers/CalcStreamlines.h | 3 +- src/visualisers/Streamlines.cc | 29 +++- 8 files changed, 394 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index bc46ae854..83610564a 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ tmp.* *.ppm .env *.swp + +# mac +.DS_Store diff --git a/src/common/Polyline.h b/src/common/Polyline.h index c4fccab62..d0c8797a5 100644 --- a/src/common/Polyline.h +++ b/src/common/Polyline.h @@ -280,6 +280,8 @@ class Polyline : public PolylineProperties { void push_front(Polyline&); void push_back(Polyline&); + void reverse() {std::reverse(polygon_.begin(), polygon_.end());} + // Is the pointincluded in the polyline" bool in(const PaperPoint&) const; diff --git a/src/common/Transformation.cc b/src/common/Transformation.cc index c8008c732..506509214 100644 --- a/src/common/Transformation.cc +++ b/src/common/Transformation.cc @@ -322,7 +322,6 @@ void Transformation::operator()(const magics::Polyline& from, BasicGraphicsObjec } void Transformation::operator()(const magics::Polyline& from, vector& out) const { - ASSERT(false); if (from.empty()) return; diff --git a/src/drivers/BaseDriver.cc b/src/drivers/BaseDriver.cc index bc5674406..0e6f19d45 100644 --- a/src/drivers/BaseDriver.cc +++ b/src/drivers/BaseDriver.cc @@ -40,10 +40,16 @@ #include "magics.h" +#include +#include +#include + + using namespace magics; int BaseDriver::numFiles_ = 0; +//#define MAG_POLYLINE_ARROW_DEBUG_ //! Constructor for all drivers /*! @@ -400,6 +406,60 @@ double BaseDriver::LSF(MFloat* x, MFloat* y, int i0) const { return angle; } +double BaseDriver::arrowHeadLSF(MFloat* x, MFloat* y, int i0) const { + // Compute the least square fit (regression) line angle. This does not determine the + // direction of the regression line, so we need an extra step to adjust the computed angle. + double angle = 0.; + const unsigned int n = 3; + const double eps = 1E-5; + double xSum = 0.; + double ySum = 0.; + double x2Sum = 0.; + double xySum = 0; + + for (unsigned int r = 0; r < n; r++) { + auto xp = projectX(x[i0 + r]); + auto yp = projectY(y[i0 + r]); + xSum += xp; + ySum += yp; + x2Sum += (xp * xp); + xySum += (xp * yp); + } + + double s1 = n * xySum - xSum * ySum; + double s2 = n * x2Sum - xSum * xSum; + + // Compute the LSF line angle. This does not tell us which way the line + // goes. We need additional information to estimate it. + if (std::fabs(s2) > eps) { + angle = std::atan(s1/s2); + + } else { + //std::cout << " (LSF) NS line!" << std::endl; + MagLog::debug() << "BaseDriver: Division through zero prevented in calculation of arrowhead angle!" << endl; + return 10.; + } + + // estimate the lines's direction from the line formed by the endpoints + double dx = projectX(x[i0 + 1]) - projectX(x[i0]); + double dy = projectY(y[i0 + 1]) - projectY(y[i0]); + + // std::cout << " (LSF) angle=" << angle << " dx=" << dx << " dy=" << dy << std::endl; + + // create unite vector from angle + double xAngle = std::cos(angle); + double yAngle = std::sin(angle); + + // compute the scalar product between the two vectors and use the + // sign of it to decide whether they point in the same direction + auto sp = dx*xAngle + dy*yAngle; + if (sp <= 0) { + angle += PI; + //std::cout << " --> a=" << angle*180/PI << std::endl; + } + return angle; +} + /*! \brief Method plotting Polylines with Labels. @@ -449,10 +509,100 @@ void BaseDriver::printLine(const magics::Polyline& line) const { } } - const unsigned int minimum_points_for_labelling = 25; // must be at least -15 : see function LSF above + if (arrowHead) { + renderArrowHeadsAlongLine(line, x, y, n); + } else { + renderLabelsAlongLine(line, x, y, n); + } + + delete[] x; + delete[] y; + currentColour_ = Colour("none"); +} + +void BaseDriver::renderArrowHeadsAlongLine(const magics::Polyline& line, MFloat* x, MFloat* y, unsigned long n) const { +#ifdef MAG_POLYLINE_ARROW_DEBUG_ + { + // Use this code to draw a green line segment to the beginning of the polyline + magics::Colour dbgCol("green"); + const unsigned long maxDbgLineLen = 3; + MFloat* xx = new MFloat[maxDbgLineLen]; + MFloat* yy = new MFloat[maxDbgLineLen]; + auto dbgLineLen = std::min(maxDbgLineLen, n); + for (unsigned long i = 0; i < dbgLineLen ; i++) { + xx[i] = x[i]; + yy[i] = y[i]; + } + setNewColour(dbgCol); + renderPolyline(dbgLineLen, xx, yy); + delete[] xx; + delete[] yy; + setNewColour(line.getColour()); + } +#endif + +// when this debug code is enabled we try add an arrowhead to each line +#ifdef MAG_POLYLINE_ARROW_DEBUG_ + const unsigned int minimum_points_for_labelling = 4; +#else + const unsigned int minimum_points_for_labelling = 25; // must be at least -15 : see function LSF +#endif + + if (n > minimum_points_for_labelling) { + + unsigned int i = 10; + const unsigned int step = 5; + static const double cosLimit = std::cos(0.01); +#ifdef MAG_POLYLINE_ARROW_DEBUG_ + i = 1; + //std::cout << "LINE" << std::endl; +#endif + while (i < n - minimum_points_for_labelling) { + assert(i < n-1); + assert(i+1 <= n-1); + bool closeAngles = false; + const double angle = arrowHeadLSF(x, y, i); +//#ifdef MAG_POLYLINE_ARROW_DEBUG_ +// closeAngles = angle < 4.; +//#else + const double angle2 = arrowHeadLSF(x, y, i + 1); + if (angle < 4. && angle2 < 4.) { + // the cos of the angular diff is the scalar product + auto sp = std::cos(angle)*std::cos(angle2) + std::sin(angle)*std::sin(angle2); + closeAngles = (sp >= cosLimit); + } +//#endif + if (closeAngles) { + MFloat pro_x = x[i]; + MFloat pro_y = y[i]; + + Arrow arrow; + arrow.copy(*line.arrowProperties()); + arrow.setColour(line.getColour()); + arrow.setArrowPosition(ArrowPosition::HEAD_ONLY); + +#ifdef MAG_POLYLINE_ARROW_DEBUG_ + //std::cout << " add " << angle * 180 / 3.14 << " [" << pro_x << "," << pro_y << "] " << x[i+1] << "," << x[i+2] << "," << x[i+3] << std::endl; +#endif + const double dx = std::cos(angle); + const double dy = setAngleY(std::sin(angle)); + PaperPoint pp(pro_x, pro_y); + ArrowPoint apoint(dx, dy, pp); + arrow.push_back(apoint); + renderWindArrow(arrow); + i += step; + } // angles are not the same + i += step; + } + } +} + +void BaseDriver::renderLabelsAlongLine(const magics::Polyline& line, MFloat* x, MFloat* y, unsigned long n) const { + const unsigned int minimum_points_for_labelling = 25; // must be at least -15 : see function LSF + + if (n > minimum_points_for_labelling && + line.getLabel().isVisible() && line.getLabel().getText() != "") { - if ((arrowHead || (line.getLabel().isVisible() && line.getLabel().getText() != "")) && - (n > minimum_points_for_labelling)) { ASSERT(staLayouts_.empty() == false); MFloat* labelx = new MFloat[n]; // in theory, we shouldn't need this many entries... @@ -487,41 +637,23 @@ void BaseDriver::printLine(const magics::Polyline& line) const { const double distance_squared = ((THIS_X - PREV_X) * (THIS_X - PREV_X)) + ((THIS_Y - PREV_Y) * (THIS_Y - PREV_Y)); - if ((arrowHead) || (distance_squared > min_square_distance_between_labels)) { - if (arrowHead) { - MFloat pro_x = x[i]; - MFloat pro_y = y[i]; - - Arrow arrow; - arrow.copy(*line.arrowProperties()); - arrow.setColour(line.getColour()); - arrow.setArrowPosition(ArrowPosition::HEAD_ONLY); - if ((x[i] - x[i + 3]) < 0.) - angle += PI; - const double dx = sin(angle + 1.5707963267949); - const double dy = -setAngleY(cos(angle + 1.5707963267949)); - PaperPoint pp(pro_x, pro_y); - ArrowPoint apoint(dx, dy, pp); - arrow.push_back(apoint); - renderWindArrow(arrow); - } - else { - MFloat pro_x = x[i + 2]; - MFloat pro_y = y[i + 2]; - Text text; - PaperPoint pp(pro_x, pro_y); - text.push_back(pp); - Label label = line.getLabel(); - MagFont font = label.font(); - text.setFont(font); - text.addText(label.getText(), font.colour(), font.size()); - text.setBlanking(label.getBlanking()); - text.setJustification(label.getJustification()); - text.setVerticalAlign(VerticalAlign::HALF); - text.setAngle(-setAngleY(angle)); - text.setFont(font); - renderText(text); - } + if (distance_squared > min_square_distance_between_labels) { + MFloat pro_x = x[i + 2]; + MFloat pro_y = y[i + 2]; + Text text; + PaperPoint pp(pro_x, pro_y); + text.push_back(pp); + Label label = line.getLabel(); + MagFont font = label.font(); + text.setFont(font); + text.addText(label.getText(), font.colour(), font.size()); + text.setBlanking(label.getBlanking()); + text.setJustification(label.getJustification()); + text.setVerticalAlign(VerticalAlign::HALF); + text.setAngle(-setAngleY(angle)); + text.setFont(font); + renderText(text); + labelx[num_labels] = x[i]; labely[num_labels] = y[i]; num_labels++; @@ -532,10 +664,7 @@ void BaseDriver::printLine(const magics::Polyline& line) const { } delete[] labelx; delete[] labely; - } // endif enough points for a label - delete[] x; - delete[] y; - currentColour_ = Colour("none"); + } } void BaseDriver::renderPolyline(vector& vP) const { diff --git a/src/drivers/BaseDriver.h b/src/drivers/BaseDriver.h index 88bda3901..e5eab1d3d 100644 --- a/src/drivers/BaseDriver.h +++ b/src/drivers/BaseDriver.h @@ -369,6 +369,9 @@ class BaseDriver : public BaseDriverAttributes, public MagicsObserver { double LSF(MFloat* x, MFloat* y, int i0) const; + double arrowHeadLSF(MFloat* x, MFloat* y, int i0) const; + void renderArrowHeadsAlongLine(const Polyline& line, MFloat* x, MFloat* y, unsigned long n) const; + void renderLabelsAlongLine(const Polyline& line, MFloat* x, MFloat* y, unsigned long n) const; mutable int currentPage_; mutable string fileName_; diff --git a/src/visualisers/CalcStreamlines.cc b/src/visualisers/CalcStreamlines.cc index c47db9bed..3171f4b0b 100644 --- a/src/visualisers/CalcStreamlines.cc +++ b/src/visualisers/CalcStreamlines.cc @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "CalcStreamlines.h" @@ -798,3 +800,188 @@ int CalcStreamlines(int density, const float* dir, const GSStruct* gs, OneLineCl return 1; } + + + +namespace { +// Utility function used only for the streamline point order adjustments. +// Computes the nearest valid value to the specified x,y coordintes. Field vals defined on the same +// regular gs grid that is used for the streamline computations. The accepted grid structure is +// rather restrictive!!! +bool nearestValidValue(float x, float y, const GSStruct* gs, const float* vals, float& resVal) +{ + assert (gs->dy>0.); + assert (gs->dx>0.); + assert (gs->period_x==0); + assert (gs->gs_geo==0); + + if (gs->dx<=0 || gs->dy <=0 || gs->period_x != 0 || gs->gs_geo != 0) { + return false; + } + + int num = gs->nx * gs->ny; + +#if 0 + std::cout << "\n nearestValidValue" << std::endl; + std::cout << "startx=" << gs->startx << " starty=" << gs->starty << " dx=" << gs->dx << " dy=" << gs->dy << std::endl; + std::cout << "x=" << x << " y=" << y << std::endl; +#endif + auto startX = gs->startx; + auto startY = gs->starty; + + //-- index for column on the west + int ix1 = int((x - startX) / gs->dx); + if (ix1 > (gs->nx - 1) || ix1 < 0) { + return false; + } + + //-- index for column on the east + int ix2 = ix1 + 1; + if (ix2 > (gs->nx - 1) || ix2 < 0) { + return false; + } + + // NS + int iy1 = int((y - startY) / gs->dy); + int iy2 = iy1 + 1; + if (iy2 > (gs->ny - 1) || iy2 < 0 ) { + return false; + } + if (iy2 > (gs->ny - 1) || iy2 < 0 ) { + return false; + } + + std::vector valVec, distVec; + + // point 11 + int index = gs->nx * iy1 + ix1; + if (index <0 || index >= num) { + return false; + } + float val = vals[index]; + if (val == val) { + valVec.push_back(val); + float dx = x - gs->startx + ix1 * gs->dx; + float dy = y - gs->starty + iy1 * gs->dy; + distVec.push_back(dx*dx + dy*dy); + } + + // point 12 + index = gs->nx * iy1 + ix2; + val = vals[index]; + if (index <0 || index >= num) { + return false; + } + if (val == val) { + valVec.push_back(val); + float dx = x - gs->startx + ix2 * gs->dx; + float dy = y - gs->starty + iy1 * gs->dy; + distVec.push_back(dx*dx + dy*dy); + } + + // point 21 + index = gs->nx * iy2 + ix1; + val = vals[index]; + if (index <0 || index >= num) { + return false; + } + if (val == val) { + valVec.push_back(val); + float dx = x - gs->startx + ix1 * gs->dx; + float dy = y - gs->starty + iy2 * gs->dy; + distVec.push_back(dx*dx + dy*dy); + } + + // point 22 + index = gs->nx * iy2 + ix2; + val = vals[index]; + if (index <0 || index >= num) { + return false; + } + if (val == val) { + valVec.push_back(val); + float dx = x - gs->startx + ix2 * gs->dx; + float dy = y - gs->starty + iy2 * gs->dy; + distVec.push_back(dx*dx + dy*dy); + } + + if (!distVec.empty()) { + std::vector idxVec(distVec.size()); + std::iota(idxVec.begin(), idxVec.end(), 0); + std::sort(idxVec.begin(), idxVec.end(), + [&distVec](size_t i1, size_t i2) { return(distVec[i1] < distVec[i2]);}); + + resVal = valVec[idxVec.front()]; + return true; + } + return false; +} + +} + +// Adjust the order of the streamline points so that they can follow the wind field direction. +// It must be called after the streamlines were computed and the polyline clipping was already applied. +// See JIRA issue MAGP-1349 for details. +// Args: +// dir: wind direction field +// gs: grid structure +// poly: the streamline with projected coordinates +// polyUnprojected: the streamline with unrojected coordinates +// Retval: +// true if the adjustment could be performed +bool AdjustStreamlinesDirection(const float* dir, const GSStruct* gs, magics::Polyline* poly, magics::Polyline* polyUnprojected) +{ + if (!dir || !gs || !poly || !polyUnprojected) + return false; + + assert(poly->size() == polyUnprojected->size()); + if (poly->size() != polyUnprojected->size()) { + return false; + } + + if (poly->size() > 2) { + int swapCnt=0; + int cnt = 0; + for (int i=0; i < std::min(5, static_cast(polyUnprojected->size())-1); i++) { + auto x1 = polyUnprojected->get(i).x(); + auto y1 = polyUnprojected->get(i).y(); + auto x2 = polyUnprojected->get(i+1).x(); + auto y2 = polyUnprojected->get(i+1).y(); + float resVal=0.; + + // get the nearest wind direction value + if (nearestValidValue(x1, y1, gs, dir,resVal)) + { + // vector along the line + auto dx = x2 - x1; + auto dy = y2 - y1; + + // in the input field (vals) the wind direction is the angle of the wind vector measured + // from N in clockwise direction. We need to convert it to the standard + // polar vector angle (measured from E in anti-clockwise direction). + auto wDir = 2.5 * M_PI - resVal; + + // normalised wind vector + auto wDx = cos(wDir); + auto wDy = sin(wDir); + + // compute the scalar product between the wind vector and line vector and use the + // sign of it to decide whether they point in the same direction + auto sp = dx*wDx + dy*wDy; + swapCnt += (sp < 0)?1:-1; + cnt++; +#if 0 + std::cout << i << " resVal=" << resVal << " x1=" << x1 << " y1=" << y1 << + " dx=" << dx << " dy=" << dy << " wDir=" << wDir << " sp=" << sp << + std::endl; +#endif + } + } + if (cnt == 0) { + return false; + } else if (swapCnt > 0) { + poly->reverse(); + } + } + return true; +} diff --git a/src/visualisers/CalcStreamlines.h b/src/visualisers/CalcStreamlines.h index f6ce0b4d2..d76f54bfa 100644 --- a/src/visualisers/CalcStreamlines.h +++ b/src/visualisers/CalcStreamlines.h @@ -22,6 +22,7 @@ #ifndef CalcStreamlines_h #define CalcStreamlines_h +#include "Polyline.h" // Shift the value between 'xstart' and 'xstart+period' // -> x in [xstart,xstart+period] @@ -79,6 +80,6 @@ class OneLineClass { // Streamline calculator function int CalcStreamlines(int density, const float* dir, const GSStruct* gs, OneLineClass**& str_lines, int& linenum); - +bool AdjustStreamlinesDirection(const float* dir, const GSStruct* gs, magics::Polyline* poly, magics::Polyline* polyUnprojected); #endif diff --git a/src/visualisers/Streamlines.cc b/src/visualisers/Streamlines.cc index 0b64aed8d..d66524f76 100644 --- a/src/visualisers/Streamlines.cc +++ b/src/visualisers/Streamlines.cc @@ -190,7 +190,6 @@ bool Streamlines::operator()(Data& data, BasicGraphicsObjectContainer& parent) { OneLineClass** result = 0; int size; - CalcStreamlines(min_density_, direction, gs, result, size); for (int l = 0; l < size; l++) { @@ -266,8 +265,32 @@ bool Streamlines::operator()(Data& data, BasicGraphicsObjectContainer& parent) { poly.push_back(pt); prevpt = pt; } - if (poly.size() >= 2) - transformation(poly, parent); + if (poly.size() >= 2) { + // clip the polyline + vector clippedPoly; + transformation(poly, clippedPoly); + // process each resulting polyline + for (auto rPoly = clippedPoly.begin(); rPoly != clippedPoly.end(); ++rPoly) { + // Copy the properties + (*rPoly)->copy(poly); + + // The order of the streamline points have to be adjusted. See MAGP-1349. + // To do so we need the unprojected polyline coordinates too. + auto rUnprojected = (*rPoly)->clone(); + assert(rUnprojected); + deque& polygon = rUnprojected->polygon(); + for (size_t k=0; k < polygon.size(); k++) { + UserPoint usp; + transformation.revert(polygon[k], usp); + polygon[k] = PaperPoint(usp.x(), usp.y()); + } + // adjust the point order in rPoly + if (AdjustStreamlinesDirection(direction, gs, *rPoly, rUnprojected)) { + parent.push_back(*rPoly); + } + delete rUnprojected; + } + } poly.clear(); } } From c7de84a1968675276e369c1345a210350261047a Mon Sep 17 00:00:00 2001 From: Sandor Kertesz Date: Fri, 16 Sep 2022 09:33:52 +0100 Subject: [PATCH 25/66] Streamline direction is inconsistent MAGP-1349 --- src/drivers/BaseDriver.cc | 29 ++++++++++++++++------------- src/visualisers/Streamlines.cc | 13 +++++++++++-- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/drivers/BaseDriver.cc b/src/drivers/BaseDriver.cc index 0e6f19d45..d043e82e1 100644 --- a/src/drivers/BaseDriver.cc +++ b/src/drivers/BaseDriver.cc @@ -406,9 +406,9 @@ double BaseDriver::LSF(MFloat* x, MFloat* y, int i0) const { return angle; } +// Compute the least square fit (regression) line angle. This does not determine the +// direction of the regression line, so we need an extra step to adjust the computed angle. double BaseDriver::arrowHeadLSF(MFloat* x, MFloat* y, int i0) const { - // Compute the least square fit (regression) line angle. This does not determine the - // direction of the regression line, so we need an extra step to adjust the computed angle. double angle = 0.; const unsigned int n = 3; const double eps = 1E-5; @@ -440,7 +440,8 @@ double BaseDriver::arrowHeadLSF(MFloat* x, MFloat* y, int i0) const { return 10.; } - // estimate the lines's direction from the line formed by the endpoints + // estimate the lines's direction from the line formed by first two point + // TODO: also use the last two points double dx = projectX(x[i0 + 1]) - projectX(x[i0]); double dy = projectY(y[i0 + 1]) - projectY(y[i0]); @@ -451,7 +452,7 @@ double BaseDriver::arrowHeadLSF(MFloat* x, MFloat* y, int i0) const { double yAngle = std::sin(angle); // compute the scalar product between the two vectors and use the - // sign of it to decide whether they point in the same direction + // sign of it to decide whether they point in the same direction] auto sp = dx*xAngle + dy*yAngle; if (sp <= 0) { angle += PI; @@ -523,6 +524,7 @@ void BaseDriver::printLine(const magics::Polyline& line) const { void BaseDriver::renderArrowHeadsAlongLine(const magics::Polyline& line, MFloat* x, MFloat* y, unsigned long n) const { #ifdef MAG_POLYLINE_ARROW_DEBUG_ { + if (n > 25) { // Use this code to draw a green line segment to the beginning of the polyline magics::Colour dbgCol("green"); const unsigned long maxDbgLineLen = 3; @@ -538,6 +540,7 @@ void BaseDriver::renderArrowHeadsAlongLine(const magics::Polyline& line, MFloat* delete[] xx; delete[] yy; setNewColour(line.getColour()); + } } #endif @@ -549,9 +552,8 @@ void BaseDriver::renderArrowHeadsAlongLine(const magics::Polyline& line, MFloat* #endif if (n > minimum_points_for_labelling) { - unsigned int i = 10; - const unsigned int step = 5; + const unsigned int step =5; static const double cosLimit = std::cos(0.01); #ifdef MAG_POLYLINE_ARROW_DEBUG_ i = 1; @@ -562,19 +564,19 @@ void BaseDriver::renderArrowHeadsAlongLine(const magics::Polyline& line, MFloat* assert(i+1 <= n-1); bool closeAngles = false; const double angle = arrowHeadLSF(x, y, i); -//#ifdef MAG_POLYLINE_ARROW_DEBUG_ -// closeAngles = angle < 4.; -//#else +#ifdef MAG_POLYLINE_ARROW_DEBUG_ + closeAngles = angle < 4.; +#else const double angle2 = arrowHeadLSF(x, y, i + 1); if (angle < 4. && angle2 < 4.) { // the cos of the angular diff is the scalar product auto sp = std::cos(angle)*std::cos(angle2) + std::sin(angle)*std::sin(angle2); closeAngles = (sp >= cosLimit); } -//#endif - if (closeAngles) { - MFloat pro_x = x[i]; - MFloat pro_y = y[i]; +#endif + if (closeAngles) { + MFloat pro_x = x[i+1]; + MFloat pro_y = y[i+1]; Arrow arrow; arrow.copy(*line.arrowProperties()); @@ -590,6 +592,7 @@ void BaseDriver::renderArrowHeadsAlongLine(const magics::Polyline& line, MFloat* ArrowPoint apoint(dx, dy, pp); arrow.push_back(apoint); renderWindArrow(arrow); + i += step; } // angles are not the same i += step; diff --git a/src/visualisers/Streamlines.cc b/src/visualisers/Streamlines.cc index d66524f76..23c047dd1 100644 --- a/src/visualisers/Streamlines.cc +++ b/src/visualisers/Streamlines.cc @@ -170,7 +170,6 @@ bool Streamlines::operator()(Data& data, BasicGraphicsObjectContainer& parent) { i++; } - GSStruct* gs = new GSStruct(); gs->nx = nbcolumns; gs->ny = handler.rows(); @@ -274,7 +273,7 @@ bool Streamlines::operator()(Data& data, BasicGraphicsObjectContainer& parent) { // Copy the properties (*rPoly)->copy(poly); - // The order of the streamline points have to be adjusted. See MAGP-1349. + // The order of the streamline points has to be adjusted. See MAGP-1349. // To do so we need the unprojected polyline coordinates too. auto rUnprojected = (*rPoly)->clone(); assert(rUnprojected); @@ -294,6 +293,16 @@ bool Streamlines::operator()(Data& data, BasicGraphicsObjectContainer& parent) { poly.clear(); } } + + delete gs; + + if (result) { + for (int l = 0; l < size; l++) { + delete result[l]; + } + delete [] result; + } + // ************ MF RV *************** // Leak ;-) delete[] direction; From 3a144a0d924f67712e2c50a43ade8caf45a9b875 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 16 Sep 2022 15:07:17 +0100 Subject: [PATCH 26/66] Magics: Fixing NetcdfXYpoints to better deal with missing data. --- src/decoders/NetcdfGeopointsInterpretor.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/decoders/NetcdfGeopointsInterpretor.cc b/src/decoders/NetcdfGeopointsInterpretor.cc index dcdf48771..ce8107183 100644 --- a/src/decoders/NetcdfGeopointsInterpretor.cc +++ b/src/decoders/NetcdfGeopointsInterpretor.cc @@ -64,9 +64,14 @@ bool NetcdfGeopointsInterpretor::interpretAsPoints(PointsList& list, const Trans netcdf.get(field_, values, first, last); setDim(netcdf, longitude_, longitudes, first, last); setDim(netcdf, latitude_, latitudes, first, last); + double missing = numeric_limits::max(); - double missing = netcdf.getMissing(field_, missing_attribute_); + if (field_.empty() == false) { + netcdf.get(field_, values, first, last); + missing = netcdf.getMissing(field_, missing_attribute_); + } + vector::iterator lat = latitudes.begin(); vector::iterator lon = longitudes.begin(); vector::const_iterator val = values.begin(); @@ -251,16 +256,20 @@ bool NetcdfXYpointsInterpretor::interpretAsPoints(PointsList& list, const Transf vector values; map first, last; setDimensions(dimension_, first, last); + double missing = numeric_limits::max(); if (field_.empty() == false) { netcdf.get(field_, values, first, last); + missing = netcdf.getMissing(field_, missing_attribute_); } setDim(netcdf, x_, xs, first, last); setDim(netcdf, y_, ys, first, last); double xmissing = netcdf.getMissing(x_, missing_attribute_); double ymissing = netcdf.getMissing(y_, missing_attribute_); - double missing = netcdf.getMissing(field_, missing_attribute_); + + + vector::iterator x = xs.begin(); vector::iterator y = ys.begin(); vector::const_iterator val = values.begin(); @@ -305,16 +314,20 @@ bool NetcdfXYpointsInterpretor::interpretAsPoints(PointsList& list, const std::s vector values; map first, last; setDimensions(dimension_, first, last); + double missing = numeric_limits::max(); if (field_.empty() == false) { netcdf.get(field_, values, first, last); + missing = netcdf.getMissing(field_, missing_attribute_); } + + setDim(netcdf, x_, xs, first, last); setDim(netcdf, y_, ys, first, last); double xmissing = netcdf.getMissing(x_, missing_attribute_); double ymissing = netcdf.getMissing(y_, missing_attribute_); - double missing = netcdf.getMissing(field_, missing_attribute_); + baseDateX_ = ""; From 8e5ccef3fc7592517aa625b44d2825f7bfdc44d4 Mon Sep 17 00:00:00 2001 From: Sandor Kertesz Date: Fri, 16 Sep 2022 15:29:17 +0100 Subject: [PATCH 27/66] Fix compilation for streamlines MAGP-1349 --- src/visualisers/Streamlines.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/visualisers/Streamlines.cc b/src/visualisers/Streamlines.cc index 23c047dd1..22c823ef8 100644 --- a/src/visualisers/Streamlines.cc +++ b/src/visualisers/Streamlines.cc @@ -25,6 +25,9 @@ #include "LegendVisitor.h" #include "Polyline.h" #include "Timer.h" + +#include + using namespace magics; bool Streamlines::operator()(Data& data, BasicGraphicsObjectContainer& parent) { From 42b19279a65b56a4d38ecffc774a84c03b91c311 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 22 Sep 2022 15:07:13 +0100 Subject: [PATCH 28/66] 4.13.0 : Fixing issue with contour_level_selection and use of min/max_levels. --- src/visualisers/CountSelectionType.cc | 31 ++++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/visualisers/CountSelectionType.cc b/src/visualisers/CountSelectionType.cc index c643caf19..09f97ac2f 100644 --- a/src/visualisers/CountSelectionType.cc +++ b/src/visualisers/CountSelectionType.cc @@ -38,12 +38,11 @@ void CountSelectionType::calculate(double min, double max, bool shading) { clear(); - double min_level=min; - double max_level=max; - double min_limit = min_level; - double max_limit = max_level; + double min_limit=min; + double max_limit=max; + if ( MINSET(min_) ) min_limit = min_; @@ -69,16 +68,18 @@ void CountSelectionType::calculate(double min, double max, bool shading) { i++; } - i += ( MINSET(min_limit) ) ? 1 : 0; - i += ( MAXSET(max_limit) ) ? 1 : 0; - + // Commented for now, may have to be revisited soon. + // i += ( MINSET(min_limit) ) ? 1 : 0; + // i += ( MAXSET(max_limit) ) ? 1 : 0; double nb = levelCount_ - 1; if (same(max_limit, min_limit)) { push_back(min_limit); return; } - double step = (max_level - min_level) / nb; + + + double step = (max_limit - min_limit) / nb; double toleranceProportion = (double)tolerance_ / (double)(levelCount_ + 1 + i); // tolerance as a proportion of the number of levels @@ -151,6 +152,7 @@ void CountSelectionType::calculate(double min, double max, bool shading) { } + for (double val = first; val < max_limit; val += inc) { // special case - if the value is close to zero then set it to precisely zero to avoid later formatting issues if (fabs(val) < epsilon) @@ -163,6 +165,7 @@ void CountSelectionType::calculate(double min, double max, bool shading) { if (max_limit != back()) push_back(max_limit); + int si = static_cast(size()); @@ -170,10 +173,10 @@ void CountSelectionType::calculate(double min, double max, bool shading) { // so as to ensure the correct number, even if they are not nice if (si - i < levelCount_ - tolerance_ || si - i > levelCount_ + tolerance_) { - MagLog::debug() << "Not using nice levels[" << levelCount_ << ", " << tolerance_ << "]-->" << size() << endl; + MagLog::debug() << "Not using nice levels[" << levelCount_ << ", " << tolerance_ << "]-->" << size() << endl; clear(); - step = (max_level - min_level) / (levelCount_ - 1); - double val = min_level; + step = (max_limit - min_limit) / (levelCount_ - 1); + double val = min_limit; while (1) { if ( val >= min_limit && val <= max_limit ) push_back(val); @@ -186,20 +189,18 @@ void CountSelectionType::calculate(double min, double max, bool shading) { if ( minOutOfBond_ ) { insert(begin(), std::max(min, min_)); - cout << " add " << std::max(min, min_) << endl; } if ( maxOutOfBond_ ) { push_back(std::min(max, max_)); } - MagLog::debug() << "count=" << levelCount_ << ", tolerance=" << tolerance_ << ", result=" << size() << endl; - + ostringstream level; for (const_iterator l = begin(); l != end(); ++l) level << *l << " "; - MagLog::debug() << level.str() << endl; + MagLog::debug() << level.str() << endl; } From 60298af37ae20596187f13b3ec9dd47ebaa7554f Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 12 Oct 2022 17:20:39 +0100 Subject: [PATCH 29/66] Fix countlevelselectiontype --- src/visualisers/CountSelectionType.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/visualisers/CountSelectionType.cc b/src/visualisers/CountSelectionType.cc index 09f97ac2f..e67aaff0f 100644 --- a/src/visualisers/CountSelectionType.cc +++ b/src/visualisers/CountSelectionType.cc @@ -59,12 +59,12 @@ void CountSelectionType::calculate(double min, double max, bool shading) { maxOutOfBond_ = oob_max_ < max_limit; int i = 0; - if ( minOutOfBond_ ) { + if ( minOutOfBond_ || !MINSET(min_)) { i++; } - if ( maxOutOfBond_ ) { + if ( maxOutOfBond_ || !MAXSET(max_) ) { i++; } From 51cc82470dbf9e2a1dfae4a60d732f188095e164 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 31 Oct 2022 17:18:11 +0000 Subject: [PATCH 30/66] Wind flags in Observation plotting : revert to the previous default values : will need to be adjusted --- src/visualisers/ObsItemFamily.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/visualisers/ObsItemFamily.cc b/src/visualisers/ObsItemFamily.cc index 91ffae21b..3ecac4daf 100644 --- a/src/visualisers/ObsItemFamily.cc +++ b/src/visualisers/ObsItemFamily.cc @@ -105,7 +105,7 @@ void ObsWind::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const { FlagItem* flag = new FlagItem(); flag->setColour(colour); flag->setThickness(owner_->wind_thickness_); - flag->length(owner_->size_ * 2.); // Size to be adjusted later! + flag->length(owner_->size_ * 2.5); // Size to be adjusted later! const string origin = "circle"; // Duck for hackathon From c78fc19d7e8afefe18ecc6d03d816b4f7846017d Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 7 Nov 2022 15:13:18 +0000 Subject: [PATCH 31/66] Fix Issue with text position and symbol plotting --- src/visualisers/SymbolMode.cc | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/visualisers/SymbolMode.cc b/src/visualisers/SymbolMode.cc index 9918fa190..8cf55b0d1 100644 --- a/src/visualisers/SymbolMode.cc +++ b/src/visualisers/SymbolMode.cc @@ -71,27 +71,21 @@ void SymbolIndividualMode::properties() const { texthandlers["top"] = TextPosition::ABOVE; texthandlers["bottom"] = TextPosition::BELOW; texthandlers["right"] = TextPosition::RIGHT; - texthandlers["centre"] = TextPosition::CENTRE; + texthandlers["centre"] = TextPosition::NONE; } TextPosition position; - if (magCompare(type_, "number")) { - position = TextPosition::NONE; - properties_.colour_ = *colour_; - properties_.height_ = height_*scaling_; + string type = lowerCase(text_position_); + + map::iterator pos = texthandlers.find(type); + position = (pos != texthandlers.end()) ? pos->second : TextPosition::ABOVE; + if (magCompare(type_, "text") || magCompare(type_, "number")) { + properties_.height_ = 0.05; // make a very small symbol } else { - string type = lowerCase(text_position_); - map::iterator pos = texthandlers.find(type); - position = (pos != texthandlers.end()) ? pos->second : TextPosition::ABOVE; - if (magCompare(type_, "text")) { - properties_.height_ = 0.01; // make a very small symbol - properties_.colour_ = Colour("none"); - } - else { - properties_.colour_ = *colour_; - properties_.height_ = height_*scaling_; - } + properties_.colour_ = *colour_; + properties_.height_ = height_*scaling_; } + if (magCompare(marker_mode_, "image")) { properties_.image_ = true; properties_.image_path_ = image_path_; From a0f543fee080aa3fda8b52df88b6f2b5c41d4536 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 8 Nov 2022 17:22:26 +0000 Subject: [PATCH 32/66] Update version number to 4.14.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bcfcd159..d77c2ec8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake") find_package( ecbuild 3.4 REQUIRED ) -project( magics VERSION 4.13.0 LANGUAGES CXX ) +project( magics VERSION 4.14.0 LANGUAGES CXX ) # make sure that the header files are installed into include/magics # note that this needs to be done before ecbuild_declare_project() From 4ddd74a9243b681dc319ce2cd497096209bda600 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 11 Jan 2023 16:14:14 -0700 Subject: [PATCH 33/66] Adding the possibility to add a background the the EpsPlumes. --- src/attributes/EpsPlumeAttributes.cc | 16 +++++++++++- src/attributes/EpsPlumeAttributes.h | 2 ++ src/attributes/EpsPlumeWrapper.cc | 10 ++++++++ src/params/EpsPlume.xml | 15 +++++++++++ src/visualisers/EpsGraph.cc | 38 ++++++++++++++++++++++++++++ src/visualisers/EpsGraph.h | 2 +- 6 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/attributes/EpsPlumeAttributes.cc b/src/attributes/EpsPlumeAttributes.cc index 5518fc280..dafaf9920 100644 --- a/src/attributes/EpsPlumeAttributes.cc +++ b/src/attributes/EpsPlumeAttributes.cc @@ -37,7 +37,9 @@ EpsPlumeAttributes::EpsPlumeAttributes(): median_line_thickness_(ParameterManager::getInt("eps_plume_median_line_thickness")), shading_(ParameterManager::getBool("eps_plume_shading")), shading_levels_(ParameterManager::getDoubleArray("eps_plume_shading_level_list")), - shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list")) + shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list")), + background_level_list_(ParameterManager::getDoubleArray("eps_plume_background_level_list")), + background_colour_list_(ParameterManager::getStringArray("eps_plume_background_colour_list")) , line_colour_(MagTranslator().magics("eps_plume_line_colour")), line_style_(MagTranslator().magics("eps_plume_line_style")), @@ -78,6 +80,8 @@ void EpsPlumeAttributes::set(const std::map& params) setAttribute(prefix, "eps_plume_shading", shading_, params); setAttribute(prefix, "eps_plume_shading_level_list", shading_levels_, params); setAttribute(prefix, "eps_plume_shading_colour_list", shading_colours_, params); + setAttribute(prefix, "eps_plume_background_level_list", background_level_list_, params); + setAttribute(prefix, "eps_plume_background_colour_list", background_colour_list_, params); setMember(prefix, "eps_plume_line_colour", line_colour_, params); setAttribute(prefix, "eps_plume_line_style", line_style_, params); @@ -105,6 +109,8 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other) shading_ = other.shading_; shading_levels_ = other.shading_levels_; shading_colours_ = other.shading_colours_; + background_level_list_ = other.background_level_list_; + background_colour_list_ = other.background_colour_list_; line_colour_ = unique_ptr(other.line_colour_->clone()); line_style_ = other.line_style_; forecast_line_colour_ = unique_ptr(other.forecast_line_colour_->clone()); @@ -164,6 +170,8 @@ void EpsPlumeAttributes::print(ostream& out) const out << " shading = " << shading_; out << " shading_levels = " << shading_levels_; out << " shading_colours = " << shading_colours_; + out << " background_level_list = " << background_level_list_; + out << " background_colour_list = " << background_colour_list_; out << " line_colour = " << *line_colour_; out << " line_style = " << line_style_; out << " forecast_line_colour = " << *forecast_line_colour_; @@ -205,6 +213,10 @@ void EpsPlumeAttributes::toxml(ostream& out) const niceprint(out,shading_levels_); out << ", \"eps_plume_shading_colour_list\":"; niceprint(out,shading_colours_); + out << ", \"eps_plume_background_level_list\":"; + niceprint(out,background_level_list_); + out << ", \"eps_plume_background_colour_list\":"; + niceprint(out,background_colour_list_); out << ", \"eps_plume_line_colour\":"; niceprint(out, *line_colour_); out << ", \"eps_plume_line_style\":"; @@ -237,6 +249,8 @@ static MagicsParameter eps_plume_median_line_thickness("eps_plume_median_li static MagicsParameter eps_plume_shading("eps_plume_shading", "off"); static MagicsParameter eps_plume_shading_level_list("eps_plume_shading_level_list", floatarray()); static MagicsParameter eps_plume_shading_colour_list("eps_plume_shading_colour_list", stringarray()); +static MagicsParameter eps_plume_background_level_list("eps_plume_background_level_list", floatarray()); +static MagicsParameter eps_plume_background_colour_list("eps_plume_background_colour_list", stringarray()); static MagicsParameter eps_plume_line_colour("eps_plume_line_colour", "magenta"); static MagicsParameter eps_plume_line_style("eps_plume_line_style", "solid"); static MagicsParameter eps_plume_forecast_line_colour("eps_plume_forecast_line_colour", "cyan"); diff --git a/src/attributes/EpsPlumeAttributes.h b/src/attributes/EpsPlumeAttributes.h index e233fbf2b..59a7b33d6 100644 --- a/src/attributes/EpsPlumeAttributes.h +++ b/src/attributes/EpsPlumeAttributes.h @@ -64,6 +64,8 @@ class EpsPlumeAttributes bool shading_; doublearray shading_levels_; stringarray shading_colours_; + doublearray background_level_list_; + stringarray background_colour_list_; unique_ptr line_colour_; LineStyle line_style_; unique_ptr forecast_line_colour_; diff --git a/src/attributes/EpsPlumeWrapper.cc b/src/attributes/EpsPlumeWrapper.cc index 1f9aac7b8..a0e846001 100644 --- a/src/attributes/EpsPlumeWrapper.cc +++ b/src/attributes/EpsPlumeWrapper.cc @@ -121,6 +121,16 @@ void EpsPlumeWrapper::set(const MagRequest& request) shading_colours_value.push_back((string)request("EPS_PLUME_SHADING_COLOUR_LIST", i)); if ( !shading_colours_value.empty() ) epsplume_->shading_colours_ = shading_colours_value; + doublearray background_level_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_BACKGROUND_LEVEL_LIST"); i++) + background_level_list_value.push_back((double)request("EPS_PLUME_BACKGROUND_LEVEL_LIST", i)); + if ( !background_level_list_value.empty() ) + epsplume_->background_level_list_ = background_level_list_value; + stringarray background_colour_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_BACKGROUND_COLOUR_LIST"); i++) + background_colour_list_value.push_back((string)request("EPS_PLUME_BACKGROUND_COLOUR_LIST", i)); + if ( !background_colour_list_value.empty() ) + epsplume_->background_colour_list_ = background_colour_list_value; if (request.countValues("EPS_PLUME_LINE_COLOUR") ) { string line_colour_value = request("EPS_PLUME_LINE_COLOUR"); diff --git a/src/params/EpsPlume.xml b/src/params/EpsPlume.xml index ebc0eb7b1..577a13120 100644 --- a/src/params/EpsPlume.xml +++ b/src/params/EpsPlume.xml @@ -164,5 +164,20 @@ does it submit to any jurisdiction. name="eps_plume_shading_colour_list"> colours used for plumes shading + + Background level list + + + Background colour list + + diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index a80ab7a69..56a459435 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -2660,7 +2660,44 @@ void EpsPlume::verticalprofile(Data& data, BasicGraphicsObjectContainer& visitor visitor.push_back(control); visitor.push_back(forecast); } + +void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { + // Add background + const Transformation& transformation = visitor.transformation(); + + double from = transformation.getMinY(); + auto colour = background_colour_list_.begin(); + for (const auto& level : background_level_list_ ) { + Polyline* area = new Polyline(); + area->setColour(Colour(*colour)); + area->setFilled(true); + area->setShading(new FillShadingProperties()); + area->setFillColour(Colour(*colour)); + visitor.push_back(area); + area->push_back(PaperPoint(transformation.getMinX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), level)); + area->push_back(PaperPoint(transformation.getMaxX(), level)); + area->push_back(PaperPoint(transformation.getMaxX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), from)); + from = level; + colour++; + } + Polyline* area = new Polyline(); + area->setColour(Colour(*colour)); + area->setFilled(true); + area->setShading(new FillShadingProperties()); + area->setFillColour(Colour(*colour)); + visitor.push_back(area); + area->push_back(PaperPoint(transformation.getMinX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), transformation.getMaxY())); + area->push_back(PaperPoint(transformation.getMaxX(), transformation.getMaxY())); + area->push_back(PaperPoint(transformation.getMaxX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), from)); + +} + void EpsPlume::operator()(Data& data, BasicGraphicsObjectContainer& visitor) { + background(visitor); method_ = lowerCase(method_); std::map::iterator method = methods_.find(method_); if (method == methods_.end()) { @@ -2668,6 +2705,7 @@ void EpsPlume::operator()(Data& data, BasicGraphicsObjectContainer& visitor) { return; } (this->*method->second)(data, visitor); + } diff --git a/src/visualisers/EpsGraph.h b/src/visualisers/EpsGraph.h index 1c70ea878..849dded9d 100644 --- a/src/visualisers/EpsGraph.h +++ b/src/visualisers/EpsGraph.h @@ -437,7 +437,7 @@ class EpsPlume : public Visdef, public EpsPlumeAttributes { vector shading_legend_; void timeserie(Data&, BasicGraphicsObjectContainer&); void verticalprofile(Data&, BasicGraphicsObjectContainer&); - + void background(BasicGraphicsObjectContainer& visitor); private: //! Copy constructor - No copy allowed EpsPlume(const EpsPlume&); From 966d614f45ec0a2d15a50678b3de91e1708f484b Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 11 Jan 2023 16:24:11 -0700 Subject: [PATCH 34/66] Add error handling on epsplumes background --- src/visualisers/EpsGraph.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index 56a459435..df7752590 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -2664,6 +2664,17 @@ void EpsPlume::verticalprofile(Data& data, BasicGraphicsObjectContainer& visitor void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { // Add background const Transformation& transformation = visitor.transformation(); + if ( background_level_list_.empty() ) + return; + + if ( background_colour_list_.size() < background_level_list_.size() + 1 ) { + MagLog::error() << "Note enough colours for the EpsPlumes background " << endl; + MagLog::error() << "should be at least " << background_level_list_.size() + 1 << " but found " << background_colour_list_.size() << endl; + MagLog::error() << " Please check your colour list " << endl; + return; + } + + double from = transformation.getMinY(); auto colour = background_colour_list_.begin(); From deb34de90d4433dcbe2d3de8d6de973277c53014 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 16 Jan 2023 16:10:16 +0000 Subject: [PATCH 35/66] Improve handling of epsplumes background --- src/visualisers/EpsGraph.cc | 78 ++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index df7752590..f4887d0d1 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -2667,43 +2667,65 @@ void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { if ( background_level_list_.empty() ) return; - if ( background_colour_list_.size() < background_level_list_.size() + 1 ) { + if ( background_colour_list_.size() < background_level_list_.size() -1 ) { MagLog::error() << "Note enough colours for the EpsPlumes background " << endl; - MagLog::error() << "should be at least " << background_level_list_.size() + 1 << " but found " << background_colour_list_.size() << endl; + MagLog::error() << "should be at least " << background_level_list_.size() -1 << " but found " << background_colour_list_.size() << endl; MagLog::error() << " Please check your colour list " << endl; return; } - double from = transformation.getMinY(); + double min = transformation.getMinY(); + double max = transformation.getMaxY(); + auto colour = background_colour_list_.begin(); - for (const auto& level : background_level_list_ ) { - Polyline* area = new Polyline(); - area->setColour(Colour(*colour)); - area->setFilled(true); - area->setShading(new FillShadingProperties()); - area->setFillColour(Colour(*colour)); - visitor.push_back(area); - area->push_back(PaperPoint(transformation.getMinX(), from)); - area->push_back(PaperPoint(transformation.getMinX(), level)); - area->push_back(PaperPoint(transformation.getMaxX(), level)); - area->push_back(PaperPoint(transformation.getMaxX(), from)); - area->push_back(PaperPoint(transformation.getMinX(), from)); - from = level; - colour++; + + auto level = background_level_list_.begin(); + double from = *level; + ++level; + + while ( level != background_level_list_.end()) { + double to = *level; + if ( from < min ) + from = min; + if ( to > max ) + to = max; + + if ( to > from && to <= max ) { + Polyline* area = new Polyline(); + area->setColour(Colour(*colour)); + area->setFilled(true); + area->setShading(new FillShadingProperties()); + area->setFillColour(Colour(*colour)); + visitor.push_back(area); + area->push_back(PaperPoint(transformation.getMinX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), to)); + area->push_back(PaperPoint(transformation.getMaxX(), to)); + area->push_back(PaperPoint(transformation.getMaxX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), from)); + + + } + from = *level; + ++colour; + ++level; } - Polyline* area = new Polyline(); - area->setColour(Colour(*colour)); - area->setFilled(true); - area->setShading(new FillShadingProperties()); - area->setFillColour(Colour(*colour)); - visitor.push_back(area); - area->push_back(PaperPoint(transformation.getMinX(), from)); - area->push_back(PaperPoint(transformation.getMinX(), transformation.getMaxY())); - area->push_back(PaperPoint(transformation.getMaxX(), transformation.getMaxY())); - area->push_back(PaperPoint(transformation.getMaxX(), from)); - area->push_back(PaperPoint(transformation.getMinX(), from)); + + + // if ( from < transformation.getMaxY() ) { + // Polyline* area = new Polyline(); + // area->setColour(Colour(*colour)); + // area->setFilled(true); + // area->setShading(new FillShadingProperties()); + // area->setFillColour(Colour(*colour)); + // visitor.push_back(area); + // area->push_back(PaperPoint(transformation.getMinX(), from)); + // area->push_back(PaperPoint(transformation.getMinX(), transformation.getMaxY())); + // area->push_back(PaperPoint(transformation.getMaxX(), transformation.getMaxY())); + // area->push_back(PaperPoint(transformation.getMaxX(), from)); + // area->push_back(PaperPoint(transformation.getMinX(), from)); + // } } From 7ba905ff526106df450078e7c3611bb1feba31dc Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 15 Feb 2023 19:11:43 +0000 Subject: [PATCH 36/66] EpsPlumes: add labels for the background --- src/attributes/EpsPlumeAttributes.cc | 39 ++++++++++++++++++++++++++-- src/attributes/EpsPlumeAttributes.h | 5 ++++ src/attributes/EpsPlumeWrapper.cc | 23 ++++++++++++++++ src/params/EpsPlume.xml | 31 ++++++++++++++++++++++ src/visualisers/EpsGraph.cc | 16 ++++++++++++ 5 files changed, 112 insertions(+), 2 deletions(-) diff --git a/src/attributes/EpsPlumeAttributes.cc b/src/attributes/EpsPlumeAttributes.cc index dafaf9920..d7c2162af 100644 --- a/src/attributes/EpsPlumeAttributes.cc +++ b/src/attributes/EpsPlumeAttributes.cc @@ -39,7 +39,11 @@ EpsPlumeAttributes::EpsPlumeAttributes(): shading_levels_(ParameterManager::getDoubleArray("eps_plume_shading_level_list")), shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list")), background_level_list_(ParameterManager::getDoubleArray("eps_plume_background_level_list")), - background_colour_list_(ParameterManager::getStringArray("eps_plume_background_colour_list")) + background_colour_list_(ParameterManager::getStringArray("eps_plume_background_colour_list")), + background_label_list_(ParameterManager::getStringArray("eps_plume_background_label_list")), + background_label_font_(ParameterManager::getString("eps_plume_background_label_font")), + background_label_font_size_(ParameterManager::getDouble("eps_plume_background_label_font_size")), + background_label_font_style_(ParameterManager::getString("eps_plume_background_label_font_style")) , line_colour_(MagTranslator().magics("eps_plume_line_colour")), line_style_(MagTranslator().magics("eps_plume_line_style")), @@ -48,7 +52,8 @@ EpsPlumeAttributes::EpsPlumeAttributes(): control_line_colour_(MagTranslator().magics("eps_plume_control_line_colour")), control_line_style_(MagTranslator().magics("eps_plume_control_line_style")), median_line_colour_(MagTranslator().magics("eps_plume_median_line_colour")), - median_line_style_(MagTranslator().magics("eps_plume_median_line_style")) + median_line_style_(MagTranslator().magics("eps_plume_median_line_style")), + background_label_font_colour_(MagTranslator().magics("eps_plume_background_label_font_colour")) { } @@ -82,6 +87,10 @@ void EpsPlumeAttributes::set(const std::map& params) setAttribute(prefix, "eps_plume_shading_colour_list", shading_colours_, params); setAttribute(prefix, "eps_plume_background_level_list", background_level_list_, params); setAttribute(prefix, "eps_plume_background_colour_list", background_colour_list_, params); + setAttribute(prefix, "eps_plume_background_label_list", background_label_list_, params); + setAttribute(prefix, "eps_plume_background_label_font", background_label_font_, params); + setAttribute(prefix, "eps_plume_background_label_font_size", background_label_font_size_, params); + setAttribute(prefix, "eps_plume_background_label_font_style", background_label_font_style_, params); setMember(prefix, "eps_plume_line_colour", line_colour_, params); setAttribute(prefix, "eps_plume_line_style", line_style_, params); @@ -91,6 +100,7 @@ void EpsPlumeAttributes::set(const std::map& params) setAttribute(prefix, "eps_plume_control_line_style", control_line_style_, params); setMember(prefix, "eps_plume_median_line_colour", median_line_colour_, params); setAttribute(prefix, "eps_plume_median_line_style", median_line_style_, params); + setMember(prefix, "eps_plume_background_label_font_colour", background_label_font_colour_, params); } @@ -111,6 +121,10 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other) shading_colours_ = other.shading_colours_; background_level_list_ = other.background_level_list_; background_colour_list_ = other.background_colour_list_; + background_label_list_ = other.background_label_list_; + background_label_font_ = other.background_label_font_; + background_label_font_size_ = other.background_label_font_size_; + background_label_font_style_ = other.background_label_font_style_; line_colour_ = unique_ptr(other.line_colour_->clone()); line_style_ = other.line_style_; forecast_line_colour_ = unique_ptr(other.forecast_line_colour_->clone()); @@ -119,6 +133,7 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other) control_line_style_ = other.control_line_style_; median_line_colour_ = unique_ptr(other.median_line_colour_->clone()); median_line_style_ = other.median_line_style_; + background_label_font_colour_ = unique_ptr(other.background_label_font_colour_->clone()); } @@ -172,6 +187,10 @@ void EpsPlumeAttributes::print(ostream& out) const out << " shading_colours = " << shading_colours_; out << " background_level_list = " << background_level_list_; out << " background_colour_list = " << background_colour_list_; + out << " background_label_list = " << background_label_list_; + out << " background_label_font = " << background_label_font_; + out << " background_label_font_size = " << background_label_font_size_; + out << " background_label_font_style = " << background_label_font_style_; out << " line_colour = " << *line_colour_; out << " line_style = " << line_style_; out << " forecast_line_colour = " << *forecast_line_colour_; @@ -180,6 +199,7 @@ void EpsPlumeAttributes::print(ostream& out) const out << " control_line_style = " << control_line_style_; out << " median_line_colour = " << *median_line_colour_; out << " median_line_style = " << median_line_style_; + out << " background_label_font_colour = " << *background_label_font_colour_; out << "]" << "\n"; } @@ -217,6 +237,14 @@ void EpsPlumeAttributes::toxml(ostream& out) const niceprint(out,background_level_list_); out << ", \"eps_plume_background_colour_list\":"; niceprint(out,background_colour_list_); + out << ", \"eps_plume_background_label_list\":"; + niceprint(out,background_label_list_); + out << ", \"eps_plume_background_label_font\":"; + niceprint(out,background_label_font_); + out << ", \"eps_plume_background_label_font_size\":"; + niceprint(out,background_label_font_size_); + out << ", \"eps_plume_background_label_font_style\":"; + niceprint(out,background_label_font_style_); out << ", \"eps_plume_line_colour\":"; niceprint(out, *line_colour_); out << ", \"eps_plume_line_style\":"; @@ -233,6 +261,8 @@ void EpsPlumeAttributes::toxml(ostream& out) const niceprint(out, *median_line_colour_); out << ", \"eps_plume_median_line_style\":"; niceprint(out, median_line_style_); + out << ", \"eps_plume_background_label_font_colour\":"; + niceprint(out, *background_label_font_colour_); } @@ -251,6 +281,10 @@ static MagicsParameter eps_plume_shading_level_list("eps_plume_shad static MagicsParameter eps_plume_shading_colour_list("eps_plume_shading_colour_list", stringarray()); static MagicsParameter eps_plume_background_level_list("eps_plume_background_level_list", floatarray()); static MagicsParameter eps_plume_background_colour_list("eps_plume_background_colour_list", stringarray()); +static MagicsParameter eps_plume_background_label_list("eps_plume_background_label_list", stringarray()); +static MagicsParameter eps_plume_background_label_font("eps_plume_background_label_font", "sansserif"); +static MagicsParameter eps_plume_background_label_font_size("eps_plume_background_label_font_size", 0.25); +static MagicsParameter eps_plume_background_label_font_style("eps_plume_background_label_font_style", ""); static MagicsParameter eps_plume_line_colour("eps_plume_line_colour", "magenta"); static MagicsParameter eps_plume_line_style("eps_plume_line_style", "solid"); static MagicsParameter eps_plume_forecast_line_colour("eps_plume_forecast_line_colour", "cyan"); @@ -259,3 +293,4 @@ static MagicsParameter eps_plume_control_line_colour("eps_plume_control_ static MagicsParameter eps_plume_control_line_style("eps_plume_control_line_style", "solid"); static MagicsParameter eps_plume_median_line_colour("eps_plume_median_line_colour", "cyan"); static MagicsParameter eps_plume_median_line_style("eps_plume_median_line_style", "solid"); +static MagicsParameter eps_plume_background_label_font_colour("eps_plume_background_label_font_colour", "black"); diff --git a/src/attributes/EpsPlumeAttributes.h b/src/attributes/EpsPlumeAttributes.h index 59a7b33d6..6c9010a74 100644 --- a/src/attributes/EpsPlumeAttributes.h +++ b/src/attributes/EpsPlumeAttributes.h @@ -66,6 +66,10 @@ class EpsPlumeAttributes stringarray shading_colours_; doublearray background_level_list_; stringarray background_colour_list_; + stringarray background_label_list_; + string background_label_font_; + double background_label_font_size_; + string background_label_font_style_; unique_ptr line_colour_; LineStyle line_style_; unique_ptr forecast_line_colour_; @@ -74,6 +78,7 @@ class EpsPlumeAttributes LineStyle control_line_style_; unique_ptr median_line_colour_; LineStyle median_line_style_; + unique_ptr background_label_font_colour_; private: diff --git a/src/attributes/EpsPlumeWrapper.cc b/src/attributes/EpsPlumeWrapper.cc index a0e846001..15ff07390 100644 --- a/src/attributes/EpsPlumeWrapper.cc +++ b/src/attributes/EpsPlumeWrapper.cc @@ -131,6 +131,23 @@ void EpsPlumeWrapper::set(const MagRequest& request) background_colour_list_value.push_back((string)request("EPS_PLUME_BACKGROUND_COLOUR_LIST", i)); if ( !background_colour_list_value.empty() ) epsplume_->background_colour_list_ = background_colour_list_value; + stringarray background_label_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_BACKGROUND_LABEL_LIST"); i++) + background_label_list_value.push_back((string)request("EPS_PLUME_BACKGROUND_LABEL_LIST", i)); + if ( !background_label_list_value.empty() ) + epsplume_->background_label_list_ = background_label_list_value; + if (request.countValues("EPS_PLUME_BACKGROUND_LABEL_FONT") ) { + string background_label_font_value = request("EPS_PLUME_BACKGROUND_LABEL_FONT"); + epsplume_->background_label_font_ = background_label_font_value; + } + if (request.countValues("EPS_PLUME_BACKGROUND_LABEL_FONT_SIZE") ) { + double background_label_font_size_value = request("EPS_PLUME_BACKGROUND_LABEL_FONT_SIZE"); + epsplume_->background_label_font_size_ = background_label_font_size_value; + } + if (request.countValues("EPS_PLUME_BACKGROUND_LABEL_FONT_STYLE") ) { + string background_label_font_style_value = request("EPS_PLUME_BACKGROUND_LABEL_FONT_STYLE"); + epsplume_->background_label_font_style_ = background_label_font_style_value; + } if (request.countValues("EPS_PLUME_LINE_COLOUR") ) { string line_colour_value = request("EPS_PLUME_LINE_COLOUR"); @@ -176,6 +193,11 @@ void EpsPlumeWrapper::set(const MagRequest& request) epsplume_->median_line_style_ = MagTranslator()(median_line_style_value); } + if (request.countValues("EPS_PLUME_BACKGROUND_LABEL_FONT_COLOUR") ) { + string background_label_font_colour_value = request("EPS_PLUME_BACKGROUND_LABEL_FONT_COLOUR"); + epsplume_->background_label_font_colour_ = unique_ptr(MagTranslator()(background_label_font_colour_value)); + } + } @@ -193,3 +215,4 @@ void EpsPlumeWrapper::print(ostream& out) const + diff --git a/src/params/EpsPlume.xml b/src/params/EpsPlume.xml index 577a13120..21946f145 100644 --- a/src/params/EpsPlume.xml +++ b/src/params/EpsPlume.xml @@ -178,6 +178,37 @@ does it submit to any jurisdiction. name="eps_plume_background_colour_list"> Background colour list + + Background colour list + + + + + diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index f4887d0d1..ddba2ae9d 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -2682,6 +2682,7 @@ void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { auto colour = background_colour_list_.begin(); auto level = background_level_list_.begin(); + auto label = background_label_list_.begin(); double from = *level; ++level; @@ -2706,6 +2707,21 @@ void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { area->push_back(PaperPoint(transformation.getMinX(), from)); + } + if ( label != background_label_list_.end() ) { + + Text* text = new Text(); + text->setText(*label); + text->setJustification(Justification::LEFT); + MagFont font(background_label_font_, background_label_font_style_, background_label_font_size_); + font.colour(*background_label_font_colour_); + text->setFont(font); + double x = transformation.getMinX() + (transformation.getMaxX() - transformation.getMinX())*0.01; + double y = from + (to-from)*0.1; + + text->push_back(PaperPoint(x, y)); + visitor.push_back(text); + ++label; } from = *level; ++colour; From c04596b0db575a6ed2f3ec82c2ccd678f77116dd Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 15 Feb 2023 19:12:30 +0000 Subject: [PATCH 37/66] Work on visibility epsgrams. --- src/web/WrepJSon.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/web/WrepJSon.cc b/src/web/WrepJSon.cc index 56a27f5fd..bc184223e 100644 --- a/src/web/WrepJSon.cc +++ b/src/web/WrepJSon.cc @@ -71,6 +71,7 @@ WrepJSon::WrepJSon() : decoders_["eps"] = &WrepJSon::eps; + decoders_["visibility"] = &WrepJSon::eps; decoders_["clim"] = &WrepJSon::eps; decoders_["profile"] = &WrepJSon::profile; @@ -86,6 +87,7 @@ WrepJSon::WrepJSon() : transformationHandlers_["eps"] = &WrepJSon::eps; + transformationHandlers_["visibility"] = &WrepJSon::eps; transformationHandlers_["cdf"] = &WrepJSon::cdf; transformationHandlers_["efi"] = &WrepJSon::efi; transformationHandlers_["profile"] = &WrepJSon::profile; @@ -1958,7 +1960,11 @@ void WrepJSon::points(const Transformation& transformation, vector& p x -= shift; } // doubble v = (*point)->find("value") != (*point)->end() ) : (**point)["value"] : 0; - points.push_back(UserPoint(x, (**point)["y"], (**point)["value"])); + if ( family_ == "visibility") + points.push_back(UserPoint(x, 1, (**point)["y"])); + else + points.push_back(UserPoint(x, (**point)["y"], (**point)["value"])); + if ((*point)->missing()) points.back().flagMissing(); } @@ -1975,7 +1981,10 @@ PointsHandler& WrepJSon::points(const Transformation& transformation, bool) { x -= shift; } - list_.push_back(new UserPoint(x, (**point)["y"], (**point)["value"])); + if ( family_ == "visibility") + list_.push_back(new UserPoint(x, 1, (**point)["y"])); + else + list_.push_back(new UserPoint(x, (**point)["y"], (**point)["value"])); if ((*point)->missing()) list_.back()->flagMissing(); } From 30084f32df0184c9be78e5793973c1d20dacfb72 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 16 Feb 2023 11:32:05 +0000 Subject: [PATCH 38/66] Netcdf Plotting : fix bug in the interpretation of the date in hivmoller plots type --- src/decoders/NetcdfData.cc | 3 +++ src/decoders/NetcdfData.h | 3 +++ src/decoders/NetcdfMatrixInterpretor.cc | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/decoders/NetcdfData.cc b/src/decoders/NetcdfData.cc index 5466f8fa5..f0157483a 100644 --- a/src/decoders/NetcdfData.cc +++ b/src/decoders/NetcdfData.cc @@ -404,6 +404,9 @@ double NetVariable::getDefaultMissing() { string Netcdf::detect(const string& var, const string& type, bool use_cache) const { + if ( std::find(ignoredDimensions_.begin(), ignoredDimensions_.end(), type) != ignoredDimensions_.end() ) + // Here we force to ignore the dimension type + return ""; if ( use_cache ) { auto cache = detected_.find(var); if ( cache != detected_.end() ) diff --git a/src/decoders/NetcdfData.h b/src/decoders/NetcdfData.h index 27f9abe3b..0705869d0 100644 --- a/src/decoders/NetcdfData.h +++ b/src/decoders/NetcdfData.h @@ -476,6 +476,8 @@ class Netcdf { } map getAttributes() { return attributes_; } + void ignoreDimension(const string& dim) { ignoredDimensions_.push_back(dim); } + void interpretDimension(const string& dim) { std::remove( ignoredDimensions_.begin(), ignoredDimensions_.end(), dim ); } protected: @@ -486,6 +488,7 @@ class Netcdf { map attributes_; double missing_; mutable map detected_; + vector ignoredDimensions_; private: int file_; diff --git a/src/decoders/NetcdfMatrixInterpretor.cc b/src/decoders/NetcdfMatrixInterpretor.cc index 84baea446..9446fb2cf 100644 --- a/src/decoders/NetcdfMatrixInterpretor.cc +++ b/src/decoders/NetcdfMatrixInterpretor.cc @@ -55,8 +55,10 @@ void NetcdfMatrixInterpretor::interpret(Netcdf& netcdf, vector& rows, ve x.precision(20); y.precision(20); + netcdf.ignoreDimension("time"); // here we send time as expressed in the data, not as a date. y << y_ << "/" << *r << "/" << *r; x << x_ << "/" << columns.front() << "/" << columns.back(); + netcdf.interpretDimension("time"); } std::copy(dimension_.begin(), dimension_.end(), std::back_inserter(dims)); dims.push_back(y.str()); From 935385fc6dc7103c8b6f1cca74b6a56bb582c74e Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 16 Feb 2023 15:21:40 +0000 Subject: [PATCH 39/66] Axis: axis_grid_background_colour ( none) background colour for axis. --- src/attributes/AxisAttributes.cc | 7 +++++++ src/attributes/AxisAttributes.h | 1 + src/attributes/AxisWrapper.cc | 6 ++++++ src/params/Axis.xml | 8 +++++++- src/visualisers/Axis.cc | 16 ++++++++++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/attributes/AxisAttributes.cc b/src/attributes/AxisAttributes.cc index 446ea50d0..c0bb27ce3 100644 --- a/src/attributes/AxisAttributes.cc +++ b/src/attributes/AxisAttributes.cc @@ -74,6 +74,7 @@ AxisAttributes::AxisAttributes(): line_colour_(MagTranslator().magics("axis_line_colour")), line_style_(MagTranslator().magics("axis_line_style")), grid_colour_(MagTranslator().magics("axis_grid_colour")), + grid_background_colour_(MagTranslator().magics("axis_grid_background_colour")), grid_style_(MagTranslator().magics("axis_grid_line_style")), minor_grid_colour_(MagTranslator().magics("axis_minor_grid_colour")), minor_grid_style_(MagTranslator().magics("axis_minor_grid_line_style")), @@ -152,6 +153,7 @@ void AxisAttributes::set(const std::map& params) setMember(prefix, "axis_line_colour", line_colour_, params); setAttribute(prefix, "axis_line_style", line_style_, params); setMember(prefix, "axis_grid_colour", grid_colour_, params); + setMember(prefix, "axis_grid_background_colour", grid_background_colour_, params); setAttribute(prefix, "axis_grid_line_style", grid_style_, params); setMember(prefix, "axis_minor_grid_colour", minor_grid_colour_, params); setAttribute(prefix, "axis_minor_grid_line_style", minor_grid_style_, params); @@ -217,6 +219,7 @@ void AxisAttributes::copy(const AxisAttributes& other) line_colour_ = unique_ptr(other.line_colour_->clone()); line_style_ = other.line_style_; grid_colour_ = unique_ptr(other.grid_colour_->clone()); + grid_background_colour_ = unique_ptr(other.grid_background_colour_->clone()); grid_style_ = other.grid_style_; minor_grid_colour_ = unique_ptr(other.minor_grid_colour_->clone()); minor_grid_style_ = other.minor_grid_style_; @@ -319,6 +322,7 @@ void AxisAttributes::print(ostream& out) const out << " line_colour = " << *line_colour_; out << " line_style = " << line_style_; out << " grid_colour = " << *grid_colour_; + out << " grid_background_colour = " << *grid_background_colour_; out << " grid_style = " << grid_style_; out << " minor_grid_colour = " << *minor_grid_colour_; out << " minor_grid_style = " << minor_grid_style_; @@ -434,6 +438,8 @@ void AxisAttributes::toxml(ostream& out) const niceprint(out, line_style_); out << ", \"axis_grid_colour\":"; niceprint(out, *grid_colour_); + out << ", \"axis_grid_background_colour\":"; + niceprint(out, *grid_background_colour_); out << ", \"axis_grid_line_style\":"; niceprint(out, grid_style_); out << ", \"axis_minor_grid_colour\":"; @@ -509,6 +515,7 @@ static MagicsParameter axis_type("axis_type", "regular"); static MagicsParameter axis_line_colour("axis_line_colour", "automatic"); static MagicsParameter axis_line_style("axis_line_style", "solid"); static MagicsParameter axis_grid_colour("axis_grid_colour", "black"); +static MagicsParameter axis_grid_background_colour("axis_grid_background_colour", "none"); static MagicsParameter axis_grid_line_style("axis_grid_line_style", "solid"); static MagicsParameter axis_minor_grid_colour("axis_minor_grid_colour", "black"); static MagicsParameter axis_minor_grid_line_style("axis_minor_grid_line_style", "solid"); diff --git a/src/attributes/AxisAttributes.h b/src/attributes/AxisAttributes.h index 1410aff32..a04e0f969 100644 --- a/src/attributes/AxisAttributes.h +++ b/src/attributes/AxisAttributes.h @@ -100,6 +100,7 @@ class AxisAttributes unique_ptr line_colour_; LineStyle line_style_; unique_ptr grid_colour_; + unique_ptr grid_background_colour_; LineStyle grid_style_; unique_ptr minor_grid_colour_; LineStyle minor_grid_style_; diff --git a/src/attributes/AxisWrapper.cc b/src/attributes/AxisWrapper.cc index a45b68f46..0f5096f48 100644 --- a/src/attributes/AxisWrapper.cc +++ b/src/attributes/AxisWrapper.cc @@ -289,6 +289,11 @@ void AxisWrapper::set(const MagRequest& request) axis_->grid_colour_ = unique_ptr(MagTranslator()(grid_colour_value)); } + if (request.countValues("AXIS_GRID_BACKGROUND_COLOUR") ) { + string grid_background_colour_value = request("AXIS_GRID_BACKGROUND_COLOUR"); + axis_->grid_background_colour_ = unique_ptr(MagTranslator()(grid_background_colour_value)); + } + if (request.countValues("AXIS_GRID_LINE_STYLE") ) { string grid_style_value = request("AXIS_GRID_LINE_STYLE"); @@ -403,3 +408,4 @@ static SimpleObjectMaker Axis_axis_ty + diff --git a/src/params/Axis.xml b/src/params/Axis.xml index 64e33e2c7..9b79fdc21 100644 --- a/src/params/Axis.xml +++ b/src/params/Axis.xml @@ -91,7 +91,13 @@ does it submit to any jurisdiction. from="string" name="axis_grid_colour"> Colour of grid lines - 2.13.5 - Default changed fronm YELLOW to BLACK + + + Colour of grid background none()) { + Polyline* area = new Polyline(); + area->setColour(*grid_background_colour_); + area->setFilled(true); + area->setShading(new FillShadingProperties()); + area->setFillColour(*grid_background_colour_); + out.push_back(area); + area->push_back(PaperPoint(left, bottom)); + area->push_back(PaperPoint(left, top)); + area->push_back(PaperPoint(right, top)); + area->push_back(PaperPoint(right, bottom)); + area->push_back(PaperPoint(left, bottom)); + } + if (!grid_) { if (grid_reference_level_ != INT_MAX) { for (AxisItems::const_iterator x = items_.begin(); x != items_.end(); ++x) { From ae707890d00fa91f9fff87b44fd5d2aabb1b9705 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 16 Feb 2023 15:22:57 +0000 Subject: [PATCH 40/66] Visvility graph : adding wrepjson_y_axis_value to allow more that one parameters on the same graph. --- src/attributes/WrepJSonAttributes.cc | 9 ++++++++- src/attributes/WrepJSonAttributes.h | 1 + src/attributes/WrepJSonWrapper.cc | 4 ++++ src/params/WrepJSon.xml | 7 +++++++ src/web/WrepJSon.cc | 4 ++-- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/attributes/WrepJSonAttributes.cc b/src/attributes/WrepJSonAttributes.cc index cdde96b59..61a3f4cfc 100644 --- a/src/attributes/WrepJSonAttributes.cc +++ b/src/attributes/WrepJSonAttributes.cc @@ -55,7 +55,8 @@ WrepJSonAttributes::WrepJSonAttributes(): profile_quantile_(ParameterManager::getString("wrepjson_profile_quantile")), hodograph_grid_(ParameterManager::getBool("wrepjson_hodograph_grid")), hodograph_tephi_(ParameterManager::getBool("wrepjson_hodograph_tephi")), - hodograph_member_(ParameterManager::getInt("wrepjson_hodograph_member")) + hodograph_member_(ParameterManager::getInt("wrepjson_hodograph_member")), + y_axis_value_(ParameterManager::getDouble("wrepjson_y_axis_value")) { @@ -105,6 +106,7 @@ void WrepJSonAttributes::set(const std::map& params) setAttribute(prefix, "wrepjson_hodograph_grid", hodograph_grid_, params); setAttribute(prefix, "wrepjson_hodograph_tephi", hodograph_tephi_, params); setAttribute(prefix, "wrepjson_hodograph_member", hodograph_member_, params); + setAttribute(prefix, "wrepjson_y_axis_value", y_axis_value_, params); } @@ -142,6 +144,7 @@ void WrepJSonAttributes::copy(const WrepJSonAttributes& other) hodograph_grid_ = other.hodograph_grid_; hodograph_tephi_ = other.hodograph_tephi_; hodograph_member_ = other.hodograph_member_; + y_axis_value_ = other.y_axis_value_; } @@ -211,6 +214,7 @@ void WrepJSonAttributes::print(ostream& out) const out << " hodograph_grid = " << hodograph_grid_; out << " hodograph_tephi = " << hodograph_tephi_; out << " hodograph_member = " << hodograph_member_; + out << " y_axis_value = " << y_axis_value_; out << "]" << "\n"; } @@ -280,6 +284,8 @@ void WrepJSonAttributes::toxml(ostream& out) const niceprint(out,hodograph_tephi_); out << ", \"wrepjson_hodograph_member\":"; niceprint(out,hodograph_member_); + out << ", \"wrepjson_y_axis_value\":"; + niceprint(out,y_axis_value_); } @@ -314,3 +320,4 @@ static MagicsParameter wrepjson_profile_quantile("wrepjson_profile_quant static MagicsParameter wrepjson_hodograph_grid("wrepjson_hodograph_grid", "off"); static MagicsParameter wrepjson_hodograph_tephi("wrepjson_hodograph_tephi", "off"); static MagicsParameter wrepjson_hodograph_member("wrepjson_hodograph_member", -1); +static MagicsParameter wrepjson_y_axis_value("wrepjson_y_axis_value", 1); diff --git a/src/attributes/WrepJSonAttributes.h b/src/attributes/WrepJSonAttributes.h index 5dbe6af44..67bb40d2b 100644 --- a/src/attributes/WrepJSonAttributes.h +++ b/src/attributes/WrepJSonAttributes.h @@ -81,6 +81,7 @@ class WrepJSonAttributes bool hodograph_grid_; bool hodograph_tephi_; int hodograph_member_; + double y_axis_value_; private: diff --git a/src/attributes/WrepJSonWrapper.cc b/src/attributes/WrepJSonWrapper.cc index fa43cdf3c..32d5f05c0 100644 --- a/src/attributes/WrepJSonWrapper.cc +++ b/src/attributes/WrepJSonWrapper.cc @@ -193,6 +193,10 @@ void WrepJSonWrapper::set(const MagRequest& request) int hodograph_member_value = request("WREPJSON_HODOGRAPH_MEMBER"); wrepjson_->hodograph_member_ = hodograph_member_value; } + if (request.countValues("WREPJSON_Y_AXIS_VALUE") ) { + double y_axis_value_value = request("WREPJSON_Y_AXIS_VALUE"); + wrepjson_->y_axis_value_ = y_axis_value_value; + } } diff --git a/src/params/WrepJSon.xml b/src/params/WrepJSon.xml index b62eece62..4796c583f 100644 --- a/src/params/WrepJSon.xml +++ b/src/params/WrepJSon.xml @@ -236,5 +236,12 @@ does it submit to any jurisdiction. visible='off'> slecet only one member + + Used in the visibility product to define the y value + diff --git a/src/web/WrepJSon.cc b/src/web/WrepJSon.cc index bc184223e..e1bd82745 100644 --- a/src/web/WrepJSon.cc +++ b/src/web/WrepJSon.cc @@ -1961,7 +1961,7 @@ void WrepJSon::points(const Transformation& transformation, vector& p } // doubble v = (*point)->find("value") != (*point)->end() ) : (**point)["value"] : 0; if ( family_ == "visibility") - points.push_back(UserPoint(x, 1, (**point)["y"])); + points.push_back(UserPoint(x, y_axis_value_, (**point)["y"])); else points.push_back(UserPoint(x, (**point)["y"], (**point)["value"])); @@ -1982,7 +1982,7 @@ PointsHandler& WrepJSon::points(const Transformation& transformation, bool) { } if ( family_ == "visibility") - list_.push_back(new UserPoint(x, 1, (**point)["y"])); + list_.push_back(new UserPoint(x, y_axis_value_, (**point)["y"])); else list_.push_back(new UserPoint(x, (**point)["y"], (**point)["value"])); if ((*point)->missing()) From 4f8bbaa36c30cd3605b7e8280fa928aa7c5bd111 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 16 Feb 2023 17:55:41 +0000 Subject: [PATCH 41/66] Netcdf : fix compilation issues --- src/decoders/NetcdfData.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decoders/NetcdfData.h b/src/decoders/NetcdfData.h index 0705869d0..5a5beaabc 100644 --- a/src/decoders/NetcdfData.h +++ b/src/decoders/NetcdfData.h @@ -477,7 +477,7 @@ class Netcdf { map getAttributes() { return attributes_; } void ignoreDimension(const string& dim) { ignoredDimensions_.push_back(dim); } - void interpretDimension(const string& dim) { std::remove( ignoredDimensions_.begin(), ignoredDimensions_.end(), dim ); } + void interpretDimension(const string&) { } //std::remove( ignoredDimensions_.begin(), ignoredDimensions_.end(), dim ); } protected: @@ -488,7 +488,7 @@ class Netcdf { map attributes_; double missing_; mutable map detected_; - vector ignoredDimensions_; + vector ignoredDimensions_; private: int file_; From 6e1a57c34b431f6191e1c1f59d3828c5f0226813 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 12 Apr 2023 13:30:03 +0200 Subject: [PATCH 42/66] ECC-1552-projString : ignore projString if the filed is on latlon. --- src/decoders/GribDecoder.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/decoders/GribDecoder.cc b/src/decoders/GribDecoder.cc index dbd1022f0..d93412e72 100644 --- a/src/decoders/GribDecoder.cc +++ b/src/decoders/GribDecoder.cc @@ -1666,6 +1666,9 @@ string GribDecoder::representation() { current_handle_ = field_; // Now warning, no caching string proj = getstring("projTargetString", false, false); + // Here if proj contains latlong we ignore the setting . + if (proj.find("longlat") != std::string::npos) + proj = ""; return (proj.size()) ? "proj" : grid; } From 225e960eb52434040b21f4fd7b444bc6d36f3a04 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 17 Apr 2023 13:27:16 +0100 Subject: [PATCH 43/66] Magics : grib_file_address_mode="byte_offset" not working for large files [MAGP-1357] Advanced wind plotting hangs when no values found above min speed[MAGP-1355] --- src/api/MagicsCalls.cc | 18 ++++++ src/api/MagicsCalls.h | 2 + src/api/MagicsCallsPython.cc | 6 +- src/api/py_calls.h | 2 + src/attributes/GribDecoderAttributes.cc | 28 +++++++++ src/attributes/GribDecoderAttributes.h | 4 ++ src/attributes/GribDecoderWrapper.cc | 76 +++++++++++++++++++++++++ src/attributes/GribDecoderWrapper.h | 4 ++ src/common/BaseParameter.cc | 15 +++++ src/common/BaseParameter.h | 5 ++ src/common/MagTranslator.h | 23 ++++++++ src/common/ParameterManager.cc | 6 ++ src/common/ParameterManager.h | 3 + src/decoders/GribAddressMode.h | 40 +++++++------ src/decoders/GribDecoder.cc | 3 +- src/decoders/GribDecoder.h | 2 +- src/params/GribDecoder.xml | 32 ++++++++++- src/visualisers/CountSelectionType.cc | 13 ++++- src/visualisers/WindPlotting.cc | 4 +- tools/xml2cc.py | 1 + tools/xml2cc_mv.py | 1 + 21 files changed, 263 insertions(+), 25 deletions(-) diff --git a/src/api/MagicsCalls.cc b/src/api/MagicsCalls.cc index 694ed8445..ce53c412d 100644 --- a/src/api/MagicsCalls.cc +++ b/src/api/MagicsCalls.cc @@ -42,7 +42,20 @@ const char* MagicsCalls::metainput() { const char* MagicsCalls::metanetcdf() { return FortranMagics::instance().metanetcdf(); } +const char* MagicsCalls::long_parameters() { + static string result; + ostringstream os; + os << "{"; + os << "\"grib_field_position\": \"grib_field_large_position\","; + os << "\"grib_wind_position_1\": \"grib_wind_large_position_1\","; + os << "\"grib_wind_position_2\": \"grib_wind_large_position_2\","; + os << "\"grib_wind_position_colour\": \"grib_wind_large_position_colour\""; + os << "}"; + result = os.str(); + return result.c_str(); + +} const char* MagicsCalls::keep_compatibility() { NOTIMP; } @@ -385,6 +398,11 @@ void MagicsCalls::seti(const std::string& name, int value) { ParameterManager::set(name, value); } +void MagicsCalls::setli(const std::string& name, unsigned long long value) { + // if (CompatibilityHelper::check(name, value)) + // return; + ParameterManager::set(name, value); +} void MagicsCalls::set1i(const std::string& name, const std::vector& data) { set1i(name, data.data(), data.size()); diff --git a/src/api/MagicsCalls.h b/src/api/MagicsCalls.h index a70123d9f..399112d3a 100644 --- a/src/api/MagicsCalls.h +++ b/src/api/MagicsCalls.h @@ -20,6 +20,7 @@ class MagicsCalls { static const char* metainput(); static const char* metanetcdf(); static const char* keep_compatibility(); + static const char* long_parameters(); // ================================================================= static void axis(); @@ -82,6 +83,7 @@ class MagicsCalls { static void set1c(const std::string& name, const std::vector& data); static void seti(const std::string& name, int value); + static void setli(const std::string& name, unsigned long long value); static void set1i(const std::string& name, const int* data, const int dim1); static void set1i(const std::string& name, const std::vector& data); static void set2i(const std::string& name, const int* data, const int dim1, const int dim2); diff --git a/src/api/MagicsCallsPython.cc b/src/api/MagicsCallsPython.cc index e3fd90b6c..45d537711 100644 --- a/src/api/MagicsCallsPython.cc +++ b/src/api/MagicsCallsPython.cc @@ -162,7 +162,7 @@ PYTHON_VOID(tile) PYTHON_VOID(unmute) // TODO: review name PYTHON_VOID(wind) PYTHON_VOID(wrepjson) - +PYTHON_CHAR(long_parameters) PYTHON_CHAR(knowndrivers) // TODO: review name PYTHON_CHAR(metagrib) // TODO: review name PYTHON_CHAR(metainput) // TODO: review name @@ -193,6 +193,10 @@ MAGICS_EXPORT const char* py_seti(const char* name, const int value) { return python_void("seti", [name, value] { MagicsCalls::seti(name, value); }); } +MAGICS_EXPORT const char* py_setli(const char* name, const unsigned long long value) { + return python_void("setli", [name, value] { MagicsCalls::setli(name, value); }); +} + MAGICS_EXPORT const char* py_set1r(const char* name, const double* data, const int dim1) { return python_void("set1r", [name, data, dim1] { MagicsCalls::set1r(name, data, dim1); }); } diff --git a/src/api/py_calls.h b/src/api/py_calls.h index 88a1c5868..503359d86 100644 --- a/src/api/py_calls.h +++ b/src/api/py_calls.h @@ -19,6 +19,7 @@ MAGICS_EXPORT const char* py_import(); MAGICS_EXPORT const char* py_input(); MAGICS_EXPORT const char* py_keep_compatibility(); MAGICS_EXPORT const char* py_knowndrivers(); +MAGICS_EXPORT const char* py_long_parameters(); MAGICS_EXPORT const char* py_legend(); MAGICS_EXPORT const char* py_line(); MAGICS_EXPORT const char* py_mapgen(); @@ -50,6 +51,7 @@ MAGICS_EXPORT const char* py_reset(const char* name); MAGICS_EXPORT const char* py_setc(const char* name, const char* value); MAGICS_EXPORT const char* py_setr(const char* name, const double value); MAGICS_EXPORT const char* py_seti(const char* name, const int value); +MAGICS_EXPORT const char* py_setli(const char* name, const unsigned long long value); MAGICS_EXPORT const char* py_set1r(const char* name, const double* data, const int dim1); MAGICS_EXPORT const char* py_set2r(const char* name, const double* data, const int dim1, const int dim2); MAGICS_EXPORT const char* py_set1i(const char* name, const int* data, const int dim1); diff --git a/src/attributes/GribDecoderAttributes.cc b/src/attributes/GribDecoderAttributes.cc index 23385a67a..8c44856a1 100644 --- a/src/attributes/GribDecoderAttributes.cc +++ b/src/attributes/GribDecoderAttributes.cc @@ -41,9 +41,13 @@ GribDecoderAttributes::GribDecoderAttributes(): expver_(ParameterManager::getBool("grib_text_experiment")), units_(ParameterManager::getBool("grib_text_units")), field_position_(ParameterManager::getInt("grib_field_position")), + large_field_position_(ParameterManager::getULong("grib_field_large_position")), position_1_(ParameterManager::getInt("grib_wind_position_1")), position_2_(ParameterManager::getInt("grib_wind_position_2")), colour_position_(ParameterManager::getInt("grib_wind_position_colour")), + large_position_1_(ParameterManager::getULong("grib_wind_large_position_1")), + large_position_2_(ParameterManager::getULong("grib_wind_large_position_2")), + large_colour_position_(ParameterManager::getULong("grib_wind_large_position_colour")), missing_value_(ParameterManager::getDouble("grib_missing_value_indicator")), wind_style_(ParameterManager::getBool("grib_wind_style")) , @@ -83,9 +87,13 @@ void GribDecoderAttributes::set(const std::map& params) setAttribute(prefix, "grib_text_experiment", expver_, params); setAttribute(prefix, "grib_text_units", units_, params); setAttribute(prefix, "grib_field_position", field_position_, params); + setAttribute(prefix, "grib_field_large_position", large_field_position_, params); setAttribute(prefix, "grib_wind_position_1", position_1_, params); setAttribute(prefix, "grib_wind_position_2", position_2_, params); setAttribute(prefix, "grib_wind_position_colour", colour_position_, params); + setAttribute(prefix, "grib_wind_large_position_1", large_position_1_, params); + setAttribute(prefix, "grib_wind_large_position_2", large_position_2_, params); + setAttribute(prefix, "grib_wind_large_position_colour", large_colour_position_, params); setAttribute(prefix, "grib_missing_value_indicator", missing_value_, params); setAttribute(prefix, "grib_wind_style", wind_style_, params); @@ -112,9 +120,13 @@ void GribDecoderAttributes::copy(const GribDecoderAttributes& other) expver_ = other.expver_; units_ = other.units_; field_position_ = other.field_position_; + large_field_position_ = other.large_field_position_; position_1_ = other.position_1_; position_2_ = other.position_2_; colour_position_ = other.colour_position_; + large_position_1_ = other.large_position_1_; + large_position_2_ = other.large_position_2_; + large_colour_position_ = other.large_colour_position_; missing_value_ = other.missing_value_; wind_style_ = other.wind_style_; address_mode_ = unique_ptr(other.address_mode_->clone()); @@ -181,9 +193,13 @@ void GribDecoderAttributes::print(ostream& out) const out << " expver = " << expver_; out << " units = " << units_; out << " field_position = " << field_position_; + out << " large_field_position = " << large_field_position_; out << " position_1 = " << position_1_; out << " position_2 = " << position_2_; out << " colour_position = " << colour_position_; + out << " large_position_1 = " << large_position_1_; + out << " large_position_2 = " << large_position_2_; + out << " large_colour_position = " << large_colour_position_; out << " missing_value = " << missing_value_; out << " wind_style = " << wind_style_; out << " address_mode = " << *address_mode_; @@ -227,12 +243,20 @@ void GribDecoderAttributes::toxml(ostream& out) const niceprint(out,units_); out << ", \"grib_field_position\":"; niceprint(out,field_position_); + out << ", \"grib_field_large_position\":"; + niceprint(out,large_field_position_); out << ", \"grib_wind_position_1\":"; niceprint(out,position_1_); out << ", \"grib_wind_position_2\":"; niceprint(out,position_2_); out << ", \"grib_wind_position_colour\":"; niceprint(out,colour_position_); + out << ", \"grib_wind_large_position_1\":"; + niceprint(out,large_position_1_); + out << ", \"grib_wind_large_position_2\":"; + niceprint(out,large_position_2_); + out << ", \"grib_wind_large_position_colour\":"; + niceprint(out,large_colour_position_); out << ", \"grib_missing_value_indicator\":"; niceprint(out,missing_value_); out << ", \"grib_wind_style\":"; @@ -260,9 +284,13 @@ static MagicsParameter grib_interpolation_method_missing_fill_count("grib_i static MagicsParameter grib_text_experiment("grib_text_experiment", "off"); static MagicsParameter grib_text_units("grib_text_units", "off"); static MagicsParameter grib_field_position("grib_field_position", 1); +static MagicsParameter grib_field_large_position("grib_field_large_position", 0); static MagicsParameter grib_wind_position_1("grib_wind_position_1", 1); static MagicsParameter grib_wind_position_2("grib_wind_position_2", -1); static MagicsParameter grib_wind_position_colour("grib_wind_position_colour", -1); +static MagicsParameter grib_wind_large_position_1("grib_wind_large_position_1", 0); +static MagicsParameter grib_wind_large_position_2("grib_wind_large_position_2", 0); +static MagicsParameter grib_wind_large_position_colour("grib_wind_large_position_colour", 0); static MagicsParameter grib_missing_value_indicator("grib_missing_value_indicator", -1.5e+21); static MagicsParameter grib_wind_style("grib_wind_style", "off"); static MagicsParameter grib_file_address_mode("grib_file_address_mode", "record"); diff --git a/src/attributes/GribDecoderAttributes.h b/src/attributes/GribDecoderAttributes.h index e096edeaf..090aa4ba8 100644 --- a/src/attributes/GribDecoderAttributes.h +++ b/src/attributes/GribDecoderAttributes.h @@ -68,9 +68,13 @@ class GribDecoderAttributes bool expver_; bool units_; int field_position_; + unsigned long long large_field_position_; int position_1_; int position_2_; int colour_position_; + unsigned long long large_position_1_; + unsigned long long large_position_2_; + unsigned long long large_colour_position_; double missing_value_; bool wind_style_; unique_ptr address_mode_; diff --git a/src/attributes/GribDecoderWrapper.cc b/src/attributes/GribDecoderWrapper.cc index 008b6cf54..08c20fb61 100644 --- a/src/attributes/GribDecoderWrapper.cc +++ b/src/attributes/GribDecoderWrapper.cc @@ -189,6 +189,78 @@ void GribDecoderWrapper::set(const MagRequest& request) gribdecoder_->wind_mode_ = unique_ptr(wind_mode_wrapper->object()); delete wind_mode_wrapper; + string large_field_position_value = request.countValues("GRIB_FIELD_LARGE_POSITION") ? (string) request("GRIB_FIELD_LARGE_POSITION") : "0"; + MagLog::debug() << " GRIB_FIELD_LARGE_POSITION set to " << large_field_position_value << endl; + unsigned long longWrapper* large_field_position_wrapper = 0; + try + { + large_field_position_wrapper = SimpleFactory::create(large_field_position_value); + } + catch (NoFactoryException&) { + if (MagicsGlobal::strict()) { + throw; + } + MagLog::warning() << "[" << large_field_position_value << "] is not a valid value for large_field_position: reset to default -> [0]" << endl; + large_field_position_wrapper = SimpleFactory::create("0"); + } + large_field_position_wrapper->set(request); + gribdecoder_->large_field_position_ = unique_ptr(large_field_position_wrapper->object()); + delete large_field_position_wrapper; + + string large_position_1_value = request.countValues("GRIB_WIND_LARGE_POSITION_1") ? (string) request("GRIB_WIND_LARGE_POSITION_1") : "0"; + MagLog::debug() << " GRIB_WIND_LARGE_POSITION_1 set to " << large_position_1_value << endl; + unsigned long longWrapper* large_position_1_wrapper = 0; + try + { + large_position_1_wrapper = SimpleFactory::create(large_position_1_value); + } + catch (NoFactoryException&) { + if (MagicsGlobal::strict()) { + throw; + } + MagLog::warning() << "[" << large_position_1_value << "] is not a valid value for large_position_1: reset to default -> [0]" << endl; + large_position_1_wrapper = SimpleFactory::create("0"); + } + large_position_1_wrapper->set(request); + gribdecoder_->large_position_1_ = unique_ptr(large_position_1_wrapper->object()); + delete large_position_1_wrapper; + + string large_position_2_value = request.countValues("GRIB_WIND_LARGE_POSITION_2") ? (string) request("GRIB_WIND_LARGE_POSITION_2") : "0"; + MagLog::debug() << " GRIB_WIND_LARGE_POSITION_2 set to " << large_position_2_value << endl; + unsigned long longWrapper* large_position_2_wrapper = 0; + try + { + large_position_2_wrapper = SimpleFactory::create(large_position_2_value); + } + catch (NoFactoryException&) { + if (MagicsGlobal::strict()) { + throw; + } + MagLog::warning() << "[" << large_position_2_value << "] is not a valid value for large_position_2: reset to default -> [0]" << endl; + large_position_2_wrapper = SimpleFactory::create("0"); + } + large_position_2_wrapper->set(request); + gribdecoder_->large_position_2_ = unique_ptr(large_position_2_wrapper->object()); + delete large_position_2_wrapper; + + string large_colour_position_value = request.countValues("GRIB_WIND_LARGE_POSITION_COLOUR") ? (string) request("GRIB_WIND_LARGE_POSITION_COLOUR") : "0"; + MagLog::debug() << " GRIB_WIND_LARGE_POSITION_COLOUR set to " << large_colour_position_value << endl; + unsigned long longWrapper* large_colour_position_wrapper = 0; + try + { + large_colour_position_wrapper = SimpleFactory::create(large_colour_position_value); + } + catch (NoFactoryException&) { + if (MagicsGlobal::strict()) { + throw; + } + MagLog::warning() << "[" << large_colour_position_value << "] is not a valid value for large_colour_position: reset to default -> [0]" << endl; + large_colour_position_wrapper = SimpleFactory::create("0"); + } + large_colour_position_wrapper->set(request); + gribdecoder_->large_colour_position_ = unique_ptr(large_colour_position_wrapper->object()); + delete large_colour_position_wrapper; + } void GribDecoderWrapper::print(ostream& out) const @@ -229,3 +301,7 @@ static SimpleObjectMaker GribDecoder_grib_wi + + + + diff --git a/src/attributes/GribDecoderWrapper.h b/src/attributes/GribDecoderWrapper.h index 20fafaf49..46e517b91 100644 --- a/src/attributes/GribDecoderWrapper.h +++ b/src/attributes/GribDecoderWrapper.h @@ -41,6 +41,10 @@ #include "GribAddressModeWrapper.h" #include "WindModeWrapper.h" +#include "unsigned long longWrapper.h" +#include "unsigned long longWrapper.h" +#include "unsigned long longWrapper.h" +#include "unsigned long longWrapper.h" namespace magics { diff --git a/src/common/BaseParameter.cc b/src/common/BaseParameter.cc index 1f70d981b..deac8e3cf 100644 --- a/src/common/BaseParameter.cc +++ b/src/common/BaseParameter.cc @@ -72,6 +72,14 @@ void BaseParameter::set(const bool& value) { throw MistmatchType(name_, getType(value), type()); } +void BaseParameter::get(unsigned long long& value) const { + throw MistmatchType(name_, getType(value), type()); +} + +void BaseParameter::set(const unsigned long long& value) { + throw MistmatchType(name_, getType(value), type()); +} + void BaseParameter::get(bool& value) const { throw MistmatchType(name_, getType(value), type()); } @@ -308,6 +316,13 @@ void BaseParameter::get(Matrix& value) const { string BaseParameter::getType(const string&) const { return "string"; } +string BaseParameter::getType(const unsigned long long&) const { + return "unsigned long "; +} + +string BaseParameter::getType(const unsigned int&) const { + return "unsigned int "; +} string BaseParameter::getType(const int&) const { return "integer"; diff --git a/src/common/BaseParameter.h b/src/common/BaseParameter.h index f61320dc4..a58b6b2f7 100644 --- a/src/common/BaseParameter.h +++ b/src/common/BaseParameter.h @@ -65,6 +65,9 @@ class BaseParameter { virtual void set(const int&); virtual void get(int&) const; + virtual void set(const unsigned long long&); + virtual void get(unsigned long long&) const; + virtual void set(const magvector&); virtual void get(magvector&) const; @@ -104,6 +107,8 @@ class BaseParameter { string getType(const string&) const; string getType(const int&) const; + string getType(const unsigned long long&) const; + string getType(const unsigned int&) const; string getType(const double&) const; string getType(const magvector&) const; string getType(const magvector&) const; diff --git a/src/common/MagTranslator.h b/src/common/MagTranslator.h index a4d4ac47d..3faf61359 100644 --- a/src/common/MagTranslator.h +++ b/src/common/MagTranslator.h @@ -130,6 +130,29 @@ class MagTranslator { } }; +template <> +class MagTranslator { +public: + int operator()(const string& value) { return atoll(value.c_str()); } + int magics(const string& param) { + int from; + ParameterManager::get(param, from); + return from; + } +}; + + +template <> +class MagTranslator { +public: + int operator()(unsigned long long& value) { return value; } + int magics(const string& param) { + unsigned long long from; + ParameterManager::get(param, from); + return from; + } +}; + template <> class MagTranslator { public: diff --git a/src/common/ParameterManager.cc b/src/common/ParameterManager.cc index 606835e4b..823154372 100644 --- a/src/common/ParameterManager.cc +++ b/src/common/ParameterManager.cc @@ -103,6 +103,12 @@ int ParameterManager::getInt(const string& name) { ASSERT(get(name, value)); return value; } +unsigned long long ParameterManager::getULong(const string& name) { + unsigned long long value; + + ASSERT(get(name, value)); + return value; +} string ParameterManager::getString(const string& name) { string value; diff --git a/src/common/ParameterManager.h b/src/common/ParameterManager.h index c25056d59..c921d670f 100644 --- a/src/common/ParameterManager.h +++ b/src/common/ParameterManager.h @@ -45,6 +45,7 @@ class ParameterManager : public map { template static void set(const string& name, const T& value) { + ASSERT(table_); BaseParameter* param = (*table_).parameter(name); if (param) { @@ -80,6 +81,8 @@ class ParameterManager : public map { static double getDouble(const string& name); static int getInt(const string& name); + static int getUnsignedInt(const string& name); + static unsigned long long getULong(const string& name); static string getString(const string& name); static stringarray getStringArray(const string& name); diff --git a/src/decoders/GribAddressMode.h b/src/decoders/GribAddressMode.h index a521a337a..8ca95e1a8 100644 --- a/src/decoders/GribAddressMode.h +++ b/src/decoders/GribAddressMode.h @@ -50,11 +50,11 @@ class GribAddressMode { virtual void toxml(ostream&, int = 0) const { MagLog::dev() << "GribAddressMode::toxml(ostream&, int = 0)---> to be checked!...\n"; } - virtual grib_handle* operator()(grib_context*, FILE*, int) const { - MagLog::dev() << "GribAddressMode::toxml(ostream&, int = 0)---> to be checked!...\n"; - return 0; - } - virtual grib_handle* operator()(grib_context*, FILE*, long int) const { + // virtual grib_handle* operator()(grib_context*, FILE*, int) const { + // MagLog::dev() << "GribAddressMode::toxml(ostream&, int = 0)---> to be checked!...\n"; + // return 0; + // } + virtual grib_handle* operator()(grib_context*, FILE*, unsigned long long) const { MagLog::dev() << "GribAddressMode::toxml(ostream&, int = 0)---> to be checked!...\n"; return 0; } @@ -87,13 +87,13 @@ class GribAddressRecordMode : public GribAddressMode { return mode; } - virtual grib_handle* operator()(grib_context*, FILE* file, int position) const override { + virtual grib_handle* operator()(grib_context*, FILE* file, unsigned long long position) const override { grib_handle* handle = 0; grib_context* context = grib_context_get_default(); int error; - for (int i = 0; i < position - 1; i++) { + for (auto i = 0; i < position - 1; i++) { // grib_read_any_from_file_alloc (context, file, &msg , &size); // grib_context_free(context,msg); // MagLog::debug() << "call to grib_handle_new_from_file for position " << i << "\n"; @@ -118,22 +118,28 @@ class GribAddressByteMode : public GribAddressMode { GribAddressMode* mode = new GribAddressByteMode(); return mode; } + #include - virtual grib_handle* operator()(grib_context* context, FILE* file, int position) const override { - // long int offset = (long int)position; - // cout << "OFFSET-->" << offset << endl; - fseek(file, (long int)position, SEEK_SET); - grib_handle* handle = 0; + // virtual grib_handle* operator()(grib_context* context, FILE* file, int position) const override { + // // long int offset = (long int)position; + // cout << "OFFSET-->" << position << endl; - int error; - handle = grib_handle_new_from_file(0, file, &error); + // fseek(file, (long int)position, SEEK_SET); + // grib_handle* handle = 0; - return handle; - } - virtual grib_handle* operator()(grib_context* context, FILE* file, long int position) const override { + // int error; + // handle = grib_handle_new_from_file(0, file, &error); + + // return handle; + // } + virtual grib_handle* operator()(grib_context* context, FILE* file, unsigned long long position) const override { + fseek(file, position, SEEK_SET); grib_handle* handle = 0; + + + int error; handle = grib_handle_new_from_file(0, file, &error); diff --git a/src/decoders/GribDecoder.cc b/src/decoders/GribDecoder.cc index d93412e72..3b454b246 100644 --- a/src/decoders/GribDecoder.cc +++ b/src/decoders/GribDecoder.cc @@ -751,7 +751,8 @@ void GribDecoder::decode2D(const Transformation&) { } void GribDecoder::openField() { - current_position_ = field_position_; + + current_position_ = (large_field_position_) ? large_field_position_ : field_position_; current_file_name_ = file_name_; field_ = open(field_); diff --git a/src/decoders/GribDecoder.h b/src/decoders/GribDecoder.h index 96a520dbc..f818e73fd 100644 --- a/src/decoders/GribDecoder.h +++ b/src/decoders/GribDecoder.h @@ -275,7 +275,7 @@ class GribDecoder : public Decoder, public Data, public GribDecoderAttributes { bool directionDone_; mutable grib_handle* current_handle_; - mutable int current_position_; + mutable unsigned long long current_position_; mutable string current_file_name_; string title_; diff --git a/src/params/GribDecoder.xml b/src/params/GribDecoder.xml index e5c6b729b..97b1a55f0 100644 --- a/src/params/GribDecoder.xml +++ b/src/params/GribDecoder.xml @@ -35,7 +35,9 @@ does it submit to any jurisdiction. to="string" default="grib_input_file_name" from="string" -CountSelection The name of the input file containing the u-component of wind + name="grib_colour_component_file_name"> + + The name of the input file containing the u-component of wind The name of the input file containing the u-comp name="grib_field_position"> The position in the input file of a field other than a wind component + + used when the offset is too big + The name of the input file containing the u-comp name="grib_wind_position_colour"> The position in the input file of a wind component field used to colour the flag + + The position in the input file of a wind component field + + + The position in the input file of a wind component field + + + The position in the input file of a wind component field used to colour the flag + max_limit) { + push_back(max_limit); + push_back(min_limit); + return; + } + double step = (max_limit - min_limit) / nb; double toleranceProportion = diff --git a/src/visualisers/WindPlotting.cc b/src/visualisers/WindPlotting.cc index fdd469c9b..0041b4f43 100644 --- a/src/visualisers/WindPlotting.cc +++ b/src/visualisers/WindPlotting.cc @@ -70,13 +70,15 @@ void WindPlotting::setAdvanced(double& min, double& max) { colourMethod_->set(*this); levels_->calculate(min, max, false); LevelSelection::const_iterator level = levels_->begin(); + if ( levels_->size() == 1 ) + levels_->push_back(levels_->back()*1.00001); colourMethod_->prepare(*levels_, *levels_); Colour last; map_.clear(); while (true) { if (level + 1 == levels_->end()) break; - MagLog::debug() << "[" << *level << ", " << *(level + 1) << "]=" << colourMethod_->right(*level) << endl; + MagLog::debug() << "[" << *level << ", " << *(level + 1) << "]=" << colourMethod_->right(*level) << endl; map_[Interval(*level, *(level + 1))] = colourMethod_->right(*level); last = colourMethod_->right(*level); ++level; diff --git a/tools/xml2cc.py b/tools/xml2cc.py index eade2d313..88abed4af 100755 --- a/tools/xml2cc.py +++ b/tools/xml2cc.py @@ -16,6 +16,7 @@ class ObjectHandler(ContentHandler): basic = { "bool": "getBool", "int": "getInt", + "unsigned long long": "getULong", "float": "getDouble", "string": "getString", "stringarray": "getStringArray", diff --git a/tools/xml2cc_mv.py b/tools/xml2cc_mv.py index 2f5793842..581ae37a3 100755 --- a/tools/xml2cc_mv.py +++ b/tools/xml2cc_mv.py @@ -17,6 +17,7 @@ class ObjectHandler(ContentHandler): basic = { "bool": "getBool", "int": "getInt", + "unsigned lon long": "getULong", "float": "getDouble", "string": "getString", "stringarray": "getStringArray", From 657a29fe022442fa251b9618505307c27e8f59fc Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 17 Apr 2023 14:57:57 +0100 Subject: [PATCH 44/66] Fixing isusue with Metview Wrapper [MAGP-1357] --- src/attributes/GribDecoderWrapper.cc | 92 +++++----------------------- src/attributes/GribDecoderWrapper.h | 4 -- tools/xml2cc_mv.py | 2 +- 3 files changed, 17 insertions(+), 81 deletions(-) diff --git a/src/attributes/GribDecoderWrapper.cc b/src/attributes/GribDecoderWrapper.cc index 08c20fb61..cec441ce6 100644 --- a/src/attributes/GribDecoderWrapper.cc +++ b/src/attributes/GribDecoderWrapper.cc @@ -129,6 +129,10 @@ void GribDecoderWrapper::set(const MagRequest& request) int field_position_value = request("GRIB_FIELD_POSITION"); gribdecoder_->field_position_ = field_position_value; } + if (request.countValues("GRIB_FIELD_LARGE_POSITION") ) { + unsigned long long large_field_position_value = request("GRIB_FIELD_LARGE_POSITION"); + gribdecoder_->large_field_position_ = large_field_position_value; + } if (request.countValues("GRIB_WIND_POSITION_1") ) { int position_1_value = request("GRIB_WIND_POSITION_1"); gribdecoder_->position_1_ = position_1_value; @@ -141,6 +145,18 @@ void GribDecoderWrapper::set(const MagRequest& request) int colour_position_value = request("GRIB_WIND_POSITION_COLOUR"); gribdecoder_->colour_position_ = colour_position_value; } + if (request.countValues("GRIB_WIND_LARGE_POSITION_1") ) { + unsigned long long large_position_1_value = request("GRIB_WIND_LARGE_POSITION_1"); + gribdecoder_->large_position_1_ = large_position_1_value; + } + if (request.countValues("GRIB_WIND_LARGE_POSITION_2") ) { + unsigned long long large_position_2_value = request("GRIB_WIND_LARGE_POSITION_2"); + gribdecoder_->large_position_2_ = large_position_2_value; + } + if (request.countValues("GRIB_WIND_LARGE_POSITION_COLOUR") ) { + unsigned long long large_colour_position_value = request("GRIB_WIND_LARGE_POSITION_COLOUR"); + gribdecoder_->large_colour_position_ = large_colour_position_value; + } if (request.countValues("GRIB_MISSING_VALUE_INDICATOR") ) { double missing_value_value = request("GRIB_MISSING_VALUE_INDICATOR"); gribdecoder_->missing_value_ = missing_value_value; @@ -189,78 +205,6 @@ void GribDecoderWrapper::set(const MagRequest& request) gribdecoder_->wind_mode_ = unique_ptr(wind_mode_wrapper->object()); delete wind_mode_wrapper; - string large_field_position_value = request.countValues("GRIB_FIELD_LARGE_POSITION") ? (string) request("GRIB_FIELD_LARGE_POSITION") : "0"; - MagLog::debug() << " GRIB_FIELD_LARGE_POSITION set to " << large_field_position_value << endl; - unsigned long longWrapper* large_field_position_wrapper = 0; - try - { - large_field_position_wrapper = SimpleFactory::create(large_field_position_value); - } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << large_field_position_value << "] is not a valid value for large_field_position: reset to default -> [0]" << endl; - large_field_position_wrapper = SimpleFactory::create("0"); - } - large_field_position_wrapper->set(request); - gribdecoder_->large_field_position_ = unique_ptr(large_field_position_wrapper->object()); - delete large_field_position_wrapper; - - string large_position_1_value = request.countValues("GRIB_WIND_LARGE_POSITION_1") ? (string) request("GRIB_WIND_LARGE_POSITION_1") : "0"; - MagLog::debug() << " GRIB_WIND_LARGE_POSITION_1 set to " << large_position_1_value << endl; - unsigned long longWrapper* large_position_1_wrapper = 0; - try - { - large_position_1_wrapper = SimpleFactory::create(large_position_1_value); - } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << large_position_1_value << "] is not a valid value for large_position_1: reset to default -> [0]" << endl; - large_position_1_wrapper = SimpleFactory::create("0"); - } - large_position_1_wrapper->set(request); - gribdecoder_->large_position_1_ = unique_ptr(large_position_1_wrapper->object()); - delete large_position_1_wrapper; - - string large_position_2_value = request.countValues("GRIB_WIND_LARGE_POSITION_2") ? (string) request("GRIB_WIND_LARGE_POSITION_2") : "0"; - MagLog::debug() << " GRIB_WIND_LARGE_POSITION_2 set to " << large_position_2_value << endl; - unsigned long longWrapper* large_position_2_wrapper = 0; - try - { - large_position_2_wrapper = SimpleFactory::create(large_position_2_value); - } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << large_position_2_value << "] is not a valid value for large_position_2: reset to default -> [0]" << endl; - large_position_2_wrapper = SimpleFactory::create("0"); - } - large_position_2_wrapper->set(request); - gribdecoder_->large_position_2_ = unique_ptr(large_position_2_wrapper->object()); - delete large_position_2_wrapper; - - string large_colour_position_value = request.countValues("GRIB_WIND_LARGE_POSITION_COLOUR") ? (string) request("GRIB_WIND_LARGE_POSITION_COLOUR") : "0"; - MagLog::debug() << " GRIB_WIND_LARGE_POSITION_COLOUR set to " << large_colour_position_value << endl; - unsigned long longWrapper* large_colour_position_wrapper = 0; - try - { - large_colour_position_wrapper = SimpleFactory::create(large_colour_position_value); - } - catch (NoFactoryException&) { - if (MagicsGlobal::strict()) { - throw; - } - MagLog::warning() << "[" << large_colour_position_value << "] is not a valid value for large_colour_position: reset to default -> [0]" << endl; - large_colour_position_wrapper = SimpleFactory::create("0"); - } - large_colour_position_wrapper->set(request); - gribdecoder_->large_colour_position_ = unique_ptr(large_colour_position_wrapper->object()); - delete large_colour_position_wrapper; - } void GribDecoderWrapper::print(ostream& out) const @@ -301,7 +245,3 @@ static SimpleObjectMaker GribDecoder_grib_wi - - - - diff --git a/src/attributes/GribDecoderWrapper.h b/src/attributes/GribDecoderWrapper.h index 46e517b91..20fafaf49 100644 --- a/src/attributes/GribDecoderWrapper.h +++ b/src/attributes/GribDecoderWrapper.h @@ -41,10 +41,6 @@ #include "GribAddressModeWrapper.h" #include "WindModeWrapper.h" -#include "unsigned long longWrapper.h" -#include "unsigned long longWrapper.h" -#include "unsigned long longWrapper.h" -#include "unsigned long longWrapper.h" namespace magics { diff --git a/tools/xml2cc_mv.py b/tools/xml2cc_mv.py index 581ae37a3..79ba64c59 100755 --- a/tools/xml2cc_mv.py +++ b/tools/xml2cc_mv.py @@ -17,7 +17,7 @@ class ObjectHandler(ContentHandler): basic = { "bool": "getBool", "int": "getInt", - "unsigned lon long": "getULong", + "unsigned long long": "getULong", "float": "getDouble", "string": "getString", "stringarray": "getStringArray", From 6d75d8ff0553b51b37cf2cb3984d8e2b8feedcac Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 17 Apr 2023 15:55:49 +0100 Subject: [PATCH 45/66] Magics-Metview : For now ignore setting of large offsets --- src/attributes/GribDecoderWrapper.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/attributes/GribDecoderWrapper.cc b/src/attributes/GribDecoderWrapper.cc index cec441ce6..3d60c345b 100644 --- a/src/attributes/GribDecoderWrapper.cc +++ b/src/attributes/GribDecoderWrapper.cc @@ -130,7 +130,7 @@ void GribDecoderWrapper::set(const MagRequest& request) gribdecoder_->field_position_ = field_position_value; } if (request.countValues("GRIB_FIELD_LARGE_POSITION") ) { - unsigned long long large_field_position_value = request("GRIB_FIELD_LARGE_POSITION"); + // unsigned long long large_field_position_value = request("GRIB_FIELD_LARGE_POSITION"); gribdecoder_->large_field_position_ = large_field_position_value; } if (request.countValues("GRIB_WIND_POSITION_1") ) { @@ -146,15 +146,15 @@ void GribDecoderWrapper::set(const MagRequest& request) gribdecoder_->colour_position_ = colour_position_value; } if (request.countValues("GRIB_WIND_LARGE_POSITION_1") ) { - unsigned long long large_position_1_value = request("GRIB_WIND_LARGE_POSITION_1"); + // unsigned long long large_position_1_value = request("GRIB_WIND_LARGE_POSITION_1"); gribdecoder_->large_position_1_ = large_position_1_value; } if (request.countValues("GRIB_WIND_LARGE_POSITION_2") ) { - unsigned long long large_position_2_value = request("GRIB_WIND_LARGE_POSITION_2"); + // unsigned long long large_position_2_value = request("GRIB_WIND_LARGE_POSITION_2"); gribdecoder_->large_position_2_ = large_position_2_value; } if (request.countValues("GRIB_WIND_LARGE_POSITION_COLOUR") ) { - unsigned long long large_colour_position_value = request("GRIB_WIND_LARGE_POSITION_COLOUR"); + // unsigned long long large_colour_position_value = request("GRIB_WIND_LARGE_POSITION_COLOUR"); gribdecoder_->large_colour_position_ = large_colour_position_value; } if (request.countValues("GRIB_MISSING_VALUE_INDICATOR") ) { From b8f792639f160cbab5a7ac2ff2ebb49cd4fc6c49 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 17 Apr 2023 16:38:06 +0100 Subject: [PATCH 46/66] Magics-Metview : Fixing GribWrapper --- src/attributes/GribDecoderWrapper.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/attributes/GribDecoderWrapper.cc b/src/attributes/GribDecoderWrapper.cc index 3d60c345b..50e0c340e 100644 --- a/src/attributes/GribDecoderWrapper.cc +++ b/src/attributes/GribDecoderWrapper.cc @@ -131,7 +131,7 @@ void GribDecoderWrapper::set(const MagRequest& request) } if (request.countValues("GRIB_FIELD_LARGE_POSITION") ) { // unsigned long long large_field_position_value = request("GRIB_FIELD_LARGE_POSITION"); - gribdecoder_->large_field_position_ = large_field_position_value; + // gribdecoder_->large_field_position_ = large_field_position_value; } if (request.countValues("GRIB_WIND_POSITION_1") ) { int position_1_value = request("GRIB_WIND_POSITION_1"); @@ -147,15 +147,15 @@ void GribDecoderWrapper::set(const MagRequest& request) } if (request.countValues("GRIB_WIND_LARGE_POSITION_1") ) { // unsigned long long large_position_1_value = request("GRIB_WIND_LARGE_POSITION_1"); - gribdecoder_->large_position_1_ = large_position_1_value; + // gribdecoder_->large_position_1_ = large_position_1_value; } if (request.countValues("GRIB_WIND_LARGE_POSITION_2") ) { // unsigned long long large_position_2_value = request("GRIB_WIND_LARGE_POSITION_2"); - gribdecoder_->large_position_2_ = large_position_2_value; + // gribdecoder_->large_position_2_ = large_position_2_value; } if (request.countValues("GRIB_WIND_LARGE_POSITION_COLOUR") ) { // unsigned long long large_colour_position_value = request("GRIB_WIND_LARGE_POSITION_COLOUR"); - gribdecoder_->large_colour_position_ = large_colour_position_value; + // gribdecoder_->large_colour_position_ = large_colour_position_value; } if (request.countValues("GRIB_MISSING_VALUE_INDICATOR") ) { double missing_value_value = request("GRIB_MISSING_VALUE_INDICATOR"); From b2c081d679bb21cb99ee02210bcc4109266e3527 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 20 Apr 2023 13:36:38 +0100 Subject: [PATCH 47/66] Next Version 4.15.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d77c2ec8c..395d95918 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake") find_package( ecbuild 3.4 REQUIRED ) -project( magics VERSION 4.14.0 LANGUAGES CXX ) +project( magics VERSION 4.15.0 LANGUAGES CXX ) # make sure that the header files are installed into include/magics # note that this needs to be done before ecbuild_declare_project() From b678a98be2aba121958c1c03b52ce129d4d0918a Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 26 Apr 2023 11:32:28 +0100 Subject: [PATCH 48/66] E-Suite ecCharts : eps_control = off will not show the control anymore --- CMakeLists.txt | 5 ++++- src/visualisers/EpsGraph.cc | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 395d95918..06d3c3ff9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,10 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake") find_package( ecbuild 3.4 REQUIRED ) -project( magics VERSION 4.15.0 LANGUAGES CXX ) + +# In prepaation for hotfix of 4.14.0 +project( magics VERSION 4.14.1 LANGUAGES CXX ) + # make sure that the header files are installed into include/magics # note that this needs to be done before ecbuild_declare_project() diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index ddba2ae9d..729e1cbb0 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -627,6 +627,8 @@ magics::Polyline* EpsGraph::newForecast() { } void EpsGraph::pushControl(magics::Polyline* control, BasicGraphicsObjectContainer& visitor) { + if ( !control_ ) + return; const Transformation& transformation = visitor.transformation(); if (!control->empty() && whisker_) { transformation(*control, visitor); From ff5194d2f0b2a9c21c33a542b8f73be6439f3575 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 26 Apr 2023 17:36:13 +0100 Subject: [PATCH 49/66] E-Suite ecCharts : eps_control = off will not show the control anymore --- src/attributes/EpsGraphAttributes.cc | 10 +++++----- src/attributes/EpsGraphAttributes.h | 2 +- src/attributes/EpsGraphWrapper.cc | 4 ++-- src/attributes/EpsWaveAttributes.cc | 9 ++++++++- src/attributes/EpsWaveAttributes.h | 1 + src/attributes/EpsWaveWrapper.cc | 6 ++++++ src/params/EpsGraph.xml | 4 ++-- src/params/EpsWave.xml | 7 +++++++ src/visualisers/EpsGraph.cc | 28 ++++++++++++++++------------ src/visualisers/EpsGraph.h | 7 ++++--- 10 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/attributes/EpsGraphAttributes.cc b/src/attributes/EpsGraphAttributes.cc index dfb1563b4..e6666cc75 100644 --- a/src/attributes/EpsGraphAttributes.cc +++ b/src/attributes/EpsGraphAttributes.cc @@ -45,7 +45,7 @@ EpsGraphAttributes::EpsGraphAttributes(): deterministic_(ParameterManager::getBool("eps_deterministic")), deterministic_thickness_(ParameterManager::getInt("eps_deterministic_line_thickness")), deterministic_legend_(ParameterManager::getString("eps_deterministic_legend_text")), - control_(ParameterManager::getBool("eps_control")), + eps_control_(ParameterManager::getBool("eps_control")), control_thickness_(ParameterManager::getInt("eps_control_line_thickness")), control_legend_(ParameterManager::getString("eps_control_legend_text")), legend_(ParameterManager::getBool("legend")), @@ -99,7 +99,7 @@ void EpsGraphAttributes::set(const std::map& params) setAttribute(prefix, "eps_deterministic", deterministic_, params); setAttribute(prefix, "eps_deterministic_line_thickness", deterministic_thickness_, params); setAttribute(prefix, "eps_deterministic_legend_text", deterministic_legend_, params); - setAttribute(prefix, "eps_control", control_, params); + setAttribute(prefix, "eps_control", eps_control_, params); setAttribute(prefix, "eps_control_line_thickness", control_thickness_, params); setAttribute(prefix, "eps_control_legend_text", control_legend_, params); setAttribute(prefix, "legend", legend_, params); @@ -141,7 +141,7 @@ void EpsGraphAttributes::copy(const EpsGraphAttributes& other) deterministic_ = other.deterministic_; deterministic_thickness_ = other.deterministic_thickness_; deterministic_legend_ = other.deterministic_legend_; - control_ = other.control_; + eps_control_ = other.eps_control_; control_thickness_ = other.control_thickness_; control_legend_ = other.control_legend_; legend_ = other.legend_; @@ -215,7 +215,7 @@ void EpsGraphAttributes::print(ostream& out) const out << " deterministic = " << deterministic_; out << " deterministic_thickness = " << deterministic_thickness_; out << " deterministic_legend = " << deterministic_legend_; - out << " control = " << control_; + out << " eps_control = " << eps_control_; out << " control_thickness = " << control_thickness_; out << " control_legend = " << control_legend_; out << " legend = " << legend_; @@ -279,7 +279,7 @@ void EpsGraphAttributes::toxml(ostream& out) const out << ", \"eps_deterministic_legend_text\":"; niceprint(out,deterministic_legend_); out << ", \"eps_control\":"; - niceprint(out,control_); + niceprint(out,eps_control_); out << ", \"eps_control_line_thickness\":"; niceprint(out,control_thickness_); out << ", \"eps_control_legend_text\":"; diff --git a/src/attributes/EpsGraphAttributes.h b/src/attributes/EpsGraphAttributes.h index 4b5edc5c4..c51a4323a 100644 --- a/src/attributes/EpsGraphAttributes.h +++ b/src/attributes/EpsGraphAttributes.h @@ -71,7 +71,7 @@ class EpsGraphAttributes bool deterministic_; int deterministic_thickness_; string deterministic_legend_; - bool control_; + bool eps_control_; int control_thickness_; string control_legend_; bool legend_; diff --git a/src/attributes/EpsGraphWrapper.cc b/src/attributes/EpsGraphWrapper.cc index 0d29f71c4..f21b51b34 100644 --- a/src/attributes/EpsGraphWrapper.cc +++ b/src/attributes/EpsGraphWrapper.cc @@ -141,9 +141,9 @@ void EpsGraphWrapper::set(const MagRequest& request) epsgraph_->deterministic_legend_ = deterministic_legend_value; } if (request.countValues("EPS_CONTROL") ) { - string control_value = request("EPS_CONTROL"); + string eps_control_value = request("EPS_CONTROL"); - epsgraph_->control_ = MagTranslator()(control_value); + epsgraph_->eps_control_ = MagTranslator()(eps_control_value); } if (request.countValues("EPS_CONTROL_LINE_THICKNESS") ) { diff --git a/src/attributes/EpsWaveAttributes.cc b/src/attributes/EpsWaveAttributes.cc index a8b326ff8..77fa20864 100644 --- a/src/attributes/EpsWaveAttributes.cc +++ b/src/attributes/EpsWaveAttributes.cc @@ -25,7 +25,8 @@ using namespace magics; EpsWaveAttributes::EpsWaveAttributes(): - colour_(ParameterManager::getStringArray("eps_rose_wave_colour")) + colour_(ParameterManager::getStringArray("eps_rose_wave_colour")), + eps_control_(ParameterManager::getBool("eps_control")) { @@ -46,6 +47,7 @@ void EpsWaveAttributes::set(const std::map& params) prefix[i++] = "eps_rose_wave"; setAttribute(prefix, "eps_rose_wave_colour", colour_, params); + setAttribute(prefix, "eps_control", eps_control_, params); } @@ -53,6 +55,7 @@ void EpsWaveAttributes::set(const std::map& params) void EpsWaveAttributes::copy(const EpsWaveAttributes& other) { colour_ = other.colour_; + eps_control_ = other.eps_control_; } @@ -92,6 +95,7 @@ void EpsWaveAttributes::print(ostream& out) const { out << "Attributes["; out << " colour = " << colour_; + out << " eps_control = " << eps_control_; out << "]" << "\n"; } @@ -101,7 +105,10 @@ void EpsWaveAttributes::toxml(ostream& out) const out << "\"epswave\""; out << ", \"eps_rose_wave_colour\":"; niceprint(out,colour_); + out << ", \"eps_control\":"; + niceprint(out,eps_control_); } static MagicsParameter eps_rose_wave_colour("eps_rose_wave_colour", stringarray()); +static MagicsParameter eps_control("eps_control", "on"); diff --git a/src/attributes/EpsWaveAttributes.h b/src/attributes/EpsWaveAttributes.h index 2fa412adb..6a63a29a8 100644 --- a/src/attributes/EpsWaveAttributes.h +++ b/src/attributes/EpsWaveAttributes.h @@ -51,6 +51,7 @@ class EpsWaveAttributes // -- members: string tag_; stringarray colour_; + bool eps_control_; private: diff --git a/src/attributes/EpsWaveWrapper.cc b/src/attributes/EpsWaveWrapper.cc index c4a145e69..7e14c28df 100644 --- a/src/attributes/EpsWaveWrapper.cc +++ b/src/attributes/EpsWaveWrapper.cc @@ -60,6 +60,12 @@ void EpsWaveWrapper::set(const MagRequest& request) colour_value.push_back((string)request("EPS_ROSE_WAVE_COLOUR", i)); if ( !colour_value.empty() ) epswave_->colour_ = colour_value; + if (request.countValues("EPS_CONTROL") ) { + string eps_control_value = request("EPS_CONTROL"); + + epswave_->eps_control_ = MagTranslator()(eps_control_value); + + } } diff --git a/src/params/EpsGraph.xml b/src/params/EpsGraph.xml index 6388879df..9177b0160 100644 --- a/src/params/EpsGraph.xml +++ b/src/params/EpsGraph.xml @@ -187,12 +187,12 @@ does it submit to any jurisdiction. name="eps_deterministic_legend_text"> Text to be used in the legend - - plot the deterministic Forecast + plot the control Forecast Rose wind darker colour + + plot the control Forecast + diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index 729e1cbb0..44f1c65d0 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -627,8 +627,10 @@ magics::Polyline* EpsGraph::newForecast() { } void EpsGraph::pushControl(magics::Polyline* control, BasicGraphicsObjectContainer& visitor) { - if ( !control_ ) + if ( !eps_control_ ) { + control_ = false; return; + } const Transformation& transformation = visitor.transformation(); if (!control->empty() && whisker_) { transformation(*control, visitor); @@ -1691,17 +1693,19 @@ void EpsWave::operator()(Data& data, BasicGraphicsObjectContainer& visitor) { } // Draw the Control - if (point->find("control") != point->end()) { - magics::Polyline* control = new magics::Polyline(); - control->setColour(Colour("red")); - control->setThickness(2); - control->setLineStyle(LineStyle::DASH); - - double angle = (*point)["control"] - 180.; - - control->push_back(PaperPoint(x, 0)); - control->push_back(PaperPoint(x + (l100 * sin(angle * (3.14 / 180.))), l100 * cos(angle * (3.14 / 180.)))); - visitor.push_back(control); + if (eps_control_) { + if (point->find("control") != point->end()) { + magics::Polyline* control = new magics::Polyline(); + control->setColour(Colour("red")); + control->setThickness(2); + control->setLineStyle(LineStyle::DASH); + + double angle = (*point)["control"] - 180.; + + control->push_back(PaperPoint(x, 0)); + control->push_back(PaperPoint(x + (l100 * sin(angle * (3.14 / 180.))), l100 * cos(angle * (3.14 / 180.)))); + visitor.push_back(control); + } } // Draw the Forecast diff --git a/src/visualisers/EpsGraph.h b/src/visualisers/EpsGraph.h index 849dded9d..57db9a44a 100644 --- a/src/visualisers/EpsGraph.h +++ b/src/visualisers/EpsGraph.h @@ -34,6 +34,7 @@ #include "EpsPlumeAttributes.h" #include "EpsShadeAttributes.h" #include "EpsWindAttributes.h" +#include "EpsWaveAttributes.h" #include "BasicGraphicsObject.h" @@ -257,13 +258,13 @@ class EpsBar : public Visdef, public EpsCloudAttributes { } }; -class EpsWave : public Visdef { +class EpsWave : public EpsWaveAttributes, public Visdef { public: EpsWave() {} virtual ~EpsWave() override {} // Implements the set method ... - void set(const map&) {} // EpsWindAttributes::set(map); } - void set(const XmlNode&) {} // EpsWindAttributes::set(node); } + void set(const map&) override {} // EpsWindAttributes::set(map); } + void set(const XmlNode&) override {} // EpsWindAttributes::set(node); } virtual void operator()(Data&, BasicGraphicsObjectContainer&) override; virtual void visit(LegendVisitor&) override; From 6c549ff8f6dcde71793a1ffc107de4f474d3ed1e Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 27 Apr 2023 16:33:04 +0100 Subject: [PATCH 50/66] E-Suite ecCharts : allow a second text "ztext" in a page --- src/basic/XmlMagics.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/basic/XmlMagics.cc b/src/basic/XmlMagics.cc index 9a452df56..1b1263d69 100644 --- a/src/basic/XmlMagics.cc +++ b/src/basic/XmlMagics.cc @@ -73,6 +73,7 @@ XmlMagics::XmlMagics() : root_(0), gribloop_(0), geographical_(true), driversToS actions_["mgb"] = &XmlMagics::binary; actions_["text"] = &XmlMagics::text; + actions_["ztext"] = &XmlMagics::text; actions_["map"] = &XmlMagics::map; actions_["matrix"] = &XmlMagics::matrix; actions_["cartesian"] = &XmlMagics::cartesian; From b3aec30e417623bd01917e80ed8f4b34b411d326 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 28 Apr 2023 12:39:03 +0100 Subject: [PATCH 51/66] E-Suite ecCharts : allow a second text "ztext" in a page --- src/attributes/TextVisitorAttributes.cc | 4 ++++ src/params/TextVisitor.xml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/attributes/TextVisitorAttributes.cc b/src/attributes/TextVisitorAttributes.cc index e1f7aed7c..6cf849b23 100644 --- a/src/attributes/TextVisitorAttributes.cc +++ b/src/attributes/TextVisitorAttributes.cc @@ -277,6 +277,8 @@ bool TextVisitorAttributes::accept(const string& node) if ( magCompare(node, "text") ) return true; + if ( magCompare(node, "ztext") ) + return true; return false; } @@ -290,6 +292,8 @@ void TextVisitorAttributes::set(const XmlNode& node) if ( magCompare(node.name(), "text") ) apply = true; + if ( magCompare(node.name(), "ztext") ) + apply = true; if ( apply ) diff --git a/src/params/TextVisitor.xml b/src/params/TextVisitor.xml index 54ee230aa..a860b6ae9 100644 --- a/src/params/TextVisitor.xml +++ b/src/params/TextVisitor.xml @@ -7,11 +7,12 @@ granted to it by virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. --> - From f3f25d27594bf7bfc7e3cf95f692ac530ee918c0 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 3 May 2023 11:26:47 +0100 Subject: [PATCH 52/66] E-Suite ecCharts : eps_control = off will not show the control anymore in epswave --- src/visualisers/EpsGraph.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/visualisers/EpsGraph.h b/src/visualisers/EpsGraph.h index 57db9a44a..0d7854fea 100644 --- a/src/visualisers/EpsGraph.h +++ b/src/visualisers/EpsGraph.h @@ -263,8 +263,8 @@ class EpsWave : public EpsWaveAttributes, public Visdef { EpsWave() {} virtual ~EpsWave() override {} // Implements the set method ... - void set(const map&) override {} // EpsWindAttributes::set(map); } - void set(const XmlNode&) override {} // EpsWindAttributes::set(node); } + void set(const map& map) override { EpsWaveAttributes::set(map); } // EpsWindAttributes::set(map); } + void set(const XmlNode& node) override { EpsWaveAttributes::set(node) ;} // EpsWindAttributes::set(node); } virtual void operator()(Data&, BasicGraphicsObjectContainer&) override; virtual void visit(LegendVisitor&) override; From ed35ba64968e2bf1c9af6d2cbe71d9c11fa2afdc Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 19 May 2023 13:13:04 +0100 Subject: [PATCH 53/66] e-suite: Improve formatting of eps_heigth --- src/web/WrepJSon.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/WrepJSon.cc b/src/web/WrepJSon.cc index e1bd82745..a5db95ddd 100644 --- a/src/web/WrepJSon.cc +++ b/src/web/WrepJSon.cc @@ -1938,7 +1938,7 @@ void WrepJSon::visit(TextVisitor& text) { text.update("json", "station_name", station_name_); if (!expver_.empty() && expver_ != "0001") text.update("json", "expver", " [" + expver_ + "] "); - text.update("json", "ens_height", tostring(epsz_)); + text.update("json", "ens_height", maground(epsz_)); } text.update("json", "product_info", product_info_); From cb999256895348309f3aed3454f2767a1b4c757a Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 19 May 2023 14:19:45 +0100 Subject: [PATCH 54/66] e-suite: Improve formatting of eps_heigth --- src/web/WrepJSon.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/WrepJSon.cc b/src/web/WrepJSon.cc index a5db95ddd..3627a34c9 100644 --- a/src/web/WrepJSon.cc +++ b/src/web/WrepJSon.cc @@ -1938,7 +1938,7 @@ void WrepJSon::visit(TextVisitor& text) { text.update("json", "station_name", station_name_); if (!expver_.empty() && expver_ != "0001") text.update("json", "expver", " [" + expver_ + "] "); - text.update("json", "ens_height", maground(epsz_)); + text.update("json", "ens_height", tostring(maground(epsz_))); } text.update("json", "product_info", product_info_); From 9de980008707eb4d5fa185fa568bf60734f9fa85 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 5 Jun 2023 18:03:43 +0100 Subject: [PATCH 55/66] Magics : contour_shade_max/min_level wher used evne idf contour_shade was off . [SD-79687] --- src/visualisers/IsoPlot.cc | 2 +- src/visualisers/IsoShading.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/visualisers/IsoPlot.cc b/src/visualisers/IsoPlot.cc index bca072258..016f728d5 100644 --- a/src/visualisers/IsoPlot.cc +++ b/src/visualisers/IsoPlot.cc @@ -1342,7 +1342,7 @@ bool IsoPlot::prepare(MatrixHandler& data) { double min = data.min(); double max = data.max(); (*levelSelection_).clear(); - (*levelSelection_).calculate(min, max, true); + (*levelSelection_).calculate(min, max, shading_->isShading()); bool need_isolines = (*shading_)(*levelSelection_); shading_->reset(); (*label_).prepare(*levelSelection_, (*colour_).name()); diff --git a/src/visualisers/IsoShading.h b/src/visualisers/IsoShading.h index 64931e41d..641c2afd1 100644 --- a/src/visualisers/IsoShading.h +++ b/src/visualisers/IsoShading.h @@ -76,6 +76,7 @@ class NoIsoShading { virtual bool needClipping() { return false; } virtual bool method(ContourMethod*) { return false; } virtual void reset() {} + virtual bool isShading() { return false; } protected: //! Method to print string about this class on to a stream of type ostream (virtual). @@ -109,6 +110,8 @@ class IsoShading : public NoIsoShading, public IsoShadingAttributes { object->copy(*this); return object; } + + bool isShading() override { return true; } CellArray* array(MatrixHandler& matrix, IntervalMap& range, const Transformation& transformation, int width, int height, float resolution, const string& technique) override { From e77d55bf7fb1c69c7af7679ded86a56185882d82 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 6 Jun 2023 17:35:55 +0100 Subject: [PATCH 56/66] VERSION 4.14.1 --- CMakeLists.txt | 2 +- VERSION | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 VERSION diff --git a/CMakeLists.txt b/CMakeLists.txt index 06d3c3ff9..ab110b0ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ find_package( ecbuild 3.4 REQUIRED ) # In prepaation for hotfix of 4.14.0 -project( magics VERSION 4.14.1 LANGUAGES CXX ) +project( magics LANGUAGES CXX ) # make sure that the header files are installed into include/magics diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..5704b893f --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +4.14.1 \ No newline at end of file From fd67672fcb20c463d2616ab2eb5c2413f704a74c Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 2 Aug 2023 18:51:22 +0200 Subject: [PATCH 57/66] [MAGP-1361] : Add more support dor synop plotting --- src/decoders/ObsDecoder.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/decoders/ObsDecoder.cc b/src/decoders/ObsDecoder.cc index 7e17561d7..2d63fbd6a 100644 --- a/src/decoders/ObsDecoder.cc +++ b/src/decoders/ObsDecoder.cc @@ -194,7 +194,7 @@ BufrIdentifiers::BufrIdentifiers(int centre) : centre_(centre) { // Open the default template for 98! // and send a big warning! in = fopen(deffile.str().c_str(), "r"); - MagLog::warning() << "No definition file for [" << centre << "]: We use ECMWF definitions " << endl; + MagLog::warning() << "No local definition file for [" << centre << "]: We use ECMWF definitions " << endl; if (MagicsGlobal::strict()) { throw CannotOpenFile(deffile.str()); @@ -293,8 +293,6 @@ class BufrAccessor { BufrAccessor(const string& descriptor) : descriptor_(descriptor) { init(); auto token = translator_.find(descriptor_); - if (token == translator_.end()) - MagLog::warning() << "Could not find eccodes key for " << descriptor_ << endl; eccodes_ = (token == translator_.end()) ? descriptor_ : token->second; } virtual ~BufrAccessor(){}; @@ -461,7 +459,7 @@ class BufrMultiLevelAccessor : public BufrAccessor { void operator()(const ObsDecoder& decoder, MvObs& obs, double& val) const { const BufrIdentifiers& table = BufrIdentTable::get(obs.originatingCentre()); int type = obs.messageType(); - + map::const_iterator multilevel = multilevels_.find(type); if (multilevel == multilevels_.end()) { MagLog::warning() << "BufrMultiLevelAccessor> Unknown observation type [" << val << "]\n"; @@ -470,6 +468,10 @@ class BufrMultiLevelAccessor : public BufrAccessor { if (type == 0 || type == 1) { // surface data val = obs.value(surface_); + if ( val == kBufrMissingValue ) { + // Trying the descriptor for multilevel: some centres are using it for surface. + val = obs.value(altitude_); + } } else { // MagLog::dev()<< " look for --->" << table.ident(altitude_) << " at " << decoder.getLevel(); From ba612c99a681547d111e4088ddc722cfb77b0666 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 4 Aug 2023 09:37:52 +0200 Subject: [PATCH 58/66] Hotfix/4.14.2 : Observation plotting [MAGP-1361] --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5704b893f..ba121e296 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.14.1 \ No newline at end of file +4.14.2 \ No newline at end of file From b0e208d0ba45ee824244379e1d7d3e58b2f18fc8 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 13 Sep 2023 17:10:32 +0100 Subject: [PATCH 59/66] Magics: Adding few arameters to show percentiles on plumes plots [ Miha Request ] --- src/attributes/EpsPlumeAttributes.cc | 35 ++++++++++++++++ src/attributes/EpsPlumeAttributes.h | 5 +++ src/attributes/EpsPlumeWrapper.cc | 26 ++++++++++++ src/params/EpsPlume.xml | 35 ++++++++++++++++ src/visualisers/EpsGraph.cc | 61 ++++++++++++++++++++++++++++ 5 files changed, 162 insertions(+) diff --git a/src/attributes/EpsPlumeAttributes.cc b/src/attributes/EpsPlumeAttributes.cc index d7c2162af..427498ac9 100644 --- a/src/attributes/EpsPlumeAttributes.cc +++ b/src/attributes/EpsPlumeAttributes.cc @@ -35,6 +35,11 @@ EpsPlumeAttributes::EpsPlumeAttributes(): control_line_thickness_(ParameterManager::getInt("eps_plume_control_line_thickness")), median_(ParameterManager::getBool("eps_plume_median")), median_line_thickness_(ParameterManager::getInt("eps_plume_median_line_thickness")), + percentiles_(ParameterManager::getBool("eps_plume_percentiles")), + percentiles_list_(ParameterManager::getDoubleArray("eps_plume_percentiles_list")), + percentiles_line_colour_list_(ParameterManager::getStringArray("eps_plume_percentiles_line_colour_list")), + percentiles_line_style_list_(ParameterManager::getStringArray("eps_plume_percentiles_line_style_list")), + percentiles_line_thickness_list_(ParameterManager::getIntArray("eps_plume_percentiles_line_thickness_list")), shading_(ParameterManager::getBool("eps_plume_shading")), shading_levels_(ParameterManager::getDoubleArray("eps_plume_shading_level_list")), shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list")), @@ -82,6 +87,11 @@ void EpsPlumeAttributes::set(const std::map& params) setAttribute(prefix, "eps_plume_control_line_thickness", control_line_thickness_, params); setAttribute(prefix, "eps_plume_median", median_, params); setAttribute(prefix, "eps_plume_median_line_thickness", median_line_thickness_, params); + setAttribute(prefix, "eps_plume_percentiles", percentiles_, params); + setAttribute(prefix, "eps_plume_percentiles_list", percentiles_list_, params); + setAttribute(prefix, "eps_plume_percentiles_line_colour_list", percentiles_line_colour_list_, params); + setAttribute(prefix, "eps_plume_percentiles_line_style_list", percentiles_line_style_list_, params); + setAttribute(prefix, "eps_plume_percentiles_line_thickness_list", percentiles_line_thickness_list_, params); setAttribute(prefix, "eps_plume_shading", shading_, params); setAttribute(prefix, "eps_plume_shading_level_list", shading_levels_, params); setAttribute(prefix, "eps_plume_shading_colour_list", shading_colours_, params); @@ -116,6 +126,11 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other) control_line_thickness_ = other.control_line_thickness_; median_ = other.median_; median_line_thickness_ = other.median_line_thickness_; + percentiles_ = other.percentiles_; + percentiles_list_ = other.percentiles_list_; + percentiles_line_colour_list_ = other.percentiles_line_colour_list_; + percentiles_line_style_list_ = other.percentiles_line_style_list_; + percentiles_line_thickness_list_ = other.percentiles_line_thickness_list_; shading_ = other.shading_; shading_levels_ = other.shading_levels_; shading_colours_ = other.shading_colours_; @@ -182,6 +197,11 @@ void EpsPlumeAttributes::print(ostream& out) const out << " control_line_thickness = " << control_line_thickness_; out << " median = " << median_; out << " median_line_thickness = " << median_line_thickness_; + out << " percentiles = " << percentiles_; + out << " percentiles_list = " << percentiles_list_; + out << " percentiles_line_colour_list = " << percentiles_line_colour_list_; + out << " percentiles_line_style_list = " << percentiles_line_style_list_; + out << " percentiles_line_thickness_list = " << percentiles_line_thickness_list_; out << " shading = " << shading_; out << " shading_levels = " << shading_levels_; out << " shading_colours = " << shading_colours_; @@ -227,6 +247,16 @@ void EpsPlumeAttributes::toxml(ostream& out) const niceprint(out,median_); out << ", \"eps_plume_median_line_thickness\":"; niceprint(out,median_line_thickness_); + out << ", \"eps_plume_percentiles\":"; + niceprint(out,percentiles_); + out << ", \"eps_plume_percentiles_list\":"; + niceprint(out,percentiles_list_); + out << ", \"eps_plume_percentiles_line_colour_list\":"; + niceprint(out,percentiles_line_colour_list_); + out << ", \"eps_plume_percentiles_line_style_list\":"; + niceprint(out,percentiles_line_style_list_); + out << ", \"eps_plume_percentiles_line_thickness_list\":"; + niceprint(out,percentiles_line_thickness_list_); out << ", \"eps_plume_shading\":"; niceprint(out,shading_); out << ", \"eps_plume_shading_level_list\":"; @@ -276,6 +306,11 @@ static MagicsParameter eps_plume_control("eps_plume_control", "on"); static MagicsParameter eps_plume_control_line_thickness("eps_plume_control_line_thickness", 5); static MagicsParameter eps_plume_median("eps_plume_median", "off"); static MagicsParameter eps_plume_median_line_thickness("eps_plume_median_line_thickness", 5); +static MagicsParameter eps_plume_percentiles("eps_plume_percentiles", "off"); +static MagicsParameter eps_plume_percentiles_list("eps_plume_percentiles_list", floatarray()); +static MagicsParameter eps_plume_percentiles_line_colour_list("eps_plume_percentiles_line_colour_list", stringarray()); +static MagicsParameter eps_plume_percentiles_line_style_list("eps_plume_percentiles_line_style_list", stringarray()); +static MagicsParameter eps_plume_percentiles_line_thickness_list("eps_plume_percentiles_line_thickness_list", intarray()); static MagicsParameter eps_plume_shading("eps_plume_shading", "off"); static MagicsParameter eps_plume_shading_level_list("eps_plume_shading_level_list", floatarray()); static MagicsParameter eps_plume_shading_colour_list("eps_plume_shading_colour_list", stringarray()); diff --git a/src/attributes/EpsPlumeAttributes.h b/src/attributes/EpsPlumeAttributes.h index 6c9010a74..5cd62468e 100644 --- a/src/attributes/EpsPlumeAttributes.h +++ b/src/attributes/EpsPlumeAttributes.h @@ -61,6 +61,11 @@ class EpsPlumeAttributes int control_line_thickness_; bool median_; int median_line_thickness_; + bool percentiles_; + doublearray percentiles_list_; + stringarray percentiles_line_colour_list_; + stringarray percentiles_line_style_list_; + intarray percentiles_line_thickness_list_; bool shading_; doublearray shading_levels_; stringarray shading_colours_; diff --git a/src/attributes/EpsPlumeWrapper.cc b/src/attributes/EpsPlumeWrapper.cc index 15ff07390..2748d2621 100644 --- a/src/attributes/EpsPlumeWrapper.cc +++ b/src/attributes/EpsPlumeWrapper.cc @@ -105,6 +105,32 @@ void EpsPlumeWrapper::set(const MagRequest& request) int median_line_thickness_value = request("EPS_PLUME_MEDIAN_LINE_THICKNESS"); epsplume_->median_line_thickness_ = median_line_thickness_value; } + if (request.countValues("EPS_PLUME_PERCENTILES") ) { + string percentiles_value = request("EPS_PLUME_PERCENTILES"); + + epsplume_->percentiles_ = MagTranslator()(percentiles_value); + + } + doublearray percentiles_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_PERCENTILES_LIST"); i++) + percentiles_list_value.push_back((double)request("EPS_PLUME_PERCENTILES_LIST", i)); + if ( !percentiles_list_value.empty() ) + epsplume_->percentiles_list_ = percentiles_list_value; + stringarray percentiles_line_colour_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_PERCENTILES_LINE_COLOUR_LIST"); i++) + percentiles_line_colour_list_value.push_back((string)request("EPS_PLUME_PERCENTILES_LINE_COLOUR_LIST", i)); + if ( !percentiles_line_colour_list_value.empty() ) + epsplume_->percentiles_line_colour_list_ = percentiles_line_colour_list_value; + stringarray percentiles_line_style_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_PERCENTILES_LINE_STYLE_LIST"); i++) + percentiles_line_style_list_value.push_back((string)request("EPS_PLUME_PERCENTILES_LINE_STYLE_LIST", i)); + if ( !percentiles_line_style_list_value.empty() ) + epsplume_->percentiles_line_style_list_ = percentiles_line_style_list_value; + intarray percentiles_line_thickness_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_PERCENTILES_LINE_THICKNESS_LIST"); i++) + percentiles_line_thickness_list_value.push_back((int)request("EPS_PLUME_PERCENTILES_LINE_THICKNESS_LIST", i)); + if ( !percentiles_line_thickness_list_value.empty() ) + epsplume_->percentiles_line_thickness_list_ = percentiles_line_thickness_list_value; if (request.countValues("EPS_PLUME_SHADING") ) { string shading_value = request("EPS_PLUME_SHADING"); diff --git a/src/params/EpsPlume.xml b/src/params/EpsPlume.xml index 21946f145..26ce98115 100644 --- a/src/params/EpsPlume.xml +++ b/src/params/EpsPlume.xml @@ -143,6 +143,41 @@ does it submit to any jurisdiction. name="eps_plume_median_line_thickness"> Line thickness of the deterministic forecast + + show teh precnetiles + + + List of the precentiles to display + + + List of colours to use to display the percentiles + + + List of line-style to use to display the percentiles + + + List of line-thickness to use to display the percentiles + setLineStyle(median_line_style_); legend.add(new LineEntry("Median", median)); } + // if (percentiles_) { + // magics::Polyline* median = new magics::Polyline(); + // median->setColour(*median_line_colour_); + // median->setThickness(median_line_thickness_); + // median->setLineStyle(median_line_style_); + // legend.add(new LineEntry("Median", median)); + // } } void EpsPlume::timeserie(Data& data, BasicGraphicsObjectContainer& visitor) { @@ -2521,11 +2528,21 @@ void EpsPlume::timeserie(Data& data, BasicGraphicsObjectContainer& visitor) { median->setColour(*median_line_colour_); median->setThickness(median_line_thickness_); median->setLineStyle(median_line_style_); + + + map> shading; + map> percentiles; + if (shading_) { for (vector::iterator level = shading_levels_.begin(); level != shading_levels_.end(); ++level) shading.insert(make_pair(*level, vector())); } + if (percentiles_) { + for (vector::iterator level = percentiles_list_.begin(); level != percentiles_list_.end(); ++level) { + percentiles.insert(make_pair(*level, vector())); + } + } for (const auto& point : points) { double x = (*point)["step"] + (*point)["shift"]; double missing = (*point)["missing"]; @@ -2565,6 +2582,11 @@ void EpsPlume::timeserie(Data& data, BasicGraphicsObjectContainer& visitor) { std::sort(members.begin(), members.end()); median->push_back(PaperPoint(x, members[m])); } + if (percentiles_) { + int m = members.size()/2; + std::sort(members.begin(), members.end()); + median->push_back(PaperPoint(x, members[m])); + } if (shading_) { for (vector::iterator level = shading_levels_.begin(); level != shading_levels_.end(); ++level) { int i = *level * (members.size()/100.); @@ -2573,7 +2595,16 @@ void EpsPlume::timeserie(Data& data, BasicGraphicsObjectContainer& visitor) { shading[*level].push_back(PaperPoint(x, members[i])); } } + if (percentiles_) { + for (vector::iterator level = percentiles_list_.begin(); level != percentiles_list_.end(); ++level) { + int i = *level * (members.size()/100.); + if (i >= members.size()) + i = members.size() - 1; + percentiles[*level].push_back(PaperPoint(x, members[i])); + } + } } + vector::iterator colour = shading_colours_.begin(); @@ -2611,6 +2642,36 @@ void EpsPlume::timeserie(Data& data, BasicGraphicsObjectContainer& visitor) { transformation(*forecast, visitor); if (median_) transformation(*median, visitor); + if (percentiles_) { + if ( percentiles_line_colour_list_.empty() ) + percentiles_line_colour_list_.push_back("black"); + if ( percentiles_line_thickness_list_.empty() ) + percentiles_line_thickness_list_.push_back(2); + if ( percentiles_line_style_list_.empty() ) + percentiles_line_style_list_.push_back("solid"); + + auto percentiles_line_colour = percentiles_line_colour_list_.begin(); + auto percentiles_line_thickness = percentiles_line_thickness_list_.begin(); + auto percentiles_line_style = percentiles_line_style_list_.begin(); + + for ( auto percentile = percentiles.begin(); percentile != percentiles.end (); ++percentile ) { + magics::Polyline* line = new magics::Polyline(); + line->setColour(Colour(*percentiles_line_colour)); + line->setLineStyle(MagTranslator()(*percentiles_line_style)); + line->setThickness(*percentiles_line_thickness); + + if (++percentiles_line_colour == percentiles_line_colour_list_.end() ) --percentiles_line_colour; + if (++percentiles_line_thickness == percentiles_line_thickness_list_.end() ) --percentiles_line_thickness; + if (++percentiles_line_style == percentiles_line_style_list_.end() ) --percentiles_line_style; + + for (vector::iterator point = percentile->second.begin(); point != percentile->second.end(); ++point) + line->push_back(*point); + + transformation(*line, visitor); + } + + + } } void EpsPlume::verticalprofile(Data& data, BasicGraphicsObjectContainer& visitor) { From b276ff6449be2cab2f3ea910a03d4fdd72432383 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 15 Sep 2023 16:10:55 +0100 Subject: [PATCH 60/66] Improve handling of legend for the plumes for Miha --- share/magics/styles/ecmwf/test/styles.json | 6 ++++++ src/attributes/EpsPlumeAttributes.cc | 7 +++++++ src/attributes/EpsPlumeAttributes.h | 1 + src/params/EpsPlume.xml | 8 ++++++++ src/visualisers/EpsGraph.cc | 7 ++++--- 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 share/magics/styles/ecmwf/test/styles.json diff --git a/share/magics/styles/ecmwf/test/styles.json b/share/magics/styles/ecmwf/test/styles.json new file mode 100644 index 000000000..1bd2ebcb3 --- /dev/null +++ b/share/magics/styles/ecmwf/test/styles.json @@ -0,0 +1,6 @@ +{ + "red_lines" : { + "contour" : "on", + "contour_line_colour" : "red" + } +} diff --git a/src/attributes/EpsPlumeAttributes.cc b/src/attributes/EpsPlumeAttributes.cc index 427498ac9..bb6f02b29 100644 --- a/src/attributes/EpsPlumeAttributes.cc +++ b/src/attributes/EpsPlumeAttributes.cc @@ -27,6 +27,7 @@ using namespace magics; EpsPlumeAttributes::EpsPlumeAttributes(): method_(ParameterManager::getString("eps_plume_method")), legend_(ParameterManager::getBool("eps_plume_legend")), + legend_grey_style_(ParameterManager::getBool("eps_plume_legend_grey_style")), line_(ParameterManager::getBool("eps_plume_members")), line_thickness_(ParameterManager::getInt("eps_plume_line_thickness")), forecast_(ParameterManager::getBool("eps_plume_forecast")), @@ -79,6 +80,7 @@ void EpsPlumeAttributes::set(const std::map& params) setAttribute(prefix, "eps_plume_method", method_, params); setAttribute(prefix, "eps_plume_legend", legend_, params); + setAttribute(prefix, "eps_plume_legend_grey_style", legend_grey_style_, params); setAttribute(prefix, "eps_plume_members", line_, params); setAttribute(prefix, "eps_plume_line_thickness", line_thickness_, params); setAttribute(prefix, "eps_plume_forecast", forecast_, params); @@ -118,6 +120,7 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other) { method_ = other.method_; legend_ = other.legend_; + legend_grey_style_ = other.legend_grey_style_; line_ = other.line_; line_thickness_ = other.line_thickness_; forecast_ = other.forecast_; @@ -189,6 +192,7 @@ void EpsPlumeAttributes::print(ostream& out) const out << "Attributes["; out << " method = " << method_; out << " legend = " << legend_; + out << " legend_grey_style = " << legend_grey_style_; out << " line = " << line_; out << " line_thickness = " << line_thickness_; out << " forecast = " << forecast_; @@ -231,6 +235,8 @@ void EpsPlumeAttributes::toxml(ostream& out) const niceprint(out,method_); out << ", \"eps_plume_legend\":"; niceprint(out,legend_); + out << ", \"eps_plume_legend_grey_style\":"; + niceprint(out,legend_grey_style_); out << ", \"eps_plume_members\":"; niceprint(out,line_); out << ", \"eps_plume_line_thickness\":"; @@ -298,6 +304,7 @@ void EpsPlumeAttributes::toxml(ostream& out) const static MagicsParameter eps_plume_method("eps_plume_method", "time_serie"); static MagicsParameter eps_plume_legend("eps_plume_legend", "on"); +static MagicsParameter eps_plume_legend_grey_style("eps_plume_legend_grey_style", "on"); static MagicsParameter eps_plume_members("eps_plume_members", "on"); static MagicsParameter eps_plume_line_thickness("eps_plume_line_thickness", 1); static MagicsParameter eps_plume_forecast("eps_plume_forecast", "on"); diff --git a/src/attributes/EpsPlumeAttributes.h b/src/attributes/EpsPlumeAttributes.h index 5cd62468e..f237745d3 100644 --- a/src/attributes/EpsPlumeAttributes.h +++ b/src/attributes/EpsPlumeAttributes.h @@ -53,6 +53,7 @@ class EpsPlumeAttributes string tag_; string method_; bool legend_; + bool legend_grey_style_; bool line_; int line_thickness_; bool forecast_; diff --git a/src/params/EpsPlume.xml b/src/params/EpsPlume.xml index 26ce98115..75856735f 100644 --- a/src/params/EpsPlume.xml +++ b/src/params/EpsPlume.xml @@ -31,6 +31,14 @@ does it submit to any jurisdiction. visible='false'> ignore legend + + if On ( default) the legend will use a grey scale ootherwise it will use user defined colour + ::reverse_iterator point = shading[top].rbegin(); point != shading[top].rend(); ++point) line->push_back(*point); - double grey = ((col.red() + col.blue() + col.green()) / 3.); - - col.setColour(grey, grey, grey); + if ( legend_grey_style_ ) { + double grey = ((col.red() + col.blue() + col.green()) / 3.); + col.setColour(grey, grey, grey); + } ++colour; shading_legend_.push_back(col); From 5d4efa80c3833aad9fd5d24fde548eac1ff201c9 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Tue, 26 Sep 2023 11:21:47 +0100 Subject: [PATCH 61/66] CAMS Addtion: adding few options for CAMS symbol plottings --- src/attributes/SymbolPlottingAttributes.cc | 65 ++++++++++++++- src/attributes/SymbolPlottingAttributes.h | 9 ++ src/attributes/SymbolPlottingWrapper.cc | 38 +++++++++ src/params/SymbolPlotting.xml | 77 ++++++++++++++++- src/visualisers/SymbolPlotting.cc | 97 ++++++++++++++++++++++ src/visualisers/SymbolPlotting.h | 1 + 6 files changed, 285 insertions(+), 2 deletions(-) diff --git a/src/attributes/SymbolPlottingAttributes.cc b/src/attributes/SymbolPlottingAttributes.cc index 2d1fbd6df..1c11550b0 100644 --- a/src/attributes/SymbolPlottingAttributes.cc +++ b/src/attributes/SymbolPlottingAttributes.cc @@ -36,7 +36,16 @@ SymbolPlottingAttributes::SymbolPlottingAttributes(): connect_(ParameterManager::getBool("symbol_connect_line")), automatic_connect_colour_(ParameterManager::getBool("symbol_connect_automatic_line_colour")), connect_thickness_(ParameterManager::getInt("symbol_connect_line_thickness")), - legend_only_(ParameterManager::getBool("symbol_legend_only")) + legend_only_(ParameterManager::getBool("symbol_legend_only")), + property_colour_name_(ParameterManager::getString("symbol_property_colour_name")), + property_colour_list_(ParameterManager::getStringArray("symbol_property_colour_list")), + property_colour_values_list_(ParameterManager::getDoubleArray("symbol_property_colour_values_list")), + property_height_name_(ParameterManager::getString("symbol_property_height_name")), + property_height_scaling_factor_(ParameterManager::getDouble("symbol_property_height_scaling_factor")), + property_filter_name_(ParameterManager::getString("symbol_property_filter_name")), + property_filter_min_value_(ParameterManager::getDouble("symbol_property_filter_min_value")), + property_filter_max_value_(ParameterManager::getDouble("symbol_property_filter_max_value")), + marker_(ParameterManager::getInt("symbol_marker_index")) , mode_(MagTranslator().magics("symbol_table_mode")), outline_colour_(MagTranslator().magics("symbol_outline_colour")), @@ -72,6 +81,15 @@ void SymbolPlottingAttributes::set(const std::map& params) setAttribute(prefix, "symbol_connect_automatic_line_colour", automatic_connect_colour_, params); setAttribute(prefix, "symbol_connect_line_thickness", connect_thickness_, params); setAttribute(prefix, "symbol_legend_only", legend_only_, params); + setAttribute(prefix, "symbol_property_colour_name", property_colour_name_, params); + setAttribute(prefix, "symbol_property_colour_list", property_colour_list_, params); + setAttribute(prefix, "symbol_property_colour_values_list", property_colour_values_list_, params); + setAttribute(prefix, "symbol_property_height_name", property_height_name_, params); + setAttribute(prefix, "symbol_property_height_scaling_factor", property_height_scaling_factor_, params); + setAttribute(prefix, "symbol_property_filter_name", property_filter_name_, params); + setAttribute(prefix, "symbol_property_filter_min_value", property_filter_min_value_, params); + setAttribute(prefix, "symbol_property_filter_max_value", property_filter_max_value_, params); + setAttribute(prefix, "symbol_marker_index", marker_, params); setMember(prefix, "symbol_table_mode", mode_, params); setMember(prefix, "symbol_outline_colour", outline_colour_, params); @@ -95,6 +113,15 @@ void SymbolPlottingAttributes::copy(const SymbolPlottingAttributes& other) automatic_connect_colour_ = other.automatic_connect_colour_; connect_thickness_ = other.connect_thickness_; legend_only_ = other.legend_only_; + property_colour_name_ = other.property_colour_name_; + property_colour_list_ = other.property_colour_list_; + property_colour_values_list_ = other.property_colour_values_list_; + property_height_name_ = other.property_height_name_; + property_height_scaling_factor_ = other.property_height_scaling_factor_; + property_filter_name_ = other.property_filter_name_; + property_filter_min_value_ = other.property_filter_min_value_; + property_filter_max_value_ = other.property_filter_max_value_; + marker_ = other.marker_; mode_ = unique_ptr(other.mode_->clone()); outline_colour_ = unique_ptr(other.outline_colour_->clone()); outline_style_ = other.outline_style_; @@ -154,6 +181,15 @@ void SymbolPlottingAttributes::print(ostream& out) const out << " automatic_connect_colour = " << automatic_connect_colour_; out << " connect_thickness = " << connect_thickness_; out << " legend_only = " << legend_only_; + out << " property_colour_name = " << property_colour_name_; + out << " property_colour_list = " << property_colour_list_; + out << " property_colour_values_list = " << property_colour_values_list_; + out << " property_height_name = " << property_height_name_; + out << " property_height_scaling_factor = " << property_height_scaling_factor_; + out << " property_filter_name = " << property_filter_name_; + out << " property_filter_min_value = " << property_filter_min_value_; + out << " property_filter_max_value = " << property_filter_max_value_; + out << " marker = " << marker_; out << " mode = " << *mode_; out << " outline_colour = " << *outline_colour_; out << " outline_style = " << outline_style_; @@ -190,6 +226,24 @@ void SymbolPlottingAttributes::toxml(ostream& out) const niceprint(out,connect_thickness_); out << ", \"symbol_legend_only\":"; niceprint(out,legend_only_); + out << ", \"symbol_property_colour_name\":"; + niceprint(out,property_colour_name_); + out << ", \"symbol_property_colour_list\":"; + niceprint(out,property_colour_list_); + out << ", \"symbol_property_colour_values_list\":"; + niceprint(out,property_colour_values_list_); + out << ", \"symbol_property_height_name\":"; + niceprint(out,property_height_name_); + out << ", \"symbol_property_height_scaling_factor\":"; + niceprint(out,property_height_scaling_factor_); + out << ", \"symbol_property_filter_name\":"; + niceprint(out,property_filter_name_); + out << ", \"symbol_property_filter_min_value\":"; + niceprint(out,property_filter_min_value_); + out << ", \"symbol_property_filter_max_value\":"; + niceprint(out,property_filter_max_value_); + out << ", \"symbol_marker_index\":"; + niceprint(out,marker_); out << ", \"symbol_table_mode\":"; mode_->toxml(out); out << ", \"symbol_outline_colour\":"; @@ -215,6 +269,15 @@ static MagicsParameter symbol_connect_line("symbol_connect_line", "off") static MagicsParameter symbol_connect_automatic_line_colour("symbol_connect_automatic_line_colour", "on"); static MagicsParameter symbol_connect_line_thickness("symbol_connect_line_thickness", 1); static MagicsParameter symbol_legend_only("symbol_legend_only", "off"); +static MagicsParameter symbol_property_colour_name("symbol_property_colour_name", "colour"); +static MagicsParameter symbol_property_colour_list("symbol_property_colour_list", stringarray()); +static MagicsParameter symbol_property_colour_values_list("symbol_property_colour_values_list", floatarray()); +static MagicsParameter symbol_property_height_name("symbol_property_height_name", "colour"); +static MagicsParameter symbol_property_height_scaling_factor("symbol_property_height_scaling_factor", 1); +static MagicsParameter symbol_property_filter_name("symbol_property_filter_name", ""); +static MagicsParameter symbol_property_filter_min_value("symbol_property_filter_min_value", LLONG_MIN); +static MagicsParameter symbol_property_filter_max_value("symbol_property_filter_max_value", LLONG_MAX); +static MagicsParameter symbol_marker_index("symbol_marker_index", 1); static MagicsParameter symbol_table_mode("symbol_table_mode", "OFF"); static MagicsParameter symbol_outline_colour("symbol_outline_colour", "black"); static MagicsParameter symbol_outline_style("symbol_outline_style", "solid"); diff --git a/src/attributes/SymbolPlottingAttributes.h b/src/attributes/SymbolPlottingAttributes.h index ea7239de8..23655451a 100644 --- a/src/attributes/SymbolPlottingAttributes.h +++ b/src/attributes/SymbolPlottingAttributes.h @@ -64,6 +64,15 @@ class SymbolPlottingAttributes bool automatic_connect_colour_; int connect_thickness_; bool legend_only_; + string property_colour_name_; + stringarray property_colour_list_; + doublearray property_colour_values_list_; + string property_height_name_; + double property_height_scaling_factor_; + string property_filter_name_; + double property_filter_min_value_; + double property_filter_max_value_; + int marker_; unique_ptr mode_; unique_ptr outline_colour_; LineStyle outline_style_; diff --git a/src/attributes/SymbolPlottingWrapper.cc b/src/attributes/SymbolPlottingWrapper.cc index f643d7423..d2520cd10 100644 --- a/src/attributes/SymbolPlottingWrapper.cc +++ b/src/attributes/SymbolPlottingWrapper.cc @@ -115,6 +115,44 @@ void SymbolPlottingWrapper::set(const MagRequest& request) symbolplotting_->legend_only_ = MagTranslator()(legend_only_value); } + if (request.countValues("SYMBOL_PROPERTY_COLOUR_NAME") ) { + string property_colour_name_value = request("SYMBOL_PROPERTY_COLOUR_NAME"); + symbolplotting_->property_colour_name_ = property_colour_name_value; + } + stringarray property_colour_list_value; + for (int i = 0; i < request.countValues("SYMBOL_PROPERTY_COLOUR_LIST"); i++) + property_colour_list_value.push_back((string)request("SYMBOL_PROPERTY_COLOUR_LIST", i)); + if ( !property_colour_list_value.empty() ) + symbolplotting_->property_colour_list_ = property_colour_list_value; + doublearray property_colour_values_list_value; + for (int i = 0; i < request.countValues("SYMBOL_PROPERTY_COLOUR_VALUES_LIST"); i++) + property_colour_values_list_value.push_back((double)request("SYMBOL_PROPERTY_COLOUR_VALUES_LIST", i)); + if ( !property_colour_values_list_value.empty() ) + symbolplotting_->property_colour_values_list_ = property_colour_values_list_value; + if (request.countValues("SYMBOL_PROPERTY_HEIGHT_NAME") ) { + string property_height_name_value = request("SYMBOL_PROPERTY_HEIGHT_NAME"); + symbolplotting_->property_height_name_ = property_height_name_value; + } + if (request.countValues("SYMBOL_PROPERTY_HEIGHT_SCALING_FACTOR") ) { + double property_height_scaling_factor_value = request("SYMBOL_PROPERTY_HEIGHT_SCALING_FACTOR"); + symbolplotting_->property_height_scaling_factor_ = property_height_scaling_factor_value; + } + if (request.countValues("SYMBOL_PROPERTY_FILTER_NAME") ) { + string property_filter_name_value = request("SYMBOL_PROPERTY_FILTER_NAME"); + symbolplotting_->property_filter_name_ = property_filter_name_value; + } + if (request.countValues("SYMBOL_PROPERTY_FILTER_MIN_VALUE") ) { + double property_filter_min_value_value = request("SYMBOL_PROPERTY_FILTER_MIN_VALUE"); + symbolplotting_->property_filter_min_value_ = property_filter_min_value_value; + } + if (request.countValues("SYMBOL_PROPERTY_FILTER_MAX_VALUE") ) { + double property_filter_max_value_value = request("SYMBOL_PROPERTY_FILTER_MAX_VALUE"); + symbolplotting_->property_filter_max_value_ = property_filter_max_value_value; + } + if (request.countValues("SYMBOL_MARKER_INDEX") ) { + int marker_value = request("SYMBOL_MARKER_INDEX"); + symbolplotting_->marker_ = marker_value; + } string mode_value = request.countValues("SYMBOL_TABLE_MODE") ? (string) request("SYMBOL_TABLE_MODE") : "OFF"; diff --git a/src/params/SymbolPlotting.xml b/src/params/SymbolPlotting.xml index 9168e5276..525edfe79 100644 --- a/src/params/SymbolPlotting.xml +++ b/src/params/SymbolPlotting.xml @@ -43,7 +43,7 @@ does it submit to any jurisdiction. default="number" member="type" to="string" - values="number/text/marker/wind"> + values="number/text/marker/wind/property"> Defines the type of symbol plotting required @@ -251,5 +251,80 @@ does it submit to any jurisdiction. visible='off'> Inform the contour object do generate only the legend and not the plot .. [Web sdpecific] + + + With GeoSon : property name to use to set the colour + + + With GeoSon : list of colours to use + + + With GeoSon : list of heights to use + + + + With GeoSon : property name to use to set the colour + + + With GeoSon : property name to use to set the colour + + + + With GeoSon : property name to use to set the colour + + + With GeoSon : property name to use to set the colour + + + With GeoSon : property name to use to set the colour + + + Marker indice: An integer between 1 and 28 + + diff --git a/src/visualisers/SymbolPlotting.cc b/src/visualisers/SymbolPlotting.cc index 834b0dd06..b9d44a47c 100644 --- a/src/visualisers/SymbolPlotting.cc +++ b/src/visualisers/SymbolPlotting.cc @@ -28,6 +28,8 @@ #include "LegendVisitor.h" #include "MagicsGlobal.h" +#include "IntervalMap.h" + using namespace magics; @@ -117,10 +119,99 @@ struct SortHelper { }; + +void SymbolPlotting::by_property(Data& data, BasicGraphicsObjectContainer& out) { + + const Transformation& transformation = out.transformation(); + + std::set needs; + + needs.insert(property_height_name_); + needs.insert(property_colour_name_); + if ( property_filter_name_.size() ) + needs.insert(property_filter_name_); + + if ( property_colour_list_.empty() ) + property_colour_list_.push_back("red"); + + + IntervalMap colourFinder; + auto value = property_colour_values_list_.begin(); + auto colour = property_colour_list_.begin(); + + while (true) { + if (value + 1 == property_colour_values_list_.end()) + break; + + colourFinder[Interval(*value, *(value+1))] = Colour(*colour); + if (colour + 1 != property_colour_list_.end()) + colour++; + ++value; + } + + + + Colour red("red"); + + double factor = ( out.absoluteHeight()*transformation.patchDistance(1))/(transformation.getMaxPCY()-transformation.getMinPCY()) ; + // cout << "sacle--> " << factor << endl; + // cout << "patch--> " << transformation.patchDistance(1) << endl; + factor = magCompare(unit_method_, "geographical") ? + ( out.absoluteHeight()*transformation.patchDistance(1))/(transformation.getMaxPCY()-transformation.getMinPCY()) : 1; + + + CustomisedPointsList points; + data.customisedPoints(out.transformation(), needs, points, true); + + for (auto& point : points) { + double val = 0; + if ( property_filter_name_.size() ) { + val = (*point)[property_filter_name_]; + if ( val < property_filter_min_value_ ) + continue; + if ( val >= property_filter_max_value_ ) + continue; + + } + + double colour = (*point)[property_colour_name_]; + double height = (*point)[property_height_name_]; + + Symbol* symbol = new Symbol(); + symbol->setMarker(marker_); + + symbol->setColour(colourFinder.find(colour, red)); + + + if ( height*property_height_scaling_factor_ > 2 ) { + height = 2*factor; + MagLog::warning() << " Symbol height reset to 2 " << endl; + } + else + height = height*property_height_scaling_factor_*factor; + + symbol->setHeight(height); + + symbol->push_back(transformation(PaperPoint(point->longitude(), point->latitude()))); + + out.push_back(symbol); + + } + + + +} + + void SymbolPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { mode_->parent(this); mode_->prepare(); symbols_.clear(); + + + if ( magCompare("property", type_) ) + return by_property(data, out); + vector check; check.push_back("text"); check.push_back("number"); @@ -143,6 +234,12 @@ void SymbolPlotting::operator()(Data& data, BasicGraphicsObjectContainer& out) { factor = magCompare(unit_method_, "geographical") ? ( out.absoluteHeight()*transformation.patchDistance(1))/(transformation.getMaxPCY()-transformation.getMinPCY()) : 1; + // cout << "abs-height->"<< out.absoluteHeight() << endl; + // cout << "patch->" << transformation.patchDistance(1) << endl; + // cout << "pc height --> " << transformation.getMaxPCY()-transformation.getMinPCY() << endl; + + // cout << "factor-->" << factor << endl; + bool valid = false; for (vector::iterator c = check.begin(); c != check.end(); ++c) { diff --git a/src/visualisers/SymbolPlotting.h b/src/visualisers/SymbolPlotting.h index 0005acdf7..3811571ca 100644 --- a/src/visualisers/SymbolPlotting.h +++ b/src/visualisers/SymbolPlotting.h @@ -44,6 +44,7 @@ class SymbolPlotting : public SymbolPlottingAttributes, public Visdef { virtual void operator()(Data&, BasicGraphicsObjectContainer&) override; + void by_property(Data&, BasicGraphicsObjectContainer&); virtual void visit(Data&, LegendVisitor&) override; bool needLegend() override { return legend_; } virtual void visit(Data&, HistoVisitor&) override; From be6bc5b36a0e2d6ae209fd7c5214ae5dea6412da Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 6 Oct 2023 11:02:35 +0100 Subject: [PATCH 62/66] Opencharts : adding cache files for opencharts Projections. --- src/attributes/TileDecoderAttributes.cc | 7 ++ src/attributes/TileDecoderAttributes.h | 1 + src/attributes/TileDecoderWrapper.cc | 4 ++ src/decoders/TileDecoder.cc | 93 +++++++++++++++---------- src/params/TileDecoder.xml | 5 ++ 5 files changed, 72 insertions(+), 38 deletions(-) diff --git a/src/attributes/TileDecoderAttributes.cc b/src/attributes/TileDecoderAttributes.cc index 6bde01aec..32b32c292 100644 --- a/src/attributes/TileDecoderAttributes.cc +++ b/src/attributes/TileDecoderAttributes.cc @@ -27,6 +27,7 @@ using namespace magics; TileDecoderAttributes::TileDecoderAttributes(): file_name_(ParameterManager::getString("grib_input_file_name")), projection_(ParameterManager::getString("grib_tile_projection")), + mode_(ParameterManager::getString("grib_tile_mode")), loop_(ParameterManager::getBool("grib_loop")), z_(ParameterManager::getInt("grib_tile_z")), x_(ParameterManager::getInt("grib_tile_x")), @@ -54,6 +55,7 @@ void TileDecoderAttributes::set(const std::map& params) setAttribute(prefix, "grib_input_file_name", file_name_, params); setAttribute(prefix, "grib_tile_projection", projection_, params); + setAttribute(prefix, "grib_tile_mode", mode_, params); setAttribute(prefix, "grib_loop", loop_, params); setAttribute(prefix, "grib_tile_z", z_, params); setAttribute(prefix, "grib_tile_x", x_, params); @@ -69,6 +71,7 @@ void TileDecoderAttributes::copy(const TileDecoderAttributes& other) { file_name_ = other.file_name_; projection_ = other.projection_; + mode_ = other.mode_; loop_ = other.loop_; z_ = other.z_; x_ = other.x_; @@ -116,6 +119,7 @@ void TileDecoderAttributes::print(ostream& out) const out << "Attributes["; out << " file_name = " << file_name_; out << " projection = " << projection_; + out << " mode = " << mode_; out << " loop = " << loop_; out << " z = " << z_; out << " x = " << x_; @@ -134,6 +138,8 @@ void TileDecoderAttributes::toxml(ostream& out) const niceprint(out,file_name_); out << ", \"grib_tile_projection\":"; niceprint(out,projection_); + out << ", \"grib_tile_mode\":"; + niceprint(out,mode_); out << ", \"grib_loop\":"; niceprint(out,loop_); out << ", \"grib_tile_z\":"; @@ -153,6 +159,7 @@ void TileDecoderAttributes::toxml(ostream& out) const static MagicsParameter grib_input_file_name("grib_input_file_name", ""); static MagicsParameter grib_tile_projection("grib_tile_projection", "cylindrical"); +static MagicsParameter grib_tile_mode("grib_tile_mode", "eccharts"); static MagicsParameter grib_loop("grib_loop", "off"); static MagicsParameter grib_tile_z("grib_tile_z", 1); static MagicsParameter grib_tile_x("grib_tile_x", 0); diff --git a/src/attributes/TileDecoderAttributes.h b/src/attributes/TileDecoderAttributes.h index 659a05d71..470ea181f 100644 --- a/src/attributes/TileDecoderAttributes.h +++ b/src/attributes/TileDecoderAttributes.h @@ -52,6 +52,7 @@ class TileDecoderAttributes string tag_; string file_name_; string projection_; + string mode_; bool loop_; int z_; int x_; diff --git a/src/attributes/TileDecoderWrapper.cc b/src/attributes/TileDecoderWrapper.cc index dbc9c0f4b..ddbcb42a4 100644 --- a/src/attributes/TileDecoderWrapper.cc +++ b/src/attributes/TileDecoderWrapper.cc @@ -63,6 +63,10 @@ void TileDecoderWrapper::set(const MagRequest& request) string projection_value = request("GRIB_TILE_PROJECTION"); tiledecoder_->projection_ = projection_value; } + if (request.countValues("GRIB_TILE_MODE") ) { + string mode_value = request("GRIB_TILE_MODE"); + tiledecoder_->mode_ = mode_value; + } if (request.countValues("GRIB_LOOP") ) { string loop_value = request("GRIB_LOOP"); diff --git a/src/decoders/TileDecoder.cc b/src/decoders/TileDecoder.cc index 3cc62f1b7..2d8d1e785 100644 --- a/src/decoders/TileDecoder.cc +++ b/src/decoders/TileDecoder.cc @@ -49,10 +49,15 @@ string TileDecoder::projection() { string TileDecoder::weights() { ostringstream out; string parent = getEnvVariable("MAGPLUS_TILE"); + if (parent.empty()) { parent = buildSharePath("tiles"); } - out << parent << "/weight-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; + if (mode_ == "opencharts" ) + out << parent << "/opencharts-cache-" << grid_ << ".nc"; + + else + out << parent << "/weight-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; return out.str(); } @@ -435,14 +440,10 @@ void TileDecoder::decode() { Timer timer("Tile", path); #ifdef HAVE_NETCDF + Netcdf netcdf(path, "index"); map first, last; - first["x"] = tostring(x_); - first["y"] = tostring(y_); - last["x"] = tostring(x_); - last["y"] = tostring(y_); - static vector bbox; static vector latitudes; static vector longitudes; @@ -450,41 +451,57 @@ void TileDecoder::decode() { static vector dindex; static vector distances; - int nblat = netcdf.getDimension("lat") - 1; - int nblon = netcdf.getDimension("lon") - 1; - - if (bbox.empty()) { - netcdf.get("bounding-box", bbox, first, last); + if ( mode_ == "opencharts") { - int error; - FILE* in = fopen(file_name_.c_str(), "rb"); - if (!in) { - if (MagicsGlobal::strict()) { - throw CannotOpenFile(file_name_); + netcdf.get(projection_ + "_lat", latitudes, first, last); + netcdf.get(projection_ + "_lon", longitudes, first, last); + netcdf.get(projection_ + "_index", dindex, first, last); + netcdf.get(projection_ + "_distances", distances, first, last); + } + else { + first["x"] = tostring(x_); + first["y"] = tostring(y_); + last["x"] = tostring(x_); + last["y"] = tostring(y_); + + + + int nblat = netcdf.getDimension("lat") - 1; + int nblon = netcdf.getDimension("lon") - 1; + + if (bbox.empty()) { + netcdf.get("bounding-box", bbox, first, last); + + int error; + FILE* in = fopen(file_name_.c_str(), "rb"); + if (!in) { + if (MagicsGlobal::strict()) { + throw CannotOpenFile(file_name_); + } + MagLog::error() << "ERROR: unable to create handle from file" << file_name_ << endl; + return; } - MagLog::error() << "ERROR: unable to create handle from file" << file_name_ << endl; - return; - } - // Adding a gutter of 5 points to avoid borders in tiles - int miny = std::min(bbox[1], bbox[3]); - miny = std::max(0, miny - 5); - int maxy = std::max(bbox[1], bbox[3]); - maxy = std::min(nblat, maxy + 5); - int minx = std::min(bbox[0], bbox[2]); - minx = std::max(0, minx - 5); - int maxx = std::max(bbox[0], bbox[2]); - maxx = std::min(nblon, maxx + 5); - - first["lat"] = tostring(miny); - first["lon"] = tostring(minx); - last["lat"] = tostring(maxy); - last["lon"] = tostring(maxx); - - netcdf.get("lat", latitudes, first, last); - netcdf.get("lon", longitudes, first, last); - netcdf.get("index", dindex, first, last); - netcdf.get("distances", distances, first, last); + // Adding a gutter of 5 points to avoid borders in tiles + int miny = std::min(bbox[1], bbox[3]); + miny = std::max(0, miny - 5); + int maxy = std::max(bbox[1], bbox[3]); + maxy = std::min(nblat, maxy + 5); + int minx = std::min(bbox[0], bbox[2]); + minx = std::max(0, minx - 5); + int maxx = std::max(bbox[0], bbox[2]); + maxx = std::min(nblon, maxx + 5); + + first["lat"] = tostring(miny); + first["lon"] = tostring(minx); + last["lat"] = tostring(maxy); + last["lon"] = tostring(maxx); + + netcdf.get("lat", latitudes, first, last); + netcdf.get("lon", longitudes, first, last); + netcdf.get("index", dindex, first, last); + netcdf.get("distances", distances, first, last); + } } int index[4]; diff --git a/src/params/TileDecoder.xml b/src/params/TileDecoder.xml index e62d76434..d7ee18159 100644 --- a/src/params/TileDecoder.xml +++ b/src/params/TileDecoder.xml @@ -28,6 +28,11 @@ does it submit to any jurisdiction. default="cylindrical" from="string" name="grib_tile_projection"> + Date: Tue, 10 Oct 2023 17:00:39 +0100 Subject: [PATCH 63/66] Opencharts : adding cache files for opencharts Projections , wind and symbol --- src/decoders/TileDecoder.cc | 96 ++++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 28 deletions(-) diff --git a/src/decoders/TileDecoder.cc b/src/decoders/TileDecoder.cc index 2d8d1e785..4731b58c2 100644 --- a/src/decoders/TileDecoder.cc +++ b/src/decoders/TileDecoder.cc @@ -55,7 +55,6 @@ string TileDecoder::weights() { } if (mode_ == "opencharts" ) out << parent << "/opencharts-cache-" << grid_ << ".nc"; - else out << parent << "/weight-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; return out.str(); @@ -67,7 +66,10 @@ string TileDecoder::positions() { if (parent.empty()) { parent = buildSharePath("tiles"); } - out << parent << "/wind-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; + if (mode_ == "opencharts" ) + out << parent << "/opencharts-wind-" << grid_ << ".nc"; + else + out << parent << "/wind-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; return out.str(); } @@ -78,7 +80,12 @@ string TileDecoder::positions_symbols() { if (parent.empty()) { parent = buildSharePath("tiles"); } - out << parent << "/symbol-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; + if (mode_ == "opencharts" ) { + out << parent << "/opencharts-symbol-" << grid_ << ".nc"; + } + + else + out << parent << "/symbol-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; file_ = ifstream(out.str()); if (file_.good()) { file_.close(); @@ -110,6 +117,20 @@ bool TileDecoder::ok() { grid_ = string(val); string path = weights(); + if (mode_ == "opencharts" ) { + try { + Netcdf netcdf(path, "index"); + map first, last; + static vector latitudes; + netcdf.get(projection_ + "_lat", latitudes, first, last); + return true; + } + catch(...) { + return false; + } + } + + file_ = ifstream(path); if (!file_.good()) { file_.close(); @@ -158,17 +179,29 @@ void TileDecoder::customisedPoints(const Transformation& transformation, const s #ifdef HAVE_NETCDF Netcdf netcdf(path, "index"); - map first, last; - first["x"] = tostring(x_); - first["y"] = tostring(y_); - last["x"] = tostring(x_); - last["y"] = tostring(y_); - vector bbox; vector latitudes; vector longitudes; vector values; vector index; + map first, last; + + if ( mode_ == "opencharts") { + + // netcdf.get(projection_ + "_lat", latitudes, first, last); + // netcdf.get(projection_ + "_lon", longitudes, first, last); + netcdf.get(projection_ + "_index", values, first, last); + + } + else { + first["x"] = tostring(x_); + first["y"] = tostring(y_); + last["x"] = tostring(x_); + last["y"] = tostring(y_); + netcdf.get("index", values, first, last); + } + + int error; FILE* in = fopen(file_name_.c_str(), "rb"); @@ -193,9 +226,6 @@ void TileDecoder::customisedPoints(const Transformation& transformation, const s return; } - int nbpoints = netcdf.getDimension("points"); - // netcdf.get("bounding-box", bbox, first, last); - netcdf.get("index", values, first, last); for (auto b = values.begin(); b != values.end(); ++b) { double lat = *b; @@ -249,21 +279,36 @@ void TileDecoder::customisedPoints(const Transformation& transformation, const s PointsHandler& TileDecoder::points(const Transformation& t, bool) { string path = positions_symbols(); Timer timer("Tile", path); + #ifdef HAVE_NETCDF Netcdf netcdf(path, "index"); - map first, last; - first["x"] = tostring(x_); - first["y"] = tostring(y_); - last["x"] = tostring(x_); - last["y"] = tostring(y_); - // vector bbox; - static vector latitudes; - static vector longitudes; - static vector values; + vector latitudes; + vector longitudes; + vector values; vector index; + map first, last; + + if ( mode_ == "opencharts") { + + // netcdf.get(projection_ + "_lat", latitudes, first, last); + // netcdf.get(projection_ + "_lon", longitudes, first, last); + netcdf.get(projection_ + "_index", values, first, last); + + + + } + else { + first["x"] = tostring(x_); + first["y"] = tostring(y_); + last["x"] = tostring(x_); + last["y"] = tostring(y_); + netcdf.get("index", values, first, last); + } + + int error; FILE* in = fopen(file_name_.c_str(), "rb"); @@ -285,12 +330,8 @@ PointsHandler& TileDecoder::points(const Transformation& t, bool) { return *(pointsHandlers_.back()); } - + if (latitudes.size() == 0) { - int nbpoints = netcdf.getDimension("points"); - // netcdf.get("bounding-box", bbox, first, last); - netcdf.get("index", values, first, last); - for (auto b = values.begin(); b != values.end(); ++b) { double lat = *b; @@ -302,11 +343,10 @@ PointsHandler& TileDecoder::points(const Transformation& t, bool) { if (i != 0) { if (lon > 180) lon -= 360; - // transformation.fast_reproject(lon, lat); - latitudes.push_back(lat); longitudes.push_back(lon); index.push_back(i); + } } } From d7e0a0d4ce0bf907ca653122bd714dbe2256ef7c Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 12 Oct 2023 15:45:21 +0100 Subject: [PATCH 64/66] Opencharts : adding cache files for opencharts Projections , wind and symbol --- src/decoders/TileDecoder.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/decoders/TileDecoder.cc b/src/decoders/TileDecoder.cc index 4731b58c2..1244c10aa 100644 --- a/src/decoders/TileDecoder.cc +++ b/src/decoders/TileDecoder.cc @@ -68,6 +68,7 @@ string TileDecoder::positions() { } if (mode_ == "opencharts" ) out << parent << "/opencharts-wind-" << grid_ << ".nc"; + else out << parent << "/wind-" << grid_ << "-" << projection() << "-z" + tostring(z_) << ".nc"; @@ -175,7 +176,6 @@ void TileDecoder::customisedPoints(const Transformation& transformation, const s CustomisedPointsList& out, bool all) { string path = positions(); Timer timer("Tile", path); - #ifdef HAVE_NETCDF Netcdf netcdf(path, "index"); @@ -235,15 +235,16 @@ void TileDecoder::customisedPoints(const Transformation& transformation, const s double i = *b; if (i != 0) { - if (lon > 180) - lon -= 360; + if ( mode_ != "opencharts") { + if (lon > 180) + lon -= 360; + } latitudes.push_back(lat); longitudes.push_back(lon); index.push_back(i); } } - { vector uc; uc.reserve(index.size()); @@ -265,6 +266,7 @@ void TileDecoder::customisedPoints(const Transformation& transformation, const s point->insert(make_pair("y_component", *vx)); out.push_back(point); point->tile(true); + ux++; vx++; lat++; @@ -341,8 +343,10 @@ PointsHandler& TileDecoder::points(const Transformation& t, bool) { double i = *b; if (i != 0) { - if (lon > 180) - lon -= 360; + if ( mode_ != "opencharts") { + if (lon > 180) + lon -= 360; + } latitudes.push_back(lat); longitudes.push_back(lon); index.push_back(i); From 8070f677edc1ed461d8b03fe0004b458aa85a82c Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Fri, 20 Oct 2023 13:53:27 +0100 Subject: [PATCH 65/66] Opencharts-CAMS: improve background layout for EpsGrah --- src/visualisers/EpsGraph.cc | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index e236a2791..1998281f2 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -2776,6 +2776,8 @@ void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { } + double shift =(transformation.getMaxY() - transformation.getMinY())*0.02; + if ( label != background_label_list_.end() ) { Text* text = new Text(); @@ -2785,10 +2787,11 @@ void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { font.colour(*background_label_font_colour_); text->setFont(font); double x = transformation.getMinX() + (transformation.getMaxX() - transformation.getMinX())*0.01; - double y = from + (to-from)*0.1; - - text->push_back(PaperPoint(x, y)); - visitor.push_back(text); + + double y = from + shift; + if ( y < transformation.getMaxY() ) + text->push_back(PaperPoint(x, y)); + visitor.push_back(text); ++label; } from = *level; @@ -2797,20 +2800,6 @@ void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { } - // if ( from < transformation.getMaxY() ) { - // Polyline* area = new Polyline(); - // area->setColour(Colour(*colour)); - // area->setFilled(true); - // area->setShading(new FillShadingProperties()); - // area->setFillColour(Colour(*colour)); - // visitor.push_back(area); - // area->push_back(PaperPoint(transformation.getMinX(), from)); - // area->push_back(PaperPoint(transformation.getMinX(), transformation.getMaxY())); - // area->push_back(PaperPoint(transformation.getMaxX(), transformation.getMaxY())); - // area->push_back(PaperPoint(transformation.getMaxX(), from)); - // area->push_back(PaperPoint(transformation.getMinX(), from)); - // } - } void EpsPlume::operator()(Data& data, BasicGraphicsObjectContainer& visitor) { From 9c60aeff3ae102aba0b539b1289a1c75f128aae6 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Wed, 8 Nov 2023 17:06:46 +0000 Subject: [PATCH 66/66] ecCharts/opencharts: improve tiling --- src/decoders/TileDecoder.cc | 69 +++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/src/decoders/TileDecoder.cc b/src/decoders/TileDecoder.cc index 1244c10aa..9a455367b 100644 --- a/src/decoders/TileDecoder.cc +++ b/src/decoders/TileDecoder.cc @@ -294,7 +294,6 @@ PointsHandler& TileDecoder::points(const Transformation& t, bool) { map first, last; if ( mode_ == "opencharts") { - // netcdf.get(projection_ + "_lat", latitudes, first, last); // netcdf.get(projection_ + "_lon", longitudes, first, last); netcdf.get(projection_ + "_index", values, first, last); @@ -477,8 +476,10 @@ Data* TileDecoder::next() { void TileDecoder::decode() { - if (matrix_.size()) - return; + if (matrix_.size()) { + matrix_ = Matrix(); + + } string path = weights(); @@ -513,39 +514,41 @@ void TileDecoder::decode() { int nblat = netcdf.getDimension("lat") - 1; int nblon = netcdf.getDimension("lon") - 1; - if (bbox.empty()) { - netcdf.get("bounding-box", bbox, first, last); + + netcdf.get("bounding-box", bbox, first, last); - int error; - FILE* in = fopen(file_name_.c_str(), "rb"); - if (!in) { - if (MagicsGlobal::strict()) { - throw CannotOpenFile(file_name_); - } - MagLog::error() << "ERROR: unable to create handle from file" << file_name_ << endl; - return; + int error; + FILE* in = fopen(file_name_.c_str(), "rb"); + if (!in) { + if (MagicsGlobal::strict()) { + throw CannotOpenFile(file_name_); } - - // Adding a gutter of 5 points to avoid borders in tiles - int miny = std::min(bbox[1], bbox[3]); - miny = std::max(0, miny - 5); - int maxy = std::max(bbox[1], bbox[3]); - maxy = std::min(nblat, maxy + 5); - int minx = std::min(bbox[0], bbox[2]); - minx = std::max(0, minx - 5); - int maxx = std::max(bbox[0], bbox[2]); - maxx = std::min(nblon, maxx + 5); - - first["lat"] = tostring(miny); - first["lon"] = tostring(minx); - last["lat"] = tostring(maxy); - last["lon"] = tostring(maxx); - - netcdf.get("lat", latitudes, first, last); - netcdf.get("lon", longitudes, first, last); - netcdf.get("index", dindex, first, last); - netcdf.get("distances", distances, first, last); + MagLog::error() << "ERROR: unable to create handle from file" << file_name_ << endl; + return; } + + // Adding a gutter of 5 points to avoid borders in tiles + int miny = std::min(bbox[1], bbox[3]); + miny = std::max(0, miny - 5); + int maxy = std::max(bbox[1], bbox[3]); + maxy = std::min(nblat, maxy + 5); + int minx = std::min(bbox[0], bbox[2]); + minx = std::max(0, minx - 5); + int maxx = std::max(bbox[0], bbox[2]); + maxx = std::min(nblon, maxx + 5); + + first["lat"] = tostring(miny); + first["lon"] = tostring(minx); + last["lat"] = tostring(maxy); + last["lon"] = tostring(maxx); + + + + netcdf.get("lat", latitudes, first, last); + netcdf.get("lon", longitudes, first, last); + netcdf.get("index", dindex, first, last); + netcdf.get("distances", distances, first, last); + } int index[4];