@@ -38,6 +38,12 @@ using namespace SCIRun::Core::Datatypes;
3838
3939typedef SCIRun::Modules::Visualization::CreateStandardColorMap CreateStandardColorMapModule;
4040
41+ namespace
42+ {
43+ const double colormapPreviewHeight = 83 ;
44+ const double colormapPreviewWidth = 365 ;
45+ const QRectF colorMapPreviewRect (0 , 0 , colormapPreviewWidth, colormapPreviewHeight);
46+ }
4147
4248CreateStandardColorMapDialog::CreateStandardColorMapDialog (const std::string& name, ModuleStateHandle state,
4349 QWidget* parent /* = 0 */ )
@@ -97,7 +103,7 @@ void CreateStandardColorMapDialog::pullSpecial()
97103 for (const auto & p : pointsVec)
98104 {
99105 auto pVec = p.toVector ();
100- previewColorMap_->addPoint (QPointF (pVec[0 ].toDouble (), pVec[1 ].toDouble ()));
106+ previewColorMap_->addPoint (QPointF (pVec[0 ].toDouble () * colormapPreviewWidth, ( 1 . 0f - pVec[1 ].toDouble ()) * colormapPreviewHeight ));
101107 }
102108 }
103109}
@@ -159,13 +165,6 @@ AlphaFunctionManager::AlphaFunctionManager(const QPointF& start, const QPointF&
159165{
160166}
161167
162- namespace
163- {
164- const double colormapPreviewHeight = 83 ;
165- const double colormapPreviewWidth = 365 ;
166- const QRectF colorMapPreviewRect (0 , 0 , colormapPreviewWidth, colormapPreviewHeight);
167- }
168-
169168ColormapPreview::ColormapPreview (QGraphicsScene* scene, ModuleStateHandle state,
170169 const boost::atomic<bool >& pulling,
171170 QWidget* parent)
@@ -250,7 +249,8 @@ void AlphaFunctionManager::pushToState()
250249 Variable::List alphaPointsVec;
251250 // strip endpoints before saving user-added points
252251 auto begin = alphaPoints_.begin (), end = alphaPoints_.end ();
253- std::for_each (begin, end, [&](const QPointF& p) { alphaPointsVec.emplace_back (Name (" alphaPoint" ), makeAnonymousVariableList (p.x (), p.y ())); });
252+ std::for_each (begin, end, [&](const QPointF& p) { alphaPointsVec.emplace_back (Name (" alphaPoint" ),
253+ makeAnonymousVariableList (p.x ()/colormapPreviewWidth, 1 .0f - p.y ()/colormapPreviewHeight)); });
254254 state_->setValue (Parameters::AlphaUserPointsVector, alphaPointsVec);
255255 }
256256 else
0 commit comments