Segment.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2007 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #ifndef MESH_SEGMENT_H
00025 #define MESH_SEGMENT_H
00026 
00027 #include <vector>
00028 #include "Facet.h"
00029 #include "Core/Iterator.h"
00030 
00031 namespace Mesh
00032 {
00033 
00034 class MeshObject;
00035 
00036 class MeshExport Segment
00037 {
00038 public:
00039     Segment(MeshObject*, bool mod);
00040     Segment(MeshObject*, const std::vector<unsigned long>& inds, bool mod);
00041     void addIndices(const std::vector<unsigned long>& inds);
00042     void removeIndices(const std::vector<unsigned long>& inds);
00043     const std::vector<unsigned long>& getIndices() const;
00044     bool isEmpty() const { return _indices.empty(); };
00045 
00046     const Segment& operator = (const Segment&);
00047     bool operator == (const Segment&) const;
00048 
00049     // friends
00050     friend class MeshObject;
00051 
00052 private:
00053     MeshObject* _mesh;
00054     std::vector<unsigned long> _indices;
00055     bool _modifykernel;
00056 
00057 public:
00058     class MeshExport const_facet_iterator
00059     {
00060     public:
00061         const_facet_iterator(const Segment*, std::vector<unsigned long>::const_iterator);
00062         const_facet_iterator(const const_facet_iterator& fi);
00063         ~const_facet_iterator();
00064 
00065         const_facet_iterator& operator=(const const_facet_iterator& fi);
00066         const Facet& operator*() const;
00067         const Facet* operator->() const;
00068         bool operator==(const const_facet_iterator& fi) const;
00069         bool operator!=(const const_facet_iterator& fi) const;
00070         const_facet_iterator& operator++();
00071         const_facet_iterator& operator--();
00072     private:
00073         void dereference();
00074         const Segment* _segment;
00075         Facet _facet;
00076         MeshCore::MeshFacetIterator _f_it;
00077         std::vector<unsigned long>::const_iterator _it;
00078     };
00079 
00080     const_facet_iterator facets_begin() const
00081     { return const_facet_iterator(this, _indices.begin()); }
00082     const_facet_iterator facets_end() const
00083     { return const_facet_iterator(this, _indices.end()); }
00084 };
00085 
00086 } // namespace Mesh
00087 
00088 
00089 #endif // MESH_SEGMENT_H

Generated on Wed Nov 23 19:00:37 2011 for FreeCAD by  doxygen 1.6.1