#include "AbstractVisualNode.h"

AbstractVisualNode::AbstractVisualNode(const DiscretePoint& location, const std::string& name)
    : mLocation(location),
      mName(name)
{

}

SceneItem* AbstractVisualNode::getSceneItem(std::size_t idx) const
{
    return mSceneItems[idx].get();
}

unsigned AbstractVisualNode::getNumSceneItems() const
{
    return mSceneItems.size();
}

void AbstractVisualNode::update(FontsManager* fontsManager)
{

}

Image<unsigned char>* AbstractVisualNode::getImage() const
{
    return mImage.get();
}

void AbstractVisualNode::syncChildren(const std::vector<AbstractVisualNode*>& children)
{
    mChildren = children;
}

void AbstractVisualNode::addChild(AbstractVisualNode* child)
{
    mChildren.push_back(child);
}

const std::vector<AbstractVisualNode*>& AbstractVisualNode::getChildren() const
{
    return mChildren;
}

void AbstractVisualNode::setIsVisible(bool isVisible)
{
    //std::cout << "Setting " << mName << " visibility to " << isVisible << std::endl;
    mIsVisible = isVisible;
}

unsigned AbstractVisualNode::getNumChildren() const
{
    return mChildren.size();
}

void AbstractVisualNode::setName(const std::string& name)
{
    mName = name;
}

const std::string& AbstractVisualNode::getName() const
{
    return mName;
}

bool AbstractVisualNode::getIsVisible() const
{
    return mIsVisible;
}

void AbstractVisualNode::setLocation(const DiscretePoint& loc)
{
    if (mLocation != loc)
    {
        mTransformIsDirty = true;
        mLocation = loc;
    }
}
