Branch data Line data Source code
1 : : /*
2 : : * AF2Edge3D.hpp
3 : : *
4 : : * An edge (or half-edge) that connects two AF2Point3D points, one labeled
5 : : * as the start of the edge, and the other labeled as the end of the edge.
6 : : *
7 : : * This class holds on to its endpoints with pointers, but it does not
8 : : * manage the memory for its endpoints. It is the reponsibility of the
9 : : * context that uses AF2Edge3D to ensure that pointers to endpoints of edges
10 : : * remain valid as long as they may be referenced by an AF2Edge3D instance.
11 : : */
12 : : #ifndef AF2EDGE3D_HPP
13 : : #define AF2EDGE3D_HPP
14 : :
15 : : // C++
16 : : #include <list>
17 : :
18 : : // MeshKit
19 : : #include "meshkit/AF2Point3D.hpp"
20 : :
21 : : class QualityDecreaseObserver;
22 : :
23 : : class AF2Edge3D
24 : : {
25 : : private:
26 : :
27 : : AF2Point3D* startPnt;
28 : : AF2Point3D* endPnt;
29 : : unsigned int qualityLevel;
30 : : QualityDecreaseObserver* observer;
31 : :
32 : : public:
33 : :
34 : : /**
35 : : * \brief Constructor
36 : : *
37 : : * Construct an edge between the two specified points.
38 : : * The context is responsible for maintaining the validity
39 : : * of the pointers to the points as long as this AF2Edge3D
40 : : * (or somy copy of it) is in use.
41 : : *
42 : : * \param start the starting endpoint of the edge
43 : : * \param end the ending endpoint of the edge.
44 : : */
45 : : AF2Edge3D(AF2Point3D* start, AF2Point3D* end);
46 : :
47 : : /**
48 : : * \brief Decrease the required quality of future attempts
49 : : * to advance the front using this edge as the baseline edge.
50 : : *
51 : : * This method increments the quality level, since a higher value
52 : : * for the quality level indicates lower quality requirements.
53 : : */
54 : : void decreaseQuality();
55 : :
56 : : /**
57 : : * \brief Get a pointer to the starting endpoint of the edge.
58 : : */
59 : : AF2Point3D* getStart() const;
60 : :
61 : : /**
62 : : * \brief Get a pointer to the ending endpoint of the edge.
63 : : */
64 : : AF2Point3D* getEnd() const;
65 : :
66 : : /**
67 : : * \brief Get the current quality level of this advancing front edge.
68 : : *
69 : : * Higher numbers for the quality level correspond to lower
70 : : * requirements on the quality of advancing the front when
71 : : * this edge is the baseline edge.
72 : : *
73 : : * \return the current quality level
74 : : */
75 : : unsigned int getQualityLevel() const;
76 : :
77 : : /**
78 : : * \brief Set this edge's quality decrease observer.
79 : : *
80 : : * The intended use of this method is for the advancing front
81 : : * to observe quality decreases to the edges that are on the
82 : : * advancing front. The method is public as an implementation
83 : : * artifact, but users should not call this method.
84 : : *
85 : : * This object does not take ownership of the observer.
86 : : *
87 : : * \param observerArg an observer that desires to be notified
88 : : * when this edge's quality decreases
89 : : */
90 : : void setObserver(QualityDecreaseObserver* observerArg);
91 : : };
92 : :
93 : 46 : class QualityDecreaseObserver
94 : : {
95 : : friend void AF2Edge3D::decreaseQuality();
96 : :
97 : : protected:
98 : : /**
99 : : * \brief Notify the observer that the quality has been decreased
100 : : * for the specified edge
101 : : *
102 : : * \param anEdge the edge for which the quality level number has increased
103 : : */
104 : : virtual void qualityDecreased(const AF2Edge3D* const & anEdge) = 0;
105 : : };
106 : :
107 : : #endif
|