Commit 29029dbf authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot

Merge topic 'misc_lut_fixes'

4e0135cc Removed obsolete baselines (-static).
da193473 Fixed testing dependency for the module.
92aeb104 Fix AMRVolumeRendering test.
940d2fd9 Updating baselines.
93ac8e8e Restore UI state between tests.
0b5af771 Update default colorbar to show min/max labels.
be8a1268 Fix build issue after changes to pqColorChooserButton.
8a82cfeb Bring back grouping of tests.
570a5763 Add proper support for resetting a session.
bc8f7127 Update scalar-bar auto-placement logic.
8e183e34 Remove GlobalMapperProperties proxy from server setup.
c38395e2 Fixed serializing of CData in vtkPVXMLElement.
e4aad648 BUG #14773. Don't not pick default color array for Outline.
parents d063f6be 4e0135cc
......@@ -266,7 +266,10 @@ if (EXISTS "${smooth_flash}")
"${CMAKE_CURRENT_BINARY_DIR}/AMRVolumeRendering.xml" @ONLY)
set (streaming_tests
${CMAKE_CURRENT_BINARY_DIR}/AMRStreaming.xml
${CMAKE_CURRENT_BINARY_DIR}/AMRStreaming.xml)
# AMRVolumeRendering is a non-streaming test.
list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_BINARY_DIR}/AMRVolumeRendering.xml)
set(AMRVolumeRendering_BREAK TRUE)
......@@ -320,12 +323,6 @@ set(PolygonCellSelection_DISABLE_CRS TRUE)
set(PolygonPointSelection_DISABLE_CRS TRUE)
set(NonlinearSubdivisionDisplay_DISABLE_CRS TRUE)
# These tests should not be run along with those using the new panels
set(3DWidgetInCustomFilter_BREAK TRUE)
set(Threshold_BREAK TRUE)
set(ExodusModeShapes_BREAK TRUE)
set(DataOutlines_BREAK TRUE)
# These tests cannot be run using ctest -j since they are affected by focus
# changed events.
set (AnimatePipelineTime_FORCE_SERIAL TRUE)
......@@ -334,75 +331,25 @@ set (PolygonCellSelection_FORCE_SERIAL TRUE)
set (PolygonPointSelection_FORCE_SERIAL TRUE)
# Set properties for CTH tests
set(CTHAMRBaseline_BREAK TRUE)
set(CTHAMRContour_BREAK TRUE)
set(CTHAMRContour_DISABLE_CS TRUE)
set(CTHAMRContour_DISABLE_CRS TRUE)
set(CTHAMRDualClip_BREAK TRUE)
set(CTHAMRDualClip_DISABLE_CS TRUE)
set(CTHAMRDualClip_DISABLE_CRS TRUE)
set(CTHAMRClip_BREAK TRUE)
set(CTHAMRClip_DISABLE_CS TRUE)
set(CTHAMRClip_DISABLE_CRS TRUE)
set(CTHAMRMaterialInterfaceFilter_BREAK TRUE)
set(CTHAMRMaterialInterfaceFilter_DISABLE_CS TRUE)
set(CTHAMRMaterialInterfaceFilter_DISABLE_CRS TRUE)
set (TestIsoVolume_BREAK TRUE)
set (TabbedViews_BREAK TRUE)
# Since this test needs selection, disable in CRS mode.
set (SelectionLabels_BREAK TRUE)
set (SelectionLabels_DISABLE_CRS TRUE)
# Mark tests that change change state considerably requires a restart of the
# test suite when grouping tests together for faster playback.
SET (XdmfReadImageData_BREAK TRUE)
# <-- since this changes light kit.
SET (UndoRedo3_BREAK TRUE)
SET (UndoRedo6_BREAK TRUE)
# <-- since this changes view settings.
SET (UndoRedo1_BREAK TRUE)
SET (UndoRedo2_BREAK TRUE)
SET (UndoRedo7_BREAK TRUE)
# <-- since these are just long tests, they result in timeouts.
SET (BackgroundLights_BREAK TRUE)
SET (ViewSettingsDialog_BREAK TRUE)
SET (UnstructuredOutline_BREAK TRUE)
# <-- since this changes view settings.
set (ColorEditorControls_BREAK TRUE)
set (ColorEditorVolumeControls_BREAK TRUE)
set (ColorOpacityTableEditing_BREAK TRUE)
set (UpdateTransferFunctionRanges_BREAK TRUE)
set (GridConnectivity_BREAK TRUE)
set (H5PartReaderPlugin_BREAK TRUE)
SET (PlotEdges2_BREAK TRUE)
SET (PolygonCellSelection_BREAK TRUE)
SET (PolygonPointSelection_BREAK TRUE)
SET (PropertyConversion2_BREAK TRUE)
SET (PropertyConversion3_BREAK TRUE)
set (ReadXMLPolyDataFileSeries_BREAK TRUE)
set (ExodusXML_BREAK TRUE)
SET (ComparativeVisPanel_BREAK TRUE)
SET (ComparativeOverlay_BREAK TRUE)
SET (SpreadSheet1_BREAK TRUE)
SET (SPTimeseries_BREAK TRUE)
SET (TensorGlyph_BREAK TRUE)
SET (XYChart_BREAK TRUE)
SET (XYHistogram_BREAK TRUE)
set (ChartAxisRangeAndLabels_BREAK TRUE)
SET(ExtractLevel_BREAK TRUE)
SET(Fractal2D_BREAK TRUE)
# Add image threshold overrides for tests.
# Generally all tests with wireframes need higher thresholds.
SET (Flow2_THRESHOLD 15)
......@@ -424,7 +371,6 @@ SET (ColorEditorVolumeControls_THRESHOLD 300)
SET (SLACTools_DISABLE_CS TRUE)
SET (SLACTools_DISABLE_CRS TRUE)
SET (SLACTools_BREAK TRUE)
set (SLACTools_THRESHOLD 70)
# Plot image leeway.
......@@ -488,11 +434,6 @@ set (FFTOverTime_DISABLE_CRS TRUE)
set (FFTOverTime_THRESHOLD 70) # since there's a plot, account for minor
# rendering differences.
set (LoadStateMultiView_BREAK TRUE)
set (RenderNan_BREAK TRUE)
# ColorEditorVolumeControls does volume rendering of structrued data which required remote
# rendering in client-serve mode.
SET (ColorEditorVolumeControls_DISABLE_CS TRUE)
......
......@@ -130,9 +130,6 @@ MACRO (process_args out_extra_args)
ENDMACRO (process_args)
#Determine how many tests are to be grouped.
SET (TEST_GROUP_SIZE 3)
FUNCTION (add_pv_test prefix skip_test_flag_suffix)
PV_PARSE_ARGUMENTS(ACT "TEST_SCRIPTS;BASELINE_DIR;COMMAND;LOAD_PLUGIN;PLUGIN_PATH" "" ${ARGN})
while (ACT_TEST_SCRIPTS)
......@@ -140,6 +137,10 @@ FUNCTION (add_pv_test prefix skip_test_flag_suffix)
set (extra_args)
set (full_test_name)
set (force_serial FALSE)
# Leaving group size as 1.
# We need to fix "resetting" of application after each test correctly,
# before we re-enable to avoid flaky tests.
set (TEST_GROUP_SIZE 1)
while (${counter} LESS ${TEST_GROUP_SIZE})
list(LENGTH ACT_TEST_SCRIPTS num_tests)
......@@ -164,9 +165,6 @@ FUNCTION (add_pv_test prefix skip_test_flag_suffix)
set (full_test_name "${full_test_name}.${test_name}")
set (extra_args ${extra_args} "--test-script=${test}")
process_args(extra_args)
if (DEFINED ${test_name}_USE_OLD_PANELS)
set (extra_args ${extra_args} "--use-old-panels")
endif ()
endif (NOT ${test_name}${skip_test_flag_suffix})
endif (${counter} LESS 100000)
endif (num_tests)
......@@ -331,9 +329,6 @@ FUNCTION(add_multi_client_tests prefix)
set (extra_args)
set (use_old_panels)
process_args(extra_args)
if (DEFINED ${test_name}_USE_OLD_PANELS)
set (use_old_panels "--use-old-panels")
endif ()
ExternalData_add_test(ParaViewData
NAME "${prefix}.${test_name}"
......
......@@ -20,10 +20,10 @@
vtkStandardNewMacro(vtkPVXMLElement);
#include <ctype.h>
#include <string>
#include <vector>
#include <vtksys/ios/sstream>
#if defined(_WIN32) && !defined(__CYGWIN__)
# define SNPRINTF _snprintf
#else
......@@ -39,6 +39,19 @@ struct vtkPVXMLElementInternals
std::string CharacterData;
};
// Function to check if a string is full of whitespace characters.
static bool vtkIsSpace(const std::string& str)
{
for (std::string::size_type cc=0; cc< str.length(); ++cc)
{
if (!isspace(str[cc]))
{
return false;
}
}
return true;
}
//----------------------------------------------------------------------------
vtkPVXMLElement::vtkPVXMLElement()
{
......@@ -272,19 +285,33 @@ void vtkPVXMLElement::PrintXML(ostream& os, vtkIndent indent)
<< "=\"" << (aValue?sanitizedValue.c_str():"NoValue") << "\"";
}
size_t numberOfNestedElements = this->Internal->NestedElements.size();
if(numberOfNestedElements > 0)
bool hasCdata = !vtkIsSpace(this->Internal->CharacterData);
bool childlessNode = (numberOfNestedElements == 0) && (hasCdata == false);
if (childlessNode)
{
os << ">\n";
os << "/>\n";
return;
}
os << ">";
if (numberOfNestedElements > 0)
{
os << "\n";
for(i=0;i < numberOfNestedElements;++i)
{
vtkIndent nextIndent = indent.GetNextIndent();
this->Internal->NestedElements[i]->PrintXML(os, nextIndent);
}
os << indent << "</" << (this->Name?this->Name:"NoName") << ">\n";
}
if (hasCdata)
{
const std::string& encoded = vtkPVXMLElement::Encode(this->Internal->CharacterData.c_str());
os << encoded.c_str();
os << "</" << (this->Name?this->Name:"NoName") << ">\n";
}
else
{
os << "/>\n";
os << indent << "</" << (this->Name?this->Name:"NoName") << ">\n";
}
}
......@@ -561,6 +588,7 @@ vtkStdString vtkPVXMLElement::Encode(const char* plaintext)
const char toescape[] = { '&', '\'', '<', '>', '\"', '\r', '\n', '\t', 0};
size_t pt_length = strlen(plaintext);
sanitized.reserve(pt_length);
for (size_t cc = 0; cc < pt_length; cc++)
{
const char* escape_char = toescape;
......
......@@ -452,32 +452,11 @@ bool vtkSMParaViewPipelineController::InitializeSession(vtkSMSession* session)
//---------------------------------------------------------------------------
// Setup global settings/state for the visualization state.
// Create the GlobalMapperPropertiesProxy (optional)
// FIXME: these probably should not be created in collaboration mode on
// non-master nodes.
vtkSMProxy* proxy = vtkSafeNewProxy(pxm, "misc", "GlobalMapperProperties");
if (proxy)
{
this->InitializeProxy(proxy);
proxy->UpdateVTKObjects();
proxy->Delete();
}
// Create Strict Load Balancing Proxy
proxy = vtkSafeNewProxy(pxm, "misc", "StrictLoadBalancing");
if (proxy)
{
this->InitializeProxy(proxy);
proxy->UpdateVTKObjects();
proxy->Delete();
}
this->UpdateSettingsProxies(session);
//---------------------------------------------------------------------------
// Setup color palette and proxies for other global property groups (optional)
proxy = pxm->GetProxy("global_properties", "ColorPalette");
vtkSMProxy* proxy = pxm->GetProxy("global_properties", "ColorPalette");
if (!proxy)
{
proxy = vtkSafeNewProxy(pxm, "misc", "ColorPalette");
......@@ -982,6 +961,7 @@ bool vtkSMParaViewPipelineController::UnRegisterAnimationProxy(vtkSMProxy* proxy
return true;
}
//----------------------------------------------------------------------------
void vtkSMParaViewPipelineController::UpdateSettingsProxies(vtkSMSession* session)
{
// Set up the settings proxies
......@@ -1293,44 +1273,6 @@ bool vtkSMParaViewPipelineController::UnRegisterProxy(vtkSMProxy* proxy)
return false;
}
//----------------------------------------------------------------------------
bool vtkSMParaViewPipelineController::ResetSession(vtkSMSession* session)
{
if (!session)
{
return false;
}
// remove all proxies except this animation scene and time keeper.
std::set<vtkSMProxy*> to_preserve;
to_preserve.insert(this->FindTimeKeeper(session));
typedef std::vector<vtkWeakPointer<vtkSMProxy> > proxyvectortype;
proxyvectortype proxies;
vtkNew<vtkSMProxyIterator> iter;
iter->SetSessionProxyManager(session->GetSessionProxyManager());
for (iter->Begin(); !iter->IsAtEnd(); iter->Next())
{
vtkSMProxy* proxy = iter->GetProxy();
if (proxy != NULL &&
to_preserve.find(proxy) == to_preserve.end())
{
proxies.push_back(proxy);
}
}
for (proxyvectortype::iterator piter = proxies.begin(), max=proxies.end(); piter != max; ++piter)
{
if (piter->GetPointer())
{
this->UnRegisterProxy(piter->GetPointer());
}
}
// Now create new time-animation track.
this->InitializeSession(session);
return true;
}
//----------------------------------------------------------------------------
void vtkSMParaViewPipelineController::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -204,11 +204,6 @@ public:
// method.
virtual bool UnRegisterProxy(vtkSMProxy* proxy);
// Description:
// Resets the session to its initial state by cleaning all pipeline
// proxies and other non-essential proxies.
virtual bool ResetSession(vtkSMSession* session);
// Description:
// For a given proxy returns the name of the group used for helper proxies.
static vtkStdString GetHelperProxyGroupName(vtkSMProxy*);
......
......@@ -20,6 +20,7 @@
#include "vtkPVXMLElement.h"
#include "vtkSMMessage.h"
#include "vtkSMSession.h"
#include "vtkTimerLog.h"
#include <vtksys/ios/sstream>
......@@ -85,6 +86,7 @@ void vtkSMProxyDefinitionManager::SynchronizeDefinitions()
return;
}
vtkTimerLog::MarkStartEvent("Process Proxy definitions");
vtkSMMessage message;
this->SetLocation(vtkPVSession::SERVERS);
if (this->PullState(&message) == false)
......@@ -96,6 +98,7 @@ void vtkSMProxyDefinitionManager::SynchronizeDefinitions()
this->SetLocation(vtkPVSession::CLIENT_AND_SERVERS);
this->ProxyDefinitionManager->Push(&message);
vtkTimerLog::MarkEndEvent("Process Proxy definitions");
}
//----------------------------------------------------------------------------
void vtkSMProxyDefinitionManager::LoadState( const vtkSMMessage* msg,
......
......@@ -8,7 +8,7 @@ vtk_module(vtkPVServerManagerDefault
vtkPVClientServerCoreDefault
TEST_DEPENDS
vtkPVServerManagerApplication
vtkTestingCore
vtkTestingRendering
TEST_LABELS
PARAVIEW
)
......
......@@ -565,6 +565,9 @@ bool vtkSMPVRepresentationProxy::SetRepresentationType(const char* type)
}
if (this->SetScalarColoring(ald->GetString(index), ald->GetFieldAssociation(index)))
{
// Ensure that the transfer function is rescaled, as if user picked the array to color
// with from the UI. I wonder if SetScalarColoring should really take care of it.
this->RescaleTransferFunctionToDataRange(true);
throw CALL_SUPERCLASS;
}
}
......
......@@ -202,6 +202,42 @@ bool vtkSMParaViewPipelineControllerWithRendering::GetInheritRepresentationPrope
return vtkSMParaViewPipelineControllerWithRendering::InheritRepresentationProperties;
}
//----------------------------------------------------------------------------
bool vtkSMParaViewPipelineControllerWithRendering::PostInitializeProxy(vtkSMProxy* proxy)
{
// save current time, we can check is a property is modified by the superclass
// call.
vtkTimeStamp ts;
ts.Modified();
if (!this->Superclass::PostInitializeProxy(proxy))
{
return false;
}
// BUG #14773: The domains for ColorArrayName and Representation properties
// come up with a good default separately. In reality, we need the
// ColorArrayName to depend on Representation and not pick any value when
// using Outline representation. However, since ColorArrayName is on a property
// on a subproxy while Representation is a property on the outer proxy, we
// cannot add dependency between the two. So we explicitly manage that here.
// Note that if the user set the ColorArrayName manually, we should not be
// changing it here, hence the check of initTime.
vtkSMProperty* colorArrayName = proxy->GetProperty("ColorArrayName");
vtkSMProperty* representation = proxy->GetProperty("Representation");
if (colorArrayName && representation && (colorArrayName->GetMTime() > ts))
{
vtkSMPropertyHelper helperRep(representation);
if (helperRep.GetAsString(0) &&
strcmp(helperRep.GetAsString(0), "Outline") == 0)
{
vtkSMPropertyHelper helper(colorArrayName);
helper.SetInputArrayToProcess(helper.GetInputArrayAssociation(), "");
proxy->UpdateVTKObjects();
}
}
return true;
}
//----------------------------------------------------------------------------
bool vtkSMParaViewPipelineControllerWithRendering::RegisterRepresentationProxy(vtkSMProxy* proxy)
{
......
......@@ -104,6 +104,11 @@ public:
// well.
static void SetInheritRepresentationProperties(bool);
static bool GetInheritRepresentationProperties();
// Description:
// Overridden to handle default ColorArrayName for representations correctly.
virtual bool PostInitializeProxy(vtkSMProxy* proxy);
//BTX
protected:
vtkSMParaViewPipelineControllerWithRendering();
......
......@@ -22,7 +22,9 @@
#include "vtkScalarBarRepresentation.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxyProperty.h"
#include "vtkTuple.h"
#include <algorithm>
#include <string>
#include <vector>
#include <vtksys/ios/sstream>
......@@ -108,6 +110,8 @@ void vtkSMScalarBarWidgetRepresentationProxy::ExecuteEvent(unsigned long event)
}
repr->SetPosition(position);
}
// user interacted. lock the position.
vtkSMPropertyHelper(this, "LockPosition").Set(1);
}
this->Superclass::ExecuteEvent(event);
}
......@@ -181,12 +185,20 @@ namespace
return true;
}
inline double clamp(double val, double min, double max)
{
val = std::max(val, min);
val = std::min(val, max);
return val;
}
inline vtkBoundingBox GetBox(
const double anchor[2], const double position[2])
const vtkTuple<double, 2>& anchor,
const vtkTuple<double, 2>& size)
{
return vtkBoundingBox(
anchor[0], anchor[0] + position[0],
anchor[1], anchor[1] + position[1],
clamp(anchor[0], 0, 1), clamp(anchor[0] + size[0], 0, 1),
clamp(anchor[1], 0, 1), clamp(anchor[1] + size[1], 0, 1),
0, 0);
}
};
......@@ -194,7 +206,7 @@ namespace
//----------------------------------------------------------------------------
bool vtkSMScalarBarWidgetRepresentationProxy::PlaceInView(vtkSMProxy* view)
{
if (!view)
if (!view || vtkSMPropertyHelper(this, "LockPosition", /*quiet*/true).GetAsInt() == 1)
{
return false;
}
......@@ -209,7 +221,7 @@ bool vtkSMScalarBarWidgetRepresentationProxy::PlaceInView(vtkSMProxy* view)
vtkSMProxy* repr = reprHelper.GetAsProxy(cc);
if (repr != this &&
vtkSMScalarBarWidgetRepresentationProxy::SafeDownCast(repr) &&
vtkSMPropertyHelper(repr, "Visibility").GetAsInt() == 1)
vtkSMPropertyHelper(repr, "Visibility", /*quiet*/true).GetAsInt() == 1)
{
double pos1[2], pos2[2];
vtkSMPropertyHelper(repr, "Position").Get(pos1, 2);
......@@ -222,49 +234,83 @@ bool vtkSMScalarBarWidgetRepresentationProxy::PlaceInView(vtkSMProxy* view)
}
}
double mysize[2];
bool isVertical = (vtkSMPropertyHelper(this, "Orientation").GetAsInt() == 1);
double aspect = vtkSMPropertyHelper(this, "AspectRatio").GetAsDouble();
aspect = aspect? aspect : 20;
vtkTuple<double,2> mysize;
vtkSMPropertyHelper pos2Helper(this, "Position2");
pos2Helper.Get(mysize, 2);
pos2Helper.Get(mysize.GetData(), 2);
// if size is invalid, fix it.
if (mysize[0] <= 0.0) { mysize[0] = 0.23; }
if (mysize[1] <= 0.0) { mysize[1] = 0.13; }
pos2Helper.Set(mysize, 2);
pos2Helper.Set(mysize.GetData(), 2);
double myanchor[2];
vtkTuple<double,2> myanchor;
vtkSMPropertyHelper posHelper(this, "Position");
posHelper.Get(myanchor, 2);
posHelper.Get(myanchor.GetData(), 2);
// if this scalar bar's current position is available, we don't bother moving
// it at all.
if (IsAvailable(GetBox(myanchor, mysize), occupiedBoxes))
vtkBoundingBox mybox = GetBox(myanchor, mysize);
// let call mybox as (x1,y1):(x2,y2)
if (IsAvailable(mybox, occupiedBoxes))
{
// scalar bar doesn't need to be moved at all.
// current position and if available, just return.
this->UpdateVTKObjects();
return true;
}
// FIXME: to respect mysize. Right now I'm just ignoring it.
// We try the 4 corners first starting with the lower-right corner.
const double anchorPositions[8][2] =
std::vector<vtkBoundingBox> regions;
regions.push_back(mybox); // although we've tested mybox, we add
// it to the regions since it makes it easier to build the regions list.
// flip mybox along X axis i.e. (x1, 1-y2):(x2, 1-y1)
regions.push_back(vtkBoundingBox(
// xmin, xmax
mybox.GetMinPoint()[0], mybox.GetMaxPoint()[0],
// ymin, ymax
1.0 - mybox.GetMaxPoint()[1], 1.0 - mybox.GetMinPoint()[1],
// zmin, zmax
0, 0));
// flip both mybox and the flipped-X box along Y axis.
// i.e. (1-x2, y1):(1-x1: y2) and (1-x2, 1-y2):(1-x1, 1-y1)
for (int cc=1; cc >=0; cc--)
{
// four corners first, starting with lower right.
{0.75, 0.05},
{0.75, 0.90},
{0.02, 0.90},
{0.02, 0.05},
// 4 centers next.
{0.30, 0.05},
{0.75, 0.40},
{0.30, 0.90},
{0.02, 0.40}
};
for (int kk=0; kk < 8; ++kk)
const vtkBoundingBox& bbox = regions[cc];
double maxX = 1.0 - bbox.GetMinPoint()[0];
double minX = 1.0 - bbox.GetMaxPoint()[0];
if (isVertical)
{
// Vertical scalar bars like to stick on the left edge of the bounding box.
// That results in the scalar bar getting too close the egde on flipping
// along Y axis. So we adjust it by offsetting the X position.
double barWidth = bbox.GetLength(1)/aspect;
double deltaX = maxX - minX;
minX = clamp(maxX - barWidth, 0, 1);
maxX = clamp(minX + deltaX, 0, 1);
}
vtkBoundingBox flippedYBox(
// xmin, xmax
//1.0 - bbox.GetMaxPoint()[0], 1.0 - bbox.GetMinPoint()[0],
minX, maxX,
// ymin, ymax
bbox.GetMinPoint()[1], bbox.GetMaxPoint()[1],
// zmin, zmax
0, 0);
regions.push_back(flippedYBox);
}
// we skip the front since we already tested it.
for (size_t cc=1; cc < regions.size(); ++cc)
{
vtkBoundingBox mybox = GetBox(anchorPositions[kk], mysize);
if (IsAvailable(mybox, occupiedBoxes))
const vtkBoundingBox &curbox = regions[cc];
if (IsAvailable(curbox, occupiedBoxes))
{
posHelper.Set(anchorPositions[kk], 2);
posHelper.Set(curbox.GetMinPoint(), 2);
double lengths[3];
curbox.GetLengths(lengths);
pos2Helper.Set(lengths, 2);
break;
}
}
......
......@@ -368,6 +368,16 @@
name="UseNonCompositedRenderer"
number_of_elements="1"
panel_visibility="never"></IntVectorProperty>
<IntVectorProperty default_values="0"
name="LockPosition"
number_of_elements="1"