FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ais_text.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #pragma once
17 
18 #include "occtools.h"
19 #include "handle_ais_text.h"
20 
21 #include <AIS_InteractiveObject.hxx>
22 #include <Aspect_TypeOfDisplayText.hxx>
23 #include <Aspect_TypeOfStyleText.hxx>
24 #include <gp_Pnt.hxx>
25 #include <Handle_Graphic3d_AspectText3d.hxx>
26 #include <Handle_Prs3d_Presentation.hxx>
27 #include <Handle_Prs3d_Projector.hxx>
28 #include <Handle_Prs3d_TextAspect.hxx>
29 #include <PrsMgr_PresentationManager3d.hxx>
30 #include <SelectMgr_Selection.hxx>
31 #include <Quantity_Color.hxx>
32 #include <TCollection_ExtendedString.hxx>
33 
34 namespace occ {
35 
36 class OCCTOOLS_EXPORT AIS_Text : public AIS_InteractiveObject
37 {
38 public:
39  AIS_Text();
40  AIS_Text(const TCollection_ExtendedString& text, const gp_Pnt& pos);
41  virtual ~AIS_Text();
42 
43  // DEFINE_STANDARD_RTTI(AIS_Text)
44 
45  Handle_Prs3d_TextAspect presentationTextAspect(unsigned i = 0) const;
46  Handle_Graphic3d_AspectText3d graphicTextAspect(unsigned i = 0) const;
47 
48  void setDefaultColor(const Quantity_Color& c);
49  void setDefaultFont(const char* fontName);
50  void setDefaultTextBackgroundColor(const Quantity_Color& c);
51  void setDefaultTextDisplayMode(Aspect_TypeOfDisplayText mode);
52  void setDefaultTextStyle(Aspect_TypeOfStyleText style);
53 
54  gp_Pnt position(unsigned i = 0) const;
55  void setPosition(const gp_Pnt& pos, unsigned i = 0);
56 
57  TCollection_ExtendedString text(unsigned i = 0) const;
58  void setText(const TCollection_ExtendedString& v, unsigned i = 0);
59  bool isValidTextIndex(unsigned i) const;
60 
61  void setTextBackgroundColor(const Quantity_Color& color, unsigned i = 0);
62  void setTextDisplayMode(Aspect_TypeOfDisplayText mode, unsigned i = 0);
63  void setTextStyle(Aspect_TypeOfStyleText style, unsigned i = 0);
64 
65  unsigned textsCount() const;
66  void addText(const TCollection_ExtendedString& text, const gp_Pnt& pos);
67 
68  // --- Implementation
69 protected:
70  void Compute(
71  const Handle_PrsMgr_PresentationManager3d& pm,
72  const Handle_Prs3d_Presentation& pres,
73  const Standard_Integer mode) override;
74  void Compute(
75  const Handle_Prs3d_Projector& proj,
76  const Handle_Prs3d_Presentation& pres) override;
77  void ComputeSelection(
78  const Handle_SelectMgr_Selection& sel,
79  const Standard_Integer mode) override;
80 
81 private:
82  class Private;
83  Private* const d;
84 };
85 
86 } // namespace occ
#define OCCTOOLS_EXPORT
Definition: occtools.h:27
Definition: ais_text.cpp:31
Interactive items specialized in text display.
Definition: ais_text.h:36