#pragma once

#include "PathElement.h"

#include <string>

class LineSegment : public PathElement
{
public:
    LineSegment(const Point& p0, const Point& p1);

    static std::unique_ptr<LineSegment> Create(const Point& p0, const Point& p1);

    double getLength() const;

    const Point& getPoint0() const;

    const Point& getPoint1() const;

    Bounds getBounds() const override;

    const Point& getLocation() const override;

    Point getFirstPoint() const override;

    Point getEndPoint() const override;

    Type getType() const override;

    bool isHorizontal() const;

    bool isVertical() const;

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

    std::string toPostScriptString(std::size_t precision = 0) const override;

private:
    Point mP0;
    Point mP1;
};
