Commit 1d9d49bc authored by Matthias Möller's avatar Matthias Möller

moves functions from BaseObjectData to BaseObject

refs #670

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14529 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2ec39c38
......@@ -709,17 +709,47 @@ QStringList BaseObject::getGroupNames() {
}
// ===============================================================================
// Name
// Name and path Handling
// ===============================================================================
QString BaseObject::name() {
return name_;
void BaseObjectData::setFromFileName(QString _filename ) {
QString str = _filename;
path_ = str.section(QDir::separator() ,0,-2);
setName(str.section(QDir::separator(),-1));
}
void BaseObject::setName(QString _name ) {
void BaseObjectData::setName( QString _name ) {
name_ = _name;
// Tell plugins about the name change
emit objectPropertiesChanged(id());
std::string nodename = std::string("SeparatorNode for object " + _name.toUtf8());
separatorNode_->name( nodename );
nodename = std::string("ManipulatorNode for object " + _name.toUtf8());
manipulatorNode_->name( nodename );
nodename = std::string("BoundingBoxNode for object " + _name.toUtf8());
boundingBoxNode_->name( nodename );
nodename = std::string(_name.toUtf8() + "'s Material" );
materialNode_->name( nodename );
nodename = std::string("StencilRefNode for object " + _name.toUtf8());
stencilRefNode_->name( nodename );
}
QString BaseObject::name() {
return name_;
}
QString BaseObjectData::path(){
return path_;
}
void BaseObjectData::setPath(QString _path ) {
path_ = _path;
}
// ===============================================================================
......
......@@ -419,19 +419,37 @@ class DLLEXPORTONLY BaseObject : public QObject {
* @{ */
//===========================================================================
signals:
/** This signal is emitted when properties of the object have been changed like its name
* or the parent changed
*/
void objectPropertiesChanged(int _objectId);
/** Set the object name from a filename. The function will set the name of the
* object to the filename. At the same time the path is set to the one given in
* the parameter
*
* @param _filename path to the file.
*/
void setFromFileName(QString _filename );
/// return the path to the object ( defaults to "." if unset )
QString path();
/// set the path to the object.
void setPath(QString _path);
public:
/// return the name of the object. The name defaults to NONAME if unset.
QString name( );
/// set the name of the object. ( If you overwrite it, call BaseObject::setName(_name ) it in your funtion first)
virtual void setName( QString _name );
private:
/// path to the file from which the object is loaded ( defaults to "." )
QString path_;
signals:
/** This signal is emitted when properties of the object have been changed like its name
* or the parent changed
*/
void objectPropertiesChanged(int _objectId);
private:
......
......@@ -181,44 +181,6 @@ void BaseObjectData::initializeScenegraphNodes() {
}
// ===============================================================================
// Name and path Handling
// ===============================================================================
void BaseObjectData::setFromFileName(QString _filename ) {
QString str = _filename;
path_ = str.section(QDir::separator() ,0,-2);
setName(str.section(QDir::separator(),-1));
}
void BaseObjectData::setName( QString _name ) {
BaseObject::setName( _name );
std::string nodename = std::string("SeparatorNode for object " + _name.toUtf8());
separatorNode_->name( nodename );
nodename = std::string("ManipulatorNode for object " + _name.toUtf8());
manipulatorNode_->name( nodename );
nodename = std::string("BoundingBoxNode for object " + _name.toUtf8());
boundingBoxNode_->name( nodename );
nodename = std::string(_name.toUtf8() + "'s Material" );
materialNode_->name( nodename );
nodename = std::string("StencilRefNode for object " + _name.toUtf8());
stencilRefNode_->name( nodename );
}
QString BaseObjectData::path(){
return path_;
}
void BaseObjectData::setPath(QString _path ) {
path_ = _path;
}
// ===============================================================================
// Object visualization
// ===============================================================================
......
......@@ -130,36 +130,6 @@ class DLLEXPORT BaseObjectData : public BaseObject
* */
virtual void cleanup();
/** @} */
//===========================================================================
/** @name Name and Path handling
* @{ */
//===========================================================================
public:
/** Set the object name from a filename. The function will set the name of the
* object to the filename. At the same time the path is set to the one given in
* the parameter
*
* @param _filename path to the file.
*/
void setFromFileName(QString _filename );
/// set the name of the object. ( If you overwrite it, call BaseObjectData::setName(_name ) it in your function first)
virtual void setName( QString _name );
/// return the path to the object ( defaults to "." if unset )
QString path();
/// set the path to the object.
void setPath(QString _path);
private:
/// path to the file from which the object is loaded ( defaults to "." )
QString path_;
/** @} */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment