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:
@@ -153,6 +153,11 @@ protected:
|
||||
{
|
||||
return getTransform() * Base::Vector3d(vec.x,vec.y,vec.z);
|
||||
}
|
||||
/// from local to outside
|
||||
inline Base::Vector3d transformToOutside3d(const Base::Vector3d& vec) const
|
||||
{
|
||||
return getTransform() * vec;
|
||||
}
|
||||
|
||||
/// from local to inside
|
||||
inline Base::Vector3f transformToInside(const Base::Vector3d& vec) const
|
||||
@@ -162,10 +167,16 @@ protected:
|
||||
Base::Vector3d tmp = tmpM * vec;
|
||||
return Base::Vector3f((float)tmp.x,(float)tmp.y,(float)tmp.z);
|
||||
}
|
||||
inline Base::Vector3d transformToInside3d(const Base::Vector3d& vec) const
|
||||
{
|
||||
Base::Matrix4D tmpM(getTransform());
|
||||
tmpM.inverse();
|
||||
return tmpM * vec;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} //namespace App
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -653,7 +653,12 @@ void Document::Save (Base::Writer &writer) const
|
||||
<< " FreeCAD Document, see http://www.freecadweb.org for more information..." << endl
|
||||
<< "-->" << endl;
|
||||
|
||||
writer.Stream() << "<Document SchemaVersion=\"5\">" << endl;
|
||||
//writer.Stream() << "<Document SchemaVersion=\"4\">" << endl;
|
||||
writer.Stream() << "<Document SchemaVersion=\"4\" ProgramVersion=\""
|
||||
<< App::Application::Config()["BuildVersionMajor"] << "."
|
||||
<< App::Application::Config()["BuildVersionMinor"] << "R"
|
||||
<< App::Application::Config()["BuildRevision"]
|
||||
<< "\" FileVersion=\"" << writer.getFileVersion() << "\">" << endl;
|
||||
|
||||
PropertyContainer::Save(writer);
|
||||
|
||||
@@ -668,6 +673,16 @@ void Document::Restore(Base::XMLReader &reader)
|
||||
reader.readElement("Document");
|
||||
long scheme = reader.getAttributeAsInteger("SchemaVersion");
|
||||
reader.DocumentSchema = scheme;
|
||||
if (reader.hasAttribute("ProgramVersion")) {
|
||||
reader.ProgramVersion = reader.getAttribute("ProgramVersion");
|
||||
} else {
|
||||
reader.ProgramVersion = "pre-0.14";
|
||||
}
|
||||
if (reader.hasAttribute("FileVersion")) {
|
||||
reader.FileVersion = reader.getAttributeAsUnsigned("FileVersion");
|
||||
} else {
|
||||
reader.FileVersion = 0;
|
||||
}
|
||||
|
||||
// When this document was created the FileName and Label properties
|
||||
// were set to the absolute path or file name, respectively. To save
|
||||
@@ -736,7 +751,11 @@ void Document::exportObjects(const std::vector<App::DocumentObject*>& obj,
|
||||
Base::ZipWriter writer(out);
|
||||
writer.putNextEntry("Document.xml");
|
||||
writer.Stream() << "<?xml version='1.0' encoding='utf-8'?>" << endl;
|
||||
writer.Stream() << "<Document SchemaVersion=\"4\">" << endl;
|
||||
//writer.Stream() << "<Document SchemaVersion=\"4\">" << endl;
|
||||
writer.Stream() << "<Document SchemaVersion=\"4\" ProgramVersion=\""
|
||||
<< App::Application::Config()["BuildVersionMajor"] << "."
|
||||
<< App::Application::Config()["BuildVersionMinor"] << "R"
|
||||
<< App::Application::Config()["BuildRevision"] << "\" FileVersion=\"1\">" << endl;
|
||||
// Add this block to have the same layout as for normal documents
|
||||
writer.Stream() << "<Properties Count=\"0\">" << endl;
|
||||
writer.Stream() << "</Properties>" << endl;
|
||||
@@ -843,6 +862,16 @@ Document::importObjects(Base::XMLReader& reader)
|
||||
reader.readElement("Document");
|
||||
long scheme = reader.getAttributeAsInteger("SchemaVersion");
|
||||
reader.DocumentSchema = scheme;
|
||||
if (reader.hasAttribute("ProgramVersion")) {
|
||||
reader.ProgramVersion = reader.getAttribute("ProgramVersion");
|
||||
} else {
|
||||
reader.ProgramVersion = "pre-0.14";
|
||||
}
|
||||
if (reader.hasAttribute("FileVersion")) {
|
||||
reader.FileVersion = reader.getAttributeAsUnsigned("FileVersion");
|
||||
} else {
|
||||
reader.FileVersion = 0;
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> objs = readObjects(reader);
|
||||
|
||||
@@ -1821,8 +1850,8 @@ std::vector<DocumentObject*> Document::getObjectsOfType(const Base::Type& typeId
|
||||
|
||||
std::vector<DocumentObject*> Document::findObjects(const Base::Type& typeId, const char* objname) const
|
||||
{
|
||||
boost::regex rx(objname);
|
||||
boost::cmatch what;
|
||||
boost::regex rx(objname);
|
||||
boost::cmatch what;
|
||||
std::vector<DocumentObject*> Objects;
|
||||
for (std::vector<DocumentObject*>::const_iterator it = d->objectArray.begin(); it != d->objectArray.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(typeId)) {
|
||||
|
||||
@@ -401,7 +401,7 @@ void PropertyFileIncluded::SaveDocFile (Base::Writer &writer) const
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyFileIncluded::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PropertyFileIncluded::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::FileInfo fi(_cValue.c_str());
|
||||
Base::ofstream to(fi);
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
virtual void Restore(Base::XMLReader &reader);
|
||||
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual Property *Copy(void) const;
|
||||
virtual void Paste(const Property &from);
|
||||
|
||||
@@ -296,19 +296,38 @@ void PropertyVectorList::SaveDocFile (Base::Writer &writer) const
|
||||
Base::OutputStream str(writer.Stream());
|
||||
uint32_t uCt = (uint32_t)getSize();
|
||||
str << uCt;
|
||||
for (std::vector<Base::Vector3d>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
str << it->x << it->y << it->z;
|
||||
if (writer.getFileVersion() > 0) {
|
||||
for (std::vector<Base::Vector3d>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
str << it->x << it->y << it->z;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (std::vector<Base::Vector3d>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
float x = (float)it->x;
|
||||
float y = (float)it->y;
|
||||
float z = (float)it->z;
|
||||
str << x << y << z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyVectorList::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PropertyVectorList::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt=0;
|
||||
str >> uCt;
|
||||
std::vector<Base::Vector3d> values(uCt);
|
||||
for (std::vector<Base::Vector3d>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str >> it->x >> it->y >> it->z;
|
||||
if (reader.getFileVersion() > 0) {
|
||||
for (std::vector<Base::Vector3d>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str >> it->x >> it->y >> it->z;
|
||||
}
|
||||
}
|
||||
else {
|
||||
float x,y,z;
|
||||
for (std::vector<Base::Vector3d>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str >> x >> y >> z;
|
||||
it->Set(x, y, z);
|
||||
}
|
||||
}
|
||||
setValues(values);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
virtual void Restore(Base::XMLReader &reader);
|
||||
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual Property *Copy(void) const;
|
||||
virtual void Paste(const Property &from);
|
||||
|
||||
@@ -552,7 +552,7 @@ void PropertyLinkSubList::setValues(const std::vector<DocumentObject*>& lValue,c
|
||||
|
||||
PyObject *PropertyLinkSubList::getPyObject(void)
|
||||
{
|
||||
int count = getSize();
|
||||
unsigned int count = getSize();
|
||||
#if 0//FIXME: Should switch to tuple
|
||||
Py::Tuple sequence(count);
|
||||
#else
|
||||
|
||||
@@ -374,7 +374,7 @@ void PropertyPythonObject::SaveDocFile (Base::Writer &writer) const
|
||||
writer.Stream().put(*it);
|
||||
}
|
||||
|
||||
void PropertyPythonObject::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PropertyPythonObject::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
aboutToSetValue();
|
||||
std::string buffer;
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
/** Use Python's pickle module to restore the object */
|
||||
virtual void Restore(Base::XMLReader &reader);
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual unsigned int getMemSize (void) const;
|
||||
virtual Property *Copy(void) const;
|
||||
|
||||
@@ -1145,21 +1145,32 @@ void PropertyFloatList::SaveDocFile (Base::Writer &writer) const
|
||||
Base::OutputStream str(writer.Stream());
|
||||
uint32_t uCt = (uint32_t)getSize();
|
||||
str << uCt;
|
||||
for (std::vector<double>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
str << *it;
|
||||
if (writer.getFileVersion() > 0) {
|
||||
for (std::vector<double>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
str << *it;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (std::vector<double>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
float v = (float)*it;
|
||||
str << v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyFloatList::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PropertyFloatList::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt=0;
|
||||
str >> uCt;
|
||||
std::vector<double> values(uCt);
|
||||
for (std::vector<double>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
if (DocumentSchema > 4) {
|
||||
if (reader.getFileVersion() > 0) {
|
||||
for (std::vector<double>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str >> *it;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (std::vector<double>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
float val;
|
||||
str >> val;
|
||||
(*it) = val;
|
||||
@@ -2120,7 +2131,7 @@ void PropertyColorList::SaveDocFile (Base::Writer &writer) const
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyColorList::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void PropertyColorList::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::InputStream str(reader);
|
||||
uint32_t uCt=0;
|
||||
|
||||
@@ -540,7 +540,7 @@ public:
|
||||
virtual void Restore(Base::XMLReader &reader);
|
||||
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual Property *Copy(void) const;
|
||||
virtual void Paste(const Property &from);
|
||||
@@ -833,7 +833,7 @@ public:
|
||||
virtual void Restore(Base::XMLReader &reader);
|
||||
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual Property *Copy(void) const;
|
||||
virtual void Paste(const Property &from);
|
||||
|
||||
Reference in New Issue
Block a user