Skip to content

Commit

Permalink
refs #6493. Use glyphs to differentiate.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Jan 30, 2013
1 parent e720c69 commit e55f5c9
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
information_only="1">
<SimpleStringInformationHelper />
</StringVectorProperty>
<DoubleVectorProperty
name="Peak Radius"
command="SetRadius"
number_of_elements="1"
default_values="0.05">
<Documentation>
Set the Radius of the Peak Marker. This is automatically determined if peaks in the PeaksWorkspace has been integrated.
</Documentation>
</DoubleVectorProperty>
<StringVectorProperty
name="FileName"
command="SetFileName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkMath.h"
#include "vtkAxes.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkPointData.h"
Expand Down Expand Up @@ -44,12 +45,6 @@ vtkNexusPeaksReader::~vtkNexusPeaksReader()
}


void vtkNexusPeaksReader::SetRadius(double radius)
{
m_radius = radius;
this->Modified();
}

void vtkNexusPeaksReader::SetDimensions(int dimensions)
{
m_dimensions = dimensions;
Expand Down Expand Up @@ -81,19 +76,28 @@ int vtkNexusPeaksReader::RequestData(vtkInformation * vtkNotUsed(request), vtkIn
FilterUpdateProgressAction<vtkNexusPeaksReader> drawingProgressUpdate(this, "Drawing...");
vtkDataSet * structuredMesh = p_peakFactory->create(drawingProgressUpdate);

// Pick the radius up from the factory if possible, otherwise use the user-provided value.
double peakRadius = m_radius;
vtkPolyDataAlgorithm* shapeMarker = NULL;
if(p_peakFactory->isPeaksWorkspaceIntegrated())
{
peakRadius = p_peakFactory->getIntegrationRadius();
double peakRadius = p_peakFactory->getIntegrationRadius();
const int resolution = 6;
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(peakRadius);
sphere->SetPhiResolution(resolution);
sphere->SetThetaResolution(resolution);
shapeMarker = sphere;
}
else
{
vtkAxes* axis = vtkAxes::New();
axis->SymmetricOn();
axis->SetScaleFactor(0.5);
shapeMarker = axis;
}

vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(peakRadius);

vtkPVGlyphFilter *glyphFilter = vtkPVGlyphFilter::New();
glyphFilter->SetInput(structuredMesh);
glyphFilter->SetSource(sphere->GetOutput());
glyphFilter->SetSource(shapeMarker->GetOutput());
glyphFilter->Update();
vtkPolyData *glyphed = glyphFilter->GetOutput();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class VTK_EXPORT vtkNexusPeaksReader : public vtkPolyDataAlgorithm
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
int CanReadFile(const char* fname);
void SetRadius(double width);
void SetDimensions(int dimensions);
/// Called by presenter to force progress information updating.
void updateAlgorithmProgress(double progress, const std::string& message);
Expand All @@ -34,9 +33,6 @@ class VTK_EXPORT vtkNexusPeaksReader : public vtkPolyDataAlgorithm

void operator = (const vtkNexusPeaksReader&);

//Peak width;
double m_radius;

/// File name from which to read.
char *FileName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
information_only="1">
<SimpleStringInformationHelper />
</StringVectorProperty>
<DoubleVectorProperty
name="Peak Radius"
command="SetRadius"
number_of_elements="1"
default_values="0.05">
<Documentation>
Set the Radius of the Peak Marker. This is automatically determined if peaks in the PeaksWorkspace has been integrated.
</Documentation>
</DoubleVectorProperty>
<StringVectorProperty
name="FileName"
command="SetFileName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "vtkCellData.h"
#include "vtkPointData.h"
#include "vtkTransform.h"
#include "vtkAxes.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include <vtkSphereSource.h>

Expand Down Expand Up @@ -42,13 +43,6 @@ vtkPeaksReader::~vtkPeaksReader()
this->SetFileName(0);
}


void vtkPeaksReader::SetRadius(double radius)
{
m_radius = radius;
this->Modified();
}

void vtkPeaksReader::SetDimensions(int dimensions)
{
m_dimensions = dimensions;
Expand Down Expand Up @@ -80,22 +74,28 @@ int vtkPeaksReader::RequestData(vtkInformation * vtkNotUsed(request), vtkInforma
FilterUpdateProgressAction<vtkPeaksReader> drawingProgressUpdate(this, "Drawing...");
vtkDataSet * structuredMesh = p_peakFactory->create(drawingProgressUpdate);

// Pick the radius up from the factory if possible, otherwise use the user-provided value.
double peakRadius = m_radius;
vtkPolyDataAlgorithm* shapeMarker = NULL;
if(p_peakFactory->isPeaksWorkspaceIntegrated())
{
peakRadius = p_peakFactory->getIntegrationRadius();
double peakRadius = p_peakFactory->getIntegrationRadius();
const int resolution = 6;
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(peakRadius);
sphere->SetPhiResolution(resolution);
sphere->SetThetaResolution(resolution);
shapeMarker = sphere;
}
else
{
vtkAxes* axis = vtkAxes::New();
axis->SymmetricOn();
axis->SetScaleFactor(0.5);
shapeMarker = axis;
}

const int resolution = 6;
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(peakRadius);
sphere->SetPhiResolution(resolution);
sphere->SetThetaResolution(resolution);

vtkPVGlyphFilter *glyphFilter = vtkPVGlyphFilter::New();
glyphFilter->SetInput(structuredMesh);
glyphFilter->SetSource(sphere->GetOutput());
glyphFilter->SetSource(shapeMarker->GetOutput());
glyphFilter->Update();
vtkPolyData *glyphed = glyphFilter->GetOutput();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class VTK_EXPORT vtkPeaksReader : public vtkPolyDataAlgorithm
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
int CanReadFile(const char* fname);
void SetRadius(double width);
void SetDimensions(int dimensions);
/// Called by presenter to force progress information updating.
void updateAlgorithmProgress(double progress, const std::string& message);
Expand All @@ -34,9 +33,6 @@ class VTK_EXPORT vtkPeaksReader : public vtkPolyDataAlgorithm

void operator = (const vtkPeaksReader&);

//Peak width;
double m_radius;

/// File name from which to read.
char *FileName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
number_of_elements="1"
information_only="0">
</StringVectorProperty>
<DoubleVectorProperty
name="Peak Radius"
command="SetRadius"
number_of_elements="1"
default_values="0.05"
information_only="0">
<Documentation>
Set the Radius of the Peak Marker. This is automatically determined if peaks in the PeaksWorkspace has been integrated.
</Documentation>
</DoubleVectorProperty>
<IntVectorProperty
name="Peak Dimensions"
command="SetPeakDimension"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "vtkPeaksSource.h"

#include "vtkSphereSource.h"
#include "vtkAxes.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
Expand All @@ -22,7 +23,7 @@ using Mantid::API::Workspace_sptr;
using Mantid::API::AnalysisDataService;

/// Constructor
vtkPeaksSource::vtkPeaksSource() : m_wsName(""), m_radius(-1),
vtkPeaksSource::vtkPeaksSource() : m_wsName(""),
m_wsTypeName(""), m_dimToShow(vtkPeakMarkerFactory::Peak_in_Q_lab)
{
this->SetNumberOfInputPorts(0);
Expand All @@ -46,13 +47,6 @@ void vtkPeaksSource::SetWsName(std::string name)
this->Modified();
}
}

void vtkPeaksSource::SetRadius(double radius)
{
m_radius = radius;
this->Modified();
}

void vtkPeaksSource::SetPeakDimension(int dim)
{
m_dimToShow = static_cast<vtkPeakMarkerFactory::ePeakDimensions>(dim);
Expand Down Expand Up @@ -80,21 +74,28 @@ int vtkPeaksSource::RequestData(vtkInformation *, vtkInformationVector **,
vtkDataSet *structuredMesh = p_peakFactory->create(drawingProgressUpdate);

// Pick the radius up from the factory if possible, otherwise use the user-provided value.
double peakRadius = m_radius;
vtkPolyDataAlgorithm* shapeMarker = NULL;
if(p_peakFactory->isPeaksWorkspaceIntegrated())
{
peakRadius = p_peakFactory->getIntegrationRadius();
double peakRadius = p_peakFactory->getIntegrationRadius();
const int resolution = 6;
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(peakRadius);
sphere->SetPhiResolution(resolution);
sphere->SetThetaResolution(resolution);
shapeMarker = sphere;
}
else
{
vtkAxes* axis = vtkAxes::New();
axis->SymmetricOn();
axis->SetScaleFactor(0.5);
shapeMarker = axis;
}

const int resolution = 6;
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(peakRadius);
sphere->SetPhiResolution(resolution);
sphere->SetThetaResolution(resolution);

vtkPVGlyphFilter *glyphFilter = vtkPVGlyphFilter::New();
glyphFilter->SetInput(structuredMesh);
glyphFilter->SetSource(sphere->GetOutput());
glyphFilter->SetSource(shapeMarker->GetOutput());
glyphFilter->Update();
vtkPolyData *glyphed = glyphFilter->GetOutput();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class VTK_EXPORT vtkPeaksSource : public vtkPolyDataAlgorithm
vtkTypeRevisionMacro(vtkPeaksSource,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);

void SetRadius(double radius);
void SetWsName(std::string wsName);
void SetPeakDimension(int dim);
/// Update the algorithm progress.
Expand All @@ -59,9 +58,6 @@ class VTK_EXPORT vtkPeaksSource : public vtkPolyDataAlgorithm
/// Name of the workspace.
std::string m_wsName;

/// Width of the glyphs
double m_radius;

/// Cache for the workspace type name
std::string m_wsTypeName;

Expand Down

0 comments on commit e55f5c9

Please sign in to comment.