#ifndef TMesh_hxx_seen #define TMesh_hxx_seen #include #include #include #include #include "IMeshEdge.hxx" #include "IMeshPoint.hxx" namespace COMET { class IMesh; }; class COMET::IMesh : public TObject, public TAttMarker, public TAttLine { public: IMesh(); virtual ~IMesh(); /// Add a new point to the mesh. The point will be owned by the mesh, and /// may be deleted immediately! When a point is added to the mesh, it is /// checked to see if it already exists. If the point exists, then the /// new object passed to AddPoint is deleted. The address of the point in /// the mesh is returned (could be the new point, or the address of the /// existing point). virtual IMeshPoint* AddPoint(IMeshPoint*); /// Add a new edge to the mesh. If the mesh points don't exist, then they /// are also added to the mesh. The edge will be owned by the mesh and /// could be deleted immediately! When an edge is added to the mesh, it is /// checked to see if it already exists. If the edge exists, then the /// new object passed to AddEdge is deleted. The address of the edget in /// the mesh is returned (could be the new edge, or the address of the /// existing edge). virtual IMeshEdge* AddEdge(IMeshEdge*); /// Return the set of TMeshPoints. virtual TMeshPointSet& GetPoints() {return fPoints;} /// Return the first iterator for the points. This iterates directly /// through the set of points, and is unaffected by the edge connections /// between the points. virtual TMeshPointSet::iterator BeginPoints() {return fPoints.begin();} /// An iterator that is "one past" the last last point. virtual TMeshPointSet::iterator EndPoints() {return fPoints.end();} /// Return the set of edges. virtual TMeshEdgeSet& GetEdges() {return fEdges;} /// Return the first iterator for the edges. This iterates directly /// through the set of edges and is unaffected by the interconnections. virtual TMeshEdgeSet::iterator BeginEdges() {return fEdges.begin();} /// An iterator that is "one past" the last last edge. virtual TMeshEdgeSet::iterator EndEdges() {return fEdges.end();} /// Remove an edge from the edge set. virtual void RemoveEdge(IMeshEdge* edge); /// Set the unit length. This is used for drawing. virtual void SetUnitXLength(double unitLength) { fUnitXLength = unitLength; } virtual void SetUnitYLength(double unitLength) { fUnitYLength = unitLength; } virtual void SetUnitLength(double unitLength) { SetUnitXLength(unitLength); SetUnitYLength(unitLength); } void Paint(Option_t *option=""); protected: /// All of the points that are owned by this mesh. TMeshPointSet fPoints; /// All of the edges that are owned by this mesh. TMeshEdgeSet fEdges; /// The unit length double fUnitXLength; double fUnitYLength; }; #endif