PointSetTopologyContainer.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                               SOFA :: Modules                               *
00020 *                                                                             *
00021 * Authors: The SOFA Team and external contributors (see Authors.txt)          *
00022 *                                                                             *
00023 * Contact information: contact@sofa-framework.org                             *
00024 ******************************************************************************/
00025 #ifndef SOFA_COMPONENT_TOPOLOGY_POINTSETTOPOLOGYCONTAINER_H
00026 #define SOFA_COMPONENT_TOPOLOGY_POINTSETTOPOLOGYCONTAINER_H
00027 
00028 #include <sofa/helper/vector.h>
00029 #include <sofa/defaulttype/VecTypes.h>
00030 #include <sofa/core/componentmodel/topology/BaseTopology.h>
00031 
00032 namespace sofa
00033 {
00034 
00035 namespace component
00036 {
00037 
00038 class MeshLoader;
00039 
00040 namespace topology
00041 {   
00042     using core::componentmodel::topology::BaseMeshTopology;
00043 
00044     typedef BaseMeshTopology::PointID           PointID;
00045 
00048     class PointSetTopologyContainer : public core::componentmodel::topology::TopologyContainer
00049     {
00050     public:
00051 
00052         PointSetTopologyContainer(int nPoints = 0);
00053 
00054         virtual ~PointSetTopologyContainer() {}
00055 
00058         virtual void clear();
00059         virtual void addPoint(double px, double py, double pz);
00061 
00062         virtual void init();
00063 
00067         virtual bool checkTopology() const;
00068 
00069         void addPoint();
00070 
00071         void addPoints(const unsigned int nPoints);
00072 
00073         void removePoint();
00074 
00075         void removePoints(const unsigned int nPoints);
00076 
00077         inline friend std::ostream& operator<< (std::ostream& out, const PointSetTopologyContainer& /*t*/)
00078         {
00079             return out;
00080         }
00081 
00082         inline friend std::istream& operator>>(std::istream& in, PointSetTopologyContainer& /*t*/)
00083         {
00084             return in;
00085         }
00086 
00089 
00092         int getNbPoints() const { return (int)nbPoints; }
00093         void setNbPoints(int n);
00094         virtual bool hasPos() const;
00095         virtual double getPX(int i) const;
00096         virtual double getPY(int i) const;
00097         virtual double getPZ(int i) const;
00099 
00100     protected:
00101         virtual void loadFromMeshLoader(sofa::component::MeshLoader* loader);
00102 
00103     protected:
00104         unsigned int nbPoints;
00105 
00106     private:
00107         typedef defaulttype::Vec3Types InitTypes;
00108         InitTypes::VecCoord initPoints;
00109     };
00110 
00111 } // namespace topology
00112 
00113 } // namespace component
00114 
00115 } // namespace sofa
00116 
00117 #endif // SOFA_COMPONENTS_POINTSETTOPOLOGYCONTAINER_H

Generated on Sun Nov 23 03:45:05 2008 for Sofa by  doxygen 1.5.7.1