3a19fe
#pragma once
3a19fe
3a19fe
#ifndef ASSISTANTLINE_INCLUDED
3a19fe
#define ASSISTANTLINE_INCLUDED
3a19fe
3a19fe
3a19fe
// TnzTools includes
3a19fe
#include <tools assistant.h=""></tools>
3a19fe
#include <tools assistants="" guidelineline.h=""></tools>
3a19fe
3a19fe
3a19fe
// TnzCore includes
3a19fe
#include <tgl.h></tgl.h>
3a19fe
3a19fe
3a19fe
//*****************************************************************************************
3a19fe
//    TAssistantLine definition
3a19fe
//*****************************************************************************************
3a19fe
3a19fe
class TAssistantLine final : public TAssistant {
3a19fe
  Q_DECLARE_TR_FUNCTIONS(TAssistantVanishingPoint)
3a19fe
public:
3a19fe
  const TStringId m_idRestricktA;
3a19fe
  const TStringId m_idRestricktB;
3a19fe
  const TStringId m_idParallel;
3a19fe
  const TStringId m_idGrid;
3a19fe
  const TStringId m_idPerspective;
3a19fe
3a19fe
protected:
3a19fe
  TAssistantPoint &m_a;
3a19fe
  TAssistantPoint &m_b;
3a19fe
  TAssistantPoint &m_grid0;
3a19fe
  TAssistantPoint &m_grid1;
3a19fe
3a19fe
public:
3a19fe
  TAssistantLine(TMetaObject &object);
3a19fe
3a19fe
  static QString getLocalName();
3a19fe
3a19fe
  void updateTranslation() const override;
3a19fe
3a19fe
  inline bool getRestrictA() const
3a19fe
    { return data()[m_idRestricktA].getBool(); }
3a19fe
  inline bool getRestrictB() const
3a19fe
    { return data()[m_idRestricktB].getBool(); }
3a19fe
  inline bool getParallel() const
3a19fe
    { return data()[m_idParallel].getBool(); }
3a19fe
  inline bool getGrid() const
3a19fe
    { return data()[m_idGrid].getBool(); }
3a19fe
  inline bool getPerspective() const
3a19fe
    { return data()[m_idPerspective].getBool(); }
3a19fe
3a19fe
  void onDataChanged(const TVariant &value) override;
3a19fe
3a19fe
private:
13f20b
  void fixGrid(const TPointD &prevA, const TPointD &prevB);
3a19fe
3a19fe
public:
3a19fe
  void onMovePoint(TAssistantPoint &point, const TPointD &position) override;
3a19fe
3a19fe
  void getGuidelines(
3a19fe
    const TPointD &position,
3a19fe
    const TAffine &toTool,
3a19fe
    TGuidelineList &outGuidelines ) const override;
3a19fe
3a19fe
  static void drawRuler(
3a19fe
    const TPointD &a,
3a19fe
    const TPointD &b,
3a19fe
    const TPointD &grid0,
3a19fe
    const TPointD &grid1,
3a19fe
    const TPointD *perspectiveBase,
3a19fe
    double alpha );
3a19fe
3a19fe
  static void drawLine(
3a19fe
    const TAffine &matrix,
3a19fe
    const TAffine &matrixInv,
3a19fe
    double pixelSize,
3a19fe
    const TPointD &a,
3a19fe
    const TPointD &b,
3a19fe
    bool restrictA,
3a19fe
    bool restrictB,
3a19fe
    double alpha );
3a19fe
3a19fe
  static void drawGrid(
3a19fe
    const TPointD &a,
3a19fe
    const TPointD &b,
3a19fe
    const TPointD &grid0,
3a19fe
    const TPointD &grid1,
3a19fe
    bool restrictA,
3a19fe
    bool restrictB,
3a19fe
    bool perspective,
3a19fe
    double alpha );
3a19fe
3a19fe
  void draw(TToolViewer *viewer, bool enabled) const override;
3a19fe
};
3a19fe
3a19fe
3a19fe
#endif