PropertyGeo.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) Jürgen Riegel          (juergen.riegel@web.de) 2002     *
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 APP_PROPERTYGEO_H
00025 #define APP_PROPERTYGEO_H
00026 
00027 // Std. configurations
00028 
00029 #include <Base/Vector3D.h>
00030 #include <Base/Matrix.h>
00031 #include <Base/BoundBox.h>
00032 #include <Base/Placement.h>
00033 
00034 #include "Property.h"
00035 #include "PropertyLinks.h"
00036 #include "ComplexGeoData.h"
00037 
00038 namespace Base {
00039 class Writer;
00040 }
00041 
00042 namespace Data {
00043 class ComplexGeoData;
00044 }
00045 
00046 namespace App
00047 {
00048 class Feature;
00049 class Placement;
00050 
00051 
00052 
00056 class AppExport PropertyVector: public Property
00057 {
00058     TYPESYSTEM_HEADER();
00059 
00060 public:
00065     PropertyVector();
00066 
00071     ~PropertyVector();
00072 
00075     void setValue(const Base::Vector3f &vec);
00076     void setValue(float x, float y, float z);
00077 
00080     const Base::Vector3f &getValue(void) const;
00081     const char* getEditorName(void) const {
00082         return "Gui::PropertyEditor::PropertyVectorItem";
00083     }
00084 
00085     virtual PyObject *getPyObject(void);
00086     virtual void setPyObject(PyObject *);
00087 
00088     virtual void Save (Base::Writer &writer) const;
00089     virtual void Restore(Base::XMLReader &reader);
00090 
00091     virtual Property *Copy(void) const;
00092     virtual void Paste(const Property &from);
00093 
00094     virtual unsigned int getMemSize (void) const {
00095         return sizeof(Base::Vector3f);
00096     }
00097 
00098 private:
00099     Base::Vector3f _cVec;
00100 };
00101 
00102 
00103 class AppExport PropertyVectorList: public PropertyLists
00104 {
00105     TYPESYSTEM_HEADER();
00106 
00107 public:
00112     PropertyVectorList();
00113 
00118     ~PropertyVectorList();
00119 
00120     virtual void setSize(int newSize);
00121     virtual int getSize(void) const;
00122 
00125     void setValue(const Base::Vector3f&);
00126     void setValue(float x, float y, float z);
00127 
00129     const Base::Vector3f& operator[] (const int idx) const {
00130         return _lValueList.operator[] (idx);
00131     }
00132 
00133     void set1Value (const int idx, const Base::Vector3f& value) {
00134         _lValueList.operator[] (idx) = value;
00135     }
00136 
00137     void setValues (const std::vector<Base::Vector3f>& values);
00138 
00139     const std::vector<Base::Vector3f> &getValues(void) const {
00140         return _lValueList;
00141     }
00142 
00143     virtual PyObject *getPyObject(void);
00144     virtual void setPyObject(PyObject *);
00145 
00146     virtual void Save (Base::Writer &writer) const;
00147     virtual void Restore(Base::XMLReader &reader);
00148 
00149     virtual void SaveDocFile (Base::Writer &writer) const;
00150     virtual void RestoreDocFile(Base::Reader &reader);
00151 
00152     virtual Property *Copy(void) const;
00153     virtual void Paste(const Property &from);
00154 
00155     virtual unsigned int getMemSize (void) const;
00156 
00157 private:
00158     std::vector<Base::Vector3f> _lValueList;
00159 };
00160 
00164 class AppExport PropertyMatrix: public Property
00165 {
00166     TYPESYSTEM_HEADER();
00167 
00168 public:
00173     PropertyMatrix();
00174 
00179     ~PropertyMatrix();
00180 
00183     void setValue(const Base::Matrix4D &mat);
00184 
00187     const Base::Matrix4D &getValue(void) const;
00188 
00189     virtual PyObject *getPyObject(void);
00190     virtual void setPyObject(PyObject *);
00191 
00192     virtual void Save (Base::Writer &writer) const;
00193     virtual void Restore(Base::XMLReader &reader);
00194 
00195     virtual Property *Copy(void) const;
00196     virtual void Paste(const Property &from);
00197 
00198     virtual unsigned int getMemSize (void) const {
00199         return sizeof(Base::Matrix4D);
00200     }
00201 
00202 private:
00203     Base::Matrix4D _cMat;
00204 };
00205 
00209 class AppExport PropertyPlacement: public Property
00210 {
00211     TYPESYSTEM_HEADER();
00212 
00213 public:
00218     PropertyPlacement();
00219 
00224     ~PropertyPlacement();
00225 
00228     void setValue(const Base::Placement &pos);
00229 
00232     const Base::Placement &getValue(void) const;
00233     const char* getEditorName(void) const {
00234         return "Gui::PropertyEditor::PropertyPlacementItem";
00235     }
00236 
00237     virtual PyObject *getPyObject(void);
00238     virtual void setPyObject(PyObject *);
00239 
00240     virtual void Save (Base::Writer &writer) const;
00241     virtual void Restore(Base::XMLReader &reader);
00242 
00243     virtual Property *Copy(void) const;
00244     virtual void Paste(const Property &from);
00245 
00246     virtual unsigned int getMemSize (void) const {
00247         return sizeof(Base::Placement);
00248     }
00249 
00250     static const Placement Null;
00251 
00252 private:
00253     Base::Placement _cPos;
00254 };
00255 
00259 class AppExport PropertyPlacementLink : public PropertyLink
00260 {
00261     TYPESYSTEM_HEADER();
00262 
00263 public:
00268     PropertyPlacementLink();
00269 
00274     ~PropertyPlacementLink();
00275 
00278     App::Placement * getPlacementObject(void) const;
00279 
00280     virtual Property *Copy(void) const;
00281     virtual void Paste(const Property &from);
00282 };
00283 
00287 class AppExport PropertyGeometry : public App::Property
00288 {
00289     TYPESYSTEM_HEADER();
00290 
00291 public:
00292     PropertyGeometry();
00293     ~PropertyGeometry();
00294 
00297 
00298     virtual void transformGeometry(const Base::Matrix4D &rclMat) = 0;
00300     virtual Base::BoundBox3d getBoundingBox() const = 0;
00302 };
00303 
00307 class AppExport PropertyComplexGeoData : public App::PropertyGeometry
00308 {
00309     TYPESYSTEM_HEADER();
00310 
00311 public:
00312     PropertyComplexGeoData();
00313     ~PropertyComplexGeoData();
00314 
00317 
00318     virtual void transformGeometry(const Base::Matrix4D &rclMat) = 0;
00320 
00323     virtual const Data::ComplexGeoData* getComplexData() const = 0;
00324     virtual Base::BoundBox3d getBoundingBox() const = 0;
00325     virtual void getFaces(std::vector<Base::Vector3d> &Points,
00326         std::vector<Data::ComplexGeoData::Facet> &Topo,
00327         float Accuracy, uint16_t flags=0) const  = 0;
00329 };
00330 
00331 } // namespace App
00332 
00333 
00334 #endif // APP_PROPERTYGEO_H

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