IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkAnnotation2D.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:50 $ 00007 Version: $Revision: 1.6 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __igstkAnnotation2D_h 00019 #define __igstkAnnotation2D_h 00020 00021 #ifdef _MSC_VER 00022 #pragma warning ( disable : 4786 ) 00023 // Disabling warning C4355: 'this' : used in base member initializer list 00024 #pragma warning ( disable : 4355 ) 00025 #endif 00026 00027 #include <string> 00028 #include "vtkTextActor.h" 00029 #include "vtkTextMapper.h" 00030 #include "vtkTextProperty.h" 00031 #include "igstkObject.h" 00032 #include "igstkStateMachine.h" 00033 #include "vtkViewport.h" 00034 00035 00036 namespace igstk 00037 { 00038 00039 class View; 00040 00053 class Annotation2D 00054 : public Object 00055 { 00056 00057 public: 00058 00059 00060 /* Macro with standard traits declarations. */ 00061 igstkStandardClassTraitsMacro( Annotation2D, Object ) 00062 00063 /* Add annotation text */ 00064 void RequestSetAnnotationText( int , const std::string & ); 00065 00067 void RequestSetFontColor( int index, double red, 00068 double green, double blue ); 00069 00071 void RequestSetFontSize( int index, int fontSize ); 00072 00074 void RequestAddAnnotations(); 00075 00077 igstkLoggerMacro(); 00078 00080 typedef std::vector< vtkTextActor* > ActorsListType; 00081 00083 igstkGetMacro( Actors, ActorsListType ); 00084 00085 friend class View; 00086 00088 friend class QView; 00089 00090 protected: 00091 00092 Annotation2D( void ); 00093 ~Annotation2D( void ); 00094 00095 00097 void AddActors( vtkTextActor* ); 00098 00100 void DeleteActors( ); 00101 00103 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00104 00106 void RequestSetAnnotationsViewPort( int horizontal, int vertical ); 00107 00108 private: 00109 00110 Annotation2D( const Self & ); //purposely not implemented 00111 void operator=(const Self&); //purposely not implemented 00112 00113 ActorsListType m_Actors; 00114 00115 std::string m_AnnotationText[4]; 00116 std::string m_AnnotationTextToBeAdded; 00117 vtkTextActor * m_AnnotationActor[4]; 00118 vtkTextActor * m_ActorToBeAdded; 00119 vtkTextProperty * m_TextProperty[4]; 00120 00121 int m_ViewPortHorizontalSize; 00122 int m_ViewPortVerticalSize; 00123 int m_ViewPortHorizontalSizeToBeSet; 00124 int m_ViewPortVerticalSizeToBeSet; 00125 00126 double m_FontColor[3]; 00127 int m_AnnotationIndexFontColorToBeChanged; 00128 00129 int m_FontSize; 00130 int m_AnnotationIndexFontSizeToBeChanged; 00131 00133 void AddActorProcessing(); 00134 void SetAnnotationTextProcessing(); 00135 void SetViewPortProcessing(); 00136 void AddAnnotationsProcessing(); 00137 void ReportInvalidAnnotationIndexProcessing(); 00138 void ReportInvalidRequestProcessing(); 00139 void ChangeTextColorProcessing(); 00140 void ChangeFontSizeProcessing(); 00141 00143 int m_IndexForAnnotationToBeAdded; 00144 00146 igstkDeclareInputMacro( ValidAnnotations ); 00147 igstkDeclareInputMacro( InvalidAnnotations ); 00148 igstkDeclareInputMacro( ValidViewPort ); 00149 igstkDeclareInputMacro( ValidAnnotationIndex ); 00150 igstkDeclareInputMacro( InvalidAnnotationIndex ); 00151 igstkDeclareInputMacro( ValidColorProperty ); 00152 igstkDeclareInputMacro( InvalidColorProperty ); 00153 igstkDeclareInputMacro( ValidFontSizeProperty ); 00154 igstkDeclareInputMacro( InvalidFontSizeProperty ); 00155 00157 igstkDeclareStateMacro( Idle ); 00158 igstkDeclareStateMacro( ViewPortSet ); 00159 igstkDeclareStateMacro( AnnotationsAdded ); 00160 }; 00161 00162 } // end namespace igstk 00163 00164 #endif // __igstkAnnotation2D_h