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:
@@ -649,10 +649,11 @@ void Document::Restore(Base::XMLReader &reader)
|
||||
/**
|
||||
* Restores the properties of the view providers.
|
||||
*/
|
||||
void Document::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void Document::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
// We must create an XML parser to read from the input stream
|
||||
Base::XMLReader xmlReader("GuiDocument.xml", reader);
|
||||
xmlReader.FileVersion = reader.getFileVersion();
|
||||
|
||||
int i,Cnt;
|
||||
|
||||
@@ -708,7 +709,7 @@ void Document::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
|
||||
// In the file GuiDocument.xml new data files might be added
|
||||
if (!xmlReader.getFilenames().empty())
|
||||
xmlReader.readFiles(static_cast<zipios::ZipInputStream&>(reader));
|
||||
xmlReader.readFiles(static_cast<zipios::ZipInputStream&>(reader.getStream()));
|
||||
|
||||
// reset modified flag
|
||||
setModified(false);
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
/// This method is used to save large amounts of data to a binary file.
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
/// This method is used to restore large amounts of data from a binary file.
|
||||
virtual void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
void exportObjects(const std::vector<App::DocumentObject*>&, Base::Writer&);
|
||||
void importObjects(const std::vector<App::DocumentObject*>&, Base::Reader&);
|
||||
//@}
|
||||
|
||||
@@ -160,7 +160,7 @@ void MergeDocuments::SaveDocFile (Base::Writer & w) const
|
||||
document->exportObjects(objects, w);
|
||||
}
|
||||
|
||||
void MergeDocuments::RestoreDocFile(Base::Reader & reader, const int DocumentSchema)
|
||||
void MergeDocuments::RestoreDocFile(Base::Reader & reader)
|
||||
{
|
||||
std::vector<App::DocumentObject*> obj = objects;
|
||||
// We must create an XML parser to read from the input stream
|
||||
@@ -199,5 +199,5 @@ void MergeDocuments::RestoreDocFile(Base::Reader & reader, const int DocumentSch
|
||||
|
||||
// In the file GuiDocument.xml new data files might be added
|
||||
if (!xmlReader.getFilenames().empty())
|
||||
xmlReader.readFiles(static_cast<zipios::ZipInputStream&>(reader));
|
||||
xmlReader.readFiles(static_cast<zipios::ZipInputStream&>(reader.getStream()));
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void Save (Base::Writer & w) const;
|
||||
void Restore(Base::XMLReader &r);
|
||||
void SaveDocFile (Base::Writer & w) const;
|
||||
void RestoreDocFile(Base::Reader & r, const int DocumentSchema);
|
||||
void RestoreDocFile(Base::Reader & r);
|
||||
|
||||
private:
|
||||
zipios::ZipInputStream* stream;
|
||||
|
||||
@@ -113,7 +113,6 @@ void Gui::SoFCDB::init()
|
||||
PropertyAngleItem ::init();
|
||||
PropertyBoolItem ::init();
|
||||
PropertyVectorItem ::init();
|
||||
PropertyDoubleVectorItem ::init();
|
||||
PropertyMatrixItem ::init();
|
||||
PropertyPlacementItem ::init();
|
||||
PropertyEnumItem ::init();
|
||||
|
||||
@@ -117,7 +117,7 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const
|
||||
writer.Stream().write(ba.constData(), ba.length());
|
||||
}
|
||||
|
||||
void Thumbnail::RestoreDocFile(Base::Reader &reader, const int DocumentSchema)
|
||||
void Thumbnail::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
/// This method is used to save large amounts of data to a binary file.
|
||||
void SaveDocFile (Base::Writer &writer) const;
|
||||
/// This method is used to restore large amounts of data from a binary file.
|
||||
void RestoreDocFile(Base::Reader &reader, const int DocumentSchema);
|
||||
void RestoreDocFile(Base::Reader &reader);
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
@@ -905,7 +905,7 @@ PropertyVectorItem::PropertyVectorItem()
|
||||
|
||||
QVariant PropertyVectorItem::toString(const QVariant& prop) const
|
||||
{
|
||||
const Base::Vector3f& value = prop.value<Base::Vector3f>();
|
||||
const Base::Vector3d& value = prop.value<Base::Vector3d>();
|
||||
QString data = QString::fromAscii("[%1 %2 %3]")
|
||||
.arg(QLocale::system().toString(value.x, 'f', 2))
|
||||
.arg(QLocale::system().toString(value.y, 'f', 2))
|
||||
@@ -944,7 +944,7 @@ QWidget* PropertyVectorItem::createEditor(QWidget* parent, const QObject* /*rece
|
||||
void PropertyVectorItem::setEditorData(QWidget *editor, const QVariant& data) const
|
||||
{
|
||||
QLineEdit* le = qobject_cast<QLineEdit*>(editor);
|
||||
const Base::Vector3f& value = data.value<Base::Vector3f>();
|
||||
const Base::Vector3d& value = data.value<Base::Vector3d>();
|
||||
QString text = QString::fromAscii("[%1 %2 %3]")
|
||||
.arg(QLocale::system().toString(value.x, 'f', 2))
|
||||
.arg(QLocale::system().toString(value.y, 'f', 2))
|
||||
@@ -990,109 +990,6 @@ void PropertyVectorItem::setZ(double z)
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyDoubleVectorItem, Gui::PropertyEditor::PropertyItem);
|
||||
|
||||
PropertyDoubleVectorItem::PropertyDoubleVectorItem()
|
||||
{
|
||||
m_x = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_x->setParent(this);
|
||||
m_x->setPropertyName(QLatin1String("x"));
|
||||
this->appendChild(m_x);
|
||||
m_y = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_y->setParent(this);
|
||||
m_y->setPropertyName(QLatin1String("y"));
|
||||
this->appendChild(m_y);
|
||||
m_z = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_z->setParent(this);
|
||||
m_z->setPropertyName(QLatin1String("z"));
|
||||
this->appendChild(m_z);
|
||||
}
|
||||
|
||||
QVariant PropertyDoubleVectorItem::toString(const QVariant& prop) const
|
||||
{
|
||||
const Base::Vector3d& value = prop.value<Base::Vector3d>();
|
||||
QString data = QString::fromAscii("[%1 %2 %3]")
|
||||
.arg(QLocale::system().toString(value.x, 'f', 2))
|
||||
.arg(QLocale::system().toString(value.y, 'f', 2))
|
||||
.arg(QLocale::system().toString(value.z, 'f', 2));
|
||||
return QVariant(data);
|
||||
}
|
||||
|
||||
QVariant PropertyDoubleVectorItem::value(const App::Property* prop) const
|
||||
{
|
||||
// no real property class is using this
|
||||
return QVariant::fromValue<Base::Vector3d>(Base::Vector3d());
|
||||
}
|
||||
|
||||
void PropertyDoubleVectorItem::setValue(const QVariant& value)
|
||||
{
|
||||
if (!value.canConvert<Base::Vector3d>())
|
||||
return;
|
||||
const Base::Vector3d& val = value.value<Base::Vector3d>();
|
||||
QString data = QString::fromAscii("(%1, %2, %3)")
|
||||
.arg(val.x,0,'f',decimals())
|
||||
.arg(val.y,0,'f',decimals())
|
||||
.arg(val.z,0,'f',decimals());
|
||||
setPropertyValue(data);
|
||||
}
|
||||
|
||||
QWidget* PropertyDoubleVectorItem::createEditor(QWidget* parent, const QObject* /*receiver*/, const char* /*method*/) const
|
||||
{
|
||||
QLineEdit *le = new QLineEdit(parent);
|
||||
le->setFrame(false);
|
||||
le->setReadOnly(true);
|
||||
return le;
|
||||
}
|
||||
|
||||
void PropertyDoubleVectorItem::setEditorData(QWidget *editor, const QVariant& data) const
|
||||
{
|
||||
QLineEdit* le = qobject_cast<QLineEdit*>(editor);
|
||||
const Base::Vector3d& value = data.value<Base::Vector3d>();
|
||||
QString text = QString::fromAscii("[%1 %2 %3]")
|
||||
.arg(QLocale::system().toString(value.x, 'f', 2))
|
||||
.arg(QLocale::system().toString(value.y, 'f', 2))
|
||||
.arg(QLocale::system().toString(value.z, 'f', 2));
|
||||
le->setText(text);
|
||||
}
|
||||
|
||||
QVariant PropertyDoubleVectorItem::editorData(QWidget *editor) const
|
||||
{
|
||||
QLineEdit *le = qobject_cast<QLineEdit*>(editor);
|
||||
return QVariant(le->text());
|
||||
}
|
||||
|
||||
double PropertyDoubleVectorItem::x() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Vector3d>().x;
|
||||
}
|
||||
|
||||
void PropertyDoubleVectorItem::setX(double x)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Vector3d(x, y(), z())));
|
||||
}
|
||||
|
||||
double PropertyDoubleVectorItem::y() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Vector3d>().y;
|
||||
}
|
||||
|
||||
void PropertyDoubleVectorItem::setY(double y)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Vector3d(x(), y, z())));
|
||||
}
|
||||
|
||||
double PropertyDoubleVectorItem::z() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Vector3d>().z;
|
||||
}
|
||||
|
||||
void PropertyDoubleVectorItem::setZ(double z)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Vector3d(x(), y(), z)));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMatrixItem, Gui::PropertyEditor::PropertyItem);
|
||||
|
||||
PropertyMatrixItem::PropertyMatrixItem()
|
||||
@@ -1522,12 +1419,12 @@ PropertyPlacementItem::PropertyPlacementItem() : init_axis(false), changed_value
|
||||
m_a->setParent(this);
|
||||
m_a->setPropertyName(QLatin1String("Angle"));
|
||||
this->appendChild(m_a);
|
||||
m_d = static_cast<PropertyDoubleVectorItem*>(PropertyDoubleVectorItem::create());
|
||||
m_d = static_cast<PropertyVectorItem*>(PropertyVectorItem::create());
|
||||
m_d->setParent(this);
|
||||
m_d->setPropertyName(QLatin1String("Axis"));
|
||||
m_d->setReadOnly(true);
|
||||
this->appendChild(m_d);
|
||||
m_p = static_cast<PropertyDoubleVectorItem*>(PropertyDoubleVectorItem::create());
|
||||
m_p = static_cast<PropertyVectorItem*>(PropertyVectorItem::create());
|
||||
m_p->setParent(this);
|
||||
m_p->setPropertyName(QLatin1String("Position"));
|
||||
m_p->setReadOnly(true);
|
||||
|
||||
@@ -335,39 +335,6 @@ private:
|
||||
PropertyFloatItem* m_z;
|
||||
};
|
||||
|
||||
class GuiExport PropertyDoubleVectorItem: public PropertyItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(double x READ x WRITE setX DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double y READ y WRITE setY DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double z READ z WRITE setZ DESIGNABLE true USER true)
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
virtual QWidget* createEditor(QWidget* parent, const QObject* receiver, const char* method) const;
|
||||
virtual void setEditorData(QWidget *editor, const QVariant& data) const;
|
||||
virtual QVariant editorData(QWidget *editor) const;
|
||||
|
||||
double x() const;
|
||||
void setX(double x);
|
||||
double y() const;
|
||||
void setY(double y);
|
||||
double z() const;
|
||||
void setZ(double z);
|
||||
|
||||
protected:
|
||||
virtual QVariant toString(const QVariant&) const;
|
||||
virtual QVariant value(const App::Property*) const;
|
||||
virtual void setValue(const QVariant&);
|
||||
|
||||
protected:
|
||||
PropertyDoubleVectorItem();
|
||||
|
||||
private:
|
||||
PropertyFloatItem* m_x;
|
||||
PropertyFloatItem* m_y;
|
||||
PropertyFloatItem* m_z;
|
||||
};
|
||||
|
||||
class GuiExport PropertyMatrixItem: public PropertyItem
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -510,8 +477,8 @@ private:
|
||||
bool changed_value;
|
||||
Base::Vector3d rot_axis;
|
||||
PropertyAngleItem * m_a;
|
||||
PropertyDoubleVectorItem* m_d;
|
||||
PropertyDoubleVectorItem* m_p;
|
||||
PropertyVectorItem* m_d;
|
||||
PropertyVectorItem* m_p;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user