Blame toonz/sources/tnzext/CompositeStatus.cpp
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/CompositeStatus.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorimage.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/Types.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/StrokeParametricDeformer.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <vector></vector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace ToonzExt
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
*@class CompositeStatus
|
|
Toshihiro Shimizu |
890ddd |
*@brief This class mantains interal data for Dragger manipulator.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
CompositeStatus::CompositeStatus()
|
|
Toshihiro Shimizu |
890ddd |
: dbImpl_(new std::map<std::string, *="" compositestatus="">), db_(*dbImpl_)</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CompositeStatus::~CompositeStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
iterator
|
|
Toshihiro Shimizu |
890ddd |
it = db_.begin(),
|
|
Toshihiro Shimizu |
890ddd |
end = db_.end();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
while (it != end) {
|
|
Toshihiro Shimizu |
890ddd |
delete it->second;
|
|
Toshihiro Shimizu |
890ddd |
++it;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
delete dbImpl_;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CompositeStatus::add(CompositeStatus *status,
|
|
Toshihiro Shimizu |
890ddd |
const std::string &name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!status)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CompositeStatus
|
|
Toshihiro Shimizu |
890ddd |
*tmp = this->find(name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (tmp)
|
|
Toshihiro Shimizu |
890ddd |
delete tmp;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
db_[name] = status;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CompositeStatus::remove(const std::string &name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
iterator
|
|
Toshihiro Shimizu |
890ddd |
found = db_.find(name),
|
|
Toshihiro Shimizu |
890ddd |
end = db_.end();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (found != end) {
|
|
Toshihiro Shimizu |
890ddd |
delete found->second;
|
|
Toshihiro Shimizu |
890ddd |
db_.erase(found);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CompositeStatus *
|
|
Toshihiro Shimizu |
890ddd |
CompositeStatus::find(const std::string &name) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
const_iterator
|
|
Toshihiro Shimizu |
890ddd |
found = db_.find(name),
|
|
Toshihiro Shimizu |
890ddd |
end = db_.end();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (found != end)
|
|
Toshihiro Shimizu |
890ddd |
return found->second;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
}
|