31 for (
int i = 0; i < thePipe.
size(); i++ )
37 QgsDebugMsg( QString(
"cloned inerface with role %1" ).arg( role ) );
61 for (
int i = 1; i < theInterfaces.size(); i++ )
63 if ( ! theInterfaces[i]->setInput( theInterfaces[i-1] ) )
65 QgsDebugMsg( QString(
"cannot connect %1 to %2" ).arg(
typeid( *( theInterfaces[i] ) ).name() ).arg(
typeid( *( theInterfaces[i-1] ) ).name() ) );
74 QgsDebugMsg( QString(
"insert %1 at %2" ).arg(
typeid( *theInterface ).name() ).arg( idx ) );
81 QVector<QgsRasterInterface*> interfaces =
mInterfaces;
83 interfaces.insert( idx, theInterface );
100 QgsDebugMsg( QString(
"replace by %1 at %2" ).arg(
typeid( *theInterface ).name() ).arg( idx ) );
102 if ( !theInterface )
return false;
106 QVector<QgsRasterInterface*> interfaces =
mInterfaces;
108 interfaces[idx] = theInterface;
109 bool success =
false;
127 if ( dynamic_cast<QgsRasterDataProvider *>( interface ) ) role =
ProviderRole;
128 else if ( dynamic_cast<QgsRasterRenderer *>( interface ) ) role =
RendererRole;
129 else if ( dynamic_cast<QgsRasterResampleFilter *>( interface ) ) role =
ResamplerRole;
130 else if ( dynamic_cast<QgsBrightnessContrastFilter *>( interface ) ) role =
BrightnessRole;
131 else if ( dynamic_cast<QgsHueSaturationFilter *>( interface ) ) role =
HueSaturationRole;
132 else if ( dynamic_cast<QgsRasterProjector *>( interface ) ) role =
ProjectorRole;
133 else if ( dynamic_cast<QgsRasterNuller *>( interface ) ) role =
NullerRole;
135 QgsDebugMsg( QString(
"%1 role = %2" ).arg(
typeid( *interface ).name() ).arg( role ) );
155 QgsDebugMsg( QString(
"%1" ).arg(
typeid( *theInterface ).name() ) );
157 if ( !theInterface )
return false;
192 idx = providerIdx + 1;
196 idx = qMax( providerIdx, rendererIdx ) + 1;
200 idx = qMax( qMax( providerIdx, rendererIdx ), brightnessIdx ) + 1;
204 idx = qMax( qMax( qMax( providerIdx, rendererIdx ), brightnessIdx ), hueSaturationIdx ) + 1;
208 idx = qMax( qMax( qMax( qMax( providerIdx, rendererIdx ), brightnessIdx ), hueSaturationIdx ), resamplerIdx ) + 1;
211 return insert( idx, theInterface );
261 QgsDebugMsg( QString(
"remove at %1" ).arg( idx ) );
267 QVector<QgsRasterInterface*> interfaces =
mInterfaces;
269 interfaces.remove( idx );
270 bool success =
false;
287 if ( !theInterface )
return false;
289 return remove(
mInterfaces.indexOf( theInterface ) );
294 QgsDebugMsg( QString(
"idx = %1 on = %2" ).arg( idx ).arg( on ) );
301 if ( onOrig == on )
return true;
314 QgsDebugMsg( QString(
"idx = %1 on = %2" ).arg( idx ).arg( on ) );
319 if ( onOrig == on )
return true;
333 if ( idx < 0 || idx >=
mInterfaces.size() )
return false;
QgsRasterInterface * interface(Role role) const
Get known interface by role.
Base class for processing modules.
QgsRasterNuller * nuller() const
QgsBrightnessContrastFilter * brightnessFilter() const
Raster pipe that deals with null values.
bool checkBounds(int idx) const
Resample filter pipe for rasters.
Role interfaceRole(QgsRasterInterface *iface) const
Get known parent type_info of interface parent.
bool connect(QVector< QgsRasterInterface * > theInterfaces)
Try to connect interfaces in pipe and to the provider at beginning.
QMap< Role, int > mRoleMap
QgsRasterDataProvider * provider() const
QgsRasterProjector * projector() const
Base class for processing filters like renderers, reprojector, resampler etc.
void setRole(QgsRasterInterface *theInterface, int idx)
bool canSetOn(int idx, bool on)
Test if interface at index may be swithed on/off.
bool remove(int idx)
Remove and delete interface at given index if possible.
bool setOn(int idx, bool on)
Set interface at index on/off Returns true on success.
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
Brightness/contrast filter pipe for rasters.
Color and saturation filter pipe for rasters.
bool insert(int idx, QgsRasterInterface *theInterface)
Try to insert interface at specified index and connect if connection would fail, the interface is not...
QgsHueSaturationFilter * hueSaturationFilter() const
bool replace(int idx, QgsRasterInterface *theInterface)
Try to replace interface at specified index and connect if connection would fail, the interface is no...
QVector< QgsRasterInterface * > mInterfaces
QgsRasterRenderer * renderer() const
bool set(QgsRasterInterface *theInterface)
Insert a new known interface in default place or replace interface of the same role if it already exi...
QgsRasterResampleFilter * resampleFilter() const
Raster renderer pipe that applies colors to a raster.
void unsetRole(QgsRasterInterface *theInterface)
Base class for raster data providers.