#include "FITKGeometryMeshVS.h" namespace Interface { FITKGeometryMeshVS::~FITKGeometryMeshVS() { //清理全部 this->clear(); } void FITKGeometryMeshVS::insertPoint(int id, FITKGeoMeshVSPt* pt) { //错误判断 if (pt == nullptr || id < 0) return; //已经存在 if (_points.contains(id)) delete _points[id]; _points.insert(id, pt); } void FITKGeometryMeshVS::insertEdge(int id, FITKGeoMeshVSEdgeEntity* edge) { //错误判断 if (edge == nullptr || id < 0) return; if (_edges.contains(id)) delete _edges[id]; _edges.insert(id, edge); } void FITKGeometryMeshVS::insertFace(int id, FITKGeoMeshVSFaceEntity* face) { //错误判断 if (face == nullptr || id < 0) return; if (_faces.contains(id)) delete _faces[id]; _faces.insert(id, face); } const QHash & FITKGeometryMeshVS::getPointItems() const { return _points; } const QHash & FITKGeometryMeshVS::getEdgeItems() const { return _edges; } const QHash & FITKGeometryMeshVS::getFaceItems() const { return _faces; } void FITKGeometryMeshVS::clear() { //清空点对象 QList pts = _points.values(); for (FITKGeoMeshVSPt* pt : pts) delete pt; _points.clear(); //清空边对象 QList edges = _edges.values(); for (FITKGeoMeshVSEdgeEntity* edge : edges) delete edge; _edges.clear(); //清空面对象 QList faces = _faces.values(); for (FITKGeoMeshVSFaceEntity* face : faces) delete face; _faces.clear(); } bool FITKGeometryMeshVS::isValid() { //判断是否为空 return _points.size() + _edges.size() + _faces.size() > 0; } }