Commit 47ca7da0 authored by Mathieu Westphal's avatar Mathieu Westphal Committed by Kitware Robot

Merge topic 'LogoSource'

b3e292bb Adding a Logo Source
35518aca Full rework of the pqTextureComboBox and related classes
2779b61a Add a GetProxy method to vtkSMProxyGroupDomain
4c37eeaa Adding a alwaysAppend boolean to GetUniqueProxyName
9beba2ad Better Representation Hints Management
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>
Acked-by: Joachim Pouderoux's avatarJoachim Pouderoux <joachim.pouderoux@kitware.com>
Merge-request: !3306
parents b565cb87 b3e292bb
Pipeline #138738 running with stage
......@@ -4,6 +4,7 @@
<Proxy group="sources" name="VectorText" />
<Proxy group="sources" name="TimeToTextConvertorSource" />
<Proxy group="sources" name="ArrowSource" />
<Proxy group="sources" name="LogoSource" />
<Proxy group="sources" name="TextSource" />
</Category>
<Category name="DataObjects" menu_label="&amp;Data Objects" preserve_order="1"
......
d653585d97c660c8c5be1c63b00e27870bd7e88c1a736113fba09f7207e4d3258542d129ac2e5315f67f2b00856b4aa75cd8fed2647a0fccaddf67934c6ed219
......@@ -76,6 +76,8 @@ ExternalData_Expand_Arguments(ParaViewData _
"DATA{${paraview_test_data_directory_input}/Data/non_convex_polygon.vtu}"
"DATA{${paraview_test_data_directory_input}/Data/office.binary.vtk}"
"DATA{${paraview_test_data_directory_input}/Data/pointSet.vtk}"
"DATA{${paraview_test_data_directory_input}/Data/ParaView_Mark.png}"
"DATA{${paraview_test_data_directory_input}/Data/ParaView_Logo.png}"
"DATA{${paraview_test_data_directory_input}/Data/porphyrin.cml}"
"DATA{${paraview_test_data_directory_input}/Data/quadraticTetra01.vtu}"
"DATA{${paraview_test_data_directory_input}/Data/quadratic_tets_with_ghost_cells.pvtu}"
......@@ -824,6 +826,7 @@ list(APPEND TESTS_WITH_BASELINES
TimeInspector.xml
TimeStepProgressBar.xml
Tessellate.xml
TextureUsages.xml
UndoRedo.xml
UndoRedo1.xml
UndoRedo2.xml
......@@ -1378,10 +1381,9 @@ set (FFTOverTime_THRESHOLD 70) # since there's a plot, account for minor
SET (ColorEditorVolumeControls_DISABLE_CS TRUE)
SET (ColorEditorVolumeControls_DISABLE_CRS TRUE)
# ViewSettingsDialog uses texture background which is currently supported only
# in local render mode.
SET (ViewSettingsDialog_DISABLE_CS TRUE)
# ViewSettingsDialog and TextureUsages uses texture which are not supported in pvcrs mode.
SET (ViewSettingsDialog_DISABLE_CRS TRUE)
SET (TextureUsages_DISABLE_CRS TRUE)
# MultiBlockAttributes1 requires selection which doesn't work on pvcrs
SET (MultiBlockAttributes1_DISABLE_CRS TRUE)
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/SearchBox/AdvancedButton" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/BackgroundType" command="activated" arguments="Image" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/1pqTextureSelectorPropertyWidget0/1pqTextureComboBox0" command="activated" arguments="Load ..." />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/1pqTextureSelectorPropertyWidget0/1pqTextureComboBox0/LoadTextureDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/Testing/Data/NE2_ps_bath.png" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/1pqTextureSelectorPropertyWidget0/1pqTextureComboBox0" command="activated" arguments="NE2_ps_bath" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources/Alphabetical" command="activate" arguments="PlaneSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Texture/1pqTextureComboBox0" command="activated" arguments="Load ..." />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Texture/1pqTextureComboBox0/LoadTextureDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/Testing/Data/ParaView_Mark.png" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Texture/1pqTextureComboBox0" command="activated" arguments="ParaView_Mark" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources/Alphabetical" command="activate" arguments="LogoSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Texture/1pqTextureComboBox0" command="activated" arguments="Load ..." />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Texture/1pqTextureComboBox0/LoadTextureDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/Testing/Data/ParaView_Logo.png" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Texture/1pqTextureComboBox0" command="activated" arguments="ParaView_Logo" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Opacity/DoubleRangeWidget/DoubleLineEdit" command="set_string" arguments="0.5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Position/DoubleLineEdit0" command="set_string" arguments="0.08" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
</pqevents>
......@@ -14,7 +14,8 @@
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/CameraParallelProjection/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/BackgroundType" command="set_string" arguments="Image" />
<!-- next command was written by by hand -->
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/Image" command="set_string" arguments="Load ..." />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/Image/LoadTextureDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/Testing/Data/NE2_ps_bath.png" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/Image" command="set_string" arguments="NE2_ps_bath.png" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/1pqTextureSelectorPropertyWidget0/1pqTextureComboBox0" command="activated" arguments="Load ..." />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/1pqTextureSelectorPropertyWidget0/1pqTextureComboBox0/LoadTextureDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/Testing/Data/NE2_ps_bath.png" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/ViewFrame/ProxyPanel/BackgroundEditor/stackedWidget/page_3/1pqTextureSelectorPropertyWidget0/1pqTextureComboBox0" command="activated" arguments="NE2_ps_bath" />
</pqevents>
# Adding a Logo Source
A new Logo source has been added. The source enables a user to show
a 2D RGBA image projected on the foreground of the rendering plane.
Its size, position and opacity can be changed interactively.
It will enable users to display the logo of their company or laboratory
on the images and videos generated with ParaView.
......@@ -48,6 +48,7 @@ set(classes
vtkGlyph3DRepresentation
vtkImageSliceRepresentation
vtkImageVolumeRepresentation
vtkLogoSourceRepresentation
vtkMoleculeRepresentation
vtkMPIMoveData
vtkOutlineRepresentation
......
/*=========================================================================
Program: ParaView
Module: vtkLogoSourceRepresentation.cxx
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkLogoSourceRepresentation.h"
#include "vtk3DWidgetRepresentation.h"
#include "vtkAbstractWidget.h"
#include "vtkAlgorithmOutput.h"
#include "vtkImageData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkLogoRepresentation.h"
#include "vtkObjectFactory.h"
#include "vtkPVCacheKeeper.h"
#include "vtkPVRenderView.h"
#include "vtkProperty2D.h"
vtkStandardNewMacro(vtkLogoSourceRepresentation);
vtkCxxSetObjectMacro(
vtkLogoSourceRepresentation, LogoWidgetRepresentation, vtk3DWidgetRepresentation);
//----------------------------------------------------------------------------
vtkLogoSourceRepresentation::vtkLogoSourceRepresentation()
{
this->CacheKeeper->SetInputData(this->ImageCache);
}
//----------------------------------------------------------------------------
vtkLogoSourceRepresentation::~vtkLogoSourceRepresentation()
{
this->SetLogoWidgetRepresentation(nullptr);
}
//----------------------------------------------------------------------------
void vtkLogoSourceRepresentation::SetVisibility(bool val)
{
this->Superclass::SetVisibility(val);
if (this->LogoWidgetRepresentation && this->LogoWidgetRepresentation->GetRepresentation())
{
this->LogoWidgetRepresentation->GetRepresentation()->SetVisibility(val);
this->LogoWidgetRepresentation->SetEnabled(val);
}
}
//----------------------------------------------------------------------------
void vtkLogoSourceRepresentation::SetInteractivity(bool val)
{
if (this->LogoWidgetRepresentation && this->LogoWidgetRepresentation->GetWidget())
{
this->LogoWidgetRepresentation->GetWidget()->SetProcessEvents(val);
}
}
//----------------------------------------------------------------------------
int vtkLogoSourceRepresentation::FillInputPortInformation(int, vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkImageData");
info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
return 1;
}
//----------------------------------------------------------------------------
bool vtkLogoSourceRepresentation::AddToView(vtkView* view)
{
if (this->LogoWidgetRepresentation)
{
view->AddRepresentation(this->LogoWidgetRepresentation);
}
return this->Superclass::AddToView(view);
}
//----------------------------------------------------------------------------
bool vtkLogoSourceRepresentation::RemoveFromView(vtkView* view)
{
if (this->LogoWidgetRepresentation)
{
view->RemoveRepresentation(this->LogoWidgetRepresentation);
}
return this->Superclass::RemoveFromView(view);
}
//----------------------------------------------------------------------------
void vtkLogoSourceRepresentation::MarkModified()
{
if (!this->GetUseCache())
{
// Cleanup caches when not using cache.
this->CacheKeeper->RemoveAllCaches();
}
this->Superclass::MarkModified();
}
//----------------------------------------------------------------------------
bool vtkLogoSourceRepresentation::IsCached(double cache_key)
{
return this->CacheKeeper->IsCached(cache_key);
}
//----------------------------------------------------------------------------
int vtkLogoSourceRepresentation::RequestData(
vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
{
// Pass caching information to the cache keeper.
this->CacheKeeper->SetCachingEnabled(this->GetUseCache());
this->CacheKeeper->SetCacheTime(this->GetCacheKey());
if (inputVector[0]->GetNumberOfInformationObjects() == 1)
{
vtkImageData* input = vtkImageData::GetData(inputVector[0], 0);
this->ImageCache->ShallowCopy(input);
}
this->ImageCache->Modified();
this->CacheKeeper->Update();
// It is tempting to try to do the data delivery in RequestData() itself.
// However, whenever a representation updates, ParaView GUI may have some
// GatherInformation() requests that happen. That messes up with any
// data-delivery code placed here. So we leave the data delivery to the
// REQUEST_PREPARE_FOR_RENDER() pass.
return this->Superclass::RequestData(request, inputVector, outputVector);
}
//----------------------------------------------------------------------------
int vtkLogoSourceRepresentation::ProcessViewRequest(
vtkInformationRequestKey* request_type, vtkInformation* inInfo, vtkInformation* outInfo)
{
if (!this->Superclass::ProcessViewRequest(request_type, inInfo, outInfo))
{
// i.e. this->GetVisibility() == false, hence nothing to do.
return 0;
}
if (request_type == vtkPVView::REQUEST_UPDATE())
{
vtkPVRenderView::SetPiece(inInfo, this, this->CacheKeeper->GetOutputDataObject(0));
vtkPVRenderView::SetDeliverToClientAndRenderingProcesses(inInfo, this,
/*deliver_to_client=*/true, /*gather_before_delivery=*/false);
}
else if (request_type == vtkPVView::REQUEST_RENDER())
{
vtkAlgorithmOutput* producerPort = vtkPVRenderView::GetPieceProducer(inInfo, this);
// since there's no direct connection between the mapper and the collector,
// we don't put an update-suppressor in the pipeline.
vtkImageData* image = vtkImageData::SafeDownCast(
producerPort->GetProducer()->GetOutputDataObject(producerPort->GetIndex()));
// Setup the logo
vtkLogoRepresentation* repr = vtkLogoRepresentation::SafeDownCast(this->LogoWidgetRepresentation
? this->LogoWidgetRepresentation->GetRepresentation()
: nullptr);
if (image && image->GetNumberOfPoints() > 0)
{
int dims[3];
image->GetDimensions(dims);
repr->SetImage(image);
repr->GetImageProperty()->SetOpacity(this->Opacity);
repr->SetVisibility(true);
float height = repr->GetPosition2()[1];
repr->SetPosition2(height * dims[0] / dims[1], height);
}
else
{
repr->SetVisibility(false);
}
}
return 1;
}
//----------------------------------------------------------------------------
void vtkLogoSourceRepresentation::PrintSelf(ostream& os, vtkIndent indent)
{
vtkIndent nextIndent = indent.GetNextIndent();
this->Superclass::PrintSelf(os, indent);
os << indent << "Opacity: " << this->Opacity << endl;
if (this->LogoWidgetRepresentation)
{
os << indent << "LogoWidgetRepresentation: " << endl;
this->LogoWidgetRepresentation->PrintSelf(os, nextIndent);
}
else
{
os << indent << "LogoWidgetRepresentation: (None)" << endl;
}
os << indent << "ImageCache: " << endl;
this->ImageCache->PrintSelf(os, nextIndent);
os << indent << "CacheKeeper: " << endl;
this->CacheKeeper->PrintSelf(os, nextIndent);
}
/*=========================================================================
Program: ParaView
Module: vtkLogoSourceRepresentation.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkLogoSourceRepresentation
*
* vtkLogoSourceRepresentation is a representation to show a Logo. The input is
* expected to a be a vtkImageData that can be passed to a vtkLogoRepresentation.
*/
#ifndef vtkLogoSourceRepresentation_h
#define vtkLogoSourceRepresentation_h
#include "vtkNew.h" // for vtkNew
#include "vtkPVClientServerCoreRenderingModule.h" //needed for exports
#include "vtkPVDataRepresentation.h"
class vtk3DWidgetRepresentation;
class vtkPVCacheKeeper;
class vtkImageData;
class VTKPVCLIENTSERVERCORERENDERING_EXPORT vtkLogoSourceRepresentation
: public vtkPVDataRepresentation
{
public:
static vtkLogoSourceRepresentation* New();
vtkTypeMacro(vtkLogoSourceRepresentation, vtkPVDataRepresentation);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@{
/**
* Set the Logo widget.
*/
void SetLogoWidgetRepresentation(vtk3DWidgetRepresentation* widget);
vtkGetObjectMacro(LogoWidgetRepresentation, vtk3DWidgetRepresentation);
//@}
/**
* Remove all cache when marking modified
*/
void MarkModified() override;
/**
* Set the visibility.
*/
void SetVisibility(bool) override;
/**
* Set the interactivity.
*/
void SetInteractivity(bool);
//@{
/**
* Set the opacity of the logo
*/
vtkSetMacro(Opacity, double);
vtkGetMacro(Opacity, double);
//@}
/**
* vtkAlgorithm::ProcessRequest() equivalent for rendering passes. This is
* typically called by the vtkView to request meta-data from the
* representations or ask them to perform certain tasks e.g.
* PrepareForRendering.
*/
int ProcessViewRequest(vtkInformationRequestKey* request_type, vtkInformation* inInfo,
vtkInformation* outInfo) override;
protected:
vtkLogoSourceRepresentation();
~vtkLogoSourceRepresentation() override;
/**
* Fill input port information.
*/
int FillInputPortInformation(int port, vtkInformation* info) override;
/**
* Overridden to invoke vtkCommand::UpdateDataEvent.
*/
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
/**
* Adds the representation to the view. This is called from
* vtkView::AddRepresentation(). Subclasses should override this method.
* Returns true if the addition succeeds.
*/
bool AddToView(vtkView* view) override;
/**
* Removes the representation to the view. This is called from
* vtkView::RemoveRepresentation(). Subclasses should override this method.
* Returns true if the removal succeeds.
*/
bool RemoveFromView(vtkView* view) override;
/**
* Overridden to check with the vtkPVCacheKeeper to see if the key is cached.
*/
bool IsCached(double cache_key) override;
vtkNew<vtkPVCacheKeeper> CacheKeeper;
vtkNew<vtkImageData> ImageCache;
vtk3DWidgetRepresentation* LogoWidgetRepresentation = nullptr;
double Opacity = 1.0;
private:
vtkLogoSourceRepresentation(const vtkLogoSourceRepresentation&) = delete;
void operator=(const vtkLogoSourceRepresentation&) = delete;
};
#endif
......@@ -160,6 +160,12 @@ const char* vtkSMProxyGroupDomain::GetProxyName(unsigned int idx)
return proxyName;
}
//---------------------------------------------------------------------------
vtkSMProxy* vtkSMProxyGroupDomain::GetProxy(unsigned int idx)
{
return this->GetProxy(this->GetProxyName(idx));
}
//---------------------------------------------------------------------------
const char* vtkSMProxyGroupDomain::GetProxyName(vtkSMProxy* proxy)
{
......
......@@ -87,6 +87,11 @@ public:
*/
const char* GetProxyName(unsigned int idx);
/**
* Given an index, returns a proxy.
*/
vtkSMProxy* GetProxy(unsigned int idx);
/**
* Returns the name (in the group) of a proxy.
*/
......
......@@ -578,7 +578,8 @@ std::string vtkSMSessionProxyManager::RegisterProxy(const char* groupname, vtkSM
}
//---------------------------------------------------------------------------
std::string vtkSMSessionProxyManager::GetUniqueProxyName(const char* groupname, const char* prefix)
std::string vtkSMSessionProxyManager::GetUniqueProxyName(
const char* groupname, const char* prefix, bool alwaysAppend)
{
if (!groupname || !prefix)
{
......@@ -589,9 +590,13 @@ std::string vtkSMSessionProxyManager::GetUniqueProxyName(const char* groupname,
this->Internals->RegisteredProxyMap.find(groupname);
if (it == this->Internals->RegisteredProxyMap.end())
{
int suffix = 1;
std::ostringstream name_stream;
name_stream << prefix << suffix;
name_stream << prefix;
if (alwaysAppend)
{
int suffix = 1;
name_stream << suffix;
}
return name_stream.str();
}
......@@ -603,6 +608,14 @@ std::string vtkSMSessionProxyManager::GetUniqueProxyName(const char* groupname,
existingNames.insert(it2->first);
}
if (!alwaysAppend)
{
if (existingNames.find(prefix) == existingNames.end())
{
return prefix;
}
}
for (int suffix = 1; suffix < VTK_INT_MAX; ++suffix)
{
std::ostringstream name_stream;
......
......@@ -271,8 +271,11 @@ public:
/**
* Given a group, returns a name not already used for proxies registered in
* the given group. The prefix is used to come up with a new name.
* if alwaysAppend is true, then a suffix will always be appended, if not,
* the prefix may be used directly if possible.
*/
std::string GetUniqueProxyName(const char* groupname, const char* prefix);
std::string GetUniqueProxyName(
const char* groupname, const char* prefix, bool alwaysAppend = true);
/**
* If the proxy is in the given group, return its name, otherwise
......
......@@ -102,11 +102,7 @@ bool vtkIsOutputTypeNonStandard(vtkPVXMLElement* hints, const int outputPort)
}
if (const char* type = child->GetAttribute("type"))
{
if (strcmp(type, "text") == 0)
{
return true;
}
else if (strcmp(type, "progress") == 0)
if (strcmp(type, "text") == 0 || strcmp(type, "progress") == 0 || strcmp(type, "logo") == 0)
{
return true;
}
......
......@@ -457,6 +457,38 @@ const char* vtkSMRenderViewProxy::GetRepresentationType(vtkSMSourceProxy* produc
return reprName;
}
if (vtkPVXMLElement* hints = producer->GetHints())
{
// If the source has an hint as follows, then it's a text producer and must
// be display-able.
// <Hints>
// <OutputPort name="..." index="..." type="text" />
// </Hints>
for (unsigned int cc = 0, max = hints->GetNumberOfNestedElements(); cc < max; cc++)
{
int index;
vtkPVXMLElement* child = hints->GetNestedElement(cc);
const char* childName = child->GetName();
const char* childType = child->GetAttribute("type");
if (childName && strcmp(childName, "OutputPort") == 0 &&
child->GetScalarAttribute("index", &index) && index == outputPort && childType)
{
if (strcmp(childType, "text") == 0)
{
return "TextSourceRepresentation";
}
else if (strcmp(childType, "progress") == 0)
{
return "ProgressBarSourceRepresentation";
}
else if (strcmp(childType, "logo") == 0)
{
return "LogoSourceRepresentation";
}
}
}
}
vtkSMSessionProxyManager* pxm = this->GetSessionProxyManager();
const char* representationsToTry[] = { "UnstructuredGridRepresentation",
"StructuredGridRepresentation", "UniformGridRepresentation", "AMRRepresentation",
......@@ -498,35 +530,6 @@ const char* vtkSMRenderViewProxy::GetRepresentationType(vtkSMSourceProxy* produc
}
}
}
if (vtkPVXMLElement* hints = producer->GetHints())
{
// If the source has an hint as follows, then it's a text producer and must
// be display-able.
// <Hints>
// <OutputPort name="..." index="..." type="text" />
// </Hints>
for (unsigned int cc = 0, max = hints->GetNumberOfNestedElements(); cc < max; cc++)
{
int index;
vtkPVXMLElement* child = hints->GetNestedElement(cc);
const char* childName = child->GetName();
if (childName && strcmp(childName, "OutputPort") == 0 &&
child->GetScalarAttribute("index", &index) && index == outputPort &&
child->GetAttribute("type"))
{
if (strcmp(child->GetAttribute("type"), "text") == 0)
{
return "TextSourceRepresentation";
}
else if (strcmp(child->GetAttribute("type"), "progress") == 0)
{
return "ProgressBarSourceRepresentation";
}
}
}
}
return NULL;
}
......
......@@ -674,6 +674,46 @@
</SubProxy>
<!-- End of ProgressBarWidgetRepresentation -->
</NewWidgetRepresentationProxy>
<!-- ================================================================== -->
<NewWidgetRepresentationProxy class="vtk3DWidgetRepresentation"
name="LogoWidgetRepresentation">
<Documentation>LogoWidgetRepresentation is a representation for a logo widget
</Documentation>
<IntVectorProperty command="SetEnabled"
default_values="1"
name="Enabled"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation>Enable/Disable widget interaction.</Documentation>
</IntVectorProperty>
<IntVectorProperty command="SetUseNonCompositedRenderer"
default_values="1"
name="UseNonCompositedRenderer"
number_of_elements="1"></IntVectorProperty>
<SubProxy>
<Proxy name="Prop2D"
proxygroup="3d_widget_representations"
proxyname="LogoRepresentation"></Proxy>
<ExposedProperties>
<Property name="Visibility" />
<Property name="Position" />
<Property name="Position2" />
<Property name="PositionInfo" />
<Property name="Position2Info" />
</ExposedProperties>
</SubProxy>
<SubProxy>
<Proxy name="Widget"
proxygroup="3d_widgets"
proxyname="LogoWidget"></Proxy>
<ExposedProperties>
<Property name="ProcessEvents" />
<Property name="Selectable" />
<Property name="Resizable" />
</ExposedProperties>
</SubProxy>
<!-- End of LogoWidgetRepresentation -->
</NewWidgetRepresentationProxy>
</ProxyGroup>
<!-- ****************************************************************** -->
<ProxyGroup name="3d_widget_representations">
......@@ -1658,6 +1698,46 @@
<BooleanDomain name="bool" />
</IntVectorProperty>
</Proxy>
<!-- ================================================================== -->
<Proxy class="vtkLogoRepresentation"
name="LogoRepresentation">
<IntVectorProperty animateable="1"
command="SetVisibility"
default_values="1"
name="Visibility"
number_of_elements="1">
<BooleanDomain name="bool" />
</IntVectorProperty>
<DoubleVectorProperty command="SetPosition"
default_values="0.02 0.02"
information_property="PositionInfo"
name="Position"
number_of_elements="2">
<DoubleRangeDomain max="1 1"
min="0 0"
name="range" />
</DoubleVectorProperty>
<DoubleVectorProperty command="GetPosition"
information_only="1"
name="PositionInfo">
<SimpleDoubleInformationHelper />
</DoubleVectorProperty>
<DoubleVectorProperty command="SetPosition2"
default_values="0.08 0.08"
information_property="Position2Info"
name="Position2"
number_of_elements="2">
<DoubleRangeDomain max="1 1"
min="0 0"
name="range" />
</DoubleVectorProperty>
<DoubleVectorProperty command="GetPosition2"
information_only="1"
name="Position2Info">
<SimpleDoubleInformationHelper />