diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/PeaksReader.xml b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/PeaksReader.xml index ee89997b749d2f0395243b1c7dbb7cc758218596..783f82d58e38746e0761878a72e0b08d210c42c8 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/PeaksReader.xml +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/PeaksReader.xml @@ -10,10 +10,13 @@ <SimpleStringInformationHelper /> </StringVectorProperty> <DoubleVectorProperty - name="Peak Width" - command="SetWidth" + 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" diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx index 817e1346807053fc29762dd5cb977bf6b6693cca..f4927de1ac456ada978fb03ffa06cd30a6abe824 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx @@ -8,7 +8,7 @@ #include "vtkPointData.h" #include "vtkTransform.h" #include "vtkStreamingDemandDrivenPipeline.h" -#include <vtkCubeSource.h> +#include <vtkSphereSource.h> #include "MantidVatesAPI/FilteringUpdateProgressAction.h" #include "MantidVatesAPI/vtkPeakMarkerFactory.h" @@ -41,9 +41,9 @@ vtkPeaksReader::~vtkPeaksReader() } -void vtkPeaksReader::SetWidth(double width) +void vtkPeaksReader::SetRadius(double radius) { - m_width = width; + m_radius = radius; this->Modified(); } @@ -78,18 +78,24 @@ int vtkPeaksReader::RequestData(vtkInformation * vtkNotUsed(request), vtkInforma FilterUpdateProgressAction<vtkPeaksReader> drawingProgressUpdate(this, "Drawing..."); vtkDataSet * structuredMesh = p_peakFactory->create(drawingProgressUpdate); - vtkCubeSource* cube = vtkCubeSource::New(); - cube->SetXLength(m_width); - cube->SetYLength(m_width); - cube->SetZLength(m_width); + // Pick the radius up from the factory if possible, otherwise use the user-provided value. + double peakRadius = m_radius; + if(p_peakFactory->isPeaksWorkspaceIntegrated()) + { + peakRadius = p_peakFactory->getIntegrationRadius(); + } - vtkPVGlyphFilter* glyphFilter = vtkPVGlyphFilter::New(); + vtkSphereSource *sphere = vtkSphereSource::New(); + sphere->SetRadius(peakRadius); + + vtkPVGlyphFilter *glyphFilter = vtkPVGlyphFilter::New(); glyphFilter->SetInput(structuredMesh); - glyphFilter->SetSource(cube->GetOutput()); + glyphFilter->SetSource(sphere->GetOutput()); glyphFilter->Update(); - vtkPolyData* glyphed = glyphFilter->GetOutput(); + vtkPolyData *glyphed = glyphFilter->GetOutput(); output->ShallowCopy(glyphed); + glyphFilter->Delete(); return 1; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.h b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.h index 37009e2dce0d47092506131bc803d1710f22a6e9..4a19685867dfb902cfae784ef6fefa56abbb0ad5 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.h +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.h @@ -13,7 +13,7 @@ public: vtkSetStringMacro(FileName); vtkGetStringMacro(FileName); int CanReadFile(const char* fname); - void SetWidth(double width); + void SetRadius(double width); void SetDimensions(int dimensions); /// Called by presenter to force progress information updating. void updateAlgorithmProgress(double progress, const std::string& message); @@ -35,7 +35,7 @@ private: void operator = (const vtkPeaksReader&); //Peak width; - double m_width; + double m_radius; /// File name from which to read. char *FileName; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/PeaksSource.xml b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/PeaksSource.xml index 00556371d3c0d73f0780a862a3638aa0a46c5cd7..2a4040977edd375005b4ae21f727c8a5e8830b97 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/PeaksSource.xml +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/PeaksSource.xml @@ -16,11 +16,14 @@ information_only="0"> </StringVectorProperty> <DoubleVectorProperty - name="Peak Width" - command="SetWidth" + 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> </SourceProxy> </ProxyGroup> diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx index 36f2b716583c7dca36cffef731cee698126fee50..168075f2bb499e462f2712249dc51ea9b4cd3152 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx @@ -1,6 +1,6 @@ #include "vtkPeaksSource.h" -#include "vtkCubeSource.h" +#include "vtkSphereSource.h" #include "vtkInformation.h" #include "vtkInformationVector.h" #include "vtkObjectFactory.h" @@ -46,9 +46,9 @@ void vtkPeaksSource::SetWsName(std::string name) } } -void vtkPeaksSource::SetWidth(double width) +void vtkPeaksSource::SetRadius(double radius) { - m_width = width; + m_radius = radius; this->Modified(); } @@ -60,7 +60,6 @@ int vtkPeaksSource::RequestData(vtkInformation *, vtkInformationVector **, { vtkInformation *outInfo = outputVector->GetInformationObject(0); - //FilterUpdateProgressAction<vtkPeaksSource> loadingProgressUpdate(this, "Loading..."); FilterUpdateProgressAction<vtkPeaksSource> drawingProgressUpdate(this, "Drawing..."); vtkPolyData *output = vtkPolyData::SafeDownCast( @@ -72,14 +71,19 @@ int vtkPeaksSource::RequestData(vtkInformation *, vtkInformationVector **, p_peakFactory->initialize(m_PeakWS); vtkDataSet *structuredMesh = p_peakFactory->create(drawingProgressUpdate); - vtkCubeSource *cube = vtkCubeSource::New(); - cube->SetXLength(m_width); - cube->SetYLength(m_width); - cube->SetZLength(m_width); + // Pick the radius up from the factory if possible, otherwise use the user-provided value. + double peakRadius = m_radius; + if(p_peakFactory->isPeaksWorkspaceIntegrated()) + { + peakRadius = p_peakFactory->getIntegrationRadius(); + } + + vtkSphereSource *sphere = vtkSphereSource::New(); + sphere->SetRadius(peakRadius); vtkPVGlyphFilter *glyphFilter = vtkPVGlyphFilter::New(); glyphFilter->SetInput(structuredMesh); - glyphFilter->SetSource(cube->GetOutput()); + glyphFilter->SetSource(sphere->GetOutput()); glyphFilter->Update(); vtkPolyData *glyphed = glyphFilter->GetOutput(); diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.h b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.h index 65290f00ea61718a00f1ff462a56c616e8abb2a4..45bb86d72201c7e196344316311d94efaa25ee2a 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.h +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.h @@ -41,7 +41,7 @@ public: vtkTypeRevisionMacro(vtkPeaksSource,vtkPolyDataAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); - void SetWidth(double width); + void SetRadius(double radius); void SetWsName(std::string wsName); /// Update the algorithm progress. void updateAlgorithmProgress(double progress, const std::string& message); @@ -59,7 +59,7 @@ private: std::string m_wsName; /// Width of the glyphs - double m_width; + double m_radius; /// Cache for the workspace type name std::string m_wsTypeName;