+ rename method 'transform' to 'tramsformGeometry' for the classes PropertyNormalList and PropertyCurvatureList

+ make transformGeometry method ready for undo/redo
This commit is contained in:
wmayer 2016-01-22 13:18:24 +01:00
parent 7bba2ee9aa
commit 27fbccaeab
4 changed files with 58 additions and 27 deletions

View File

@ -192,7 +192,7 @@ unsigned int PropertyNormalList::getMemSize (void) const
return static_cast<unsigned int>(_lValueList.size() * sizeof(Base::Vector3f));
}
void PropertyNormalList::transform(const Base::Matrix4D &mat)
void PropertyNormalList::transformGeometry(const Base::Matrix4D &mat)
{
// A normal vector is only a direction with unit length, so we only need to rotate it
// (no translations or scaling)
@ -222,7 +222,6 @@ void PropertyNormalList::transform(const Base::Matrix4D &mat)
}
hasSetValue();
}
// ----------------------------------------------------------------------------
@ -300,7 +299,7 @@ std::vector<float> PropertyCurvatureList::getCurvature( int mode ) const
return fValues;
}
void PropertyCurvatureList::transform(const Base::Matrix4D &mat)
void PropertyCurvatureList::transformGeometry(const Base::Matrix4D &mat)
{
// The principal direction is only a vector with unit length, so we only need to rotate it
// (no translations or scaling)

View File

@ -65,11 +65,11 @@ public:
void setValue(float x, float y, float z);
const Base::Vector3f& operator[] (const int idx) const {
return _lValueList.operator[] (idx);
return _lValueList[idx];
}
void set1Value (const int idx, const Base::Vector3f& value) {
_lValueList.operator[] (idx) = value;
_lValueList[idx] = value;
}
void setValues (const std::vector<Base::Vector3f>& values);
@ -92,7 +92,7 @@ public:
virtual unsigned int getMemSize (void) const;
void transform(const Base::Matrix4D &rclMat);
void transformGeometry(const Base::Matrix4D &rclMat);
private:
std::vector<Base::Vector3f> _lValueList;
@ -132,10 +132,16 @@ public:
void setValues(const std::vector<CurvatureInfo>&);
/// index operator
const CurvatureInfo& operator[] (const int idx) const {return _lValueList.operator[] (idx);}
void set1Value (const int idx, const CurvatureInfo& value){_lValueList.operator[] (idx) = value;}
const std::vector<CurvatureInfo> &getValues(void) const{return _lValueList;}
void transform(const Base::Matrix4D &rclMat);
const CurvatureInfo& operator[] (const int idx) const {
return _lValueList[idx];
}
void set1Value (const int idx, const CurvatureInfo& value) {
_lValueList[idx] = value;
}
const std::vector<CurvatureInfo> &getValues(void) const {
return _lValueList;
}
void transformGeometry(const Base::Matrix4D &rclMat);
void Save (Base::Writer &writer) const;
void Restore(Base::XMLReader &reader);
@ -231,7 +237,9 @@ public:
void setPyObject(PyObject *value);
//@}
const char* getEditorName(void) const { return "MeshGui::PropertyMeshKernelItem"; }
const char* getEditorName(void) const {
return "MeshGui::PropertyMeshKernelItem";
}
/** @name Save/restore */
//@{

View File

@ -364,7 +364,7 @@ unsigned int PropertyNormalList::getMemSize (void) const
return static_cast<unsigned int>(_lValueList.size() * sizeof(Base::Vector3f));
}
void PropertyNormalList::transform(const Base::Matrix4D &mat)
void PropertyNormalList::transformGeometry(const Base::Matrix4D &mat)
{
// A normal vector is only a direction with unit length, so we only need to rotate it
// (no translations or scaling)
@ -386,10 +386,14 @@ void PropertyNormalList::transform(const Base::Matrix4D &mat)
}
}
aboutToSetValue();
// Rotate the normal vectors
for (int ii=0; ii<getSize(); ii++) {
set1Value(ii, rot * operator[](ii));
}
hasSetValue();
}
void PropertyNormalList::removeIndices( const std::vector<unsigned long>& uIndices )
@ -489,7 +493,7 @@ std::vector<float> PropertyCurvatureList::getCurvature( int mode ) const
return fValues;
}
void PropertyCurvatureList::transform(const Base::Matrix4D &mat)
void PropertyCurvatureList::transformGeometry(const Base::Matrix4D &mat)
{
// The principal direction is only a vector with unit length, so we only need to rotate it
// (no translations or scaling)
@ -511,6 +515,8 @@ void PropertyCurvatureList::transform(const Base::Matrix4D &mat)
}
}
aboutToSetValue();
// Rotate the principal directions
for (int ii=0; ii<getSize(); ii++) {
CurvatureInfo ci = operator[](ii);
@ -518,6 +524,8 @@ void PropertyCurvatureList::transform(const Base::Matrix4D &mat)
ci.cMinCurvDir = rot * ci.cMinCurvDir;
set1Value(ii, ci);
}
hasSetValue();
}
void PropertyCurvatureList::removeIndices( const std::vector<unsigned long>& uIndices )

