b311480e |
1 | // Created on: 1995-04-21 |
2 | // Created by: Robert COUBLANC |
3 | // Copyright (c) 1995-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <StdSelect_SensitiveText2d.ixx> |
24 | #include <StdSelect_TextProjector2d.hxx> |
25 | #include <gp_Pnt2d.hxx> |
26 | |
27 | |
28 | StdSelect_SensitiveText2d:: |
29 | StdSelect_SensitiveText2d (const Handle(SelectBasics_EntityOwner)& anOwnerId, |
30 | const TCollection_ExtendedString& aString, |
31 | const Standard_Real XPos, |
32 | const Standard_Real YPos, |
33 | const Standard_Real Angle, |
34 | const Standard_Integer aFontIndex): |
35 | Select2D_SensitiveEntity(anOwnerId), |
36 | mytext(aString), |
37 | myxpos(XPos), |
38 | myypos(YPos), |
39 | myangle(Angle), |
40 | myfont(aFontIndex) {} |
41 | |
42 | |
43 | |
44 | void StdSelect_SensitiveText2d::Convert(const Handle(Select2D_Projector)& aPrj) |
45 | { |
46 | if(!(Handle(StdSelect_TextProjector2d)::DownCast(aPrj)).IsNull()) |
47 | { |
48 | gp_Pnt2d FirstP,LastP; |
49 | Handle(StdSelect_TextProjector2d)::DownCast(aPrj) |
50 | ->Convert(mytext,myxpos,myypos,FirstP,LastP,myfont); |
51 | myinitbox.Set(FirstP); |
52 | myinitbox.Add(LastP); |
53 | } |
54 | } |
55 | |
56 | void StdSelect_SensitiveText2d::Areas(SelectBasics_ListOfBox2d& aresult) |
57 | { |
58 | if(myangle==0.) aresult.Append(myinitbox); |
59 | else { |
60 | gp_Trsf2d T; T.SetRotation(gp_Pnt2d(myxpos,myypos),myangle); |
61 | aresult.Append(myinitbox.Transformed(T)); |
62 | } |
63 | } |
64 | |
65 | Standard_Boolean StdSelect_SensitiveText2d::Matches(const Standard_Real X, |
66 | const Standard_Real Y, |
67 | const Standard_Real aTol, |
68 | Standard_Real& DMin) |
69 | { |
70 | return Standard_True; |
71 | } |
72 | |
73 | Standard_Boolean StdSelect_SensitiveText2d::Matches |
74 | (const Standard_Real XMin, |
75 | const Standard_Real YMin, |
76 | const Standard_Real XMax, |
77 | const Standard_Real YMax, |
78 | const Standard_Real aTol) { |
79 | |
80 | return Standard_True; |
81 | |
82 | } |
83 | |
84 | Standard_Boolean StdSelect_SensitiveText2d::Matches |
85 | (const TColgp_Array1OfPnt2d& aPoly, |
86 | const Bnd_Box2d& aBox, |
87 | const Standard_Real aTol) { |
88 | |
89 | return Standard_True; |
90 | |
91 | } |