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