View File

@ -71,13 +71,19 @@ public:
void setValue(float);
/// index operator
float operator[] (const int idx) const {return _lValueList.operator[] (idx);}
void set1Value (const int idx, float value){_lValueList.operator[] (idx) = value;}
float operator[] (const int idx) const {
return _lValueList[idx];
}
void set1Value (const int idx, float value) {
_lValueList[idx] = value;
}
void setValues (const std::vector<float>& values);
const std::vector<float> &getValues(void) const{return _lValueList;}
const std::vector<float> &getValues(void) const {
return _lValueList;
}
virtual PyObject *getPyObject(void);
virtual void setPyObject(PyObject *);
@ -115,11 +121,11 @@ public:
void setValue(float x, float y, float z);
const Base::Vector3f& operator[] (const int idx) const {
return _lValueList.operator[] (idx);
return _lValueList[idx];
}
void set1Value (const int idx, const Base::Vector3f& value) {
_lValueList.operator[] (idx) = value;
_lValueList[idx] = value;
}
void setValues (const std::vector<Base::Vector3f>& values);
@ -144,7 +150,7 @@ public:
/** @name Modify */
//@{
void transform(const Base::Matrix4D &rclMat);
void transformGeometry(const Base::Matrix4D &rclMat);
void removeIndices( const std::vector<unsigned long>& );
//@}
@ -178,16 +184,26 @@ public:
PropertyCurvatureList();
~PropertyCurvatureList();
void setSize(int newSize){_lValueList.resize(newSize);}
int getSize(void) const {return _lValueList.size();}
void setSize(int newSize) {
_lValueList.resize(newSize);
}
int getSize(void) const {
return _lValueList.size();
}
void setValue(const CurvatureInfo&);
void setValues(const std::vector<CurvatureInfo>&);
std::vector<float> getCurvature( int tMode) const;
/// index operator
const CurvatureInfo& operator[] (const int idx) const {return _lValueList.operator[] (idx);}
void set1Value (const int idx, const CurvatureInfo& value){_lValueList.operator[] (idx) = value;}
const std::vector<CurvatureInfo> &getValues(void) const{return _lValueList;}
const CurvatureInfo& operator[] (const int idx) const {
return _lValueList[idx];
}
void set1Value (const int idx, const CurvatureInfo& value) {
_lValueList[idx] = value;
}
const std::vector<CurvatureInfo> &getValues(void) const {
return _lValueList;
}
/** @name Save/restore */
//@{
@ -209,7 +225,7 @@ public:
/** @name Modify */
//@{
void transform(const Base::Matrix4D &rclMat);
void transformGeometry(const Base::Matrix4D &rclMat);
void removeIndices( const std::vector<unsigned long>& );
//@}