1 -- Created on: 1993-04-13
2 -- Created by: Gerard GRAS
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
24 class SetOfPolylines from Graphic2d inherits Line from Graphic2d
28 ---Purpose: The primitive SetOfPolylines
29 -- Warning: This primitive must be use as possible for to insure
30 -- that the sets is drawn correctly when the line type or
31 -- line width attrib is not SOLID and 1 pixel for the set.
32 -- NOTE: than the method PickedIndex() permits to known
33 -- the last picked polyline and segment in the set.
37 Drawer from Graphic2d,
38 GraphicObject from Graphic2d,
40 SequenceOfPolyline from Graphic2d,
47 OutOfRange from Standard
50 -------------------------
51 -- Category: Constructors
52 -------------------------
54 Create (aGraphicObject: GraphicObject from Graphic2d)
55 returns mutable SetOfPolylines from Graphic2d;
57 ---Purpose: Creates an empty set of polylines in the graphic
58 -- object <aGraphicObject>.
59 ---Category: Constructors
61 Add(me : mutable; X, Y: Length from Quantity;
62 NewPolyline: Boolean from Standard = Standard_False);
64 ---Purpose: Add a point in the current polyline of the set
65 -- or creates a new one when <NewPolyline> flag is TRUE.
66 ---Category: Update method
68 Add(me : mutable; X1, Y1, X2, Y2: Length from Quantity);
70 ---Purpose: Add a segment in the set to one of polyline
71 -- which has the last point identical to one of the segment
72 -- or creates a new polyline in the sets with the 2 segment points.
73 -- The first point is <X1>, <Y1>.
74 -- The second point is <X2>, <Y2>.
75 ---Category: Update method
77 Length(me) returns Integer from Standard;
79 ---Purpose: Returns the number of polylines in the set.
80 ---Category: Inquiry method
82 Length(me; aPrank: Integer from Standard)
83 returns Integer from Standard
85 ---Purpose: Returns the number of points of the polylines
87 -- Trigger: Raises OutOfRange if <aPrank> is <1 or >Length()
88 raises OutOfRange from Standard;
89 ---Category: Inquiry method
91 Values( me; aPrank : Integer from Standard;
92 aVrank : Integer from Standard;
93 X,Y : out Length from Quantity)
95 ---Purpose: Returns the point of rank <aVrank>
96 -- from the polyline of rank <aPrank>.
97 -- Trigger: Raises OutOfRange if <aPrank> is <1 or >Length()
98 -- or if <aVrank> is <1 or >Length(<aPrank>)
99 raises OutOfRange from Standard;
100 ---Category: Inquiry method
102 --------------------------
103 -- Category: Draw and Pick
104 --------------------------
106 Draw (me : mutable; aDrawer: Drawer from Graphic2d)
109 ---Purpose: Draws the set of polylines <me>.
111 Pick (me : mutable; X, Y: ShortReal from Standard;
112 aPrecision: ShortReal from Standard;
113 aDrawer: Drawer from Graphic2d)
114 returns Boolean from Standard
117 ---Purpose: Returns Standard_True if one point of the set <me>
118 -- is picked, Standard_False if not.
119 -- Warning: The PickIndex() method returns the rank of the picked
120 -- polyline point if any under the format :
121 -- (<aPrank> << 16) | <aVrank>.
123 ----------------------------------------------------------------------
125 Save( me; aFStream: in out FStream from Aspect ) is virtual;
126 -- Retrieve( me; aIFStream: in out IFStream from AIS2D ) is virtual;
129 myPolylines: SequenceOfPolyline from Graphic2d;
131 end SetOfPolylines from Graphic2d;