CEdgesReductorComp.h
Go to the documentation of this file.
1 #ifndef iedge_CEdgesReductorComp_included
2 #define iedge_CEdgesReductorComp_included
3 
4 
5 #include <QtCore/QBitArray>
6 
7 // ACF includes
8 #include <istd/TSmartPtr.h>
11 
12 // ACF-Solutions includes
13 #include <imeas/INumericValue.h>
15 
17 
18 
19 namespace iedge
20 {
21 
22 
24  public iproc::TSyncProcessorCompBase<IEdgeLinesProcessor>,
25  virtual public imeas::INumericConstraints,
26  virtual protected iprm::IOptionsList
27 {
28 public:
30 
31  I_BEGIN_COMPONENT(CEdgesReductorComp);
32  I_REGISTER_INTERFACE(IEdgeLinesProcessor);
33  I_REGISTER_INTERFACE(imeas::INumericConstraints);
34  I_ASSIGN(m_defaultToleranceParamsCompPtr, "DefaultToleranceParams", "Default parameter for thresholds, if not taken from parameters", false, "DefaultToleranceParams");
35  I_ASSIGN(m_toleranceParamsIdAttrPtr, "ToleranceParamsId", "Parameter ID (imeas::INumericValue) for reduction tolerance", false, "ReductionTolerances");
36  I_ASSIGN(m_distanceUnitInfoCompPtr, "DistanceUnitInfo", "Unit information used for distance tolerance", false, "DistanceUnit");
37  I_END_COMPONENT;
38 
40 
41  void GetReducedLine(
42  const CEdgeLine& edgeLine,
43  double positionTolerance,
44  double weightTolerance,
45  CEdgeLine& result) const;
46 
47  void GetReducedLines(
48  const CEdgeLineContainer& edgeLines,
49  double positionTolerance,
50  double weightTolerance,
51  CEdgeLineContainer& result) const;
52 
53  // reimplemented (iedge::IEdgeLinesProcessor)
54  virtual bool DoLinesProcessing(
55  const iprm::IParamsSet* paramsPtr,
56  const CEdgeLineContainer& edgeLines,
57  CEdgeLineContainer& result) const;
58 
59  // reimplemented (iproc::IProcessor)
60  virtual int DoProcessing(
61  const iprm::IParamsSet* paramsPtr,
62  const istd::IPolymorphic* inputPtr,
63  istd::IChangeable* outputPtr,
64  ibase::IProgressManager* progressManagerPtr = NULL);
65 
66  // reimplemented (imeas::INumericConstraints)
67  virtual const iprm::IOptionsList& GetValueListInfo() const;
68  virtual const imath::IUnitInfo* GetNumericValueUnitInfo(int index) const;
69 
70 protected:
71  typedef QBitArray NodesToRemove;
72 
73  // cache of the nodes to avoid constant reallocations
75 
80  int ReduceNodes(
81  const CEdgeLine& edgeLine,
82  double positionTolerance,
83  double weightTolerance,
84  int firstIndex,
85  int lastIndex,
86  NodesToRemove& nodesToRemove,
87  int& firstInsideIndex,
88  int& lastInsideIndex) const;
89 
90  // reimplemented (iprm::IOptionsList)
91  virtual int GetOptionsFlags() const;
92  virtual int GetOptionsCount() const;
93  virtual QString GetOptionName(int index) const;
94  virtual QString GetOptionDescription(int index) const;
95  virtual QByteArray GetOptionId(int index) const;
96  virtual bool IsOptionEnabled(int index) const;
97 
98  // reimplemented (icomp::CComponentBase)
99  virtual void OnComponentCreated();
100 
101 private:
102  I_REF(imeas::INumericValue, m_defaultToleranceParamsCompPtr);
103  I_ATTR(QByteArray, m_toleranceParamsIdAttrPtr);
104  I_REF(imath::IUnitInfo, m_distanceUnitInfoCompPtr);
105 
106  imath::CGeneralUnitInfo m_distanceUnitInfo;
107 };
108 
109 
110 } // namespace iedge
111 
112 
113 #endif // !iedge_CEdgesReductorComp_included
114 
115 
Simple definition macro for a synchronous processor.
void GetReducedLine(const CEdgeLine &edgeLine, double positionTolerance, double weightTolerance, CEdgeLine &result) const
virtual QString GetOptionName(int index) const
virtual bool DoLinesProcessing(const iprm::IParamsSet *paramsPtr, const CEdgeLineContainer &edgeLines, CEdgeLineContainer &result) const
iproc::TSyncProcessorCompBase< IEdgeLinesProcessor > BaseClass
virtual int GetOptionsCount() const
virtual void OnComponentCreated()
virtual QByteArray GetOptionId(int index) const
Describe additional meta information for set of numeric values.
virtual const imath::IUnitInfo * GetNumericValueUnitInfo(int index) const
Get range of possible numeric values for specified list index.
virtual QString GetOptionDescription(int index) const
Interface for edge lines processing.
General parameter set containing list of numeric values.
Definition: INumericValue.h:20
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)
void GetReducedLines(const CEdgeLineContainer &edgeLines, double positionTolerance, double weightTolerance, CEdgeLineContainer &result) const
int ReduceNodes(const CEdgeLine &edgeLine, double positionTolerance, double weightTolerance, int firstIndex, int lastIndex, NodesToRemove &nodesToRemove, int &firstInsideIndex, int &lastInsideIndex) const
Mark points to remove.
virtual bool IsOptionEnabled(int index) const
virtual const iprm::IOptionsList & GetValueListInfo() const
Get general information about the "content" of the numeric value.
virtual int GetOptionsFlags() const

© 2007-2017 Witold Gantzke and Kirill Lepskiy