1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                          Ada Modeling Framework                          --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com>                     --
12-- All rights reserved.                                                     --
13--                                                                          --
14-- Redistribution and use in source and binary forms, with or without       --
15-- modification, are permitted provided that the following conditions       --
16-- are met:                                                                 --
17--                                                                          --
18--  * Redistributions of source code must retain the above copyright        --
19--    notice, this list of conditions and the following disclaimer.         --
20--                                                                          --
21--  * Redistributions in binary form must reproduce the above copyright     --
22--    notice, this list of conditions and the following disclaimer in the   --
23--    documentation and/or other materials provided with the distribution.  --
24--                                                                          --
25--  * Neither the name of the Vadim Godunko, IE nor the names of its        --
26--    contributors may be used to endorse or promote products derived from  --
27--    this software without specific prior written permission.              --
28--                                                                          --
29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      --
30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT        --
31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    --
32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT     --
33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   --
34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR   --
36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF   --
37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     --
38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS       --
39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.             --
40--                                                                          --
41------------------------------------------------------------------------------
42--  $Revision: 3432 $ $Date: 2012-11-14 00:51:21 +0400 (Wed, 14 Nov 2012) $
43------------------------------------------------------------------------------
44with AMF.Elements;
45with AMF.Internals.Helpers;
46with AMF.Internals.Tables.UML_Attributes;
47with AMF.Visitors.UMLDI_Iterators;
48with AMF.Visitors.UMLDI_Visitors;
49
50package body AMF.Internals.UMLDI_UML_Shapes is
51
52   -----------------
53   -- Get_Is_Icon --
54   -----------------
55
56   overriding function Get_Is_Icon
57    (Self : not null access constant UMLDI_UML_Shape_Proxy)
58       return Boolean is
59   begin
60      return
61        AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Icon
62         (Self.Element);
63   end Get_Is_Icon;
64
65   -----------------
66   -- Set_Is_Icon --
67   -----------------
68
69   overriding procedure Set_Is_Icon
70    (Self : not null access UMLDI_UML_Shape_Proxy;
71     To   : Boolean) is
72   begin
73      AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Icon
74       (Self.Element, To);
75   end Set_Is_Icon;
76
77   ---------------------
78   -- Get_Local_Style --
79   ---------------------
80
81   overriding function Get_Local_Style
82    (Self : not null access constant UMLDI_UML_Shape_Proxy)
83       return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access is
84   begin
85      return
86        AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access
87         (AMF.Internals.Helpers.To_Element
88           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
89             (Self.Element)));
90   end Get_Local_Style;
91
92   ---------------------
93   -- Set_Local_Style --
94   ---------------------
95
96   overriding procedure Set_Local_Style
97    (Self : not null access UMLDI_UML_Shape_Proxy;
98     To   : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access) is
99   begin
100      AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
101       (Self.Element,
102        AMF.Internals.Helpers.To_Element
103         (AMF.Elements.Element_Access (To)));
104   end Set_Local_Style;
105
106   -----------------------
107   -- Get_Model_Element --
108   -----------------------
109
110   overriding function Get_Model_Element
111    (Self : not null access constant UMLDI_UML_Shape_Proxy)
112       return AMF.UML.Elements.Collections.Set_Of_UML_Element is
113   begin
114      raise Program_Error;
115      return X : AMF.UML.Elements.Collections.Set_Of_UML_Element;
116--      return
117--        AMF.UML.Elements.Collections.Wrap
118--         (AMF.Internals.Element_Collections.Wrap
119--           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
120--             (Self.Element)));
121   end Get_Model_Element;
122
123   -----------------------
124   -- Get_Model_Element --
125   -----------------------
126
127   overriding function Get_Model_Element
128    (Self : not null access constant UMLDI_UML_Shape_Proxy)
129       return AMF.CMOF.Elements.CMOF_Element_Access is
130   begin
131      return
132        AMF.CMOF.Elements.CMOF_Element_Access
133         (AMF.Internals.Helpers.To_Element
134           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
135             (Self.Element)));
136   end Get_Model_Element;
137
138   ---------------------
139   -- Get_Local_Style --
140   ---------------------
141
142   overriding function Get_Local_Style
143    (Self : not null access constant UMLDI_UML_Shape_Proxy)
144       return AMF.DI.Styles.DI_Style_Access is
145   begin
146      return
147        AMF.DI.Styles.DI_Style_Access
148         (AMF.Internals.Helpers.To_Element
149           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
150             (Self.Element)));
151   end Get_Local_Style;
152
153   ---------------------
154   -- Set_Local_Style --
155   ---------------------
156
157   overriding procedure Set_Local_Style
158    (Self : not null access UMLDI_UML_Shape_Proxy;
159     To   : AMF.DI.Styles.DI_Style_Access) is
160   begin
161      AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
162       (Self.Element,
163        AMF.Internals.Helpers.To_Element
164         (AMF.Elements.Element_Access (To)));
165   end Set_Local_Style;
166
167   ----------------
168   -- Get_Bounds --
169   ----------------
170
171   overriding function Get_Bounds
172    (Self : not null access constant UMLDI_UML_Shape_Proxy)
173       return AMF.DC.Optional_DC_Bounds is
174   begin
175      return
176        AMF.Internals.Tables.UML_Attributes.Internal_Get_Bounds
177         (Self.Element);
178   end Get_Bounds;
179
180   ----------------
181   -- Set_Bounds --
182   ----------------
183
184   overriding procedure Set_Bounds
185    (Self : not null access UMLDI_UML_Shape_Proxy;
186     To   : AMF.DC.Optional_DC_Bounds) is
187   begin
188      AMF.Internals.Tables.UML_Attributes.Internal_Set_Bounds
189       (Self.Element, To);
190   end Set_Bounds;
191
192   -------------------
193   -- Enter_Element --
194   -------------------
195
196   overriding procedure Enter_Element
197    (Self    : not null access constant UMLDI_UML_Shape_Proxy;
198     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
199     Control : in out AMF.Visitors.Traverse_Control) is
200   begin
201      if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
202         AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
203          (Visitor).Enter_UML_Shape
204            (AMF.UMLDI.UML_Shapes.UMLDI_UML_Shape_Access (Self),
205           Control);
206      end if;
207   end Enter_Element;
208
209   -------------------
210   -- Leave_Element --
211   -------------------
212
213   overriding procedure Leave_Element
214    (Self    : not null access constant UMLDI_UML_Shape_Proxy;
215     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
216     Control : in out AMF.Visitors.Traverse_Control) is
217   begin
218      if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
219         AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
220          (Visitor).Leave_UML_Shape
221            (AMF.UMLDI.UML_Shapes.UMLDI_UML_Shape_Access (Self),
222           Control);
223      end if;
224   end Leave_Element;
225
226   -------------------
227   -- Visit_Element --
228   -------------------
229
230   overriding procedure Visit_Element
231    (Self     : not null access constant UMLDI_UML_Shape_Proxy;
232     Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
233     Visitor  : in out AMF.Visitors.Abstract_Visitor'Class;
234     Control  : in out AMF.Visitors.Traverse_Control) is
235   begin
236      if Iterator in AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class then
237         AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class
238          (Iterator).Visit_UML_Shape
239            (Visitor,
240             AMF.UMLDI.UML_Shapes.UMLDI_UML_Shape_Access (Self),
241           Control);
242      end if;
243   end Visit_Element;
244
245end AMF.Internals.UMLDI_UML_Shapes;
246