Commit 8a6747bf authored by hrchilds's avatar hrchilds
Browse files

Make streamline tubes/seeds/ribbons/cones have an option for scaling based on the size

of the bounding box.  Turn on seeds by default.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12653 18c085ea-50e0-402c-830e-de6fd14e8384
parent 975f4b53
......@@ -396,3 +396,23 @@ avtCustomRenderer::SetSurfaceRepresentation(int rep)
;
}
// ****************************************************************************
// Method: avtCustomRenderer::SetBoundingBox
//
// Purpose:
// Sets the bounding box of the input.
//
// Programmer: Hank Childs
// Creation: September 30, 2010
//
// ****************************************************************************
void
avtCustomRenderer::SetBoundingBox(const double *b)
{
for (int i = 0 ; i < 6 ; i++)
bbox[i] = b[i];
}
......@@ -87,6 +87,9 @@ typedef void (*OverrideRenderCallback)(void *, avtDataObject_p &);
// Brad Whitlock, Wed Aug 22 11:38:46 PDT 2007
// Added reduced detail mode.
//
// Hank Childs, Thu Sep 30 00:39:47 PDT 2010
// Add methods for setting the bbox.
//
// ****************************************************************************
class PLOTTER_API avtCustomRenderer
......@@ -99,8 +102,10 @@ class PLOTTER_API avtCustomRenderer
void SetView(avtViewInfo &);
void SetRange(double, double);
void SetBoundingBox(const double *);
virtual bool OperatesOnScalars(void) { return false; };
virtual bool NeedsBoundingBox(void) { return false; };
virtual void GlobalLightingOn(void);
virtual void GlobalLightingOff(void);
......@@ -127,6 +132,7 @@ class PLOTTER_API avtCustomRenderer
protected:
avtViewInfo view;
double varmin, varmax;
double bbox[6];
vtkRenderer *VTKRen;
bool immediateModeRendering;
......
......@@ -169,6 +169,10 @@ avtUserDefinedMapper::GetCurrentDataRange(double &rmin, double &rmax)
// Kathleen Bonnell, Wed Mar 19 14:26:05 PST 2003
// Removed test for min == max, no longer an issue with vtkLookupTables or
// vtkMappers.
//
// Hank Childs, Thu Sep 30 00:45:38 PDT 2010
// Also do bounding boxes.
//
// ****************************************************************************
void
......@@ -185,6 +189,13 @@ avtUserDefinedMapper::CustomizeMappers(void)
//
renderer->SetRange(mmin, mmax);
}
if (renderer->NeedsBoundingBox())
{
double bbox[6];
avtDataAttributes &atts = GetInput()->GetInfo().GetAttributes();
atts.GetSpatialExtents(bbox);
renderer->SetBoundingBox(bbox);
}
}
......
This diff is collapsed.
......@@ -44,7 +44,7 @@
//
// Functions exposed to the VisIt module.
//
#define STREAMLINEATTRIBUTES_NMETH 142
#define STREAMLINEATTRIBUTES_NMETH 158
void PyStreamlineAttributes_StartUp(StreamlineAttributes *subj, void *data);
void PyStreamlineAttributes_CloseDown();
PyMethodDef * PyStreamlineAttributes_GetMethodTable(int *nMethods);
......
This diff is collapsed.
......@@ -131,6 +131,9 @@ class StreamlineAttributes;
// Add methods for the maximum time step (DoPri), which is distinct from
// the step length (Adams/Bashforth).
//
// Hank Childs, Thu Sep 30 01:22:24 PDT 2010
// Add widgets for choosing size type between fraction of bbox and absolute.
//
// ****************************************************************************
class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
......@@ -203,7 +206,7 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
void ribbonWidthProcessText();
void seedRadiusProcessText();
void headRadiusProcessText();
void headHeightProcessText();
void headHeightRatioProcessText();
void lineWidthChanged(int style);
void coloringMethodChanged(int val);
void colorTableNameChanged(bool useDefault, const QString &ctName);
......@@ -240,6 +243,10 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
void textChanged(const QString &currentText);
void forceNodalChanged(bool);
void limitMaxTimeStepChanged(bool);
void headSizeTypeChanged(int);
void seedSizeTypeChanged(int);
void tubeSizeTypeChanged(int);
void ribbonSizeTypeChanged(int);
private:
int plotType;
......@@ -298,9 +305,13 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
QCheckBox *showSeeds, *showHeads;
QLabel *seedRadiusLabel, *headRadiusLabel, *headHeightLabel;
QComboBox *headDisplayType;
QComboBox *headSizeType;
QLabel *headDisplayTypeLabel;
QLineEdit *seedRadius, *headRadius, *headHeight;
QComboBox *seedSizeType;
QLineEdit *tubeRadius, *ribbonWidth;
QComboBox *tubeSizeType;
QComboBox *ribbonSizeType;
QLabel *geomRadiusLabel;
QvisLineWidthWidget *lineWidth;
QLabel *lineWidthLabel;
......
......@@ -85,6 +85,10 @@
Sphere
Cone
</Enum>
<Enum name="SizeType">
Absolute
FractionOfBBox
</Enum>
<Field name="sourceType" label="Source" type="enum" subtype="SourceType">
SpecifiedPoint
</Field>
......@@ -160,24 +164,6 @@
<Field name="sampleDensity2" label="sampleDensity2" type="int">
2
</Field>
<Field name="displayMethod" label="Display method" type="enum" subtype="DisplayMethod">
Lines
</Field>
<Field name="showSeeds" label="Show seed points" type="bool">
false
</Field>
<Field name="showHeads" label="show heads" type="bool">
false
</Field>
<Field name="tubeRadius" label="Radius" type="double">
0.125000
</Field>
<Field name="ribbonWidth" label="ribbonWidth" type="double">
0.125000
</Field>
<Field name="lineWidth" label="Line width" type="linewidth">
2
</Field>
<Field name="coloringMethod" label="Coloring method" type="enum" subtype="ColoringMethod">
ColorByTime
</Field>
......@@ -261,17 +247,59 @@
<Field name="displayEndFlag" label="displayEndFlag" type="bool">
false
</Field>
<Field name="seedDisplayRadius" label="displaySeedRadius" type="double">
0.250000
<Field name="displayMethod" label="Display method" type="enum" subtype="DisplayMethod">
Lines
</Field>
<Field name="tubeSizeType" label="tubeSizeType" type="enum" subtype="SizeType">
FractionOfBBox
</Field>
<Field name="tubeRadiusAbsolute" label="Radius (Absolute)" type="double" enabler="tubeSizeType:Absolute">
0.125000
</Field>
<Field name="tubeRadiusBBox" label="Radius (BBox Fraction)" type="double" enabler="tubeSizeType:FractionOfBBox">
0.005000
</Field>
<Field name="ribbonWidthSizeType" label="ribbonWidthSizeType" type="enum" subtype="SizeType">
FractionOfBBox
</Field>
<Field name="ribbonWidthAbsolute" label="ribbonWidthAbsolute" type="double" enabler="ribbonWidthSizeType:Absolute">
0.125000
</Field>
<Field name="ribbonWidthBBox" label="ribbonWidthBBox" type="double" enabler="ribbonWidthSizeType:FractionOfBBox">
0.010000
</Field>
<Field name="lineWidth" label="Line width" type="linewidth">
2
</Field>
<Field name="showSeeds" label="Show seed points" type="bool">
true
</Field>
<Field name="seedRadiusSizeType" label="seedRadiusSizeType" type="enum" subtype="SizeType">
FractionOfBBox
</Field>
<Field name="seedRadiusAbsolute" label="seedRadiusAbsolute" type="double" enabler="seedRadiusSizeType:Absolute">
1.000000
</Field>
<Field name="seedRadiusBBox" label="seedRadiusBBox" type="double" enabler="seedRadiusSizeType:FractionOfBBox">
0.015000
</Field>
<Field name="showHeads" label="show heads" type="bool">
false
</Field>
<Field name="headDisplayType" label="headDisplayType" type="enum" subtype="GeomDisplayType">
Sphere
</Field>
<Field name="headDisplayRadius" label="headDisplayRadius" type="double">
<Field name="headRadiusSizeType" label="headRadiusSizeType" type="enum" subtype="SizeType">
FractionOfBBox
</Field>
<Field name="headRadiusAbsolute" label="headRadiusAbsolute" type="double" enabler="headRadiusSizeType:Absolute">
0.250000
</Field>
<Field name="headDisplayHeight" label="headDisplayHeight" type="double">
0.500000
<Field name="headRadiusBBox" label="headRadiusBBox" type="double" enabler="headRadiusSizeType:FractionOfBBox">
0.020000
</Field>
<Field name="headHeightRatio" label="headHeightRatio" type="double">
2.000000
</Field>
<Field name="opacityType" label="opacityType" type="enum" subtype="OpacityType">
FullyOpaque
......
This diff is collapsed.
......@@ -131,6 +131,11 @@ public:
Sphere,
Cone
};
enum SizeType
{
Absolute,
FractionOfBBox
};
// These constructors are for objects of this class
StreamlineAttributes();
......@@ -188,12 +193,6 @@ public:
void SetSampleDensity0(int sampleDensity0_);
void SetSampleDensity1(int sampleDensity1_);
void SetSampleDensity2(int sampleDensity2_);
void SetDisplayMethod(DisplayMethod displayMethod_);
void SetShowSeeds(bool showSeeds_);
void SetShowHeads(bool showHeads_);
void SetTubeRadius(double tubeRadius_);
void SetRibbonWidth(double ribbonWidth_);
void SetLineWidth(int lineWidth_);
void SetColoringMethod(ColoringMethod coloringMethod_);
void SetColorTableName(const std::string &colorTableName_);
void SetSingleColor(const ColorAttribute &singleColor_);
......@@ -221,10 +220,24 @@ public:
void SetDisplayEnd(double displayEnd_);
void SetDisplayBeginFlag(bool displayBeginFlag_);
void SetDisplayEndFlag(bool displayEndFlag_);
void SetSeedDisplayRadius(double seedDisplayRadius_);
void SetDisplayMethod(DisplayMethod displayMethod_);
void SetTubeSizeType(SizeType tubeSizeType_);
void SetTubeRadiusAbsolute(double tubeRadiusAbsolute_);
void SetTubeRadiusBBox(double tubeRadiusBBox_);
void SetRibbonWidthSizeType(SizeType ribbonWidthSizeType_);
void SetRibbonWidthAbsolute(double ribbonWidthAbsolute_);
void SetRibbonWidthBBox(double ribbonWidthBBox_);
void SetLineWidth(int lineWidth_);
void SetShowSeeds(bool showSeeds_);
void SetSeedRadiusSizeType(SizeType seedRadiusSizeType_);
void SetSeedRadiusAbsolute(double seedRadiusAbsolute_);
void SetSeedRadiusBBox(double seedRadiusBBox_);
void SetShowHeads(bool showHeads_);
void SetHeadDisplayType(GeomDisplayType headDisplayType_);
void SetHeadDisplayRadius(double headDisplayRadius_);
void SetHeadDisplayHeight(double headDisplayHeight_);
void SetHeadRadiusSizeType(SizeType headRadiusSizeType_);
void SetHeadRadiusAbsolute(double headRadiusAbsolute_);
void SetHeadRadiusBBox(double headRadiusBBox_);
void SetHeadHeightRatio(double headHeightRatio_);
void SetOpacityType(OpacityType opacityType_);
void SetOpacityVariable(const std::string &opacityVariable_);
void SetOpacity(double opacity_);
......@@ -269,12 +282,6 @@ public:
int GetSampleDensity0() const;
int GetSampleDensity1() const;
int GetSampleDensity2() const;
DisplayMethod GetDisplayMethod() const;
bool GetShowSeeds() const;
bool GetShowHeads() const;
double GetTubeRadius() const;
double GetRibbonWidth() const;
int GetLineWidth() const;
ColoringMethod GetColoringMethod() const;
const std::string &GetColorTableName() const;
std::string &GetColorTableName();
......@@ -305,10 +312,24 @@ public:
double GetDisplayEnd() const;
bool GetDisplayBeginFlag() const;
bool GetDisplayEndFlag() const;
double GetSeedDisplayRadius() const;
DisplayMethod GetDisplayMethod() const;
SizeType GetTubeSizeType() const;
double GetTubeRadiusAbsolute() const;
double GetTubeRadiusBBox() const;
SizeType GetRibbonWidthSizeType() const;
double GetRibbonWidthAbsolute() const;
double GetRibbonWidthBBox() const;
int GetLineWidth() const;
bool GetShowSeeds() const;
SizeType GetSeedRadiusSizeType() const;
double GetSeedRadiusAbsolute() const;
double GetSeedRadiusBBox() const;
bool GetShowHeads() const;
GeomDisplayType GetHeadDisplayType() const;
double GetHeadDisplayRadius() const;
double GetHeadDisplayHeight() const;
SizeType GetHeadRadiusSizeType() const;
double GetHeadRadiusAbsolute() const;
double GetHeadRadiusBBox() const;
double GetHeadHeightRatio() const;
OpacityType GetOpacityType() const;
const std::string &GetOpacityVariable() const;
std::string &GetOpacityVariable();
......@@ -383,6 +404,11 @@ public:
protected:
static std::string GeomDisplayType_ToString(int);
public:
static std::string SizeType_ToString(SizeType);
static bool SizeType_FromString(const std::string &, SizeType &);
protected:
static std::string SizeType_ToString(int);
public:
// Keyframing methods
virtual std::string GetFieldName(int index) const;
......@@ -412,12 +438,6 @@ public:
ID_sampleDensity0,
ID_sampleDensity1,
ID_sampleDensity2,
ID_displayMethod,
ID_showSeeds,
ID_showHeads,
ID_tubeRadius,
ID_ribbonWidth,
ID_lineWidth,
ID_coloringMethod,
ID_colorTableName,
ID_singleColor,
......@@ -445,10 +465,24 @@ public:
ID_displayEnd,
ID_displayBeginFlag,
ID_displayEndFlag,
ID_seedDisplayRadius,
ID_displayMethod,
ID_tubeSizeType,
ID_tubeRadiusAbsolute,
ID_tubeRadiusBBox,
ID_ribbonWidthSizeType,
ID_ribbonWidthAbsolute,
ID_ribbonWidthBBox,
ID_lineWidth,
ID_showSeeds,
ID_seedRadiusSizeType,
ID_seedRadiusAbsolute,
ID_seedRadiusBBox,
ID_showHeads,
ID_headDisplayType,
ID_headDisplayRadius,
ID_headDisplayHeight,
ID_headRadiusSizeType,
ID_headRadiusAbsolute,
ID_headRadiusBBox,
ID_headHeightRatio,
ID_opacityType,
ID_opacityVariable,
ID_opacity,
......@@ -486,12 +520,6 @@ private:
int sampleDensity0;
int sampleDensity1;
int sampleDensity2;
int displayMethod;
bool showSeeds;
bool showHeads;
double tubeRadius;
double ribbonWidth;
int lineWidth;
int coloringMethod;
std::string colorTableName;
ColorAttribute singleColor;
......@@ -519,10 +547,24 @@ private:
double displayEnd;
bool displayBeginFlag;
bool displayEndFlag;
double seedDisplayRadius;
int displayMethod;
int tubeSizeType;
double tubeRadiusAbsolute;
double tubeRadiusBBox;
int ribbonWidthSizeType;
double ribbonWidthAbsolute;
double ribbonWidthBBox;
int lineWidth;
bool showSeeds;
int seedRadiusSizeType;
double seedRadiusAbsolute;
double seedRadiusBBox;
bool showHeads;
int headDisplayType;
double headDisplayRadius;
double headDisplayHeight;
int headRadiusSizeType;
double headRadiusAbsolute;
double headRadiusBBox;
double headHeightRatio;
int opacityType;
std::string opacityVariable;
double opacity;
......@@ -545,6 +587,6 @@ private:
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define STREAMLINEATTRIBUTES_TMFS "idDDDDDDdDDbd*iiiibbddiisabbidbdddiiiiiibsbbddddbbdiddisdddbbiidddbbiib"
#define STREAMLINEATTRIBUTES_TMFS "idDDDDDDdDDbd*iiiisabbidbdddiiiiiibsbbddddbbiiddiddibiddbiidddisdddbbiidddbbiib"
#endif
This diff is collapsed.
......@@ -594,6 +594,7 @@ avtOpenGLStreamlineRenderer::DrawAsLines(vtkPolyData *data)
shader->Disable();
}
// ****************************************************************************
// Method: avtOpenGLStreamlineRenderer::DrawAsTubes
//
......@@ -609,8 +610,11 @@ avtOpenGLStreamlineRenderer::DrawAsLines(vtkPolyData *data)
// Dave Pugmire, Wed Jan 20 09:28:59 EST 2010
// Changed some attribute names.
//
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Support for transparency sorting.
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Support for transparency sorting.
//
// Hank Childs, Thu Sep 30 01:11:03 PDT 2010
// Add an option for sizing based on a fraction of the bounding box.
//
// ****************************************************************************
......@@ -618,7 +622,10 @@ void
avtOpenGLStreamlineRenderer::DrawAsTubes(vtkPolyData *data)
{
vtkTubeFilter *tube = vtkTubeFilter::New();
tube->SetRadius(atts.GetTubeRadius());
double tubeRadius = atts.GetTubeRadiusAbsolute();
if (atts.GetTubeSizeType() == StreamlineAttributes::FractionOfBBox)
tubeRadius = atts.GetTubeRadiusBBox() * GetBBoxSize();
tube->SetRadius(tubeRadius);
tube->SetNumberOfSides(atts.GetTubeDisplayDensity());
tube->SetCapping(1);
......@@ -678,8 +685,11 @@ avtOpenGLStreamlineRenderer::DrawAsTubes(vtkPolyData *data)
// Dave Pugmire, Wed Jan 20 09:28:59 EST 2010
// Changed some attribute names.
//
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Support for transparency sorting.
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Support for transparency sorting.
//
// Hank Childs, Thu Sep 30 01:11:03 PDT 2010
// Add an option for sizing based on a fraction of the bounding box.
//
// ****************************************************************************
......@@ -759,7 +769,10 @@ avtOpenGLStreamlineRenderer::DrawAsRibbons(vtkPolyData *data)
lineNormalGenerator->Delete();
vtkRibbonFilter *ribbons = vtkRibbonFilter::New();
ribbons->SetWidth(atts.GetRibbonWidth());
double ribbonWidth = atts.GetRibbonWidthAbsolute();
if (atts.GetRibbonWidthSizeType() == StreamlineAttributes::FractionOfBBox)
ribbonWidth = atts.GetRibbonWidthBBox() * GetBBoxSize();
ribbons->SetWidth(ribbonWidth);
ribbons->SetInput(pd);
ribbons->Update();
......@@ -788,8 +801,11 @@ avtOpenGLStreamlineRenderer::DrawAsRibbons(vtkPolyData *data)
// Dave Pugmire, Wed Jan 20 09:28:59 EST 2010
// Changed some attribute names.
//
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Support for transparency sorting.
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Support for transparency sorting.
//
// Hank Childs, Thu Sep 30 01:11:03 PDT 2010
// Add an option for sizing based on a fraction of the bounding box.
//
// ****************************************************************************
......@@ -797,7 +813,9 @@ void
avtOpenGLStreamlineRenderer::DrawSeedPoints(vtkPolyData *data)
{
CalculateSpherePts();
double rad = atts.GetSeedDisplayRadius();
double rad = atts.GetSeedRadiusAbsolute();
if (atts.GetSeedRadiusSizeType() == StreamlineAttributes::FractionOfBBox)
rad = atts.GetSeedRadiusBBox() * GetBBoxSize();
int quality = (int)(atts.GetGeomDisplayQuality());
vtkPoints *points = data->GetPoints();
......@@ -855,14 +873,19 @@ avtOpenGLStreamlineRenderer::DrawSeedPoints(vtkPolyData *data)
// Dave Pugmire, Thu Mar 25 16:34:23 EDT 2010
// Fixed indexing problem.
//
// Hank Childs, Thu Sep 30 01:11:03 PDT 2010
// Add an option for sizing based on a fraction of the bounding box.
//
// ****************************************************************************
void
avtOpenGLStreamlineRenderer::DrawHeadGeom(vtkPolyData *data)
{
CalculateSpherePts();
double rad = atts.GetHeadDisplayRadius();
double height = atts.GetHeadDisplayHeight();
double rad = atts.GetHeadRadiusAbsolute();
if (atts.GetHeadRadiusSizeType() == StreamlineAttributes::FractionOfBBox)
rad = atts.GetHeadRadiusBBox() * GetBBoxSize();
double height = rad*atts.GetHeadHeightRatio();
int quality = (int)(atts.GetGeomDisplayQuality());
vtkPoints *points = data->GetPoints();
......
......@@ -159,6 +159,9 @@ avtStreamlineRenderer::New()
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Pass in camera to do transparency sorting.
//
// Hank Childs, Thu Sep 30 00:45:38 PDT 2010
// Pass along the bounding box to the renderer implementation.
//
// ****************************************************************************
void
......@@ -194,6 +197,7 @@ avtStreamlineRenderer::Render(vtkDataSet *ds)
winsize[0] = VTKRen->GetVTKWindow()->GetSize()[0];
winsize[1] = VTKRen->GetVTKWindow()->GetSize()[1];
rendererImplementation->SetBoundingBox(bbox);
rendererImplementation->Render(polydata,
atts,
immediateModeRendering,
......
......@@ -54,13 +54,16 @@ class avtStreamlineRendererImplementation;
// Class: avtStreamlineRenderer
//
// Purpose:
//
// A specialized renderer for rendering streamlines.
//
// Programmer: Dave Pugmire
// Creation: December 29, 2009
//
// Modifications:
//
// Hank Childs, Thu Sep 30 00:45:38 PDT 2010
// Added method NeedsBoundingBox.
//
// ****************************************************************************
class avtStreamlineRenderer : public avtCustomRenderer
......@@ -75,6 +78,7 @@ class avtStreamlineRenderer : public avtCustomRenderer
virtual void ReleaseGraphicsResources();
virtual void Render(vtkDataSet *);
virtual bool NeedsBoundingBox(void) { return true; };
void SetLevelsLUT(avtLookupTable *);
......
......@@ -63,6 +63,9 @@ struct avtViewInfo;
// Dave Pugmire, Fri Feb 12 14:02:57 EST 2010
// Support for transparency sorting.
//
// Hank Childs, Thu Sep 30 00:45:38 PDT 2010
// Store the bounding box.
//
// ****************************************************************************
class avtStreamlineRendererImplementation
{
......@@ -74,7 +77,23 @@ class avtStreamlineRendererImplementation
varMin = min;
varMax = max;
}
void SetBoundingBox(const double *b)
{
for (int i = 0 ; i < 6 ; i++)
bbox[i] = b[i];
}
double GetBBoxSize(void)
{
double smallest = 1e+32;
if ((bbox[1]-bbox[0] != 0.) && ((bbox[1]-bbox[0]) < smallest))
smallest = bbox[1]-bbox[0];
if ((bbox[3]-bbox[2] != 0.) && ((bbox[3]-bbox[2]) < smallest))
smallest = bbox[3]-bbox[2];
if ((bbox[5]-bbox[4] != 0.) && ((bbox[5]-bbox[4]) < smallest))
smallest = bbox[5]-bbox[4];
return smallest;
}