Loading...
Searching...
No Matches
TrackedObjectBase.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_TRACKEDOBJECTBASE_H
#define OPENSHOT_TRACKEDOBJECTBASE_H
#include <vector>
#include <string>
#include "KeyFrame.h"
#include "Json.h"
namespace openshot {
// Forward decls
class ClipBase;
class TrackedObjectBase {
protected:
std::string id;
ClipBase* parentClip;
public:
Keyframe visible;
Keyframe draw_box;
TrackedObjectBase();
TrackedObjectBase(std::string _id);
virtual ~TrackedObjectBase() = default;
std::string Id() const { return id; }
void Id(std::string _id) { id = _id; }
ClipBase* ParentClip() const { return parentClip; }
void ParentClip(ClipBase* clip) { parentClip = clip; }
virtual bool ExactlyContains(int64_t frame_number) const { return {}; };
virtual void ScalePoints(double scale) { return; };
virtual std::map<std::string, float> GetBoxValues(int64_t frame_number) const { std::map<std::string, float> ret; return ret; };
virtual void AddBox(int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle) { return; };
virtual std::string Json() const = 0;
virtual Json::Value JsonValue() const = 0;
virtual void SetJson(const std::string value) = 0;
virtual void SetJsonValue(const Json::Value root) = 0;
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;
};
} // Namespace openshot
#endif
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
openshot::ClipBase
This abstract class is the base class, used by all clips in libopenshot.
Definition ClipBase.h:32
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
openshot::TrackedObjectBase::SetJsonValue
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
openshot::TrackedObjectBase::parentClip
ClipBase * parentClip
Definition TrackedObjectBase.h:38
openshot::TrackedObjectBase::draw_box
Keyframe draw_box
Keyframe to determine if a specific box is drawn (or hidden).
Definition TrackedObjectBase.h:46
openshot::TrackedObjectBase::Json
virtual std::string Json() const =0
Get and Set JSON methods.
openshot::TrackedObjectBase::PropertiesJSON
virtual Json::Value PropertiesJSON(int64_t requested_frame) const =0
openshot::TrackedObjectBase::add_property_choice_json
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const
Generate JSON choice for a property (dropdown properties).
Definition TrackedObjectBase.cpp:28
openshot::TrackedObjectBase::ExactlyContains
virtual bool ExactlyContains(int64_t frame_number) const
Check if there is data for the exact frame number.
Definition TrackedObjectBase.h:66
openshot::TrackedObjectBase::visible
Keyframe visible
Keyframe to track if a box is visible in the current frame (read-only).
Definition TrackedObjectBase.h:43
openshot::TrackedObjectBase::SetJson
virtual void SetJson(const std::string value)=0
Load JSON string into this object.
openshot::TrackedObjectBase::ScalePoints
virtual void ScalePoints(double scale)
Scale an object's property.
Definition TrackedObjectBase.h:69
openshot::TrackedObjectBase::Id
void Id(std::string _id)
Set the id of this object.
Definition TrackedObjectBase.h:60
openshot::TrackedObjectBase::ParentClip
void ParentClip(ClipBase *clip)
Definition TrackedObjectBase.h:63
openshot::TrackedObjectBase::TrackedObjectBase
TrackedObjectBase()
Default constructor.
Definition TrackedObjectBase.cpp:22
openshot::TrackedObjectBase::id
std::string id
Definition TrackedObjectBase.h:37
openshot::TrackedObjectBase::JsonValue
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
openshot::TrackedObjectBase::~TrackedObjectBase
virtual ~TrackedObjectBase()=default
Destructor.
openshot::TrackedObjectBase::GetBoxValues
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.
Definition TrackedObjectBase.h:71
openshot::TrackedObjectBase::AddBox
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.
Definition TrackedObjectBase.h:73
openshot::TrackedObjectBase::ParentClip
ClipBase * ParentClip() const
Get and set the parentClip of this object.
Definition TrackedObjectBase.h:62
openshot::TrackedObjectBase::Id
std::string Id() const
Get the id of this object.
Definition TrackedObjectBase.h:58
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29