Commit b1957c8f authored by Mathieu Westphal's avatar Mathieu Westphal Committed by Kitware Robot

Merge topic 'PipelineIconXMLSupport'

3bf10d04 Specifying PipelineIcon for non standard View Type used in paraview
4b8c10cb Add Support for PipelineIcon hint
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Michael Migliore's avatarMichael Migliore <michael.migliore@kitware.com>
Acked-by: Nicolas Vuaille's avatarNicolas Vuaille <nicolas.vuaille@kitware.com>
Merge-request: !2958
parents 3d0efc54 3bf10d04
Pipeline #127531 running with stage
* Support for PipelineIcon filter hint in xml
Xml filter definition can now specify the pipeline icon to use for a specific filter or output port.
It can be either a view type name or an existing icon resource.
```
<SourceProxy>
<Hints>
<PipelineIcon name="<view name or icon resource>" port="<output port number>" />
</Hints>
</SourceProxy>
```
......@@ -666,6 +666,21 @@ const char* vtkSMParaViewPipelineControllerWithRendering::GetPreferredViewType(
return nullptr;
}
//----------------------------------------------------------------------------
const char* vtkSMParaViewPipelineControllerWithRendering::GetPipelineIcon(
vtkSMSourceProxy* producer, int outputPort)
{
// 1. Check if there's a hint for the producer. If so, use that.
vtkPVXMLElement* hint = vtkFindChildFromHints(producer->GetHints(), outputPort, "PipelineIcon");
if (hint && hint->GetAttribute("name"))
{
return hint->GetAttribute("name");
}
// 2. If not, return the prefered view type
return this->GetPreferredViewType(producer, outputPort);
}
//----------------------------------------------------------------------------
bool vtkSMParaViewPipelineControllerWithRendering::AlsoShowInCurrentView(
vtkSMSourceProxy* producer, int outputPort, vtkSMViewProxy* vtkNotUsed(currentView))
......
......@@ -142,6 +142,32 @@ public:
*/
virtual const char* GetPreferredViewType(vtkSMSourceProxy* producer, int outputPort);
/**
* Return the pipeline icon to use with the provided producer.
* It can be either a view type name, an existing icon resource or nullptr.
* Here is the strategy to determine the pipeline icon.
*
* # Using XML hints.
* A producer proxy can provide XML hints to define the pipeline icon to use
* of each (or all) of its output ports. This is done as follows:
*
* @code{xml}
* <SourceProxy>
* <Hints>
* <PipelineIcon name="<view name or icon resource>" port="<output port number>" />
* </Hints>
* </SourceProxy>
* @endcode
*
* Attribute `port` is optional and only needed to explicitly specify
* different view types for different output ports.
*
* # Using GetPreferredViewType
* If no PipelineIcon as been provided, we fall back to using
* GetPreferredViewType.
*/
virtual const char* GetPipelineIcon(vtkSMSourceProxy* producer, int outputPort);
/**
* Overridden to create color and opacity transfer functions if applicable.
* While it is tempting to add any default property setup logic in such
......
......@@ -746,6 +746,7 @@
</IntVectorProperty>
<Hints>
<!-- View can be used to specify the preferred view for the proxy -->
<PipelineIcon name="XYChartView" />
<View type="QuartileChartView" />
<WarnOnCreate title="Potentially slow operation">
**Plot Data Over Time** filter needs to process all timesteps
......@@ -822,6 +823,7 @@
<Hints>
<!-- View can be used to specify the preferred view for the proxy -->
<PipelineIcon name="XYChartView" />
<View type="QuartileChartView" />
<WarnOnCreate title="Potentially slow operation">
**Plot Selection Over Time** filter needs to process all timesteps
......
This diff is collapsed.
......@@ -29,31 +29,6 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef pqPipelineModel_h
#define pqPipelineModel_h
#include "pqComponentsModule.h"
#include "pqView.h"
#include "vtkSmartPointer.h"
#include <QAbstractItemModel>
#include <QPointer>
class pqDataRepresentation;
class pqPipelineModelFilter;
class pqPipelineModelInternal;
class pqPipelineModelItem;
class pqPipelineModelOutput;
class pqPipelineModelSource;
class pqPipelineSource;
class pqView;
class pqServer;
class pqServerManagerModel;
class pqServerManagerModelItem;
class QFont;
class QPixmap;
class ModifiedLiveInsituLink;
/**
* \class pqPipelineModel
* \brief
......@@ -73,13 +48,26 @@ class ModifiedLiveInsituLink;
* pipeline object.
*/
class pqPipelineModelInternal;
class pqServerManagerModelItem;
class pqPipelineSource;
class pqServer;
#ifndef pqPipelineModel_h
#define pqPipelineModel_h
#include "pqComponentsModule.h" // For export macro
#include "pqView.h" // For View
#include <QAbstractItemModel>
#include <QMap> // For PixmapMap
#include <QPointer> // For View
class ModifiedLiveInsituLink;
class QFont;
class QPixmap;
class QString;
class pqPipelineModelDataItem;
class pqPipelineModelInternal;
class pqPipelineSource;
class pqServer;
class pqServerManagerModel;
class pqServerManagerModelItem;
class vtkSession;
/**
......@@ -430,9 +418,18 @@ private:
QModelIndex getIndex(pqPipelineModelDataItem* item) const;
/**
* Check the PixmapMap contains a pixmap associated to the provided iconType.
* Return true if yes.
* If not it will try to load a new pixmap interpreting iconType as a Qt resource name
* and add it to the map.
* Return true if sucessful, false otherwise.
*/
bool checkAndLoadPipelinePixmap(const QString& iconType);
private:
pqPipelineModelInternal* Internal; ///< Stores the pipeline representation.
QPixmap* PixmapList; ///< Stores the item icons.
QMap<QString, QPixmap> PixmapMap; ///< Stores the item icons.
QPointer<pqView> View;
bool Editable;
QString FilterRoleAnnotationKey;
......
......@@ -20,7 +20,6 @@ representation from the UI.
</Hints>
</RepresentationProxy>
WarnOnCreate
------------
Warn the user when creating the filter or source in the UI.
......@@ -29,7 +28,6 @@ The motivation behind this hint is to warn the user when executing filters
like **Temporal Statistics** filter since they can potentially take a long time
for large file series.
<SourceProxy ...>
...
<Hints>
......@@ -114,6 +112,77 @@ displayed manually by toggling the visibility when an appropriate View is active
</Hints>
</SourceProxy>
PipelineIcon
------------
Specify the pipeline icon view to use in the pipeline browser for this
source/filter proxy.
This hint is used to indicate the icon to use in the pipeline browser.
It can be either the full name of a qt resource icon or the name of a view type
for which an icon as already been defined.
<SourceProxy ...>
...
<Hints>
<PipelineIcon name="XYChartView" />
</Hints>
</SourceProxy>
If the source/filter has more than 1 output port, you can choose which port the
hint corresponds to by using the optional `port` attribute.
<SourceProxy ...>
...
<Hints>
<PipelineIcon name="XYChartView" port="1" />
</Hints>
</SourceProxy>
At the time of writing, the supported stock icon names were:
* "SERVER"
* "SECURE_SERVER"
* "LINK"
* "GEOMETRY"
* "XYBagChartView"
* "XYChartView"
* "XYBarChartView"
* "XYFunctionnalBagChartView"
* "XYHistogramChartView"
* "BoxChartView"
* "SpreadSheetView"
* "INDETERMINATE"
* "None"
* "EYEBALL"
* "EYEBALL_GRAY"
* "INSITU_EXTRACT"
* "INSITU_EXTRACT_GRAY"
* "INSITU_SERVER_RUNNING"
* "INSITU_SERVER_PAUSED"
* "INSITU_BREAKPOINT"
* "INSITU_WRITER_PARAMETERS"
* "CINEMA_MARK"
If the desired icon is not present in the list, it is possible to use a Qt resource icon name directly.
<SourceProxy ...>
...
<Hints>
<PipelineIcon name=":/pqWidgets/Icons/pqCalculator24.png" />
</Hints>
</SourceProxy>
Available icons are visible in the sources of ParaView
If the desired icon is not present, it can be added, for example in the context of a plugin, using
GUI_RESOURCES in your ADD_PARAVIEW_PLUGIN macro, a .qrc file and your own icon file.
<SourceProxy ...>
...
<Hints>
<PipelineIcon name=":/MyPluginQtResource/Icons/myIcon.png" />
</Hints>
</SourceProxy>
Plotable
--------
Mark output data as plotable in 2D chart views.
......@@ -192,7 +261,6 @@ possible values are:
2. *short_help*: to use vtkSMDocumentation::GetShortHelp(), and
3. *long_help*: to use vtkSMDocumentation::GetLongHelp().
<SourceProxy ...>
<Documentation>
Some text that will be shown in the label.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment