ctkCoordinatesWidget_p.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkCoordinatesWidget_p_h
  15. #define __ctkCoordinatesWidget_p_h
  16. // Qt includes
  17. #include <QPointer>
  18. // CTK includes
  19. #include "ctkCoordinatesWidget.h"
  20. class ctkCoordinatesWidgetPrivate: public QObject
  21. {
  22. Q_OBJECT
  23. Q_DECLARE_PUBLIC(ctkCoordinatesWidget);
  24. protected:
  25. ctkCoordinatesWidget* const q_ptr;
  26. public:
  27. ctkCoordinatesWidgetPrivate(ctkCoordinatesWidget& object);
  28. virtual ~ctkCoordinatesWidgetPrivate();
  29. void init();
  30. public Q_SLOTS:
  31. void updateDecimals();
  32. void updateOtherDecimals(int);
  33. void setTemporaryDecimals(int);
  34. void onValueProxyAboutToBeModified();
  35. void onValueProxyModified();
  36. public:
  37. void addSpinBox();
  38. /// Normalize coordinates vector and return the previous norm.
  39. static double normalize(double* coordinates, int dimension);
  40. /// Compute the norm of a coordinates \a dimension vector
  41. static double norm(double* coordinates, int dimension);
  42. static double squaredNorm(double* coordinates, int dimension);
  43. /// Return the ideal number of decimals based on the spinBox value or
  44. /// 16 if there is no "good" number of decimals.
  45. /// \sa ctk::significantDecimals()
  46. static int spinBoxSignificantDecimals(ctkDoubleSpinBox* spinBox);
  47. int Decimals;
  48. ctkDoubleSpinBox::DecimalsOptions DecimalsOption;
  49. double SingleStep;
  50. double Minimum;
  51. double Maximum;
  52. bool Normalized;
  53. int Dimension;
  54. ctkDoubleSpinBox::SizeHintPolicy SizeHintPolicy;
  55. double* Coordinates;
  56. QList<int> LastUserEditedCoordinates;
  57. bool ChangingDecimals;
  58. QPointer<ctkValueProxy> Proxy;
  59. private:
  60. Q_DISABLE_COPY(ctkCoordinatesWidgetPrivate);
  61. };
  62. #endif