PointT.tcc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libimage - An image/template for new NICE libraries
  4. * See file License for license information.
  5. */
  6. /*****************************************************************************/
  7. /*
  8. * $Author: bajramov $
  9. * $Date: 2009/05/28 11:36:30 $
  10. * $Revision: 1.2 $
  11. */
  12. /*****************************************************************************/
  13. #include "core/image/PointT.h"
  14. namespace NICE {
  15. // Constructors:
  16. // -------------
  17. template<class P>
  18. PointT<P>::PointT(const PointT<P>& ex) : Drawable<P>(ex)
  19. {
  20. *this=ex;
  21. }
  22. // Operators:
  23. // ----------
  24. template<class P>
  25. PointT<P>& PointT<P>::operator=(const PointT<P>& ex)
  26. {
  27. coord=ex.coord;
  28. this->defaultColor=ex.defaultColor;
  29. return *this;
  30. }
  31. template<class P>
  32. bool PointT<P>::operator==(const PointT<P>& ex) const
  33. {
  34. if(coord==ex.coord && this->defaultColor==ex.defaultColor)
  35. return true;
  36. return false;
  37. }
  38. template<class P>
  39. bool PointT<P>::operator!=(const PointT<P>& ex) const {
  40. return !(this->operator==(ex));
  41. }
  42. // Methods:
  43. // --------
  44. template<class P>
  45. void PointT<P>::doDraw(ColorImageT<P> &image, const ColorT<P>& color) const
  46. {
  47. if(coord.x>=0 && coord.y>=0 &&
  48. coord.x<image.width() && coord.y<image.height())
  49. image.setPixelQuick(coord,color);
  50. }
  51. template<class P>
  52. void PointT<P>::doDraw(ImageT<P> &image, const P& gray) const
  53. {
  54. if(coord.x>=0 && coord.y>=0 &&
  55. coord.x<image.width() && coord.y<image.height())
  56. image.setPixelQuick(coord,gray);
  57. }
  58. // Destructor:
  59. // -----------
  60. template<class P>
  61. PointT<P>::~PointT()
  62. {
  63. }
  64. }; // namespace NICE
  65. /*****************************************************************************/
  66. /*
  67. * $Log: PointT.tcc,v $
  68. * Revision 1.2 2009/05/28 11:36:30 bajramov
  69. * renamed a few things for consistency
  70. *
  71. * Revision 1.2 2008/05/26 18:26:51 bajramov
  72. * warnings
  73. *
  74. * Revision 1.1.1.1 2007/05/22 19:26:35 bajramov
  75. * limun2
  76. *
  77. * Revision 1.6 2007/05/03 12:07:28 bajramov
  78. * docu
  79. *
  80. * Revision 1.5 2007/02/04 15:32:50 zimmermann
  81. * * added operator !=
  82. * * bugfix operator == : circle, color
  83. * * bugfix operator = : point, circle
  84. * * expended gray() in ColorT for size()==3
  85. * * expended draw for ColorImage, to draw gray Drawables
  86. * * added new constructor PointT(Coord)
  87. *
  88. * Revision 1.4 2006/11/02 13:36:16 zimmermann
  89. * * insert some 'this->'
  90. *
  91. * Revision 1.3 2006/11/01 16:05:24 bajramov
  92. * Further changes to Drawable and subclasses.
  93. * Methods draw() of ImageT/ColorImageT with iterator parameter renamed to drawIter().
  94. * New Drawable CrossT.
  95. *
  96. * Revision 1.2 2006/11/01 15:18:14 bajramov
  97. * added drawing methods with color/gray value parameter
  98. *
  99. * Revision 1.1 2006/06/29 10:16:03 bajramov
  100. * classes and functions for drawing points, lines, ellipses, ...
  101. *
  102. * Revision 1.2 2006/02/09 09:39:14 mattern
  103. * * template update
  104. *
  105. * Revision 1.3 2006/02/02 10:50:12 mattern
  106. * * Template changed
  107. *
  108. * Revision 1.2 2005/07/28 09:56:34 bajramov
  109. * License
  110. *
  111. * Revision 1.1.1.1 2005/07/22 13:53:17 mattern
  112. * Librarys for IMage UNderstanding
  113. *
  114. */