Merge branch 'refs/heads/double-precision-werner'
Conflicts: src/App/Document.cpp src/App/PropertyGeo.cpp src/App/PropertyStandard.cpp src/Base/Reader.cpp src/Base/Reader.h src/Gui/propertyeditor/PropertyItem.cpp src/Mod/Fem/Gui/ViewProviderFemMesh.cpp src/Mod/Inspection/Gui/ViewProviderInspection.cpp src/Mod/Mesh/App/MeshProperties.cpp src/Mod/Part/App/TopoShapeFacePyImp.cpp src/Mod/PartDesign/App/FeatureRevolution.cpp
This commit is contained in:
@@ -70,8 +70,8 @@ Data::Segment* PointKernel::getSubElement(const char* Type, unsigned long n) con
|
||||
|
||||
void PointKernel::transformGeometry(const Base::Matrix4D &rclMat)
|
||||
{
|
||||
std::vector<Base::Vector3f>& kernel = getBasicPoints();
|
||||
for (std::vector<Base::Vector3f>::iterator it = kernel.begin(); it != kernel.end(); ++it)
|
||||
std::vector<value_type>& kernel = getBasicPoints();
|
||||
for (std::vector<value_type>::iterator it = kernel.begin(); it != kernel.end(); ++it)
|
||||
*it = rclMat * (*it);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ void PointKernel::operator = (const PointKernel& Kernel)
|
||||
|
||||
unsigned int PointKernel::getMemSize (void) const
|
||||
{
|
||||
return _Points.size() * sizeof(Base::Vector3f);
|
||||
return _Points.size() * sizeof(value_type);
|
||||
}
|
||||
|
||||
void PointKernel::Save (Base::Writer &writer) const
|
||||
@@ -111,8 +111,8 @@ void PointKernel::SaveDocFile (Base::Writer &writer) const
|
||||
Base::OutputStream str(writer.Stream());
|
||||
uint32_t uCt = (uint32_t)size();
|
||||
str << uCt;
|
||||
// store the data without transforming it and save as float, not double
|
||||
for (std::vector<Base::Vector3f>::const_iterator it = _Points.begin(); it != _Points.end(); ++it) {
|
||||
// store the data without transforming it
|
||||
for (std::vector<value_type>::const_iterator it = _Points.begin(); it != _Points.end(); ++it) {
|
||||
str << it->x << it->y << it->z;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ void PointKernel::Restore(Base::XMLReader &reader)
|
||||
}
|
||||
}
|
||||
|
||||
void PointKernel::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PointKernel::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt = 0;
|
||||
@@ -176,12 +176,12 @@ void PointKernel::getFaces(std::vector<Base::Vector3d> &Points,std::vector<Facet
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
PointKernel::const_point_iterator::const_point_iterator
|
||||
(const PointKernel* kernel, std::vector<Base::Vector3f>::const_iterator index)
|
||||
(const PointKernel* kernel, std::vector<kernel_type>::const_iterator index)
|
||||
: _kernel(kernel), _p_it(index)
|
||||
{
|
||||
if(_p_it != kernel->_Points.end())
|
||||
{
|
||||
Base::Vector3d vertd(_p_it->x, _p_it->y, _p_it->z);
|
||||
value_type vertd(_p_it->x, _p_it->y, _p_it->z);
|
||||
this->_point = _kernel->_Mtrx * vertd;
|
||||
}
|
||||
}
|
||||
@@ -207,17 +207,19 @@ PointKernel::const_point_iterator::operator=(const PointKernel::const_point_iter
|
||||
|
||||
void PointKernel::const_point_iterator::dereference()
|
||||
{
|
||||
Base::Vector3d vertd(_p_it->x, _p_it->y, _p_it->z);
|
||||
value_type vertd(_p_it->x, _p_it->y, _p_it->z);
|
||||
this->_point = _kernel->_Mtrx * vertd;
|
||||
}
|
||||
|
||||
const Base::Vector3d& PointKernel::const_point_iterator::operator*()
|
||||
const PointKernel::const_point_iterator::value_type&
|
||||
PointKernel::const_point_iterator::operator*()
|
||||
{
|
||||
dereference();
|
||||
return this->_point;
|
||||
}
|
||||
|
||||
const Base::Vector3d* PointKernel::const_point_iterator::operator->()
|
||||
const PointKernel::const_point_iterator::value_type*
|
||||
PointKernel::const_point_iterator::operator->()
|
||||
{
|
||||
dereference();
|
||||
return &(this->_point);
|
||||
|
||||
@@ -46,6 +46,8 @@ class PointsExport PointKernel : public Data::ComplexGeoData
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
typedef Base::Vector3f value_type;
|
||||
|
||||
PointKernel(void)
|
||||
{
|
||||
}
|
||||
@@ -73,9 +75,9 @@ public:
|
||||
|
||||
inline void setTransform(const Base::Matrix4D& rclTrf){_Mtrx = rclTrf;}
|
||||
inline Base::Matrix4D getTransform(void) const{return _Mtrx;}
|
||||
std::vector<Base::Vector3f>& getBasicPoints()
|
||||
std::vector<value_type>& getBasicPoints()
|
||||
{ return this->_Points; }
|
||||
const std::vector<Base::Vector3f>& getBasicPoints() const
|
||||
const std::vector<value_type>& getBasicPoints() const
|
||||
{ return this->_Points; }
|
||||
void getFaces(std::vector<Base::Vector3d> &Points,std::vector<Facet> &Topo,
|
||||
float Accuracy, uint16_t flags=0) const;
|
||||
@@ -90,7 +92,7 @@ public:
|
||||
void Save (Base::Writer &writer) const;
|
||||
void SaveDocFile (Base::Writer &writer) const;
|
||||
void Restore(Base::XMLReader &reader);
|
||||
void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
void RestoreDocFile(Base::Reader &reader);
|
||||
void save(const char* file) const;
|
||||
void save(std::ostream&) const;
|
||||
void load(const char* file);
|
||||
@@ -99,11 +101,11 @@ public:
|
||||
|
||||
private:
|
||||
Base::Matrix4D _Mtrx;
|
||||
std::vector<Base::Vector3f> _Points;
|
||||
std::vector<value_type> _Points;
|
||||
|
||||
public:
|
||||
typedef std::vector<Base::Vector3f>::difference_type difference_type;
|
||||
typedef std::vector<Base::Vector3f>::size_type size_type;
|
||||
typedef std::vector<value_type>::difference_type difference_type;
|
||||
typedef std::vector<value_type>::size_type size_type;
|
||||
|
||||
/// number of points stored
|
||||
size_type size(void) const {return this->_Points.size();}
|
||||
@@ -132,20 +134,21 @@ public:
|
||||
class PointsExport const_point_iterator
|
||||
{
|
||||
public:
|
||||
typedef std::vector<Base::Vector3f>::const_iterator iter_type;
|
||||
typedef PointKernel::value_type kernel_type;
|
||||
typedef Base::Vector3d value_type;
|
||||
typedef std::vector<kernel_type>::const_iterator iter_type;
|
||||
typedef iter_type::difference_type difference_type;
|
||||
typedef iter_type::iterator_category iterator_category;
|
||||
typedef const Base::Vector3d* pointer;
|
||||
typedef const Base::Vector3d& reference;
|
||||
typedef Base::Vector3d value_type;
|
||||
typedef const value_type* pointer;
|
||||
typedef const value_type& reference;
|
||||
|
||||
const_point_iterator(const PointKernel*, std::vector<Base::Vector3f>::const_iterator index);
|
||||
const_point_iterator(const PointKernel*, std::vector<kernel_type>::const_iterator index);
|
||||
const_point_iterator(const const_point_iterator& pi);
|
||||
//~const_point_iterator();
|
||||
|
||||
const_point_iterator& operator=(const const_point_iterator& fi);
|
||||
const Base::Vector3d& operator*();
|
||||
const Base::Vector3d* operator->();
|
||||
const value_type& operator*();
|
||||
const value_type* operator->();
|
||||
bool operator==(const const_point_iterator& fi) const;
|
||||
bool operator!=(const const_point_iterator& fi) const;
|
||||
const_point_iterator& operator++();
|
||||
@@ -160,8 +163,8 @@ public:
|
||||
private:
|
||||
void dereference();
|
||||
const PointKernel* _kernel;
|
||||
Base::Vector3d _point;
|
||||
std::vector<Base::Vector3f>::const_iterator _p_it;
|
||||
value_type _point;
|
||||
std::vector<kernel_type>::const_iterator _p_it;
|
||||
};
|
||||
|
||||
typedef const_point_iterator const_iterator;
|
||||
|
||||
@@ -64,10 +64,10 @@ void Feature::Restore(Base::XMLReader &reader)
|
||||
GeoFeature::Restore(reader);
|
||||
}
|
||||
|
||||
void Feature::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void Feature::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
// This gets only invoked if a points file has been added from Restore()
|
||||
Points.RestoreDocFile(reader, DocumentSchema);
|
||||
Points.RestoreDocFile(reader);
|
||||
}
|
||||
|
||||
void Feature::onChanged(const App::Property* prop)
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
/** @name methods overide Feature */
|
||||
//@{
|
||||
void Restore(Base::XMLReader &reader);
|
||||
void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
void RestoreDocFile(Base::Reader &reader);
|
||||
/// recalculate the Feature
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
/// returns the type name of the ViewProvider
|
||||
|
||||
@@ -204,7 +204,7 @@ unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector<uns
|
||||
return raulElements.size();
|
||||
}
|
||||
|
||||
unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector<unsigned long> &raulElements, const Base::Vector3d &rclOrg, float fMaxDist, bool bDelDoubles) const
|
||||
unsigned long PointsGrid::InSide (const Base::BoundBox3d &rclBB, std::vector<unsigned long> &raulElements, const Base::Vector3d &rclOrg, double fMaxDist, bool bDelDoubles) const
|
||||
{
|
||||
unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ;
|
||||
double fGridDiag = GetBoundBox(0, 0, 0).CalcDiagonalLength();
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::set<unsigned long> &raulElementss) const;
|
||||
/** Searches for elements lying in the intersection area of the grid and the bounding box. */
|
||||
virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::vector<unsigned long> &raulElements,
|
||||
const Base::Vector3d &rclOrg, float fMaxDist, bool bDelDoubles = true) const;
|
||||
const Base::Vector3d &rclOrg, double fMaxDist, bool bDelDoubles = true) const;
|
||||
/** Searches for the nearest grids that contain elements from a point, the result are grid indices. */
|
||||
void SearchNearestFromPoint (const Base::Vector3d &rclPt, std::set<unsigned long> &rclInd) const;
|
||||
//@}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <Base/Persistence.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Writer.h>
|
||||
#include <Base/VectorPy.h>
|
||||
|
||||
#include "Points.h"
|
||||
#include "Properties.h"
|
||||
@@ -42,10 +43,151 @@ using namespace Points;
|
||||
using namespace std;
|
||||
|
||||
TYPESYSTEM_SOURCE(Points::PropertyGreyValue, App::PropertyFloat);
|
||||
TYPESYSTEM_SOURCE(Points::PropertyGreyValueList, App::PropertyFloatList);
|
||||
TYPESYSTEM_SOURCE(Points::PropertyNormalList, App::PropertyVectorList);
|
||||
TYPESYSTEM_SOURCE(Points::PropertyGreyValueList, App::PropertyLists);
|
||||
TYPESYSTEM_SOURCE(Points::PropertyNormalList, App::PropertyLists);
|
||||
TYPESYSTEM_SOURCE(Points::PropertyCurvatureList , App::PropertyLists);
|
||||
|
||||
PropertyGreyValueList::PropertyGreyValueList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertyGreyValueList::~PropertyGreyValueList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::setSize(int newSize)
|
||||
{
|
||||
_lValueList.resize(newSize);
|
||||
}
|
||||
|
||||
int PropertyGreyValueList::getSize(void) const
|
||||
{
|
||||
return static_cast<int>(_lValueList.size());
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::setValue(float lValue)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_lValueList.resize(1);
|
||||
_lValueList[0]=lValue;
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::setValues(const std::vector<float>& values)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_lValueList = values;
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
PyObject *PropertyGreyValueList::getPyObject(void)
|
||||
{
|
||||
PyObject* list = PyList_New(getSize());
|
||||
for (int i = 0;i<getSize(); i++)
|
||||
PyList_SetItem( list, i, PyFloat_FromDouble(_lValueList[i]));
|
||||
return list;
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::setPyObject(PyObject *value)
|
||||
{
|
||||
if (PyList_Check(value)) {
|
||||
Py_ssize_t nSize = PyList_Size(value);
|
||||
std::vector<float> values;
|
||||
values.resize(nSize);
|
||||
|
||||
for (Py_ssize_t i=0; i<nSize;++i) {
|
||||
PyObject* item = PyList_GetItem(value, i);
|
||||
if (!PyFloat_Check(item)) {
|
||||
std::string error = std::string("type in list must be float, not ");
|
||||
error += item->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
|
||||
values[i] = (float)PyFloat_AsDouble(item);
|
||||
}
|
||||
|
||||
setValues(values);
|
||||
}
|
||||
else if (PyFloat_Check(value)) {
|
||||
setValue((float)PyFloat_AsDouble(value));
|
||||
}
|
||||
else {
|
||||
std::string error = std::string("type must be float or list of float, not ");
|
||||
error += value->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::Save (Base::Writer &writer) const
|
||||
{
|
||||
if (writer.isForceXML()) {
|
||||
writer.Stream() << writer.ind() << "<FloatList count=\"" << getSize() <<"\">" << endl;
|
||||
writer.incInd();
|
||||
for(int i = 0;i<getSize(); i++)
|
||||
writer.Stream() << writer.ind() << "<F v=\"" << _lValueList[i] <<"\"/>" << endl; ;
|
||||
writer.decInd();
|
||||
writer.Stream() << writer.ind() <<"</FloatList>" << endl ;
|
||||
}
|
||||
else {
|
||||
writer.Stream() << writer.ind() << "<FloatList file=\"" <<
|
||||
writer.addFile(getName(), this) << "\"/>" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::Restore(Base::XMLReader &reader)
|
||||
{
|
||||
reader.readElement("FloatList");
|
||||
string file (reader.getAttribute("file") );
|
||||
|
||||
if (!file.empty()) {
|
||||
// initate a file read
|
||||
reader.addFile(file.c_str(),this);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::SaveDocFile (Base::Writer &writer) const
|
||||
{
|
||||
Base::OutputStream str(writer.Stream());
|
||||
uint32_t uCt = (uint32_t)getSize();
|
||||
str << uCt;
|
||||
for (std::vector<float>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
str << *it;
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt=0;
|
||||
str >> uCt;
|
||||
std::vector<float> values(uCt);
|
||||
for (std::vector<float>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str >> *it;
|
||||
}
|
||||
setValues(values);
|
||||
}
|
||||
|
||||
App::Property *PropertyGreyValueList::Copy(void) const
|
||||
{
|
||||
PropertyGreyValueList *p= new PropertyGreyValueList();
|
||||
p->_lValueList = _lValueList;
|
||||
return p;
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::Paste(const App::Property &from)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_lValueList = dynamic_cast<const PropertyGreyValueList&>(from)._lValueList;
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
unsigned int PropertyGreyValueList::getMemSize (void) const
|
||||
{
|
||||
return static_cast<unsigned int>(_lValueList.size() * sizeof(float));
|
||||
}
|
||||
|
||||
void PropertyGreyValueList::removeIndices( const std::vector<unsigned long>& uIndices )
|
||||
{
|
||||
#if 0
|
||||
@@ -77,6 +219,151 @@ void PropertyGreyValueList::removeIndices( const std::vector<unsigned long>& uIn
|
||||
#endif
|
||||
}
|
||||
|
||||
PropertyNormalList::PropertyNormalList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertyNormalList::~PropertyNormalList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PropertyNormalList::setSize(int newSize)
|
||||
{
|
||||
_lValueList.resize(newSize);
|
||||
}
|
||||
|
||||
int PropertyNormalList::getSize(void) const
|
||||
{
|
||||
return static_cast<int>(_lValueList.size());
|
||||
}
|
||||
|
||||
void PropertyNormalList::setValue(const Base::Vector3f& lValue)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_lValueList.resize(1);
|
||||
_lValueList[0]=lValue;
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyNormalList::setValue(float x, float y, float z)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_lValueList.resize(1);
|
||||
_lValueList[0].Set(x,y,z);
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
void PropertyNormalList::setValues(const std::vector<Base::Vector3f>& values)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_lValueList = values;
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
PyObject *PropertyNormalList::getPyObject(void)
|
||||
{
|
||||
PyObject* list = PyList_New(getSize());
|
||||
|
||||
for (int i = 0;i<getSize(); i++)
|
||||
PyList_SetItem(list, i, new Base::VectorPy(_lValueList[i]));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void PropertyNormalList::setPyObject(PyObject *value)
|
||||
{
|
||||
if (PyList_Check(value)) {
|
||||
Py_ssize_t nSize = PyList_Size(value);
|
||||
std::vector<Base::Vector3f> values;
|
||||
values.resize(nSize);
|
||||
|
||||
for (Py_ssize_t i=0; i<nSize;++i) {
|
||||
PyObject* item = PyList_GetItem(value, i);
|
||||
App::PropertyVector val;
|
||||
val.setPyObject( item );
|
||||
values[i] = Base::convertTo<Base::Vector3f>(val.getValue());
|
||||
}
|
||||
|
||||
setValues(values);
|
||||
}
|
||||
else if (PyObject_TypeCheck(value, &(Base::VectorPy::Type))) {
|
||||
Base::VectorPy *pcObject = static_cast<Base::VectorPy*>(value);
|
||||
Base::Vector3d* val = pcObject->getVectorPtr();
|
||||
setValue(Base::convertTo<Base::Vector3f>(*val));
|
||||
}
|
||||
else if (PyTuple_Check(value) && PyTuple_Size(value) == 3) {
|
||||
App::PropertyVector val;
|
||||
val.setPyObject( value );
|
||||
setValue(Base::convertTo<Base::Vector3f>(val.getValue()));
|
||||
}
|
||||
else {
|
||||
std::string error = std::string("type must be 'Vector' or list of 'Vector', not ");
|
||||
error += value->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyNormalList::Save (Base::Writer &writer) const
|
||||
{
|
||||
if (!writer.isForceXML()) {
|
||||
writer.Stream() << writer.ind() << "<VectorList file=\"" << writer.addFile(getName(), this) << "\"/>" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyNormalList::Restore(Base::XMLReader &reader)
|
||||
{
|
||||
reader.readElement("VectorList");
|
||||
std::string file (reader.getAttribute("file") );
|
||||
|
||||
if (!file.empty()) {
|
||||
// initate a file read
|
||||
reader.addFile(file.c_str(),this);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyNormalList::SaveDocFile (Base::Writer &writer) const
|
||||
{
|
||||
Base::OutputStream str(writer.Stream());
|
||||
uint32_t uCt = (uint32_t)getSize();
|
||||
str << uCt;
|
||||
for (std::vector<Base::Vector3f>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
str << it->x << it->y << it->z;
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyNormalList::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt=0;
|
||||
str >> uCt;
|
||||
std::vector<Base::Vector3f> values(uCt);
|
||||
for (std::vector<Base::Vector3f>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str >> it->x >> it->y >> it->z;
|
||||
}
|
||||
setValues(values);
|
||||
}
|
||||
|
||||
App::Property *PropertyNormalList::Copy(void) const
|
||||
{
|
||||
PropertyNormalList *p= new PropertyNormalList();
|
||||
p->_lValueList = _lValueList;
|
||||
return p;
|
||||
}
|
||||
|
||||
void PropertyNormalList::Paste(const App::Property &from)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_lValueList = dynamic_cast<const PropertyNormalList&>(from)._lValueList;
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
unsigned int PropertyNormalList::getMemSize (void) const
|
||||
{
|
||||
return static_cast<unsigned int>(_lValueList.size() * sizeof(Base::Vector3f));
|
||||
}
|
||||
|
||||
void PropertyNormalList::transform(const Base::Matrix4D &mat)
|
||||
{
|
||||
// A normal vector is only a direction with unit length, so we only need to rotate it
|
||||
@@ -111,17 +398,17 @@ void PropertyNormalList::removeIndices( const std::vector<unsigned long>& uIndic
|
||||
std::vector<unsigned long> uSortedInds = uIndices;
|
||||
std::sort(uSortedInds.begin(), uSortedInds.end());
|
||||
|
||||
const std::vector<Base::Vector3d>& rValueList = getValues();
|
||||
const std::vector<Base::Vector3f>& rValueList = getValues();
|
||||
|
||||
assert( uSortedInds.size() <= rValueList.size() );
|
||||
if ( uSortedInds.size() > rValueList.size() )
|
||||
return;
|
||||
|
||||
std::vector<Base::Vector3d> remainValue;
|
||||
std::vector<Base::Vector3f> remainValue;
|
||||
remainValue.reserve(rValueList.size() - uSortedInds.size());
|
||||
|
||||
std::vector<unsigned long>::iterator pos = uSortedInds.begin();
|
||||
for ( std::vector<Base::Vector3d>::const_iterator it = rValueList.begin(); it != rValueList.end(); ++it ) {
|
||||
for ( std::vector<Base::Vector3f>::const_iterator it = rValueList.begin(); it != rValueList.end(); ++it ) {
|
||||
unsigned long index = it - rValueList.begin();
|
||||
if (pos == uSortedInds.end())
|
||||
remainValue.push_back( *it );
|
||||
@@ -291,7 +578,7 @@ void PropertyCurvatureList::SaveDocFile (Base::Writer &writer) const
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyCurvatureList::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PropertyCurvatureList::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt=0;
|
||||
|
||||
@@ -55,47 +55,101 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Own class to distinguish from real float list
|
||||
*/
|
||||
class PointsExport PropertyGreyValueList : public App::PropertyFloatList
|
||||
class PointsExport PropertyGreyValueList: public App::PropertyLists
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
PropertyGreyValueList()
|
||||
{
|
||||
}
|
||||
virtual ~PropertyGreyValueList()
|
||||
{
|
||||
}
|
||||
PropertyGreyValueList();
|
||||
virtual ~PropertyGreyValueList();
|
||||
|
||||
virtual void setSize(int newSize);
|
||||
virtual int getSize(void) const;
|
||||
|
||||
/** Sets the property
|
||||
*/
|
||||
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;}
|
||||
void setValues (const std::vector<float>& values);
|
||||
|
||||
const std::vector<float> &getValues(void) const{return _lValueList;}
|
||||
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual void setPyObject(PyObject *);
|
||||
|
||||
virtual void Save (Base::Writer &writer) const;
|
||||
virtual void Restore(Base::XMLReader &reader);
|
||||
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual App::Property *Copy(void) const;
|
||||
virtual void Paste(const App::Property &from);
|
||||
virtual unsigned int getMemSize (void) const;
|
||||
|
||||
/** @name Modify */
|
||||
//@{
|
||||
void removeIndices( const std::vector<unsigned long>& );
|
||||
//@}
|
||||
|
||||
private:
|
||||
std::vector<float> _lValueList;
|
||||
};
|
||||
|
||||
/**
|
||||
* Own class to distinguish from real vector list
|
||||
*/
|
||||
class PointsExport PropertyNormalList : public App::PropertyVectorList
|
||||
class PointsExport PropertyNormalList: public App::PropertyLists
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
PropertyNormalList()
|
||||
{
|
||||
PropertyNormalList();
|
||||
~PropertyNormalList();
|
||||
|
||||
virtual void setSize(int newSize);
|
||||
virtual int getSize(void) const;
|
||||
|
||||
void setValue(const Base::Vector3f&);
|
||||
void setValue(float x, float y, float z);
|
||||
|
||||
const Base::Vector3f& operator[] (const int idx) const {
|
||||
return _lValueList.operator[] (idx);
|
||||
}
|
||||
virtual ~PropertyNormalList()
|
||||
{
|
||||
|
||||
void set1Value (const int idx, const Base::Vector3f& value) {
|
||||
_lValueList.operator[] (idx) = value;
|
||||
}
|
||||
|
||||
void setValues (const std::vector<Base::Vector3f>& values);
|
||||
|
||||
const std::vector<Base::Vector3f> &getValues(void) const {
|
||||
return _lValueList;
|
||||
}
|
||||
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual void setPyObject(PyObject *);
|
||||
|
||||
virtual void Save (Base::Writer &writer) const;
|
||||
virtual void Restore(Base::XMLReader &reader);
|
||||
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual App::Property *Copy(void) const;
|
||||
virtual void Paste(const App::Property &from);
|
||||
|
||||
virtual unsigned int getMemSize (void) const;
|
||||
|
||||
/** @name Modify */
|
||||
//@{
|
||||
void transform(const Base::Matrix4D &rclMat);
|
||||
void removeIndices( const std::vector<unsigned long>& );
|
||||
//@}
|
||||
|
||||
private:
|
||||
std::vector<Base::Vector3f> _lValueList;
|
||||
};
|
||||
|
||||
/** Curvature information. */
|
||||
@@ -141,7 +195,7 @@ public:
|
||||
void Restore(Base::XMLReader &reader);
|
||||
|
||||
void SaveDocFile (Base::Writer &writer) const;
|
||||
void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
void RestoreDocFile(Base::Reader &reader);
|
||||
//@}
|
||||
|
||||
/** @name Undo/Redo */
|
||||
|
||||
@@ -134,10 +134,10 @@ void PropertyPointKernel::SaveDocFile (Base::Writer &writer) const
|
||||
// does nothing
|
||||
}
|
||||
|
||||
void PropertyPointKernel::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PropertyPointKernel::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
aboutToSetValue();
|
||||
_cPoints->RestoreDocFile(reader, DocumentSchema);
|
||||
_cPoints->RestoreDocFile(reader);
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
void Save (Base::Writer &writer) const;
|
||||
void Restore(Base::XMLReader &reader);
|
||||
void SaveDocFile (Base::Writer &writer) const;
|
||||
void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
void RestoreDocFile(Base::Reader &reader);
|
||||
//@}
|
||||
|
||||
/** @name Modification */
|
||||
|
||||
@@ -125,14 +125,14 @@ void ViewProviderPoints::setVertexColorMode(App::PropertyColorList* pcProperty)
|
||||
|
||||
void ViewProviderPoints::setVertexGreyvalueMode(Points::PropertyGreyValueList* pcProperty)
|
||||
{
|
||||
const std::vector<double>& val = pcProperty->getValues();
|
||||
const std::vector<float>& val = pcProperty->getValues();
|
||||
unsigned long i=0;
|
||||
|
||||
pcColorMat->enableNotify(false);
|
||||
pcColorMat->diffuseColor.deleteValues(0);
|
||||
pcColorMat->diffuseColor.setNum(val.size());
|
||||
|
||||
for ( std::vector<double>::const_iterator it = val.begin(); it != val.end(); ++it ) {
|
||||
for ( std::vector<float>::const_iterator it = val.begin(); it != val.end(); ++it ) {
|
||||
pcColorMat->diffuseColor.set1Value(i++, SbColor(*it, *it, *it));
|
||||
}
|
||||
|
||||
@@ -142,14 +142,14 @@ void ViewProviderPoints::setVertexGreyvalueMode(Points::PropertyGreyValueList* p
|
||||
|
||||
void ViewProviderPoints::setVertexNormalMode(Points::PropertyNormalList* pcProperty)
|
||||
{
|
||||
const std::vector<Base::Vector3d>& val = pcProperty->getValues();
|
||||
const std::vector<Base::Vector3f>& val = pcProperty->getValues();
|
||||
unsigned long i=0;
|
||||
|
||||
pcPointsNormal->enableNotify(false);
|
||||
pcPointsNormal->vector.deleteValues(0);
|
||||
pcPointsNormal->vector.setNum(val.size());
|
||||
|
||||
for ( std::vector<Base::Vector3d>::const_iterator it = val.begin(); it != val.end(); ++it ) {
|
||||
for ( std::vector<Base::Vector3f>::const_iterator it = val.begin(); it != val.end(); ++it ) {
|
||||
pcPointsNormal->vector.set1Value(i++, it->x, it->y, it->z);
|
||||
}
|
||||
|
||||
@@ -469,9 +469,9 @@ void ViewProviderPointsBuilder::createPoints(const App::Property* prop, SoCoordi
|
||||
|
||||
// get all points
|
||||
int idx=0;
|
||||
const std::vector<Base::Vector3f>& kernel = cPts.getBasicPoints();
|
||||
for (std::vector<Base::Vector3f>::const_iterator it = kernel.begin(); it != kernel.end(); ++it, idx++) {
|
||||
coords->point.set1Value(idx, it->x, it->y, it->z);
|
||||
const std::vector<Points::PointKernel::value_type>& kernel = cPts.getBasicPoints();
|
||||
for (std::vector<Points::PointKernel::value_type>::const_iterator it = kernel.begin(); it != kernel.end(); ++it, idx++) {
|
||||
coords->point.set1Value(idx, (float)it->x, (float)it->y, (float)it->z);
|
||||
}
|
||||
|
||||
points->numPoints = cPts.size();
|
||||
|
||||
Reference in New Issue
Block a user