00001 /*************************************************************************** 00002 * Copyright (c) Juergen Riegel <juergen.riegel@web.de> * 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 POINTS_POINTPROPERTIES_H 00025 #define POINTS_POINTPROPERTIES_H 00026 00027 #include <vector> 00028 00029 #include <Base/Vector3D.h> 00030 #include <Base/Matrix.h> 00031 #include <Base/Reader.h> 00032 #include <Base/Writer.h> 00033 00034 #include <App/PropertyStandard.h> 00035 #include <App/PropertyGeo.h> 00036 00037 #include "Points.h" 00038 00039 namespace Points 00040 { 00041 00042 00045 class PointsExport PropertyGreyValue : public App::PropertyFloat 00046 { 00047 TYPESYSTEM_HEADER(); 00048 00049 public: 00050 PropertyGreyValue(void) 00051 { 00052 } 00053 virtual ~PropertyGreyValue() 00054 { 00055 } 00056 }; 00057 00061 class PointsExport PropertyGreyValueList : public App::PropertyFloatList 00062 { 00063 TYPESYSTEM_HEADER(); 00064 00065 public: 00066 PropertyGreyValueList() 00067 { 00068 } 00069 virtual ~PropertyGreyValueList() 00070 { 00071 } 00072 00075 void removeIndices( const std::vector<unsigned long>& ); 00077 }; 00078 00082 class PointsExport PropertyNormalList : public App::PropertyVectorList 00083 { 00084 TYPESYSTEM_HEADER(); 00085 00086 public: 00087 PropertyNormalList() 00088 { 00089 } 00090 virtual ~PropertyNormalList() 00091 { 00092 } 00093 00096 void transform(const Base::Matrix4D &rclMat); 00097 void removeIndices( const std::vector<unsigned long>& ); 00099 }; 00100 00102 struct PointsExport CurvatureInfo 00103 { 00104 float fMaxCurvature, fMinCurvature; 00105 Base::Vector3f cMaxCurvDir, cMinCurvDir; 00106 }; 00107 00110 class PointsExport PropertyCurvatureList: public App::PropertyLists 00111 { 00112 TYPESYSTEM_HEADER(); 00113 00114 public: 00115 enum { 00116 MeanCurvature = 0, 00117 GaussCurvature = 1, 00118 MaxCurvature = 2, 00119 MinCurvature = 3, 00120 AbsCurvature = 4 00121 }; 00122 00123 public: 00124 PropertyCurvatureList(); 00125 ~PropertyCurvatureList(); 00126 00127 void setSize(int newSize){_lValueList.resize(newSize);} 00128 int getSize(void) const {return _lValueList.size();} 00129 void setValue(const CurvatureInfo&); 00130 void setValues(const std::vector<CurvatureInfo>&); 00131 std::vector<float> getCurvature( int tMode) const; 00132 00134 const CurvatureInfo& operator[] (const int idx) const {return _lValueList.operator[] (idx);} 00135 void set1Value (const int idx, const CurvatureInfo& value){_lValueList.operator[] (idx) = value;} 00136 const std::vector<CurvatureInfo> &getValues(void) const{return _lValueList;} 00137 00140 void Save (Base::Writer &writer) const; 00141 void Restore(Base::XMLReader &reader); 00142 00143 void SaveDocFile (Base::Writer &writer) const; 00144 void RestoreDocFile(Base::Reader &reader); 00146 00149 00150 App::Property *Copy(void) const; 00152 void Paste(const App::Property &from); 00153 unsigned int getMemSize (void) const; 00155 00158 void transform(const Base::Matrix4D &rclMat); 00159 void removeIndices( const std::vector<unsigned long>& ); 00161 00162 private: 00163 std::vector<CurvatureInfo> _lValueList; 00164 }; 00165 00166 } // namespace Points 00167 00168 00169 #endif // POINTS_POINTPROPERTIES_H