summaryrefslogtreecommitdiff
path: root/src/Graphic2d/Graphic2d_Circle.cdl
blob: 30411a002fe07a35fc166e8f6eea3a9cd862b549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

-- File:	Graphic2d_Circle.cdl
-- Created:	Tue Jun 22 16:36:51 1993
-- Author:	Jean Louis FRENKEL, Gerard GRAS
--		<jlf@stylox>
-- Modified: TCL G002, 07-08-00, new inquire methods Center, Radius, FirstAngle, SecondAngle
--                               new methods SetRadius, SetCenter, SetAngles

---Copyright:	 Matra Datavision 1993

class Circle from Graphic2d inherits Line from Graphic2d

	---Purpose: Constructs a primitive Circle

	
uses
	Drawer		from Graphic2d,
	GraphicObject	from Graphic2d,
	Length		from Quantity,
	PlaneAngle	from Quantity,
	FStream		from Aspect,
	IFStream	from Aspect

raises
	CircleDefinitionError	from Graphic2d

is
	-------------------------
	-- Category: Constructors
	-------------------------

	Create (aGraphicObject: GraphicObject from Graphic2d;
		X, Y: Length from Quantity;
		Radius: Length from Quantity)
	returns mutable Circle from Graphic2d
	---Level: Public
	---Purpose: Creates a complete circle.
	--	    The center is <X>, <Y>.
	--	    The radius is <Radius>.
	--  Warning: Raises CircleDefinitionError if the
	--          radius is null.
	raises CircleDefinitionError from Graphic2d;

	Create (aGraphicObject: GraphicObject from Graphic2d;
		X, Y: Length from Quantity;
		Radius: Length from Quantity;
		Alpha, Beta: PlaneAngle from Quantity)
	returns mutable Circle from Graphic2d
	---Level: Public
	---Purpose: Creates an arc.
	--	    The center is <X>, <Y>.
	--	    The radius is <Radius>.
	--	    Angles are measured counterclockwise with 0 radian
	--	    at 3 o'clock.
	--  Warning: Raises CircleDefinitionError if the
	--          radius is null.
	raises CircleDefinitionError from Graphic2d;

	----------------------------
	-- Category: Inquire methods
	----------------------------

	Center( me; X, Y: out Length from Quantity );  
	---Level: Public
	---Purpose: returns the coordinates of center of the circle
	
	Radius( me ) returns Length from Quantity;
	---Level: Public
	---Purpose: returns the radius of this circle
	
	FirstAngle( me ) returns PlaneAngle from Quantity;
	---Level: Public
	---Purpose: returns the first angle of the arc
	
	SecondAngle( me ) returns PlaneAngle from Quantity;
	---Level: Public
	---Purpose: returns the second angle of the arc
	

	--------------------------------------------------------
	-- Category: Methods for the definition of the circle's properties
	--------------------------------------------------------

	SetCenter( me: mutable; X, Y: Length from Quantity );  
	---Level: Public
	---Purpose: defines the coordinates of center of the circle
	
	SetRadius( me: mutable; theR: Length from Quantity );
	---Level: Public
	---Purpose: defines the radius of this circle
	
	SetAngles( me: mutable; Alpha, Beta: PlaneAngle from Quantity );
	---Level: Public
	---Purpose: defines the angles of the arc

	--------------------------
	-- Category: Draw and Pick
	--------------------------

	Draw (me : mutable; aDrawer: Drawer from Graphic2d)
	is static protected;
	---Level: Internal
	---Purpose: Draws the circle <me>.

	DrawElement( me : mutable; aDrawer: Drawer from Graphic2d;
		 anIndex: Integer from Standard)
	is redefined protected;
	---Level: Internal
	---Purpose: Draws element <anIndex> of the circle <me>.

	DrawVertex( me : mutable; aDrawer: Drawer from Graphic2d;
		anIndex: Integer from Standard)
	is redefined protected;
	---Level: Internal
	---Purpose: Draws vertex <anIndex> of the circle <me>.

	Pick (me : mutable; X, Y: ShortReal from Standard;
		aPrecision: ShortReal from Standard;
		aDrawer: Drawer from Graphic2d)
	returns Boolean from Standard is static protected;
	---Level: Internal
	---Purpose: Returns Standard_True if the circle <me> is picked,
	--	    Standard_False if not.

	DoMinMax( me: mutable ) is private;

	----------------------------------------------------------------------

	Save( me; aFStream: in out FStream from Aspect ) is virtual;
	Retrieve( myclass; anIFStream: in out IFStream from Aspect;
		aGraphicObject: GraphicObject from Graphic2d );

fields

	myX:		ShortReal from Standard;
	myY:		ShortReal from Standard;
	myRadius:	ShortReal from Standard;
	myFirstAngle:	ShortReal from Standard;
	mySecondAngle:	ShortReal from Standard;
	myisArc:	Boolean from Standard;

end Circle from Graphic2d;