ICF 3.1.1.10
Technical documentation of ICF Libraries
TVisualObjects.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iview_TVisualObjects_included
7#define iview_TVisualObjects_included
8
9
10// ICF includes
11#include <imod/TModelWrap.h>
12#include <iview/CImageShape.h>
13
14
15namespace iview
16{
17
18
19// helper template for shapes
20
21template<class Object, class Shape>
22struct TVisualObject: public Shape
23{
24 typedef Shape BaseClass;
25
26 TVisualObject(bool editable = false);
27
29
30 std::unique_ptr<PositionModel> model;
31};
32
33
34template<class Object, class Shape>
36{
37 model = std::make_unique<PositionModel>();
38
39 BaseClass::SetEditablePosition(editable);
40 BaseClass::SetEditableRadius(editable);
41
42 model->AttachObserver(this);
43}
44
45
46// helper template for image shapes
47
48template<class Object, class BitmapShape = iview::CImageShape>
50{
51 TBitmapVisualObject(const Object* imagePtr = nullptr);
52
54
55 std::unique_ptr<ImageModel> model;
56 std::unique_ptr<BitmapShape> shape;
57};
58
59
60template<class Object, class BitmapShape>
62{
63 model.SetPtr(new ImageModel);
64 if (imagePtr != nullptr){
65 model->SetBaseObject(*imagePtr);
66 }
67
68 shape.SetPtr(new BitmapShape);
69
70 model->AttachObserver(shape.get());
71}
72
73
74} // namespace iview
75
76
77#endif // !iview_TVisualObjects_included
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:28
In this library is defined 2D view concept and standard visualisation objects.
std::unique_ptr< BitmapShape > shape
std::unique_ptr< ImageModel > model
imod::TModelWrap< Object > ImageModel
TBitmapVisualObject(const Object *imagePtr=nullptr)
imod::TModelWrap< Object > PositionModel
TVisualObject(bool editable=false)
std::unique_ptr< PositionModel > model

© Witold Gantzke and Kirill Lepskiy