55 #if QT_VERSION >= 0x050000
66 return QString( tr(
"Sphere definition files ( *.sph )") );
70 return QString( tr(
"Sphere definition files ( *.sph )") );
78 int FileSPHPlugin::loadObject(QString _filename)
89 QFileInfo fi(_filename);
96 QSettings settings(_filename, QSettings::IniFormat);
97 settings.beginGroup(
"SPHERE");
99 if ( settings.contains(
"Name") ) {
101 QString name = settings.value(
"Name").toString();
110 if ( settings.contains(
"PositionX") ) {
113 position[0] = settings.value(
"PositionX").toDouble();
114 position[1] = settings.value(
"PositionY").toDouble();
115 position[2] = settings.value(
"PositionZ").toDouble();
120 if ( settings.contains(
"Size") ){
122 double size = settings.value(
"Size").toDouble();
127 if ( settings.contains(
"Slices") ){
129 int slices = settings.value(
"Slices").toDouble();
134 if ( settings.contains(
"Stacks") ){
136 int stacks = settings.value(
"Stacks").toDouble();
145 emit openedFile( sphereObject->
id() );
156 bool FileSPHPlugin::saveObject(
int _id, QString _filename)
167 QSettings settings(_filename, QSettings::IniFormat);
168 settings.beginGroup(
"SPHERE");
170 settings.setValue(
"Name",sphereObject->
name());
172 settings.setValue(
"PositionX", sphere->
get_primitive(0).position[0]);
173 settings.setValue(
"PositionY", sphere->
get_primitive(0).position[1]);
174 settings.setValue(
"PositionZ", sphere->
get_primitive(0).position[2]);
177 settings.setValue(
"Slices", sphere->
get_primitive(0).slices);
178 settings.setValue(
"Stacks", sphere->
get_primitive(0).stacks);
182 obj->setFromFileName(_filename);
183 obj->setName(obj->filename());
186 emit log(
LOGERR, tr(
"saveObject : cannot get object id %1 for save name %2").arg(_id).arg(_filename) );
193 #if QT_VERSION < 0x050000
QString name() const
return the name of the object. The name defaults to NONAME if unset.
SphereNode * sphereNode(BaseObjectData *_object)
Get a SphereNode from an object.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
bool getObject(int _identifier, BSplineCurveObject *&_object)
void setFromFileName(const QString &_filename)
SphereObject * sphereObject(int _objectId)
Get a SphereObject from id if possible.
void setName(QString _name)
Set the name of the Object.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Primitive & get_primitive(int _idx)
get a primitive
void initializePlugin()
Initialize Plugin.
QString name()
Return a name for the plugin.