#pragma once

#include "PathElement.h"

#include <vector>
#include <memory>
#include <string>

using PathElementPtr = std::unique_ptr<PathElement>;

class GeometryPathFeature
{
public:
    void addElement(PathElementPtr element)
    {
        if (mElements.empty())
        {
            mLocation = element->getFirstPoint();
        }
        mElements.push_back(std::move(element));
    }

    const Point& getLocation() const
    {
        return mLocation;
    }

    const std::vector<PathElementPtr>& getElements() const
    {
        return mElements;
    }

private:
    Point mLocation;
    std::vector<PathElementPtr> mElements;
};
using GeometryPathFeaturePtr = std::unique_ptr<GeometryPathFeature>;

class GeometryPath : public AbstractGeometricItem
{
public:
    ~GeometryPath();

    void addFeature(GeometryPathFeaturePtr feature);

    void buildFromPostscript(const std::string& psString);

    std::string getAsPostScript() const;

    const Point& getLocation() const override;

    Bounds getBounds() const override;

    Type getType() const override;

    const std::vector<GeometryPathFeaturePtr>& getFeatures() const;

    void sample(SparseGrid<bool>*) const override;

private:
    Point mLocation;
    std::vector<GeometryPathFeaturePtr> mFeatures;
};
