1 /* === S Y N F I G ========================================================= */
3 ** \brief Template File
5 ** $Id: waypoint.cpp,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
33 #include "valuenode_const.h"
37 /* === U S I N G =========================================================== */
41 using namespace synfig;
43 /* === M A C R O S ========================================================= */
45 /* === G L O B A L S ======================================================= */
47 /* === P R O C E D U R E S ================================================= */
49 /* === M E T H O D S ======================================================= */
51 Waypoint::Waypoint(ValueBase value, Time time):
53 before(INTERPOLATION_TCB),
54 after(INTERPOLATION_TCB),
55 value_node(ValueNode_Const::create(value)),
62 if(value.get_type()==ValueBase::TYPE_ANGLE)
63 after=before=INTERPOLATION_LINEAR;
66 Waypoint::Waypoint(ValueNode::Handle value_node, Time time):
68 before(INTERPOLATION_TCB),
69 after(INTERPOLATION_TCB),
70 value_node(value_node),
77 if(value_node->get_type()==ValueBase::TYPE_ANGLE)
78 after=before=INTERPOLATION_LINEAR;
83 before(INTERPOLATION_TCB),
84 after(INTERPOLATION_TCB),
93 Waypoint::set_value(const ValueBase &x)
95 if(!value_node && x.get_type()==ValueBase::TYPE_ANGLE)
96 after=before=INTERPOLATION_LINEAR;
98 value_node=ValueNode_Const::create(x);
102 Waypoint::set_value_node(const ValueNode::Handle &x)
104 if(!value_node && x->get_type()==ValueBase::TYPE_ANGLE)
105 after=before=INTERPOLATION_LINEAR;
111 Waypoint::is_static()const
113 return static_cast<bool>(ValueNode_Const::Handle::cast_dynamic(value_node)) && value_node && !value_node->is_exported();
117 Waypoint::set_time(const Time &x)
123 Waypoint::apply_model(const Model &x)
125 if(x.priority_flag) set_priority(x.get_priority());
126 if(x.before_flag) set_before(x.get_before());
127 if(x.after_flag) set_after(x.get_after());
128 if(x.tension_flag) set_tension(x.get_tension());
129 if(x.continuity_flag) set_continuity(x.get_continuity());
130 if(x.bias_flag) set_bias(x.get_bias());
131 if(x.temporal_tension_flag) set_temporal_tension(x.get_temporal_tension());
135 Waypoint::clone(const GUID& deriv_guid)const
139 if(!ret.value_node->is_exported())
140 ret.value_node=value_node->clone(deriv_guid);
146 Waypoint::get_value()const { return (*value_node)(0); }
149 Waypoint::get_value(const Time &t)const { return (*value_node)(t); }
152 Waypoint::get_guid()const
154 return GUID::hasher(get_uid());