//#####################################################################
// Copyright 2002, Ronald Fedkiw, Eilene Hao, Sergey Koltakov, Neil Molino, Eran Guendelman.
// This file is part of PhysBAM whose distribution is governed by the license 
// contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class QT_SEGMENTED_CURVE
//##################################################################### 
#ifndef __QT_SEGMENTED_CURVE__
#define __QT_SEGMENTED_CURVE__

#include <Core/Meshes/SEGMENTED_CURVE.h>
#include "QT_COMPONENT.h"
#include "QT_SPLIT_OBJECT.h"

namespace PhysBAM{
template<class OBJ> class QT_OBJECT;

template<class TV>
class QT_SEGMENTED_CURVE:public QT_SPLIT_OBJECT<TV,MESH_OBJECT<TV,1>>
{
public:
    typedef typename TV::SCALAR T;
    typedef MESH_OBJECT<TV,1> TYPE;
    typedef MESH_OPTIONS<1> OPT;
    typedef QT_SPLIT_OBJECT<TV,MESH_OBJECT<TV,1>> BASE;
private:
    OPT opt,raw_opt[4];
    using typename BASE::FV;using BASE::Obj;using BASE::valid;
    using BASE::name;using BASE::action;

    int selected_vertex=-1;
    int selected_segment=-1;
    static const QT_COMPONENT_OPTION options[];
    static const int num_options;
    typedef QT_SEGMENTED_CURVE SELF;

public:
    QT_SEGMENTED_CURVE(QT_WORLD& world,const std::string& name,const std::string& file);
    QT_SEGMENTED_CURVE(QT_WORLD& world,const std::string& name,const std::string& mesh_file,const std::string& part_file);

    virtual ~QT_SEGMENTED_CURVE();

    RANGE<FV> Bounding_Box() override;
    void Render(QT_RENDER_UTILS& ru) override;
    void Set_Selection(ARRAY_VIEW<int> selection) override;
    void Clear_Selection() override;
    FV Selection_Point() override;
    void Make_Dialog(QT_WINDOW& window) override;
    void Read_Option(std::istream& in,int level) override;
    void Set_Draw(bool draw) override;
    bool Draw() const override;
    void Save_Settings(std::ostream& out) override;
    void Clear_Settings() override;
};
}
#endif
