|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//#include "tpointparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tparamset.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tdoubleparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "texception.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=========================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TPointParamImp
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TPointParamImp(const TPointD &p)
|
|
Toshihiro Shimizu |
890ddd |
: m_x(new TDoubleParam(p.x)), m_y(new TDoubleParam(p.y))
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
TPointParamImp(const TPointParamImp &src)
|
|
Toshihiro Shimizu |
890ddd |
: m_x(src.m_x->clone()), m_y(src.m_y->clone())
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
~TPointParamImp() {}
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_x, m_y;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PERSIST_IDENTIFIER(TPointParam, "pointParam")
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPointParam::TPointParam(const TPointD &p, bool from_plugin)
|
|
Toshihiro Shimizu |
890ddd |
: m_data(new TPointParamImp(p)), m_from_plugin(from_plugin)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
addParam(m_data->m_x, "x");
|
|
Toshihiro Shimizu |
890ddd |
addParam(m_data->m_y, "y");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPointParam::TPointParam(const TPointParam &src)
|
|
Toshihiro Shimizu |
890ddd |
: TParamSet(src.getName()), m_data(new TPointParamImp(*src.m_data)), m_from_plugin(src.m_from_plugin)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
addParam(m_data->m_x, "x");
|
|
Toshihiro Shimizu |
890ddd |
addParam(m_data->m_y, "y");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPointParam::~TPointParam()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
delete m_data;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TPointParam::copy(TParam *src)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPointParam *p = dynamic_cast<tpointparam *="">(src);</tpointparam>
|
|
Toshihiro Shimizu |
890ddd |
if (!p)
|
|
Toshihiro Shimizu |
890ddd |
throw TException("invalid source for copy");
|
|
Toshihiro Shimizu |
890ddd |
setName(src->getName());
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_x->copy(p->m_data->m_x.getPointer());
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_y->copy(p->m_data->m_y.getPointer());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPointD TPointParam::getDefaultValue() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return TPointD(m_data->m_x->getDefaultValue(), m_data->m_y->getDefaultValue());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPointD TPointParam::getValue(double frame) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return TPointD(m_data->m_x->getValue(frame), m_data->m_y->getValue(frame));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TPointParam::setValue(double frame, const TPointD &p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
beginParameterChange();
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_x->setValue(frame, p.x);
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_y->setValue(frame, p.y);
|
|
Toshihiro Shimizu |
890ddd |
endParameterChange();
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TPointParam::setDefaultValue(const TPointD &p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_x->setDefaultValue(p.x);
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_y->setDefaultValue(p.y);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TPointParam::loadData(TIStream &is)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
string childName;
|
|
Toshihiro Shimizu |
890ddd |
while (is.openChild(childName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (childName == "x")
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_x->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
else if (childName == "y")
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_y->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
throw TException("unknown coord");
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TPointParam::saveData(TOStream &os)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("x");
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_x->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("y");
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_y->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP &TPointParam::getX()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_data->m_x;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP &TPointParam::getY()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_data->m_y;
|
|
Toshihiro Shimizu |
890ddd |
}
|