TVisualObjects.h
Go to the documentation of this file.
1 #ifndef iview_TVisualObjects_included
2 #define iview_TVisualObjects_included
3 
4 
5 // ACF includes
6 #include <imod/TModelWrap.h>
7 #include <iview/CImageShape.h>
8 
9 
10 namespace iview
11 {
12 
13 
14 // helper template for shapes
15 
16 template<class Object, class Shape>
17 struct TVisualObject: public Shape
18 {
19  typedef Shape BaseClass;
20 
21  TVisualObject(bool editable = false);
22 
24 
26 };
27 
28 
29 template<class Object, class Shape>
31 {
32  model.SetPtr(new PositionModel);
33 
34  BaseClass::SetEditablePosition(editable);
35  BaseClass::SetEditableRadius(editable);
36 
37  model->AttachObserver(this);
38 }
39 
40 
41 // helper template for image shapes
42 
43 template<class Object, class BitmapShape = iview::CImageShape>
45 {
46  TBitmapVisualObject(const Object* imagePtr = NULL);
47 
49 
52 };
53 
54 
55 template<class Object, class BitmapShape>
57 {
58  model.SetPtr(new ImageModel);
59  if (imagePtr != NULL){
60  model->SetBaseObject(*imagePtr);
61  }
62 
63  shape.SetPtr(new BitmapShape);
64 
65  model->AttachObserver(shape.GetPtr());
66 }
67 
68 
69 } // namespace iview
70 
71 
72 #endif // !iview_TVisualObjects_included
istd::TDelPtr< PositionModel > model
TVisualObject(bool editable=false)
imod::TModelWrap< Object > PositionModel
imod::TModelWrap< Object > ImageModel
TBitmapVisualObject(const Object *imagePtr=NULL)
#define NULL
Definition: istd.h:64
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition: TModelWrap.h:24
istd::TDelPtr< ImageModel > model
istd::TDelPtr< BitmapShape > shape
Pointer wrapper providing automatic deleting pointed object during destruction.
Definition: TDelPtr.h:20

© 2007-2017 Witold Gantzke and Kirill Lepskiy