mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3297 Make casing shoe a right-angled triangle and refactor symbols
* Put plot symbol enum inside the symbol class. * Put line style enums inside the line class. * Add custom capability.
This commit is contained in:
66
ApplicationCode/UserInterface/RiuQwtSymbol.h
Normal file
66
ApplicationCode/UserInterface/RiuQwtSymbol.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Equinor ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qwt_symbol.h"
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// This class overrides renderSymbols to draw symbols and labels.
|
||||
/// The label is only visible in the legend, while it is clipped in the plot.
|
||||
/// Therefore the method RiuQwtPlotCurve::drawSymbols also draw labels to have labels
|
||||
/// in the plot as well.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiuQwtSymbol : public QwtSymbol
|
||||
{
|
||||
public:
|
||||
enum LabelPosition
|
||||
{
|
||||
LabelAboveSymbol,
|
||||
LabelRightOfSymbol
|
||||
};
|
||||
enum PointSymbolEnum
|
||||
{
|
||||
SYMBOL_NONE,
|
||||
SYMBOL_ELLIPSE,
|
||||
SYMBOL_RECT,
|
||||
SYMBOL_DIAMOND,
|
||||
SYMBOL_TRIANGLE,
|
||||
SYMBOL_CROSS,
|
||||
SYMBOL_XCROSS,
|
||||
SYMBOL_DOWN_TRIANGLE,
|
||||
SYMBOL_LEFT_TRIANGLE,
|
||||
SYMBOL_RIGHT_TRIANGLE
|
||||
};
|
||||
|
||||
RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, LabelPosition labelPosition = LabelAboveSymbol);
|
||||
|
||||
virtual void renderSymbols(QPainter *painter, const QPointF *points, int numPoints) const override;
|
||||
void renderSymbolLabel(QPainter *painter, const QPointF& position) const;
|
||||
QString label() const { return m_label; }
|
||||
|
||||
void setLabelPosition(LabelPosition labelPosition);
|
||||
|
||||
private:
|
||||
QString m_label;
|
||||
LabelPosition m_labelPosition;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user