Commit 3e8b7c00 authored by allens's avatar allens
Browse files

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>
......
......@@ -125,6 +125,44 @@ IntegralCurveAttributes::DataValue_FromString(const std::string &s, IntegralCurv
return false;
}
//
// Enum conversion methods for IntegralCurveAttributes::CropValue
//
static const char *CropValue_strings[] = {
"Distance", "Time", "StepNumber"
};
std::string
IntegralCurveAttributes::CropValue_ToString(IntegralCurveAttributes::CropValue t)
{
int index = int(t);
if(index < 0 || index >= 3) index = 0;
return CropValue_strings[index];
}
std::string
IntegralCurveAttributes::CropValue_ToString(int t)
{
int index = (t < 0 || t >= 3) ? 0 : t;
return CropValue_strings[index];
}
bool
IntegralCurveAttributes::CropValue_FromString(const std::string &s, IntegralCurveAttributes::CropValue &val)
{
val = IntegralCurveAttributes::Distance;
for(int i = 0; i < 3; ++i)
{
if(s == CropValue_strings[i])
{
val = (CropValue)i;
return true;
}
}
return false;
}
//
// Enum conversion methods for IntegralCurveAttributes::DisplayGeometry
//
......@@ -519,10 +557,13 @@ void IntegralCurveAttributes::Init()
pathlinesCMFE = POS_CMFE;
displayGeometry = Lines;
coordinateSystem = AsIs;
phiScalingFlag = false;
phiScaling = 1;
showLines = true;
showPoints = false;
cropBeginFlag = false;
cropBegin = 0;
cropEndFlag = false;
cropEnd = 0;
cropValue = Time;
sampleDistance0 = 10;
sampleDistance1 = 10;
sampleDistance2 = 10;
......@@ -632,10 +673,13 @@ void IntegralCurveAttributes::Copy(const IntegralCurveAttributes &obj)
pathlinesCMFE = obj.pathlinesCMFE;
displayGeometry = obj.displayGeometry;
coordinateSystem = obj.coordinateSystem;
phiScalingFlag = obj.phiScalingFlag;
phiScaling = obj.phiScaling;
showLines = obj.showLines;
showPoints = obj.showPoints;
cropBeginFlag = obj.cropBeginFlag;
cropBegin = obj.cropBegin;
cropEndFlag = obj.cropEndFlag;
cropEnd = obj.cropEnd;
cropValue = obj.cropValue;
sampleDistance0 = obj.sampleDistance0;
sampleDistance1 = obj.sampleDistance1;
sampleDistance2 = obj.sampleDistance2;
......@@ -900,10 +944,13 @@ IntegralCurveAttributes::operator == (const IntegralCurveAttributes &obj) const
(pathlinesCMFE == obj.pathlinesCMFE) &&
(displayGeometry == obj.displayGeometry) &&
(coordinateSystem == obj.coordinateSystem) &&
(phiScalingFlag == obj.phiScalingFlag) &&
(phiScaling == obj.phiScaling) &&
(showLines == obj.showLines) &&
(showPoints == obj.showPoints) &&
(cropBeginFlag == obj.cropBeginFlag) &&
(cropBegin == obj.cropBegin) &&
(cropEndFlag == obj.cropEndFlag) &&
(cropEnd == obj.cropEnd) &&
(cropValue == obj.cropValue) &&
(sampleDistance0 == obj.sampleDistance0) &&
(sampleDistance1 == obj.sampleDistance1) &&
(sampleDistance2 == obj.sampleDistance2) &&
......@@ -1222,10 +1269,13 @@ IntegralCurveAttributes::SelectAll()
Select(ID_pathlinesCMFE, (void *)&pathlinesCMFE);
Select(ID_displayGeometry, (void *)&displayGeometry);
Select(ID_coordinateSystem, (void *)&coordinateSystem);
Select(ID_phiScalingFlag, (void *)&phiScalingFlag);
Select(ID_phiScaling, (void *)&phiScaling);
Select(ID_showLines, (void *)&showLines);
Select(ID_showPoints, (void *)&showPoints);
Select(ID_cropBeginFlag, (void *)&cropBeginFlag);
Select(ID_cropBegin, (void *)&cropBegin);
Select(ID_cropEndFlag, (void *)&cropEndFlag);
Select(ID_cropEnd, (void *)&cropEnd);
Select(ID_cropValue, (void *)&cropValue);
Select(ID_sampleDistance0, (void *)&sampleDistance0);
Select(ID_sampleDistance1, (void *)&sampleDistance1);
Select(ID_sampleDistance2, (void *)&sampleDistance2);
......@@ -1545,28 +1595,46 @@ IntegralCurveAttributes::CreateNode(DataNode *parentNode, bool completeSave, boo
node->AddNode(new DataNode("coordinateSystem", CoordinateSystem_ToString(coordinateSystem)));
}
if(completeSave || !FieldsEqual(ID_phiScalingFlag, &defaultObject))
if(completeSave || !FieldsEqual(ID_showLines, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("showLines", showLines));
}
if(completeSave || !FieldsEqual(ID_showPoints, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("phiScalingFlag", phiScalingFlag));
node->AddNode(new DataNode("showPoints", showPoints));
}
if(completeSave || !FieldsEqual(ID_phiScaling, &defaultObject))
if(completeSave || !FieldsEqual(ID_cropBeginFlag, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("phiScaling", phiScaling));
node->AddNode(new DataNode("cropBeginFlag", cropBeginFlag));
}
if(completeSave || !FieldsEqual(ID_showLines, &defaultObject))
if(completeSave || !FieldsEqual(ID_cropBegin, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("showLines", showLines));
node->AddNode(new DataNode("cropBegin", cropBegin));
}
if(completeSave || !FieldsEqual(ID_showPoints, &defaultObject))
if(completeSave || !FieldsEqual(ID_cropEndFlag, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("showPoints", showPoints));
node->AddNode(new DataNode("cropEndFlag", cropEndFlag));
}
if(completeSave || !FieldsEqual(ID_cropEnd, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("cropEnd", cropEnd));
}
if(completeSave || !FieldsEqual(ID_cropValue, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("cropValue", CropValue_ToString(cropValue)));
}
if(completeSave || !FieldsEqual(ID_sampleDistance0, &defaultObject))
......@@ -1937,14 +2005,34 @@ IntegralCurveAttributes::SetFromNode(DataNode *parentNode)
SetCoordinateSystem(value);
}
}
if((node = searchNode->GetNode("phiScalingFlag")) != 0)
SetPhiScalingFlag(node->AsBool());
if((node = searchNode->GetNode("phiScaling")) != 0)
SetPhiScaling(node->AsDouble());
if((node = searchNode->GetNode("showLines")) != 0)
SetShowLines(node->AsBool());
if((node = searchNode->GetNode("showPoints")) != 0)
SetShowPoints(node->AsBool());
if((node = searchNode->GetNode("cropBeginFlag")) != 0)
SetCropBeginFlag(node->AsBool());
if((node = searchNode->GetNode("cropBegin")) != 0)
SetCropBegin(node->AsDouble());
if((node = searchNode->GetNode("cropEndFlag")) != 0)
SetCropEndFlag(node->AsBool());
if((node = searchNode->GetNode("cropEnd")) != 0)
SetCropEnd(node->AsDouble());
if((node = searchNode->GetNode("cropValue")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 3)
SetCropValue(CropValue(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
CropValue value;
if(CropValue_FromString(node->AsString(), value))
SetCropValue(value);
}
}
if((node = searchNode->GetNode("sampleDistance0")) != 0)
SetSampleDistance0(node->AsDouble());
if((node = searchNode->GetNode("sampleDistance1")) != 0)
......@@ -2332,31 +2420,52 @@ IntegralCurveAttributes::SetCoordinateSystem(IntegralCurveAttributes::Coordinate
}
void
IntegralCurveAttributes::SetPhiScalingFlag(bool phiScalingFlag_)
IntegralCurveAttributes::SetShowLines(bool showLines_)
{
showLines = showLines_;
Select(ID_showLines, (void *)&showLines);
}
void
IntegralCurveAttributes::SetShowPoints(bool showPoints_)
{
phiScalingFlag = phiScalingFlag_;
Select(ID_phiScalingFlag, (void *)&phiScalingFlag);
showPoints = showPoints_;
Select(ID_showPoints, (void *)&showPoints);
}
void
IntegralCurveAttributes::SetPhiScaling(double phiScaling_)
IntegralCurveAttributes::SetCropBeginFlag(bool cropBeginFlag_)
{
phiScaling = phiScaling_;
Select(ID_phiScaling, (void *)&phiScaling);
cropBeginFlag = cropBeginFlag_;
Select(ID_cropBeginFlag, (void *)&cropBeginFlag);
}
void
IntegralCurveAttributes::SetShowLines(bool showLines_)
IntegralCurveAttributes::SetCropBegin(double cropBegin_)
{
showLines = showLines_;
Select(ID_showLines, (void *)&showLines);
cropBegin = cropBegin_;
Select(ID_cropBegin, (void *)&cropBegin);
}
void
IntegralCurveAttributes::SetShowPoints(bool showPoints_)
IntegralCurveAttributes::SetCropEndFlag(bool cropEndFlag_)
{
showPoints = showPoints_;
Select(ID_showPoints, (void *)&showPoints);
cropEndFlag = cropEndFlag_;
Select(ID_cropEndFlag, (void *)&cropEndFlag);
}
void
IntegralCurveAttributes::SetCropEnd(double cropEnd_)
{
cropEnd = cropEnd_;
Select(ID_cropEnd, (void *)&cropEnd);
}
void
IntegralCurveAttributes::SetCropValue(IntegralCurveAttributes::CropValue cropValue_)
{
cropValue = cropValue_;
Select(ID_cropValue, (void *)&cropValue);
}
void
......@@ -2819,27 +2928,45 @@ IntegralCurveAttributes::GetCoordinateSystem() const
}
bool
IntegralCurveAttributes::GetPhiScalingFlag() const
IntegralCurveAttributes::GetShowLines() const
{
return phiScalingFlag;
return showLines;
}
double
IntegralCurveAttributes::GetPhiScaling() const
bool
IntegralCurveAttributes::GetShowPoints() const
{
return phiScaling;
return showPoints;
}
bool
IntegralCurveAttributes::GetShowLines() const
IntegralCurveAttributes::GetCropBeginFlag() const
{
return showLines;
return cropBeginFlag;
}
double
IntegralCurveAttributes::GetCropBegin() const
{
return cropBegin;
}
bool
IntegralCurveAttributes::GetShowPoints() const
IntegralCurveAttributes::GetCropEndFlag() const
{
return showPoints;
return cropEndFlag;
}
double
IntegralCurveAttributes::GetCropEnd() const
{
return cropEnd;
}
IntegralCurveAttributes::CropValue
IntegralCurveAttributes::GetCropValue() const
{
return CropValue(cropValue);
}
double
......@@ -3095,10 +3222,13 @@ IntegralCurveAttributes::GetFieldName(int index) const
case ID_pathlinesCMFE: return "pathlinesCMFE";
case ID_displayGeometry: return "displayGeometry";
case ID_coordinateSystem: return "coordinateSystem";
case ID_phiScalingFlag: return "phiScalingFlag";
case ID_phiScaling: return "phiScaling";
case ID_showLines: return "showLines";
case ID_showPoints: return "showPoints";
case ID_cropBeginFlag: return "cropBeginFlag";
case ID_cropBegin: return "cropBegin";
case ID_cropEndFlag: return "cropEndFlag";
case ID_cropEnd: return "cropEnd";
case ID_cropValue: return "cropValue";
case ID_sampleDistance0: return "sampleDistance0";
case ID_sampleDistance1: return "sampleDistance1";
case ID_sampleDistance2: return "sampleDistance2";
......@@ -3185,10 +3315,13 @@ IntegralCurveAttributes::GetFieldType(int index) const
case ID_pathlinesCMFE: return FieldType_enum;
case ID_displayGeometry: return FieldType_enum;
case ID_coordinateSystem: return FieldType_enum;
case ID_phiScalingFlag: return FieldType_bool;
case ID_phiScaling: return FieldType_double;
case ID_showLines: return FieldType_bool;
case ID_showPoints: return FieldType_bool;
case ID_cropBeginFlag: return FieldType_bool;
case ID_cropBegin: return FieldType_double;
case ID_cropEndFlag: return FieldType_bool;
case ID_cropEnd: return FieldType_double;
case ID_cropValue: return FieldType_enum;
case ID_sampleDistance0: return FieldType_double;
case ID_sampleDistance1: return FieldType_double;
case ID_sampleDistance2: return FieldType_double;
......@@ -3275,10 +3408,13 @@ IntegralCurveAttributes::GetFieldTypeName(int index) const
case ID_pathlinesCMFE: return "enum";
case ID_displayGeometry: return "enum";
case ID_coordinateSystem: return "enum";
case ID_phiScalingFlag: return "bool";
case ID_phiScaling: return "double";
case ID_showLines: return "bool";
case ID_showPoints: return "bool";
case ID_cropBeginFlag: return "bool";
case ID_cropBegin: return "double";
case ID_cropEndFlag: return "bool";
case ID_cropEnd: return "double";
case ID_cropValue: return "enum";
case ID_sampleDistance0: return "double";
case ID_sampleDistance1: return "double";
case ID_sampleDistance2: return "double";
......@@ -3592,24 +3728,39 @@ IntegralCurveAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) cons
retval = (coordinateSystem == obj.coordinateSystem);
}
break;
case ID_phiScalingFlag:
case ID_showLines:
{ // new scope
retval = (showLines == obj.showLines);
}
break;
case ID_showPoints:
{ // new scope
retval = (phiScalingFlag == obj.phiScalingFlag);
retval = (showPoints == obj.showPoints);
}
break;
case ID_phiScaling:
case ID_cropBeginFlag:
{ // new scope
retval = (phiScaling == obj.phiScaling);
retval = (cropBeginFlag == obj.cropBeginFlag);
}
break;
case ID_showLines:
case ID_cropBegin:
{ // new scope
retval = (showLines == obj.showLines);
retval = (cropBegin == obj.cropBegin);
}
break;
case ID_showPoints:
case ID_cropEndFlag:
{ // new scope
retval = (showPoints == obj.showPoints);
retval = (cropEndFlag == obj.cropEndFlag);
}
break;
case ID_cropEnd:
{ // new scope
retval = (cropEnd == obj.cropEnd);
}
break;
case ID_cropValue:
{ // new scope
retval = (cropValue == obj.cropValue);
}
break;
case ID_sampleDistance0:
......@@ -3768,8 +3919,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 ||
......
......@@ -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
......@@ -61,7 +61,7 @@ import java.util.Vector;
public class IntegralCurveAttributes extends AttributeSubject implements Plugin
{
private static int IntegralCurveAttributes_numAdditionalAtts = 66;
private static int IntegralCurveAttributes_numAdditionalAtts = 69;
// Enum values
public final static int SOURCETYPE_POINT = 0;
......@@ -85,6 +85,10 @@ public class IntegralCurveAttributes extends AttributeSubject implements Plugin
public final static int DATAVALUE_DIFFERENCE = 9;
public final static int DATAVALUE_VARIABLE = 10;
public final static int CROPVALUE_DISTANCE = 0;
public final static int CROPVALUE_TIME = 1;
public final static int CROPVALUE_STEPNUMBER = 2;
public final static int DISPLAYGEOMETRY_LINES = 0;
public final static int DISPLAYGEOMETRY_TUBES = 1;
public final static int DISPLAYGEOMETRY_RIBBONS = 2;
......@@ -211,10 +215,13 @@ public class IntegralCurveAttributes extends AttributeSubject implements Plugin
pathlinesCMFE = PATHLINESCMFE_POS_CMFE;
displayGeometry = DISPLAYGEOMETRY_LINES;