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 );
83 std::unique_ptr< QgsRasterDataProvider > mProvider;
85 std::unique_ptr< QgsColorRamp > mRamp;
89 QMutex mFeedbackMutex;
93class QgsPalettedRendererModel :
public QAbstractItemModel
106 QgsPalettedRendererModel( QObject *parent =
nullptr );
113 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
114 QModelIndex parent(
const QModelIndex &index )
const override;
115 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
116 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
117 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
118 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
119 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
120 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
121 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
122 bool insertRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
123 Qt::DropActions supportedDropActions()
const override;
124 QStringList mimeTypes()
const override;
125 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
126 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
128 QModelIndex addEntry(
const QColor &color );
136 void classesChanged();
145class QgsPalettedRendererProxyModel:
public QSortFilterProxyModel
151 QgsPalettedRendererProxyModel( QObject *parent = 0 )
152 : QSortFilterProxyModel( parent )
161 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override
163 const QModelIndex lv { left.model()->index( left.row(),
static_cast<int>( QgsPalettedRendererModel::Column::ValueColumn ), left.parent() ) };
164 const QModelIndex rv { right.model()->index( right.row(),
static_cast<int>( QgsPalettedRendererModel::Column::ValueColumn ), right.parent() ) };
165 const double leftData { sourceModel()->data( lv ).toDouble( ) };
166 const double rightData { sourceModel()->data( rv ).toDouble( ) };
167 return leftData < rightData;
198 QMenu *mContextMenu =
nullptr;
199 QMenu *mAdvancedMenu =
nullptr;
200 QAction *mLoadFromLayerAction =
nullptr;
201 QgsPalettedRendererModel *mModel =
nullptr;
202 QgsPalettedRendererProxyModel *mProxyModel =
nullptr;
205 QgsPalettedRendererClassGatherer *mGatherer =
nullptr;
209 QgsLocaleAwareNumericLineEditDelegate *mValueDelegate =
nullptr;
211 void setSelectionColor( const QItemSelection &selection, const QColor &color );
218 void changeOpacity();
220 void applyColorRamp();
221 void loadColorTable();
222 void saveColorTable();
224 void loadFromLayer();
225 void bandChanged(
int band );
227 void gatheredClasses();
228 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.