Commit 30d39a0e authored by whitlocb's avatar whitlocb
Browse files

Change how selection apply vs update is done.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@15881 18c085ea-50e0-402c-830e-de6fd14e8384
parent 97adf34d
......@@ -178,7 +178,6 @@ void SelectionProperties::Init()
histogramStartBin = 0;
histogramEndBin = 9;
histogramVariableIndex = -1;
updateSelection = false;
SelectionProperties::SelectAll();
}
......@@ -215,7 +214,6 @@ void SelectionProperties::Copy(const SelectionProperties &obj)
histogramStartBin = obj.histogramStartBin;
histogramEndBin = obj.histogramEndBin;
histogramVariableIndex = obj.histogramVariableIndex;
updateSelection = obj.updateSelection;
SelectionProperties::SelectAll();
}
......@@ -387,8 +385,7 @@ SelectionProperties::operator == (const SelectionProperties &obj) const
(histogramNumBins == obj.histogramNumBins) &&
(histogramStartBin == obj.histogramStartBin) &&
(histogramEndBin == obj.histogramEndBin) &&
(histogramVariableIndex == obj.histogramVariableIndex) &&
(updateSelection == obj.updateSelection));
(histogramVariableIndex == obj.histogramVariableIndex));
}
// ****************************************************************************
......@@ -547,7 +544,6 @@ SelectionProperties::SelectAll()
Select(ID_histogramStartBin, (void *)&histogramStartBin);
Select(ID_histogramEndBin, (void *)&histogramEndBin);
Select(ID_histogramVariableIndex, (void *)&histogramVariableIndex);
Select(ID_updateSelection, (void *)&updateSelection);
}
///////////////////////////////////////////////////////////////////////////////
......@@ -670,12 +666,6 @@ SelectionProperties::CreateNode(DataNode *parentNode, bool completeSave, bool fo
node->AddNode(new DataNode("histogramVariableIndex", histogramVariableIndex));
}
if(completeSave || !FieldsEqual(ID_updateSelection, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("updateSelection", updateSelection));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
......@@ -784,8 +774,6 @@ SelectionProperties::SetFromNode(DataNode *parentNode)
SetHistogramEndBin(node->AsInt());
if((node = searchNode->GetNode("histogramVariableIndex")) != 0)
SetHistogramVariableIndex(node->AsInt());
if((node = searchNode->GetNode("updateSelection")) != 0)
SetUpdateSelection(node->AsBool());
}
///////////////////////////////////////////////////////////////////////////////
......@@ -897,13 +885,6 @@ SelectionProperties::SetHistogramVariableIndex(int histogramVariableIndex_)
Select(ID_histogramVariableIndex, (void *)&histogramVariableIndex);
}
void
SelectionProperties::SetUpdateSelection(bool updateSelection_)
{
updateSelection = updateSelection_;
Select(ID_updateSelection, (void *)&updateSelection);
}
///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -1028,12 +1009,6 @@ SelectionProperties::GetHistogramVariableIndex() const
return histogramVariableIndex;
}
bool
SelectionProperties::GetUpdateSelection() const
{
return updateSelection;
}
///////////////////////////////////////////////////////////////////////////////
// Select property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -1107,7 +1082,6 @@ SelectionProperties::GetFieldName(int index) const
case ID_histogramStartBin: return "histogramStartBin";
case ID_histogramEndBin: return "histogramEndBin";
case ID_histogramVariableIndex: return "histogramVariableIndex";
case ID_updateSelection: return "updateSelection";
default: return "invalid index";
}
}
......@@ -1147,7 +1121,6 @@ SelectionProperties::GetFieldType(int index) const
case ID_histogramStartBin: return FieldType_int;
case ID_histogramEndBin: return FieldType_int;
case ID_histogramVariableIndex: return FieldType_int;
case ID_updateSelection: return FieldType_bool;
default: return FieldType_unknown;
}
}
......@@ -1187,7 +1160,6 @@ SelectionProperties::GetFieldTypeName(int index) const
case ID_histogramStartBin: return "int";
case ID_histogramEndBin: return "int";
case ID_histogramVariableIndex: return "int";
case ID_updateSelection: return "bool";
default: return "invalid index";
}
}
......@@ -1289,11 +1261,6 @@ SelectionProperties::FieldsEqual(int index_, const AttributeGroup *rhs) const
retval = (histogramVariableIndex == obj.histogramVariableIndex);
}
break;
case ID_updateSelection:
{ // new scope
retval = (updateSelection == obj.updateSelection);
}
break;
default: retval = false;
}
......
......@@ -126,7 +126,6 @@ public:
void SetHistogramStartBin(int histogramStartBin_);
void SetHistogramEndBin(int histogramEndBin_);
void SetHistogramVariableIndex(int histogramVariableIndex_);
void SetUpdateSelection(bool updateSelection_);
// Property getting methods
const std::string &GetName() const;
......@@ -149,7 +148,6 @@ public:
int GetHistogramStartBin() const;
int GetHistogramEndBin() const;
int GetHistogramVariableIndex() const;
bool GetUpdateSelection() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -199,7 +197,6 @@ public:
ID_histogramStartBin,
ID_histogramEndBin,
ID_histogramVariableIndex,
ID_updateSelection,
ID__LAST
};
......@@ -219,12 +216,11 @@ private:
int histogramStartBin;
int histogramEndBin;
int histogramVariableIndex;
bool updateSelection;
// Static class format string for type map.
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define SELECTIONPROPERTIES_TMFS "ssis*d*d*iiiiiiiiib"
#define SELECTIONPROPERTIES_TMFS "ssis*d*d*iiiiiiiii"
#endif
......@@ -54,9 +54,6 @@
<Field name="histogramVariableIndex" label="Histogram variable index" type="int">
-1
</Field>
<Field name="updateSelection" label="Update Selection" type="bool">
false
</Field>
<Function name="GetOriginatingPlot" user="true" member="true">
</Function>
<Function name="SetOriginatingPlot" user="true" member="true">
......
......@@ -73,6 +73,9 @@
#include <QvisVariableButton.h>
#include <QvisVariableListLimiter.h>
#define DEFAULT_FORCE_UPDATE false
#define DEFAULT_UPDATE_PLOTS true
// ****************************************************************************
// Method: QvisSelectionsWindow::QvisSelectionsWindow
//
......@@ -726,11 +729,13 @@ QvisSelectionsWindow::GetCurrentValues(int which_widget)
// Creation: Fri Aug 6 15:44:09 PDT 2010
//
// Modifications:
//
// Brad Whitlock, Mon Aug 22 16:42:43 PDT 2011
// I added an updatePlots argument.
//
// ****************************************************************************
void
QvisSelectionsWindow::Apply(bool forceUpdate)
QvisSelectionsWindow::Apply(bool forceUpdate, bool updatePlots)
{
if(forceUpdate || AutoUpdate())
{
......@@ -738,7 +743,8 @@ QvisSelectionsWindow::Apply(bool forceUpdate)
if(selectionListBox->currentItem() != 0)
{
GetViewerMethods()->UpdateNamedSelection(selectionProps.GetName(), selectionProps);
GetViewerMethods()->UpdateNamedSelection(selectionProps.GetName(),
selectionProps, updatePlots);
}
}
}
......@@ -820,7 +826,7 @@ QvisSelectionsWindow::UpdateHistogram(const double *values, int nvalues,
minBin = 0;
maxBin = nvalues-1;
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
UpdateMinMaxBins(true, true, true);
}
......@@ -1476,8 +1482,8 @@ QvisSelectionsWindow::deleteSelection()
void
QvisSelectionsWindow::updateQuery()
{
selectionProps.SetUpdateSelection(false);
Apply(true);
// Force an update of the selection but do not update the plots that use it.
Apply(true, false);
}
// ****************************************************************************
......@@ -1498,8 +1504,8 @@ QvisSelectionsWindow::updateQuery()
void
QvisSelectionsWindow::updateSelection()
{
selectionProps.SetUpdateSelection(true);
Apply(true);
// Force an update of the selection and update the plots that use it.
Apply(true, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1607,7 +1613,7 @@ QvisSelectionsWindow::cumulativeQueryClicked(bool value)
{
selectionProps.SetSelectionType(value ? SelectionProperties::CumulativeQuerySelection :
SelectionProperties::BasicSelection);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1635,7 +1641,7 @@ QvisSelectionsWindow::addVariable(const QString &var)
// Update the window using the new selectionProps.
UpdateSelectionProperties();
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1666,7 +1672,7 @@ QvisSelectionsWindow::setVariableRange(const QString &var, float r0, float r1)
{
selectionProps.GetVariableMins()[i] = r0;
selectionProps.GetVariableMaxs()[i] = r1;
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
return;
}
}
......@@ -1710,7 +1716,7 @@ QvisSelectionsWindow::deleteVariable(const QString &var)
selectionProps.SetVariableMins(newmin);
selectionProps.SetVariableMaxs(newmax);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
return;
}
}
......@@ -1739,7 +1745,7 @@ QvisSelectionsWindow::summationChanged(int val)
selectionProps.SetCombineRule(SelectionProperties::CombineOr);
else
selectionProps.SetCombineRule(SelectionProperties::CombineAnd);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1759,7 +1765,7 @@ void
QvisSelectionsWindow::processTimeMin()
{
GetCurrentValues(SelectionProperties::ID_minTimeState);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1779,7 +1785,7 @@ void
QvisSelectionsWindow::processTimeMax()
{
GetCurrentValues(SelectionProperties::ID_maxTimeState);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1799,7 +1805,7 @@ void
QvisSelectionsWindow::processTimeStride()
{
GetCurrentValues(SelectionProperties::ID_timeStateStride);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1818,7 +1824,7 @@ QvisSelectionsWindow::processTimeStride()
void
QvisSelectionsWindow::initializeVariableList()
{
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
// Ask the viewer to populate the selection's variables using the
// current plot's attributes.
......@@ -1880,7 +1886,7 @@ QvisSelectionsWindow::histogramTypeChanged(int value)
break;
}
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
UpdateHistogram(0,0,0,0,false); // invalidate the histogram
UpdateHistogramTitle();
......@@ -1916,7 +1922,7 @@ void
QvisSelectionsWindow::histogramVariableChanged(int index)
{
selectionProps.SetHistogramVariableIndex(index);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
}
// ****************************************************************************
......@@ -1951,7 +1957,7 @@ QvisSelectionsWindow::histogramNumBinsChanged(int index)
selectionProps.SetHistogramStartBin(b0);
selectionProps.SetHistogramEndBin(b1);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
UpdateMinMaxBins(true, true, true);
}
......@@ -1977,7 +1983,7 @@ QvisSelectionsWindow::histogramStartChanged(int index)
{
selectionProps.SetHistogramStartBin(index);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
UpdateMinMaxBins(false, true, false);
UpdateHistogram();
......@@ -2004,7 +2010,7 @@ QvisSelectionsWindow::histogramEndChanged(int index)
{
selectionProps.SetHistogramEndBin(index);
Apply();
Apply(DEFAULT_FORCE_UPDATE, DEFAULT_UPDATE_PLOTS);
UpdateMinMaxBins(true, false, false);
UpdateHistogram();
}
......@@ -108,7 +108,7 @@ protected:
void UpdateHistogram();
void UpdateHistogramTitle();
void UpdateMinMaxBins(bool, bool, bool);
void Apply(bool forceUpdate = false);
void Apply(bool forceUpdate, bool updatePlots);
void GetCurrentValues(int);
QString GetLoadHost() const;
......
......@@ -58,7 +58,7 @@ import java.lang.Double;
public class SelectionProperties extends AttributeSubject
{
private static int SelectionProperties_numAdditionalAtts = 16;
private static int SelectionProperties_numAdditionalAtts = 15;
// Enum values
public final static int SELECTIONTYPE_BASICSELECTION = 0;
......@@ -83,7 +83,6 @@ public class SelectionProperties extends AttributeSubject
variables = new Vector();
variableMins = new Vector();
variableMaxs = new Vector();
timeEnabled = true;
minTimeState = 0;
maxTimeState = -1;
timeStateStride = 1;
......@@ -105,7 +104,6 @@ public class SelectionProperties extends AttributeSubject
variables = new Vector();
variableMins = new Vector();
variableMaxs = new Vector();
timeEnabled = true;
minTimeState = 0;
maxTimeState = -1;
timeStateStride = 1;
......@@ -144,7 +142,6 @@ public class SelectionProperties extends AttributeSubject
variableMaxs.addElement(new Double(dv.doubleValue()));
}
timeEnabled = obj.timeEnabled;
minTimeState = obj.minTimeState;
maxTimeState = obj.maxTimeState;
timeStateStride = obj.timeStateStride;
......@@ -206,7 +203,6 @@ public class SelectionProperties extends AttributeSubject
variables_equal &&
variableMins_equal &&
variableMaxs_equal &&
(timeEnabled == obj.timeEnabled) &&
(minTimeState == obj.minTimeState) &&
(maxTimeState == obj.maxTimeState) &&
(timeStateStride == obj.timeStateStride) &&
......@@ -255,83 +251,76 @@ public class SelectionProperties extends AttributeSubject
Select(5);
}
public void SetTimeEnabled(boolean timeEnabled_)
{
timeEnabled = timeEnabled_;
Select(6);
}
public void SetMinTimeState(int minTimeState_)
{
minTimeState = minTimeState_;
Select(7);
Select(6);
}
public void SetMaxTimeState(int maxTimeState_)
{
maxTimeState = maxTimeState_;
Select(8);
Select(7);
}
public void SetTimeStateStride(int timeStateStride_)
{
timeStateStride = timeStateStride_;
Select(9);
Select(8);
}
public void SetCombineRule(int combineRule_)
{
combineRule = combineRule_;
Select(10);
Select(9);
}
public void SetHistogramType(int histogramType_)
{
histogramType = histogramType_;
Select(11);
Select(10);
}
public void SetHistogramNumBins(int histogramNumBins_)
{
histogramNumBins = histogramNumBins_;
Select(12);
Select(11);
}
public void SetHistogramStartBin(int histogramStartBin_)
{
histogramStartBin = histogramStartBin_;
Select(13);
Select(12);
}
public void SetHistogramEndBin(int histogramEndBin_)
{
histogramEndBin = histogramEndBin_;
Select(14);
Select(13);
}
public void SetHistogramVariableIndex(int histogramVariableIndex_)
{
histogramVariableIndex = histogramVariableIndex_;
Select(15);
Select(14);
}
// Property getting methods
public String GetName() { return name; }
public String GetSource() { return source; }
public int GetSelectionType() { return selectionType; }
public Vector GetVariables() { return variables; }
public Vector GetVariableMins() { return variableMins; }
public Vector GetVariableMaxs() { return variableMaxs; }
public boolean GetTimeEnabled() { return timeEnabled; }
public int GetMinTimeState() { return minTimeState; }
public int GetMaxTimeState() { return maxTimeState; }
public int GetTimeStateStride() { return timeStateStride; }
public int GetCombineRule() { return combineRule; }
public int GetHistogramType() { return histogramType; }
public int GetHistogramNumBins() { return histogramNumBins; }
public int GetHistogramStartBin() { return histogramStartBin; }
public int GetHistogramEndBin() { return histogramEndBin; }
public int GetHistogramVariableIndex() { return histogramVariableIndex; }
public String GetName() { return name; }
public String GetSource() { return source; }
public int GetSelectionType() { return selectionType; }
public Vector GetVariables() { return variables; }
public Vector GetVariableMins() { return variableMins; }
public Vector GetVariableMaxs() { return variableMaxs; }
public int GetMinTimeState() { return minTimeState; }
public int GetMaxTimeState() { return maxTimeState; }
public int GetTimeStateStride() { return timeStateStride; }
public int GetCombineRule() { return combineRule; }
public int GetHistogramType() { return histogramType; }
public int GetHistogramNumBins() { return histogramNumBins; }
public int GetHistogramStartBin() { return histogramStartBin; }
public int GetHistogramEndBin() { return histogramEndBin; }
public int GetHistogramVariableIndex() { return histogramVariableIndex; }
// Write and read methods.
public void WriteAtts(CommunicationBuffer buf)
......@@ -349,24 +338,22 @@ public class SelectionProperties extends AttributeSubject
if(WriteSelect(5, buf))
buf.WriteDoubleVector(variableMaxs);
if(WriteSelect(6, buf))
buf.WriteBool(timeEnabled);
if(WriteSelect(7, buf))
buf.WriteInt(minTimeState);
if(WriteSelect(8, buf))
if(WriteSelect(7, buf))
buf.WriteInt(maxTimeState);
if(WriteSelect(9, buf))
if(WriteSelect(8, buf))
buf.WriteInt(timeStateStride);
if(WriteSelect(10, buf))
if(WriteSelect(9, buf))
buf.WriteInt(combineRule);
if(WriteSelect(11, buf))
if(WriteSelect(10, buf))
buf.WriteInt(histogramType);
if(WriteSelect(12, buf))
if(WriteSelect(11, buf))
buf.WriteInt(histogramNumBins);
if(WriteSelect(13, buf))
if(WriteSelect(12, buf))
buf.WriteInt(histogramStartBin);
if(WriteSelect(14, buf))
if(WriteSelect(13, buf))
buf.WriteInt(histogramEndBin);
if(WriteSelect(15, buf))
if(WriteSelect(14, buf))
buf.WriteInt(histogramVariableIndex);
}
......@@ -393,33 +380,30 @@ public class SelectionProperties extends AttributeSubject
SetVariableMaxs(buf.ReadDoubleVector());
break;
case 6:
SetTimeEnabled(buf.ReadBool());
break;
case 7:
SetMinTimeState(buf.ReadInt());
break;
case 8:
case 7:
SetMaxTimeState(buf.ReadInt());
break;
case 9:
case 8:
SetTimeStateStride(buf.ReadInt());
break;
case 10:
case 9:
SetCombineRule(buf.ReadInt());
break;
case 11:
case 10:
SetHistogramType(buf.ReadInt());
break;
case 12:
case 11:
SetHistogramNumBins(buf.ReadInt());
break;
case 13:
case 12:
SetHistogramStartBin(buf.ReadInt());
break;
case 14:
case 13:
SetHistogramEndBin(buf.ReadInt());
break;
case 15:
case 14:
SetHistogramVariableIndex(buf.ReadInt());
break;
}
......@@ -439,7 +423,6 @@ public class SelectionProperties extends AttributeSubject
str = str + stringVectorToString("variables", variables, indent) + "\n";
str = str + doubleVectorToString("variableMins", variableMins, indent) + "\n";
str = str + doubleVectorToString("variableMaxs", variableMaxs, indent) + "\n";
str = str + boolToString("timeEnabled", timeEnabled, indent) + "\n";
str = str + intToString("minTimeState", minTimeState, indent) + "\n";
str = str + intToString("maxTimeState", maxTimeState, indent) + "\n";
str = str + intToString("timeStateStride", timeStateStride, indent) + "\n";
......@@ -468,21 +451,20 @@ public class SelectionProperties extends AttributeSubject
// Attributes
private String name;
private String source;
private int selectionType;
private Vector variables; // vector of String objects
private Vector variableMins; // vector of Double objects
private Vector variableMaxs; // vector of Double objects
private boolean timeEnabled;
private int minTimeState;
private int maxTimeState;
private int timeStateStride;
private int combineRule;
private int histogramType;
private int histogramNumBins;
private int histogramStartBin;
private int histogramEndBin;
private int histogramVariableIndex;
private String name;
private String source;
private int selectionType;
private Vector variables; // vector of String objects
private Vector variableMins; // vector of Double objects
private Vector variableMaxs; // vector of Double objects
private int minTimeState;
private int maxTimeState;
private int timeStateStride;
private int combineRule;
private int histogramType;
private int histogramNumBins;
private int histogramStartBin;
private int histogramEndBin;
private int histogramVariableIndex;
}
......@@ -3454,12 +3454,15 @@ public class ViewerMethods
* Updates a named selection.
*
* @param selName The name of the named selection to update.