2017-10-23 11:29:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-10-23 11:29:23 -05:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-10-23 11:29:23 -05:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-10-23 11:29:23 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-09-10 08:21:58 -05:00
|
|
|
#include "cafColorTable.h"
|
|
|
|
|
2017-10-23 11:29:23 -05:00
|
|
|
#include "qwt_plot_marker.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
2017-11-03 05:36:44 -05:00
|
|
|
#include <QPointer>
|
|
|
|
|
2017-10-23 11:29:23 -05:00
|
|
|
class QString;
|
|
|
|
class QwtPlot;
|
|
|
|
|
|
|
|
class RiuPlotAnnotationTool
|
|
|
|
{
|
2019-09-10 06:23:29 -05:00
|
|
|
public:
|
2020-05-13 23:39:55 -05:00
|
|
|
enum class RegionAnnotationType
|
2019-09-25 04:59:31 -05:00
|
|
|
{
|
2020-06-08 04:09:11 -05:00
|
|
|
NO_ANNOTATIONS = 0,
|
|
|
|
FORMATION_ANNOTATIONS = 1,
|
2020-05-25 01:59:00 -05:00
|
|
|
// Used to have Wbs-parameter coding as 2
|
2020-05-13 23:39:55 -05:00
|
|
|
RESULT_PROPERTY_ANNOTATIONS = 3
|
2019-09-25 04:59:31 -05:00
|
|
|
};
|
|
|
|
enum RegionDisplay
|
2019-09-10 06:23:29 -05:00
|
|
|
{
|
|
|
|
DARK_LINES = 0x01,
|
|
|
|
COLORED_LINES = 0x02,
|
|
|
|
COLOR_SHADING = 0x04,
|
2020-02-07 04:08:47 -06:00
|
|
|
COLOR_SHADING_AND_LINES = 0x05,
|
|
|
|
LIGHT_LINES = 0x08,
|
2019-09-10 06:23:29 -05:00
|
|
|
};
|
2020-05-13 23:39:55 -05:00
|
|
|
enum class TrackSpan
|
2019-09-25 04:59:31 -05:00
|
|
|
{
|
|
|
|
FULL_WIDTH,
|
|
|
|
LEFT_COLUMN,
|
|
|
|
CENTRE_COLUMN,
|
|
|
|
RIGHT_COLUMN
|
|
|
|
};
|
2020-12-07 09:47:34 -06:00
|
|
|
enum class Orientation
|
|
|
|
{
|
|
|
|
HORIZONTAL = 0,
|
|
|
|
VERTICAL
|
|
|
|
};
|
2019-09-10 06:23:29 -05:00
|
|
|
|
2017-10-23 11:29:23 -05:00
|
|
|
public:
|
2019-09-06 03:40:57 -05:00
|
|
|
RiuPlotAnnotationTool(){};
|
2017-11-03 05:36:44 -05:00
|
|
|
~RiuPlotAnnotationTool();
|
2017-10-23 11:29:23 -05:00
|
|
|
|
2019-11-03 07:08:21 -06:00
|
|
|
void attachNamedRegions( QwtPlot* plot,
|
|
|
|
const std::vector<QString>& names,
|
|
|
|
const std::pair<double, double> xRange,
|
|
|
|
const std::vector<std::pair<double, double>>& yPositions,
|
|
|
|
RegionDisplay regionDisplay,
|
|
|
|
const caf::ColorTable& colorTable,
|
|
|
|
int shadingAlphaByte,
|
2020-02-07 08:20:19 -06:00
|
|
|
bool showNames = true,
|
2020-05-13 23:39:55 -05:00
|
|
|
TrackSpan trackSpan = TrackSpan::FULL_WIDTH,
|
2021-10-04 12:43:27 -05:00
|
|
|
const std::vector<Qt::BrushStyle>& brushStyles = {},
|
|
|
|
int fontSize = 0 );
|
2019-11-03 07:08:21 -06:00
|
|
|
void attachWellPicks( QwtPlot* plot, const std::vector<QString>& names, const std::vector<double>& yPositions );
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2020-12-07 09:47:34 -06:00
|
|
|
void attachAnnotationLine( QwtPlot* plot,
|
|
|
|
const QColor& color,
|
|
|
|
const QString& annotationText,
|
|
|
|
const double position,
|
|
|
|
Orientation orientation );
|
|
|
|
|
|
|
|
void attachAnnotationRange( QwtPlot* plot,
|
|
|
|
const QColor& color,
|
|
|
|
const QString& annotationText,
|
|
|
|
const double rangeStart,
|
|
|
|
const double rangeEnd,
|
|
|
|
Orientation orientation );
|
|
|
|
|
|
|
|
void horizontalRange( const QString& name,
|
|
|
|
const std::pair<double, double> yRange,
|
|
|
|
const QColor& color = QColor( 0, 0, 100 ),
|
|
|
|
const QColor& textColor = QColor( 0, 0, 100 ),
|
|
|
|
Qt::Alignment horizontalAlignment = Qt::AlignRight );
|
|
|
|
|
|
|
|
void verticalRange( const QString& name,
|
|
|
|
const std::pair<double, double> xRange,
|
|
|
|
const QColor& color = QColor( 0, 0, 100 ),
|
|
|
|
const QColor& textColor = QColor( 0, 0, 100 ),
|
|
|
|
Qt::Alignment horizontalAlignment = Qt::AlignRight );
|
2019-03-22 09:11:56 -05:00
|
|
|
|
2017-10-23 11:29:23 -05:00
|
|
|
void detachAllAnnotations();
|
2020-12-07 09:47:34 -06:00
|
|
|
void detachAllAnnotations( Orientation orientation );
|
2017-10-23 11:29:23 -05:00
|
|
|
|
2017-12-05 05:56:13 -06:00
|
|
|
private:
|
2019-09-25 04:59:31 -05:00
|
|
|
static Qt::Alignment trackTextAlignment( TrackSpan trackSpan );
|
|
|
|
static void horizontalDashedLine( QwtPlotMarker* line,
|
|
|
|
const QString& name,
|
|
|
|
double yValue,
|
|
|
|
const QColor& color = QColor( 0, 0, 100 ),
|
|
|
|
const QColor& textColor = QColor( 0, 0, 100 ),
|
2021-10-04 12:43:27 -05:00
|
|
|
Qt::Alignment horizontalAlignment = Qt::AlignRight,
|
|
|
|
int fontSize = 0 );
|
2017-12-05 05:56:13 -06:00
|
|
|
|
2020-12-07 09:47:34 -06:00
|
|
|
void verticalLine( QwtPlotMarker* line,
|
|
|
|
const QString& name,
|
|
|
|
double xValue,
|
|
|
|
const QColor& color = QColor( 0, 0, 100 ),
|
|
|
|
const QColor& textColor = QColor( 0, 0, 100 ),
|
|
|
|
Qt::PenStyle lineStyle = Qt::DashLine,
|
|
|
|
Qt::Alignment horizontalAlignment = Qt::AlignRight | Qt::AlignBottom );
|
|
|
|
|
2017-10-23 11:29:23 -05:00
|
|
|
private:
|
2019-09-10 06:23:29 -05:00
|
|
|
QPointer<QwtPlot> m_plot;
|
2020-12-07 09:47:34 -06:00
|
|
|
std::vector<QwtPlotItem*> m_horizontalMarkers;
|
|
|
|
std::vector<QwtPlotItem*> m_verticalMarkers;
|
2017-10-23 11:29:23 -05:00
|
|
|
};
|