0032961: Coding - get rid of unused headers [IGESAppli to IGESToBRep]
[occt.git] / src / IGESDraw / IGESDraw_LabelDisplay.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <gp_Pnt.hxx>
20 #include <IGESDraw_LabelDisplay.hxx>
21 #include <IGESDraw_PerspectiveView.hxx>
22 #include <IGESDraw_View.hxx>
23 #include <Interface_Macros.hxx>
24 #include <Standard_DimensionMismatch.hxx>
25 #include <Standard_Type.hxx>
26
27 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_LabelDisplay,IGESData_LabelDisplayEntity)
28
29 IGESDraw_LabelDisplay::IGESDraw_LabelDisplay ()    {  }
30
31     void IGESDraw_LabelDisplay::Init
32   (const Handle(IGESDraw_HArray1OfViewKindEntity)& allViews,
33    const Handle(TColgp_HArray1OfXYZ)&              allTextLocations,
34    const Handle(IGESDimen_HArray1OfLeaderArrow)&   allLeaderEntities,
35    const Handle(TColStd_HArray1OfInteger)&         allLabelLevels,
36    const Handle(IGESData_HArray1OfIGESEntity)&     allDisplayedEntities)
37 {
38   Standard_Integer Ln  = allViews->Length();
39   if ( allViews->Lower()          != 1 ||
40       (allTextLocations->Lower()  != 1 || allTextLocations->Length()  != Ln) ||
41       (allLeaderEntities->Lower() != 1 || allLeaderEntities->Length() != Ln) ||
42       (allLabelLevels->Lower()    != 1 || allLabelLevels->Length()    != Ln) ||
43       (allDisplayedEntities->Lower() != 1 || allDisplayedEntities->Length() != Ln))
44     throw Standard_DimensionMismatch("IGESDraw_LabelDisplay : Init");
45
46   theViews             = allViews; 
47   theTextLocations     = allTextLocations; 
48   theLeaderEntities    = allLeaderEntities; 
49   theLabelLevels       = allLabelLevels; 
50   theDisplayedEntities = allDisplayedEntities; 
51   InitTypeAndForm(402,5);
52 }
53
54     Standard_Integer IGESDraw_LabelDisplay::NbLabels () const
55 {
56   return (theViews->Length());
57 }
58
59     Handle(IGESData_ViewKindEntity) IGESDraw_LabelDisplay::ViewItem
60   (const Standard_Integer ViewIndex) const
61 {
62   return (theViews->Value(ViewIndex));
63 }
64
65     gp_Pnt IGESDraw_LabelDisplay::TextLocation
66   (const Standard_Integer ViewIndex) const
67 {
68   return ( gp_Pnt (theTextLocations->Value(ViewIndex)) );
69 }
70
71     Handle(IGESDimen_LeaderArrow) IGESDraw_LabelDisplay::LeaderEntity
72   (const Standard_Integer ViewIndex) const
73 {
74   return (theLeaderEntities->Value(ViewIndex));
75 }
76
77     Standard_Integer IGESDraw_LabelDisplay::LabelLevel
78   (const Standard_Integer ViewIndex) const
79 {
80   return (theLabelLevels->Value(ViewIndex));
81 }
82
83     Handle(IGESData_IGESEntity) IGESDraw_LabelDisplay::DisplayedEntity
84   (const Standard_Integer EntityIndex) const
85 {
86   return (theDisplayedEntities->Value(EntityIndex));
87 }
88
89     gp_Pnt IGESDraw_LabelDisplay::TransformedTextLocation
90   (const Standard_Integer ViewIndex) const
91 {
92   gp_XYZ retXYZ;
93   gp_XYZ tempXYZ = theTextLocations->Value(ViewIndex);
94
95   Handle(IGESData_ViewKindEntity) tempView = theViews->Value(ViewIndex);
96   if (tempView->IsKind(STANDARD_TYPE(IGESDraw_View)))
97     {
98       DeclareAndCast(IGESDraw_View, thisView, tempView);
99       retXYZ = thisView->ModelToView( tempXYZ );
100     }
101   else if (tempView->IsKind(STANDARD_TYPE(IGESDraw_PerspectiveView)))
102     {
103       DeclareAndCast(IGESDraw_PerspectiveView, thisView, tempView);
104       retXYZ = thisView->ModelToView( tempXYZ );
105     }
106   return ( gp_Pnt(retXYZ) );
107 }