ICF 3.1.1.10
Technical documentation of ICF Libraries
TResultShapeCreatorWrap.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#pragma once
7
8
9// ICF includes
10#include <iview/IShapeFactory.h>
11#include <iview/IColorSchema.h>
12
13
14namespace iinspgui
15{
16
17
18template <class Base>
19class TResultShapeCreatorWrap: public Base
20{
21public:
22 typedef Base BaseClass;
23
24 I_BEGIN_BASE_COMPONENT(TResultShapeCreatorWrap);
25 I_ASSIGN(m_noneStatusSchemeCompPtr, "NoneStatusColorSchema", "Color schema used for shapes without any status", false, "NoneStatusColorSchema");
26 I_ASSIGN(m_okColorSchemeCompPtr, "OkColorSchema", "Color schema used for ok shapes", false, "OkColorSchema");
27 I_ASSIGN(m_warningColorSchemeCompPtr, "WarningColorSchema", "Color schema used for warning shapes", false, "WarningColorSchema");
28 I_ASSIGN(m_errorColorSchemeCompPtr, "ErrorColorSchema", "Color schema used for error shapes", false, "ErrorColorSchema");
29 I_END_COMPONENT;
30
34 virtual std::unique_ptr<iview::IShape> CreateResultShape(
35 const iview::IShapeFactory* shapeFactoryPtr,
36 const istd::IChangeable* objectPtr,
37 const istd::IInformationProvider* infoPtr,
38 bool connectToModel = true) const;
39
40private:
41 I_REF(iview::IColorSchema, m_noneStatusSchemeCompPtr);
42 I_REF(iview::IColorSchema, m_okColorSchemeCompPtr);
43 I_REF(iview::IColorSchema, m_warningColorSchemeCompPtr);
44 I_REF(iview::IColorSchema, m_errorColorSchemeCompPtr);
45};
46
47
48// public methods
49template <class Base>
51 const iview::IShapeFactory* shapeFactoryPtr,
52 const istd::IChangeable* objectPtr,
53 const istd::IInformationProvider* infoPtr,
54 bool connectToModel) const
55{
56 if (shapeFactoryPtr != nullptr){
57 auto shapePtr = shapeFactoryPtr->CreateShape(objectPtr, connectToModel);
58 if (shapePtr == nullptr){
59 return nullptr;
60 }
61
62 if (infoPtr == nullptr){
63 return shapePtr;
64 }
65
66 int category = infoPtr->GetInformationCategory();
67
68 const iview::IColorSchema* userColorSchemaPtr = shapePtr->GetUserColorSchema();
69
70 switch (category){
73 if ((userColorSchemaPtr == nullptr) && m_errorColorSchemeCompPtr != nullptr){
74 shapePtr->SetUserColorSchema(m_errorColorSchemeCompPtr.get());
75 }
76 break;
77
79 if ((userColorSchemaPtr == nullptr) && m_warningColorSchemeCompPtr != nullptr){
80 shapePtr->SetUserColorSchema(m_warningColorSchemeCompPtr.get());
81 }
82 break;
83
85 if ((userColorSchemaPtr == nullptr) && m_okColorSchemeCompPtr != nullptr){
86 shapePtr->SetUserColorSchema(m_okColorSchemeCompPtr.get());
87 }
88 break;
89
91 if ((userColorSchemaPtr == nullptr) && m_noneStatusSchemeCompPtr != nullptr){
92 shapePtr->SetUserColorSchema(m_noneStatusSchemeCompPtr.get());
93 }
94 break;
95
96 default:;
97 }
98
99 return shapePtr;
100 }
101
102 return nullptr;
103}
104
105
106} // namespace iinspgui
107
108
virtual std::unique_ptr< iview::IShape > CreateResultShape(const iview::IShapeFactory *shapeFactoryPtr, const istd::IChangeable *objectPtr, const istd::IInformationProvider *infoPtr, bool connectToModel=true) const
Create a shape for the result object and corresponding status information.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Common interface for class providing some basic information object.
@ IC_ERROR
Information about error, processing could not be done correctly.
@ IC_CRITICAL
Information about critical error - unnormal state of system, should never be returned.
@ IC_INFO
Normal information level, can be also interpreted as OK.
@ IC_NONE
Information is unimportant, for example can be used for diagnostic.
@ IC_WARNING
Information about warning, processing could be done.
virtual InformationCategory GetInformationCategory() const =0
Get category of the information.
Defines set of standard pens, brushes and simple management of unions.
Interface for creation of visualization shapes of some geometrical object.
virtual std::unique_ptr< IShape > CreateShape(const istd::IChangeable *objectPtr, bool connectToModel=false) const =0
Create a graphical representation of the given 2D-object object.
Contains Qt based implementations of inspection classes and components.

© Witold Gantzke and Kirill Lepskiy