56 return QString( tr(
"Sphere definition files ( *.sph )") );
60 return QString( tr(
"Sphere definition files ( *.sph )") );
68 int FileSPHPlugin::loadObject(QString _filename)
79 QFileInfo fi(_filename);
86 QSettings settings(_filename, QSettings::IniFormat);
87 settings.beginGroup(
"SPHERE");
89 if ( settings.contains(
"Name") ) {
91 QString name = settings.value(
"Name").toString();
100 if ( settings.contains(
"PositionX") ) {
103 position[0] = settings.value(
"PositionX").toDouble();
104 position[1] = settings.value(
"PositionY").toDouble();
105 position[2] = settings.value(
"PositionZ").toDouble();
110 if ( settings.contains(
"Size") ){
112 double size = settings.value(
"Size").toDouble();
117 if ( settings.contains(
"Slices") ){
119 int slices = settings.value(
"Slices").toDouble();
124 if ( settings.contains(
"Stacks") ){
126 int stacks = settings.value(
"Stacks").toDouble();
135 emit openedFile( sphereObject->
id() );
146 bool FileSPHPlugin::saveObject(
int _id, QString _filename)
157 QSettings settings(_filename, QSettings::IniFormat);
158 settings.beginGroup(
"SPHERE");
160 settings.setValue(
"Name",sphereObject->
name());
162 settings.setValue(
"PositionX", sphere->
get_primitive(0).position[0]);
163 settings.setValue(
"PositionY", sphere->
get_primitive(0).position[1]);
164 settings.setValue(
"PositionZ", sphere->
get_primitive(0).position[2]);
167 settings.setValue(
"Slices", sphere->
get_primitive(0).slices);
168 settings.setValue(
"Stacks", sphere->
get_primitive(0).stacks);
176 emit log(
LOGERR, tr(
"saveObject : cannot get object id %1 for save name %2").arg(_id).arg(_filename) );
void setName(QString _name)
Set the name of the Object.
virtual void setName(QString _name) override
path to the file from which the object is loaded ( defaults to "." )
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
QString name()
Return a name for the plugin.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
QString filename() const
return the filename of the object
SphereObject * sphereObject(int _objectId)
Get a SphereObject from id if possible.
void initializePlugin()
Initialize Plugin.
SphereNode * sphereNode(BaseObjectData *_object)
Get a SphereNode from an object.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
Primitive & get_primitive(int _idx)
get a primitive
void setFromFileName(const QString &_filename)