ACF $AcfVersion:0$
CSubstractiveColorModel.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
7#include <iser/CArchiveTag.h>
9#include <ibase/TContainer.h>
10#include <imod/TModelWrap.h>
12
13
14namespace icmm
15{
16
17
25 virtual public iser::ISerializable
26{
27public:
29 typedef CObservableListBase BaseClass2;
30
35
37
38 bool operator==(const CSubstractiveColorModel& ref) const;
39 bool operator!=(const CSubstractiveColorModel& ref) const;
40
44 bool ContainsColorant(const ColorantId& colorantId) const;
45
52 bool InsertColorant(const ColorantId& colorantId, ColorantUsage usage, int index = -1);
53
58 bool RemoveColorant(const ColorantId& colorantId);
59
63 bool SetColorantUsage(const ColorantId& colorantId, ColorantUsage usage);
64
68 bool SetColorantId(const ColorantId& colorantId, const ColorantId& newColorantId);
69
75
79 bool HasProcessColorants() const;
80
84 bool HasEcg() const;
85
89 bool HasSpot() const;
90
95
100
105
106 // reimplemented ISubstractiveColorModel
107 virtual std::unique_ptr<ISubstractiveColorModel> CreateSubspaceModel(const QStringList& colorantIds) const override;
108
109 // reimplemented (icmm::IColorantList)
110 virtual ColorantIds GetColorantIds() const override;
111 virtual ColorantUsage GetColorantUsage(const ColorantId& colorantId) const override;
112
113 // reimplemented (iser::ISerializable)
114 virtual bool Serialize(iser::IArchive& archive) override;
115
116 // reimplemented (istd::IChangeable)
117 virtual int GetSupportedOperations() const override;
118 virtual bool CopyFrom(const istd::IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS) override;
120
121 static std::unique_ptr<ISubstractiveColorModel> CreateSubspaceModelFrom(const CSubstractiveColorModelBase& model, const QStringList& colorantIds);
122
123protected:
125 {
128
129 inline bool operator==(const ColorantInfo& ref) const
130 {
131 return (ref.id == id) && (ref.usage == usage);
132 }
133
134 inline bool operator!=(const ColorantInfo& ref) const
135 {
136 return !operator==(ref);
137 }
138 };
139
141
142protected:
149
150 int FindColorantIndex(const ColorantId& colorantId) const;
152 iser::IArchive& archive,
153 ColorantInfo& colorantInfo,
154 const iser::CArchiveTag* parentTagPtr) const;
155
156private:
159};
160
161
162} // namespace icmm
163
164
Base implementation for creating simple observable collection.
Common implementation of an abstract container.
Definition TContainer.h:26
Common implementation of the general device-based, substractive color model based on the list of colo...
static icmm::ColorantUsage GetDefaultUsageFromColorantName(const ColorantId &colorantId)
int FindColorantIndex(const ColorantId &colorantId) const
bool InsertColorant(const ColorantId &colorantId, ColorantUsage usage, int index=-1)
Insert a new colorant at the given position.
ibase::TContainer< ColorantInfo > ColorantInfoList
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
bool operator!=(const CSubstractiveColorModel &ref) const
CSubstractiveColorModelBase BaseClass
bool RemoveColorant(const ColorantId &colorantId)
Remove a colorant with the given ID.
bool AppendColorModel(const ISubstractiveColorModel &other)
Append colorants from from another model to this one.
virtual std::unique_ptr< ISubstractiveColorModel > CreateSubspaceModel(const QStringList &colorantIds) const override
Create ColorModel of the subspace.
CSubstractiveColorModel(const ColorantIds &colorantIds)
static ColorantId GetEcgBlue()
virtual ColorantUsage GetColorantUsage(const ColorantId &colorantId) const override
Get type of the colorant with the given ID.
ColorantIds GetProcessColorants() const
Get the list of process colors in this color model.
bool HasProcessColorants() const
Check if the color model contains process colorants.
static ColorantId GetEcgViolet()
bool ContainsColorant(const ColorantId &colorantId) const
Returns true if the colorant with the given ID exists in the color model.
virtual ColorantIds GetColorantIds() const override
Get the list of colorant-IDs.
static ColorantId GetEcgRed()
bool SetColorantUsage(const ColorantId &colorantId, ColorantUsage usage)
Set a colorant usage for an existing colorant.
bool SetColorantId(const ColorantId &colorantId, const ColorantId &newColorantId)
Set a new ID for an existing colorant.
bool operator==(const CSubstractiveColorModel &ref) const
ColorantIds GetEcgColorants() const
Get the list of ECG colorants in this color model.
CSubstractiveColorModel(const ISubstractiveColorModel &other)
bool HasSpot() const
Check if the color model contains any spot colors.
virtual bool CopyFrom(const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
Copy this object from another one.
static std::unique_ptr< ISubstractiveColorModel > CreateSubspaceModelFrom(const CSubstractiveColorModelBase &model, const QStringList &colorantIds)
static ColorantId GetEcgGreen()
ColorantIds GetSpotColorants() const
Get the list of spot colors in this color model.
bool HasEcg() const
Check if the color model contains ECG colorants.
static ColorantId GetEcgOrange()
virtual int GetSupportedOperations() const override
Get set of flags for supported operations.
CSubstractiveColorModel & operator=(const CSubstractiveColorModel &other)
bool SerializeColorantInfo(iser::IArchive &archive, ColorantInfo &colorantInfo, const iser::CArchiveTag *parentTagPtr) const
CSubstractiveColorModel(const CSubstractiveColorModel &other)
virtual istd::TUniqueInterfacePtr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
QStringList ColorantIds
Reflects the changes of observed objects as changes of some other object (over istd::IChangeable),...
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:24
Process tag used to group data in archive stream.
Definition CArchiveTag.h:22
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
Common class for all classes which objects can be archived or restored from archive.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Unique ownership smart pointer for interface types.
Contains color management classes.
ColorantUsage
Usage of a colorant.
Definition icmm.h:183
@ CU_NONE
No special usage of the colorant.
Definition icmm.h:187
bool operator==(const ColorantInfo &ref) const
bool operator!=(const ColorantInfo &ref) const