OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
TrackedObjectBase.h
Go to the documentation of this file.
1
10// Copyright (c) 2008-2019 OpenShot Studios, LLC
11//
12// SPDX-License-Identifier: LGPL-3.0-or-later
13
14#ifndef OPENSHOT_TRACKEDOBJECTBASE_H
15#define OPENSHOT_TRACKEDOBJECTBASE_H
16
17#include <vector>
18#include <string>
19
20#include "KeyFrame.h"
21#include "Json.h"
22
23namespace openshot {
24
25 // Forward decls
26 class ClipBase;
27
36 protected:
37 std::string id;
39
40 public:
41
44
47
50
52 TrackedObjectBase(std::string _id);
53
55 virtual ~TrackedObjectBase() = default;
56
58 std::string Id() const { return id; }
60 void Id(std::string _id) { id = _id; }
62 ClipBase* ParentClip() const { return parentClip; }
63 void ParentClip(ClipBase* clip) { parentClip = clip; }
64
66 virtual bool ExactlyContains(int64_t frame_number) const { return {}; };
67
69 virtual void ScalePoints(double scale) { return; };
71 virtual std::map<std::string, float> GetBoxValues(int64_t frame_number) const { std::map<std::string, float> ret; return ret; };
73 virtual void AddBox(int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle) { return; };
74
75
77 virtual std::string Json() const = 0;
78 virtual Json::Value JsonValue() const = 0;
79 virtual void SetJson(const std::string value) = 0;
80 virtual void SetJsonValue(const Json::Value root) = 0;
81
84 virtual Json::Value PropertiesJSON(int64_t requested_frame) const = 0;
86 Json::Value add_property_choice_json(std::string name, int value, int selected_value) const;
87 };
88} // Namespace openshot
89
90#endif
Header file for JSON class.
Header file for the Keyframe class.
This abstract class is the base class, used by all clips in libopenshot.
Definition ClipBase.h:33
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
This abstract class is the base class of all Tracked Objects.
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
Keyframe draw_box
Keyframe to determine if a specific box is drawn (or hidden)
virtual std::string Json() const =0
Get and Set JSON methods.
virtual Json::Value PropertiesJSON(int64_t requested_frame) const =0
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const
Generate JSON choice for a property (dropdown properties)
virtual bool ExactlyContains(int64_t frame_number) const
Check if there is data for the exact frame number.
Keyframe visible
Keyframe to track if a box is visible in the current frame (read-only)
virtual void SetJson(const std::string value)=0
Load JSON string into this object.
virtual void ScalePoints(double scale)
Scale an object's property.
void Id(std::string _id)
Set the id of this object.
void ParentClip(ClipBase *clip)
TrackedObjectBase()
Default constructor.
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
virtual ~TrackedObjectBase()=default
Destructor.
virtual std::map< std::string, float > GetBoxValues(int64_t frame_number) const
Return the main properties of a TrackedObjectBBox instance - such as position, size and rotation.
virtual void AddBox(int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle)
Add a bounding box to the tracked object's BoxVec map.
ClipBase * ParentClip() const
Get and set the parentClip of this object.
std::string Id() const
Get the id of this object.
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29