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