Commit 3e8b7c00 authored by allens's avatar allens

added cropping to the curve operation

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23531 18c085ea-50e0-402c-830e-de6fd14e8384
parent 250e29f7
......@@ -238,8 +238,6 @@ IntegralCurveAttributes::ChangesRequireRecalculation(const IntegralCurveAttribut
fieldConstant != obj.fieldConstant ||
integrationType != obj.integrationType ||
coordinateSystem != obj.coordinateSystem ||
phiScalingFlag != obj.phiScalingFlag ||
phiScaling != obj.phiScaling ||
maxStepLength != obj.maxStepLength ||
maxTimeStep != obj.maxTimeStep ||
limitMaximumTimestep != obj.limitMaximumTimestep ||
......
......@@ -35,6 +35,11 @@
Difference
Variable
</Enum>
<Enum name="CropValue">
Distance
Time
StepNumber
</Enum>
<Enum name="DisplayGeometry">
Lines
Tubes
......@@ -243,18 +248,27 @@
<Field name="coordinateSystem" label="coordinateSystem" type="enum" subtype="CoordinateSystem">
AsIs
</Field>
<Field name="phiScalingFlag" label="Phi scaling" type="bool">
false
</Field>
<Field name="phiScaling" label="Phi scaling" type="double">
1.000000
</Field>
<Field name="showLines" label="Show Lines" type="bool">
true
</Field>
<Field name="showPoints" label="Show Points" type="bool">
false
</Field>
<Field name="cropBeginFlag" label="Crop from" type="bool">
false
</Field>
<Field name="cropBegin" label="cropBegin" type="double">
0
</Field>
<Field name="cropEndFlag" label="Crop to" type="bool">
false
</Field>
<Field name="cropEnd" label="cropEnd" type="double">
0
</Field>
<Field name="cropValue" label="Crop value" type="enum" subtype="CropValue">
Time
</Field>
<Field name="sampleDistance0" label="sampleDistance0" type="double">
10.000000
</Field>
......
......@@ -85,6 +85,12 @@ public:
Difference,
Variable
};
enum CropValue
{
Distance,
Time,
StepNumber
};
enum DisplayGeometry
{
Lines,
......@@ -223,10 +229,13 @@ public:
void SetPathlinesCMFE(PathlinesCMFE pathlinesCMFE_);
void SetDisplayGeometry(DisplayGeometry displayGeometry_);
void SetCoordinateSystem(CoordinateSystem coordinateSystem_);
void SetPhiScalingFlag(bool phiScalingFlag_);
void SetPhiScaling(double phiScaling_);
void SetShowLines(bool showLines_);
void SetShowPoints(bool showPoints_);
void SetCropBeginFlag(bool cropBeginFlag_);
void SetCropBegin(double cropBegin_);
void SetCropEndFlag(bool cropEndFlag_);
void SetCropEnd(double cropEnd_);
void SetCropValue(CropValue cropValue_);
void SetSampleDistance0(double sampleDistance0_);
void SetSampleDistance1(double sampleDistance1_);
void SetSampleDistance2(double sampleDistance2_);
......@@ -302,10 +311,13 @@ public:
PathlinesCMFE GetPathlinesCMFE() const;
DisplayGeometry GetDisplayGeometry() const;
CoordinateSystem GetCoordinateSystem() const;
bool GetPhiScalingFlag() const;
double GetPhiScaling() const;
bool GetShowLines() const;
bool GetShowPoints() const;
bool GetCropBeginFlag() const;
double GetCropBegin() const;
bool GetCropEndFlag() const;
double GetCropEnd() const;
CropValue GetCropValue() const;
double GetSampleDistance0() const;
double GetSampleDistance1() const;
double GetSampleDistance2() const;
......@@ -339,6 +351,11 @@ public:
static bool DataValue_FromString(const std::string &, DataValue &);
protected:
static std::string DataValue_ToString(int);
public:
static std::string CropValue_ToString(CropValue);
static bool CropValue_FromString(const std::string &, CropValue &);
protected:
static std::string CropValue_ToString(int);
public:
static std::string DisplayGeometry_ToString(DisplayGeometry);
static bool DisplayGeometry_FromString(const std::string &, DisplayGeometry &);
......@@ -437,10 +454,13 @@ public:
ID_pathlinesCMFE,
ID_displayGeometry,
ID_coordinateSystem,
ID_phiScalingFlag,
ID_phiScaling,
ID_showLines,
ID_showPoints,
ID_cropBeginFlag,
ID_cropBegin,
ID_cropEndFlag,
ID_cropEnd,
ID_cropValue,
ID_sampleDistance0,
ID_sampleDistance1,
ID_sampleDistance2,
......@@ -507,10 +527,13 @@ private:
int pathlinesCMFE;
int displayGeometry;
int coordinateSystem;
bool phiScalingFlag;
double phiScaling;
bool showLines;
bool showPoints;
bool cropBeginFlag;
double cropBegin;
bool cropEndFlag;
double cropEnd;
int cropValue;
double sampleDistance0;
double sampleDistance1;
double sampleDistance2;
......@@ -533,6 +556,6 @@ private:
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define INTEGRALCURVEATTRIBUTES_TMFS "iDDDDDDdDDbd*iiiisiibdbddbddiddidDiiiiibbddiiibdbbdddbbiibbbbddddis"
#define INTEGRALCURVEATTRIBUTES_TMFS "iDDDDDDdDDbd*iiiisiibdbddbddiddidDiiiiibbddiiibbbdbdidddbbiibbbbddddis"
#endif
......@@ -44,7 +44,7 @@
//
// Functions exposed to the VisIt module.
//
#define INTEGRALCURVEATTRIBUTES_NMETH 134
#define INTEGRALCURVEATTRIBUTES_NMETH 140
void PyIntegralCurveAttributes_StartUp(IntegralCurveAttributes *subj, void *data);
void PyIntegralCurveAttributes_CloseDown();
PyMethodDef * PyIntegralCurveAttributes_GetMethodTable(int *nMethods);
......
......@@ -833,7 +833,6 @@ QvisIntegralCurveWindow::CreateAppearanceTab(QWidget *pageAppearance)
QGridLayout *coordinateLayout = new QGridLayout(coordinateGrp);
coordinateLayout->setMargin(5);
coordinateLayout->setSpacing(10);
coordinateLayout->setColumnStretch(2,10);
coordinateButtonGroup = new QButtonGroup(coordinateGrp);
QRadioButton *asIsButton = new QRadioButton(tr("None"), coordinateGrp);
......@@ -850,18 +849,41 @@ QvisIntegralCurveWindow::CreateAppearanceTab(QWidget *pageAppearance)
connect(coordinateButtonGroup, SIGNAL(buttonClicked(int)), this,
SLOT(coordinateButtonGroupChanged(int)));
// Create the widgets that specify a phi scaling.
phiScalingToggle = new QCheckBox(tr("Phi scaling"), central);
coordinateLayout->addWidget(phiScalingToggle, 1, 0);
connect(phiScalingToggle, SIGNAL(toggled(bool)),
this, SLOT(phiScalingToggled(bool)));
// Create the crop group
QGroupBox *cropGrp = new QGroupBox(pageAppearance);
cropGrp->setTitle(tr("Crop a portion of the integral curve (for animations)"));
mainLayout->addWidget(cropGrp, 3, 0);
phiScaling = new QLineEdit(coordinateGrp);
connect(phiScaling, SIGNAL(returnPressed()),
this, SLOT(phiScalingProcessText()));
coordinateLayout->addWidget(phiScaling, 1, 1);
QGridLayout *cropLayout = new QGridLayout(cropGrp);
cropLayout->setMargin(5);
cropLayout->setSpacing(10);
coordinateLayout->addWidget(new QLabel(tr("(When displaying in cylindrical coordinates.)"), central), 1, 2, 1, 2);
cropBeginFlag = new QCheckBox(tr("Crop from"), cropGrp);
connect(cropBeginFlag, SIGNAL(toggled(bool)), this, SLOT(cropBeginFlagChanged(bool)));
cropLayout->addWidget(cropBeginFlag, 0, 0);
cropBegin = new QLineEdit(cropGrp);
connect(cropBegin, SIGNAL(returnPressed()), this, SLOT(cropBeginProcessText()));
cropLayout->addWidget(cropBegin, 0, 1);
cropEndFlag = new QCheckBox(tr("To"), cropGrp);
connect(cropEndFlag, SIGNAL(toggled(bool)), this, SLOT(cropEndFlagChanged(bool)));
cropLayout->addWidget(cropEndFlag, 0, 2);
cropEnd = new QLineEdit(cropGrp);
connect(cropEnd, SIGNAL(returnPressed()), this, SLOT(cropEndProcessText()));
cropLayout->addWidget(cropEnd, 0, 3);
QLabel *cropValueLabel = new QLabel(tr("Crop value"), cropGrp);
cropLayout->addWidget(cropValueLabel, 1, 0);
cropValueComboBox = new QComboBox(cropGrp);
cropValueComboBox->addItem(tr("Distance"));
cropValueComboBox->addItem(tr("Time"));
cropValueComboBox->addItem(tr("Step numbers"));
connect(cropValueComboBox, SIGNAL(activated(int)), this, SLOT(cropValueChanged(int)));
cropLayout->addWidget(cropValueComboBox, 1, 1);
// Streamlines/Pathline Group.
QGroupBox *icGrp = new QGroupBox(pageAppearance);
......@@ -1330,7 +1352,7 @@ QvisIntegralCurveWindow::UpdateWindow(bool doAll)
TurnOff(correlationDistanceMinDistType);
}
break;
case IntegralCurveAttributes::ID_showLines:
case IntegralCurveAttributes::ID_showLines:
showLines->blockSignals(true);
showLines->setChecked(atts->GetShowLines());
showLines->blockSignals(false);
......@@ -1341,6 +1363,37 @@ QvisIntegralCurveWindow::UpdateWindow(bool doAll)
showPoints->setChecked(atts->GetShowPoints());
showPoints->blockSignals(false);
break;
case IntegralCurveAttributes::ID_cropBeginFlag:
cropBeginFlag->blockSignals(true);
cropBeginFlag->setChecked(atts->GetCropBeginFlag());
cropBeginFlag->blockSignals(false);
cropBegin->setEnabled( atts->GetCropBeginFlag() );
break;
case IntegralCurveAttributes::ID_cropBegin:
temp.setNum(atts->GetCropBegin(), 'g', 16);
cropBegin->setText(temp);
break;
case IntegralCurveAttributes::ID_cropEndFlag:
cropEndFlag->blockSignals(true);
cropEndFlag->setChecked(atts->GetCropEndFlag());
cropEndFlag->blockSignals(false);
cropEnd->setEnabled( atts->GetCropEndFlag() );
break;
case IntegralCurveAttributes::ID_cropEnd:
temp.setNum(atts->GetCropEnd(), 'g', 16);
cropEnd->setText(temp);
break;
case IntegralCurveAttributes::ID_cropValue:
cropValueComboBox->blockSignals(true);
cropValueComboBox->setCurrentIndex(int(atts->GetCropValue()));
cropValueComboBox->blockSignals(false);
break;
case IntegralCurveAttributes::ID_integrationDirection:
directionType->blockSignals(true);
directionType->setCurrentIndex(int(atts->GetIntegrationDirection()) );
......@@ -1446,18 +1499,8 @@ QvisIntegralCurveWindow::UpdateWindow(bool doAll)
case IntegralCurveAttributes::ID_coordinateSystem:
coordinateButtonGroup->blockSignals(true);
coordinateButtonGroup->button(atts->GetCoordinateSystem())->setChecked(true);
phiScalingToggle->setEnabled(atts->GetCoordinateSystem()!=1);
phiScaling->setEnabled(atts->GetCoordinateSystem()!=1 &&
atts->GetPhiScalingFlag());
coordinateButtonGroup->blockSignals(false);
break;
case IntegralCurveAttributes::ID_phiScalingFlag:
phiScaling->setEnabled(atts->GetCoordinateSystem()!=1 &&
atts->GetPhiScalingFlag());
break;
case IntegralCurveAttributes::ID_phiScaling:
phiScaling->setText(DoubleToQString(atts->GetPhiScaling()));
break;
case IntegralCurveAttributes::ID_maxProcessCount:
maxSLCount->blockSignals(true);
maxSLCount->setValue(atts->GetMaxProcessCount());
......@@ -2195,6 +2238,33 @@ QvisIntegralCurveWindow::GetCurrentValues(int which_widget)
atts->SetTermDistance(atts->GetTermDistance());
}
}
// Do crop begin
if(which_widget == IntegralCurveAttributes::ID_cropBegin || doAll)
{
double val;
if(LineEditGetDouble(cropBegin, val))
atts->SetCropBegin(val);
else
{
ResettingError(tr("crop begin"),
DoubleToQString(atts->GetCropBegin()));
atts->SetCropBegin(atts->GetCropBegin());
}
}
// Do crop end
if(which_widget == IntegralCurveAttributes::ID_cropEnd || doAll)
{
double val;
if(LineEditGetDouble(cropEnd, val))
atts->SetCropEnd(val);
else
{
ResettingError(tr("crop end"),
DoubleToQString(atts->GetCropEnd()));
atts->SetCropEnd(atts->GetCropEnd());
}
}
if(which_widget == IntegralCurveAttributes::ID_pathlinesOverrideStartingTime || doAll)
{
double val;
......@@ -2488,22 +2558,6 @@ QvisIntegralCurveWindow::GetCurrentValues(int which_widget)
atts->SetWorkGroupSize(val);
}
if(which_widget == IntegralCurveAttributes::ID_phiScaling || doAll)
{
double val;
LineEditGetDouble(phiScaling, val);
if(LineEditGetDouble(phiScaling, val) && val >= 0)
atts->SetPhiScaling(val);
else
{
// cerr << "phi scaling (" << val << ")" << endl;
ResettingError(tr("phi scaling"),
DoubleToQString(atts->GetPhiScaling()));
atts->SetPhiScaling(atts->GetPhiScaling());
}
}
// criticalPointThreshold
if(which_widget == IntegralCurveAttributes::ID_criticalPointThreshold || doAll)
{
......@@ -2845,6 +2899,41 @@ QvisIntegralCurveWindow::workGroupSizeChanged(int val)
Apply();
}
void
QvisIntegralCurveWindow::cropBeginFlagChanged(bool val)
{
atts->SetCropBeginFlag(val);
Apply();
}
void
QvisIntegralCurveWindow::cropBeginProcessText()
{
GetCurrentValues(IntegralCurveAttributes::ID_cropBegin);
Apply();
}
void
QvisIntegralCurveWindow::cropEndFlagChanged(bool val)
{
atts->SetCropEndFlag(val);
Apply();
}
void
QvisIntegralCurveWindow::cropEndProcessText()
{
GetCurrentValues(IntegralCurveAttributes::ID_cropEnd);
Apply();
}
void
QvisIntegralCurveWindow::cropValueChanged(int val)
{
atts->SetCropValue((IntegralCurveAttributes::CropValue)val);
Apply();
}
void
QvisIntegralCurveWindow::showLinesChanged(bool val)
{
......@@ -2894,13 +2983,6 @@ QvisIntegralCurveWindow::coordinateButtonGroupChanged(int val)
Apply();
}
void
QvisIntegralCurveWindow::phiScalingToggled(bool val)
{
atts->SetPhiScalingFlag(val);
Apply();
}
void
QvisIntegralCurveWindow::absTolProcessText()
{
......@@ -3072,13 +3154,6 @@ QvisIntegralCurveWindow::processCorrelationDistanceMinDistEditText()
Apply();
}
void
QvisIntegralCurveWindow::phiScalingProcessText()
{
GetCurrentValues(IntegralCurveAttributes::ID_phiScaling);
Apply();
}
void
QvisIntegralCurveWindow::icButtonGroupChanged(int val)
{
......
......@@ -249,12 +249,16 @@ class QvisIntegralCurveWindow : public QvisOperatorWindow
void processCorrelationDistanceAngTolEditText();
void processCorrelationDistanceMinDistEditText();
void cropBeginFlagChanged(bool val);
void cropBeginProcessText();
void cropEndFlagChanged(bool val);
void cropEndProcessText();
void cropValueChanged(int val);
void showLinesChanged(bool val);
void showPointsChanged(bool val);
void coordinateButtonGroupChanged(int val);
void phiScalingToggled(bool);
void phiScalingProcessText();
// Advanced
void parallelAlgorithmChanged(int val);
......@@ -352,12 +356,16 @@ class QvisIntegralCurveWindow : public QvisOperatorWindow
QLineEdit *correlationDistanceAngTolEdit, *correlationDistanceMinDistEdit;
QComboBox *correlationDistanceMinDistType;
QCheckBox *cropBeginFlag;
QLineEdit *cropBegin;
QCheckBox *cropEndFlag;
QLineEdit *cropEnd;
QComboBox *cropValueComboBox;
QCheckBox *showLines;
QCheckBox *showPoints;
QButtonGroup *coordinateButtonGroup;
QLineEdit *phiScaling;
QCheckBox *phiScalingToggle;
// Advanced
QLabel *parallelAlgoLabel;
......
......@@ -153,6 +153,7 @@ class avtIntegralCurveFilter : public virtual avtPluginFilter,
void SetDisplayGeometry(int d);
void SetDataValue(int, const std::string &var="");
void SetCropValue(int);
void SetCorrelationDistanceTol(double angTol,
double minDist, bool doBBox)
{
......@@ -163,8 +164,6 @@ class avtIntegralCurveFilter : public virtual avtPluginFilter,
void SetVelocitiesForLighting(bool v) { storeVelocitiesForLighting = v; };
void SetReferenceTypeForDisplay(int d)
{ referenceTypeForDisplay = d; };
void IssueWarningForMaxStepsTermination(bool v)
{ issueWarningForMaxStepsTermination = v; };
void IssueWarningForStiffness(bool v)
......@@ -196,9 +195,6 @@ class avtIntegralCurveFilter : public virtual avtPluginFilter,
static std::string scaleRadiusArrayName;
void SetCoordinateSystem(int c) {coordinateSystem = c;}
void SetPhiScaling(bool flag, double pf) { phiScalingFlag = flag;
phiScaling = pf; }
void GenerateSeedPointsFromPoint(std::vector<avtVector> &pts);
void GenerateSeedPointsFromLine(std::vector<avtVector> &pts);
......@@ -231,7 +227,8 @@ class avtIntegralCurveFilter : public virtual avtPluginFilter,
int sourceType;
int displayGeometry;
int dataValue;
int referenceTypeForDisplay;
int cropValue;
std::string dataVariable;
int tubeVariableIndex;
double correlationDistanceAngTol, correlationDistanceMinDist;
......@@ -267,8 +264,6 @@ class avtIntegralCurveFilter : public virtual avtPluginFilter,
avtVector seedVelocity;
int coordinateSystem;
bool phiScalingFlag;
double phiScaling;
std::string SeedInfoString() const;
};
......
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