OpenShot Library | libopenshot  0.2.3
Coordinate.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header file for Coordinate class
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  *
6  * @section LICENSE
7  *
8  * Copyright (c) 2008-2014 OpenShot Studios, LLC
9  * <http://www.openshotstudios.com/>. This file is part of
10  * OpenShot Library (libopenshot), an open-source project dedicated to
11  * delivering high quality video editing and animation solutions to the
12  * world. For more information visit <http://www.openshot.org/>.
13  *
14  * OpenShot Library (libopenshot) is free software: you can redistribute it
15  * and/or modify it under the terms of the GNU Lesser General Public License
16  * as published by the Free Software Foundation, either version 3 of the
17  * License, or (at your option) any later version.
18  *
19  * OpenShot Library (libopenshot) is distributed in the hope that it will be
20  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #ifndef OPENSHOT_COORDINATE_H
29 #define OPENSHOT_COORDINATE_H
30 
31 #include <iostream>
32 #include "Exceptions.h"
33 #include "Fraction.h"
34 #include "Json.h"
35 
36 using namespace std;
37 
38 namespace openshot {
39 
40  /**
41  * @brief This class represents a Cartesian coordinate (X, Y) used in the Keyframe animation system.
42  *
43  * Animation involves the changing (i.e. interpolation) of numbers over time. A series of Coordinate
44  * objects allows us to plot a specific curve or line used during interpolation. In other words, it helps us
45  * control how a number changes over time (quickly or slowly).
46  *
47  * Please see the following <b>Example Code</b>:
48  * \code
49  * Coordinate c1(2,4);
50  * assert(c1.X == 2.0f);
51  * assert(c1.Y == 4.0f);
52  * \endcode
53  */
54  class Coordinate {
55  public:
56  double X; ///< The X value of the coordinate (usually representing the frame #)
57  double Y; ///< The Y value of the coordinate (usually representing the value of the property being animated)
58 
59  /// The default constructor, which defaults to (0,0)
60  Coordinate();
61 
62  /// @brief Constructor which also sets the X and Y
63  /// @param x The X coordinate (usually representing the frame #)
64  /// @param y The Y coordinate (usually representing the value of the property being animated)
65  Coordinate(double x, double y);
66 
67  /// Get and Set JSON methods
68  string Json(); ///< Generate JSON string of this object
69  Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
70  void SetJson(string value); ///< Load JSON string into this object
71  void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
72  };
73 
74 }
75 
76 #endif
This class represents a Cartesian coordinate (X, Y) used in the Keyframe animation system...
Definition: Coordinate.h:54
Header file for Fraction class.
Header file for all Exception classes.
double Y
The Y value of the coordinate (usually representing the value of the property being animated) ...
Definition: Coordinate.h:57
Header file for JSON class.
double X
The X value of the coordinate (usually representing the frame #)
Definition: Coordinate.h:56