18#ifndef QGSPALETTEDRENDERERWIDGET_H
19#define QGSPALETTEDRENDERERWIDGET_H
26#include "ui_qgspalettedrendererwidgetbase.h"
30#include <QSortFilterProxyModel>
33class QgsLocaleAwareNumericLineEditDelegate;
42class QgsPalettedRendererClassGatherer :
public QThread
55 mFeedbackMutex.lock();
58 mFeedbackMutex.unlock();
64 bool wasCanceled()
const {
return mWasCanceled; }
73 void collectedClasses();
79 void progressChanged(
double progress );
82 std::unique_ptr<QgsRasterDataProvider> mProvider;
84 std::unique_ptr<QgsColorRamp> mRamp;
88 QMutex mFeedbackMutex;
92class QgsPalettedRendererModel :
public QAbstractItemModel
104 QgsPalettedRendererModel( QObject *parent =
nullptr );
111 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
112 QModelIndex parent(
const QModelIndex &index )
const override;
113 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
114 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
115 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
116 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
117 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
118 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
119 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
120 bool insertRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
121 Qt::DropActions supportedDropActions()
const override;
122 QStringList mimeTypes()
const override;
123 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
124 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
126 QModelIndex addEntry(
const QColor &color );
134 void classesChanged();
140class QgsPalettedRendererProxyModel :
public QSortFilterProxyModel
145 QgsPalettedRendererProxyModel( QObject *parent = 0 )
146 : QSortFilterProxyModel( parent )
154 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override
156 const QModelIndex lv { left.model()->index( left.row(),
static_cast<int>( QgsPalettedRendererModel::Column::ValueColumn ), left.parent() ) };
157 const QModelIndex rv { right.model()->index( right.row(),
static_cast<int>( QgsPalettedRendererModel::Column::ValueColumn ), right.parent() ) };
158 const double leftData { sourceModel()->data( lv ).toDouble() };
159 const double rightData { sourceModel()->data( rv ).toDouble() };
160 return leftData < rightData;
188 QMenu *mContextMenu =
nullptr;
189 QMenu *mAdvancedMenu =
nullptr;
190 QgsPalettedRendererModel *mModel =
nullptr;
191 QgsPalettedRendererProxyModel *mProxyModel =
nullptr;
194 QgsPalettedRendererClassGatherer *mGatherer =
nullptr;
198 QgsLocaleAwareNumericLineEditDelegate *mValueDelegate =
nullptr;
200 void setSelectionColor( const QItemSelection &selection, const QColor &color );
207 void changeOpacity();
209 void applyColorRamp();
210 void loadColorTable();
211 void saveColorTable();
213 void loadFromLayer();
214 void bandChanged(
int band );
216 void gatheredClasses();
217 void gathererThreadFinished();
Abstract base class for color ramps.
Base class for all map layer types.
QList< QgsPalettedRasterRenderer::Class > ClassData
Map of value to class properties.
Feedback object tailored for raster block reading.
Represents a raster layer.
Raster renderer pipe that applies colors to a raster.
A rectangle specified with double values.
Properties of a single value class.