# class hiro::draw::LineFieldRenderer

## Overview

Renderer used for rendering array of lines. More…

    #include <LineFieldRenderer.h>

    class LineFieldRenderer: public hiro::draw::Renderer {
    public:
        // construction

        LineFieldRenderer();
        LineFieldRenderer(const std::vector<geom::LineSegment2>& line_array);
        LineFieldRenderer(const std::vector<geom::LineSegment3>& line_array);
        LineFieldRenderer(const hiro::draw::LineFieldRenderer& source);
        LineFieldRenderer(hiro::draw::LineFieldRenderer&&);
        virtual ~LineFieldRenderer();

        // methods

        LineFieldRenderer& operator=(const hiro::draw::LineFieldRenderer& source);
        LineFieldRenderer& operator=(hiro::draw::LineFieldRenderer&&);
        void SetLines(const std::vector<geom::LineSegment3>& line_array);
        void SetLines(const std::vector<geom::LineSegment2>& line_array);
        size_t GetLineCount() const;
        glw::ArrayObject::BufferName AddColors(std::vector<cogs::Color3f> data);
        virtual bool IsCompatibileWithStyle(const hiro::draw::Style* style);

    protected:
        // methods

        virtual void OnRenderSimple();
        virtual void OnRenderSimple2D();
    };

### Inherited Members

    public:
        // methods

        virtual bool IsCompatibileWithStyle(const hiro::draw::Style* style) = 0;

    protected:
        // methods

        virtual void LoadRequiredShaderPrograms(glw::ProgramList* programs);
        virtual void Render(const std::string& program);
        virtual void OnRenderSimple();
        virtual void Render2D(const std::string& program);
        virtual void OnRenderSimple2D();
        virtual void FillTextRenderer(hiro::draw::TextRenderer* t_renderer);

        template <typename StyleType>
        const StyleType* GetStyle() const;

        const Scene* GetScene() const;

## Detailed Documentation

Renderer used for rendering array of lines.

### Construction

    LineFieldRenderer()

Creates a renderer with an empty line array.

    LineFieldRenderer(const std::vector<geom::LineSegment2>& line_array)

Creates a renderer with the specified 2D line array.

    LineFieldRenderer(const std::vector<geom::LineSegment3>& line_array)

Creates a renderer with the specified line array.

### Methods

    void SetLines(const std::vector<geom::LineSegment3>& line_array)

Replace the currently used line array with a new one.

    void SetLines(const std::vector<geom::LineSegment2>& line_array)

Replace the currently used line array with a new one.

    size_t GetLineCount() const

Returns number of lines in currently set line array.

    glw::ArrayObject::BufferName AddColors(std::vector<cogs::Color3f> data)

Creates a buffer with given colors.

Returns:

The name of the created buffer. If creation failed -1.

    virtual bool IsCompatibileWithStyle(const hiro::draw::Style* style)

Test whether specified style is compatible with the object.

    virtual void OnRenderSimple()

Specifies what happens when simple rendering is done.

    virtual void OnRenderSimple2D()

Specifies what happens when simple 2d rendering is done.