2011-10-11 08:44:27 -05:00
|
|
|
/**
|
2013-09-09 23:32:16 -05:00
|
|
|
* @file
|
|
|
|
|
* @brief Header file for Coordinate class
|
2013-09-12 17:52:10 -05:00
|
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
*
|
2019-06-09 08:31:04 -04:00
|
|
|
* @ref License
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* LICENSE
|
2013-09-12 17:52:10 -05:00
|
|
|
*
|
2019-06-11 06:48:32 -04:00
|
|
|
* Copyright (c) 2008-2019 OpenShot Studios, LLC
|
2014-03-29 18:49:22 -05:00
|
|
|
* <http://www.openshotstudios.com/>. This file is part of
|
|
|
|
|
* OpenShot Library (libopenshot), an open-source project dedicated to
|
|
|
|
|
* delivering high quality video editing and animation solutions to the
|
|
|
|
|
* world. For more information visit <http://www.openshot.org/>.
|
2013-09-12 17:52:10 -05:00
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* OpenShot Library (libopenshot) is free software: you can redistribute it
|
2014-07-11 16:52:14 -05:00
|
|
|
* and/or modify it under the terms of the GNU Lesser General Public License
|
2014-03-29 18:49:22 -05:00
|
|
|
* as published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
2013-09-12 17:52:10 -05:00
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* OpenShot Library (libopenshot) is distributed in the hope that it will be
|
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-07-11 16:52:14 -05:00
|
|
|
* GNU Lesser General Public License for more details.
|
2013-09-12 17:52:10 -05:00
|
|
|
*
|
2014-07-11 16:52:14 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2014-03-29 18:49:22 -05:00
|
|
|
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
2011-10-11 08:44:27 -05:00
|
|
|
*/
|
|
|
|
|
|
2013-09-12 17:52:10 -05:00
|
|
|
#ifndef OPENSHOT_COORDINATE_H
|
|
|
|
|
#define OPENSHOT_COORDINATE_H
|
|
|
|
|
|
2013-10-01 15:22:25 -05:00
|
|
|
#include <iostream>
|
2013-12-06 00:40:26 -06:00
|
|
|
#include "Exceptions.h"
|
|
|
|
|
#include "Fraction.h"
|
|
|
|
|
#include "Json.h"
|
|
|
|
|
|
2011-10-11 08:44:27 -05:00
|
|
|
namespace openshot {
|
|
|
|
|
|
|
|
|
|
/**
|
2013-09-09 23:32:16 -05:00
|
|
|
* @brief This class represents a Cartesian coordinate (X, Y) used in the Keyframe animation system.
|
2011-10-11 08:44:27 -05:00
|
|
|
*
|
|
|
|
|
* Animation involves the changing (i.e. interpolation) of numbers over time. A series of Coordinate
|
|
|
|
|
* objects allows us to plot a specific curve or line used during interpolation. In other words, it helps us
|
|
|
|
|
* control how a number changes over time (quickly or slowly).
|
|
|
|
|
*
|
|
|
|
|
* Please see the following <b>Example Code</b>:
|
|
|
|
|
* \code
|
|
|
|
|
* Coordinate c1(2,4);
|
|
|
|
|
* assert(c1.X == 2.0f);
|
|
|
|
|
* assert(c1.Y == 4.0f);
|
|
|
|
|
* \endcode
|
|
|
|
|
*/
|
|
|
|
|
class Coordinate {
|
2013-09-12 17:52:10 -05:00
|
|
|
public:
|
2017-01-24 18:39:17 -06:00
|
|
|
double X; ///< The X value of the coordinate (usually representing the frame #)
|
|
|
|
|
double Y; ///< The Y value of the coordinate (usually representing the value of the property being animated)
|
2013-09-12 17:52:10 -05:00
|
|
|
|
2011-10-11 08:44:27 -05:00
|
|
|
/// The default constructor, which defaults to (0,0)
|
|
|
|
|
Coordinate();
|
|
|
|
|
|
2013-09-12 17:52:10 -05:00
|
|
|
/// @brief Constructor which also sets the X and Y
|
|
|
|
|
/// @param x The X coordinate (usually representing the frame #)
|
|
|
|
|
/// @param y The Y coordinate (usually representing the value of the property being animated)
|
2017-01-24 18:39:17 -06:00
|
|
|
Coordinate(double x, double y);
|
2013-09-12 17:52:10 -05:00
|
|
|
|
2013-12-06 00:40:26 -06:00
|
|
|
/// Get and Set JSON methods
|
2019-08-04 22:48:57 -04:00
|
|
|
std::string Json(); ///< Generate JSON string of this object
|
2013-12-06 00:40:26 -06:00
|
|
|
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
2019-08-04 22:48:57 -04:00
|
|
|
void SetJson(std::string value); ///< Load JSON string into this object
|
2013-12-07 21:09:55 -06:00
|
|
|
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
2011-10-11 08:44:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|