Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 5e1854624d3bc613bdd0dd13d1ef9ac7 > files > 3454

gap-system-4.4.12-5mdv2010.0.i586.rpm

<html><head><title>[xgap] 6.2 Graphic Objects in Sheets</title></head>
<body text="#000000" bgcolor="#ffffff">
[<a href = "C006S000.htm">Up</a>] [<a href ="C006S001.htm">Previous</a>] [<a href ="C006S003.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<h1>6.2 Graphic Objects in Sheets</h1><p>
<p>
All graphics within graphic sheets are so called graphic objects. They 
are <font face="Gill Sans,Helvetica,Arial">GAP</font> objects in the category <code>IsGraphicObject</code>. These objects are
linked internally to the actual graphics within the window. You can 
modify these objects via certain operations which leads to the
corresponding change of the real graphics on the screen. The types of
graphic objects supported in XGAP are: boxes, circles, discs, diamonds,
rectangles, lines, texts, vertices and connections. Vertices are compound
objects consisting of a circle, rectangle oder diamond with a short text
inside. They remember their connections to other vertices. That means
that if for example the position of a vertex is changed, the line which 
makes the connection to some other vertex is also changed automatically.
For every graphic object there is a constructor which has the same name 
as the graphic object (e.g. <code>Box</code> is the constructor for boxes).
<p>
<a name = "SSEC1"></a>
<li><code>IsGraphicObject( </code><var>gobj</var><code> ) C</code>
<p>
This is the category in which all graphic objects are.
<p>
<strong>Constructors:</strong>
<p>
<a name = "SSEC2"></a>
<li><code>Box( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code> ) O</code>
<li><code>Box( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
creates a new graphic object,  namely a filled black  box, in the graphic
sheet <var>sheet</var> and  returns a <font face="Gill Sans,Helvetica,Arial">GAP</font> record describing  this  object.  The
four   corners     of  the    box    are   <var>(<var>x</var>,<var>y</var>)</var>,  <var>(<var>x</var>+<var>w</var>,<var>y</var>)</var>,
<var>(<var>x</var>+<var>w</var>,<var>y</var>+<var>h</var>)</var>, and <var>(<var>x</var>,<var>y</var>+<var>h</var>)</var>.
<p>
Note that the box is <var><var>w</var>+1</var> pixel wide and <var><var>h</var>+1</var> pixels high.
<p>
If a record <var>defaults</var> is given and contains a component <code>color</code> of value
<var>color</var>, the  function works like the first version  of  <code>Box</code>, except 
that the color of the box will be <var>color</var>.  See <a href="C006S003.htm">Color Models</a> for how 
to select a <var>color</var>.
<p>
See <a href="C006S004.htm">operations for graphic objects</a> for a list of operations
that apply to boxes.
<p>
Note that <code>Reshape</code> for boxes takes three parameters, namely the box
object, the new width, and the new height of the box.
<p>
<a name = "SSEC3"></a>
<li><code>Circle( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>r</var><code> ) O</code>
<li><code>Circle( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>r</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
creates a new graphic object, namely a black circle, in the graphic sheet
<var>sheet</var> and returns a <font face="Gill Sans,Helvetica,Arial">GAP</font> record describing this object. The center
of the circle is <var>(<var>x</var>,<var>y</var>)</var> and the radius is <var><var>r</var></var>.
<p>
If a record <var>defaults</var> is given and contains a component <code>color</code> of value
<var>color</var>, the  function works like the first version  of  <code>Circle</code>, except 
that the color of the circle will be <var>color</var>.  See <a href="C006S003.htm">Color Models</a> for how 
to select a <var>color</var>. If the record contains a component <code>width</code> of value
<var>width</var>, the line width of the circle is set accordingly.
<p>
See <a href="C006S004.htm">operations for graphic objects</a> for a list of operations
that apply to circles.
<p>
Note that <code>Reshape</code> for circles takes two parameters, namely the circle
object, and the new radius of the circle.
<p>
<a name = "SSEC4"></a>
<li><code>Disc( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>r</var><code> ) O</code>
<li><code>Disc( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>r</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
creates a new graphic object, namely a disc (a black filled circle), 
in the graphic sheet
<var>sheet</var> and returns a <font face="Gill Sans,Helvetica,Arial">GAP</font> record describing this object. The center
of the disc is <var>(<var>x</var>,<var>y</var>)</var> and the radius is <var><var>r</var></var>.
<p>
If a record <var>defaults</var> is given and contains a component <code>color</code> of value
<var>color</var>, the  function works like the first version  of  <code>Disc</code>, except 
that the color of the disc will be <var>color</var>.  See <a href="C006S003.htm">Color Models</a> for how 
to select a <var>color</var>. 
<p>
See <a href="C006S004.htm">operations for graphic objects</a> for a list of operations
that apply to discs.
<p>
Note that <code>Reshape</code> for discs takes two parameters, namely the disc
object, and the new radius.
<p>
<a name = "SSEC5"></a>
<li><code>Diamond( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code> ) O</code>
<li><code>Diamond( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
creates a new graphic object, namely a black diamond, in the graphic sheet
<var>sheet</var> and returns a <font face="Gill Sans,Helvetica,Arial">GAP</font> record describing this object. The left
corner of the diamond is <var>(<var>x</var>,<var>y</var>)</var>, the others are <var>(<var>x</var>+<var>w</var>,<var>y</var>-<var>h</var>)</var>,
<var>(<var>x</var>+<var>w</var>,<var>y</var>+<var>h</var>)</var>, and <var>(<var>x</var>+2<var>w</var>,<var>y</var>)</var>.
<p>
If a record <var>defaults</var> is given and contains a component <code>color</code> of value
<var>color</var>, the  function works like the first version  of  <code>Diamond</code>, except 
that the color of the diamond will be <var>color</var>.  See <a href="C006S003.htm">Color Models</a> for how 
to select a <var>color</var>. If the record contains a component <code>width</code> with 
integer value <var>width</var>, the line width is set accordingly.
<p>
See <a href="C006S004.htm">operations for graphic objects</a> for a list of operations
that apply to diamonds.
<p>
Note that <code>Reshape</code> for diamonds takes three parameters, namely the diamond
object, and the new <var>width</var> and <var>height</var> values.
<p>
<a name = "SSEC6"></a>
<li><code>Rectangle( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code> ) O</code>
<li><code>Rectangle( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
creates a new graphic object,  namely a black  rectangle, in the graphic
sheet <var>sheet</var> and  returns a <font face="Gill Sans,Helvetica,Arial">GAP</font> record describing  this  object.  The
four   corners     of  the    box    are   <var>(<var>x</var>,<var>y</var>)</var>,  <var>(<var>x</var>+<var>w</var>,<var>y</var>)</var>,
<var>(<var>x</var>+<var>w</var>,<var>y</var>+<var>h</var>)</var>, and <var>(<var>x</var>,<var>y</var>+<var>h</var>)</var>.
<p>
Note that the rectangle is <var><var>w</var>+1</var> pixel wide and <var><var>h</var>+1</var> pixels high.
<p>
If a record <var>defaults</var> is given and contains a component <code>color</code> of value
<var>color</var>, the  function works like the first version  of  <code>Rectangle</code>, 
except 
that the color of the rectangle will be <var>color</var>.  See <a href="C006S003.htm">Color Models</a> for 
how 
to select a <var>color</var>. If the record contains a component <code>width</code> with 
integer value <var>width</var>, the line width is set accordingly.
<p>
See <a href="C006S004.htm">operations for graphic objects</a> for a list of operations
that apply to rectangles.
<p>
Note that <code>Reshape</code> for rectangles takes three parameters, namely the 
rectangle object, and the new <var>width</var> and <var>height</var> values.
<p>
<a name = "SSEC7"></a>
<li><code>Line( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code> ) O</code>
<li><code>Line( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>w</var><code>, </code><var>h</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
creates a new graphic object,  namely a black  line, in the graphic
sheet <var>sheet</var> and  returns a <font face="Gill Sans,Helvetica,Arial">GAP</font> record describing  this  object.  The
line has the end points <var>(<var>x</var>,<var>y</var>)</var> and <var>(<var>x</var>+<var>w</var>,<var>y</var>+<var>h</var>)</var>.
<p>
If a record <var>defaults</var> is given and contains a component <code>color</code> of value
<var>color</var>, the  function works like the first version  of  <code>Line</code>, except 
that the color of the line will be <var>color</var>.  See <a href="C006S003.htm">Color Models</a> for how 
to select a <var>color</var>. If the record contains a component <code>width</code> with 
integer value <var>width</var>, the line width is set accordingly. If the record
contains a component <code>label</code> with a string value <var>label</var>, a text object
is attached as a label to the line.
<p>
See <a href="C006S004.htm">operations for graphic objects</a> for a list of operations
that apply to lines.
<p>
Note that <code>Reshape</code> for lines takes three parameters, namely the 
line object, and the new <var>w</var> and <var>h</var> value. <code>Change</code> for
lines in contrast takes five parameters, namely the line object and all 
four coordinates like in the original call.
<p>
<a name = "SSEC8"></a>
<li><code>Text( </code><var>sheet</var><code>, </code><var>font</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>str</var><code> ) O</code>
<li><code>Text( </code><var>sheet</var><code>, </code><var>font</var><code>, </code><var>x</var><code>, </code><var>y</var><code>, </code><var>str</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
creates a new graphic object, namely the string <var>str</var> as a black text,
in the graphic sheet <var>sheet</var> and returns a <font face="Gill Sans,Helvetica,Arial">GAP</font> record describing
this object.  The text has the baseline of the first character at
<var>(x,y)</var>.
<p>
If a record <var>defaults</var> is given and contains a component <code>color</code> of value
<var>color</var>, the  function works like the first version  of  <code>Text</code>, except 
that the color of the text will be <var>color</var>.  See <a href="C006S003.htm">Color Models</a> for how 
to select a <var>color</var>. 
<p>
See <a href="C006S004.htm">operations for graphic objects</a> for a list of operations
that apply to texts.
<p>
Note that <code>Reshape</code> for texts takes two parameters, namely the 
text object, and the new font. Use <code>Relabel</code> to change the string of the
text.
<p>
<strong>Operations for graphic objects:</strong>
<p>
<a name = "SSEC9"></a>
<li><code>Connection( </code><var>vertex</var><code>, </code><var>vertex</var><code> ) O</code>
<li><code>Connection( </code><var>vertex</var><code>, </code><var>vertex</var><code>, </code><var>defaults</var><code> ) O</code>
<p>
Connects two vertices with a line.
The second variation can get a <var>defaults</var> record for the actual line. The
same entries as in the <var>defaults</var> record for lines are allowed.
<p>
<a name = "SSEC10"></a>
<li><code>Disconnect( </code><var>vertex</var><code>, </code><var>vertex</var><code> ) O</code>
<p>
Deletes connection between two vertices.
<p>
<a name = "SSEC11"></a>
<li><code>Draw( </code><var>object</var><code> ) O</code>
<p>
This operation (re-)draws a graphic object on the screen. You normally
do not need to call this yourself. But in some rare cases of object
overlaps you could find it useful.
<p>
<a name = "SSEC12"></a>
<li><code>Delete( </code><var>sheet</var><code>, </code><var>object</var><code> ) O</code>
<li><code>Delete( </code><var>object</var><code> ) O</code>
<p>
Deletes a graphic object. Calls <code>Destroy</code> first, so the graphic object
is no more <var>alive</var> afterwards. The object is deleted from the list of
objects in its graphic sheet. There is no way to reactivate such an
object afterwards.
<p>
<a name = "SSEC13"></a>
<li><code>Destroy( </code><var>object</var><code> ) O</code>
<p>
Destroys a graphic object. It disappears from the screen and will not be 
<var>alive</var> any more after this call.
Note that <var>object</var> is <strong>not</strong> deleted from the list of objects in its
graphic sheet <var>sheet</var>.  
This makes it possible to <code>Revive</code> it again.
In order to delete <var>object</var> from <var>sheet</var>,
use <code>Delete( </code><var>sheet</var><code>, </code><var>obj</var><code> )</code>, which calls <code>Destroy</code> for <var>obj</var>.
<p>
<a name = "SSEC14"></a>
<li><code>Revive( </code><var>object</var><code> ) O</code>
<p>
Note that <var>object</var> must be in the list of objects in its graphic sheet!
So this is only possible for <code>Destroyed</code>, not
for <code>Deleted</code> graphic objects.
<p>
<a name = "SSEC15"></a>
<li><code>Move( </code><var>object</var><code>, </code><var>x</var><code>, </code><var>y</var><code> ) O</code>
<p>
Changes the position of a graphic object absolutely. It must be <var>alive</var>
and will be moved at once on the screen.
<p>
<a name = "SSEC16"></a>
<li><code>MoveDelta( </code><var>object</var><code>, </code><var>dx</var><code>, </code><var>dy</var><code> ) O</code>
<p>
Changes the position of a graphic object relatively. It must be <var>alive</var>
and will be moved at once on the screen.
<p>
<a name = "SSEC17"></a>
<li><code>PSString( </code><var>object</var><code> ) O</code>
<p>
Creates a postscript string which describes the graphic object. Normally
you do not need to call this because it is only used internally if the
user exports the whole graphic sheet to encapsulated postscript.
<p>
<a name = "SSEC18"></a>
<li><code>PrintInfo( </code><var>object</var><code> ) O</code>
<p>
This operation prints debugging info about a graphic object.
<p>
<a name = "SSEC19"></a>
<li><code>Recolor( </code><var>object</var><code>, </code><var>col</var><code> ) O</code>
<p>
Changes the color of a graphic object. See <a href="C006S003.htm">Color Models</a> for how 
to select a <var>color</var>. 
<p>
<a name = "SSEC20"></a>
<li><code>Reshape( </code><var>object</var><code>, ... ) O</code>
<p>
Changes the shape of a graphic object. The parameters depend on the type
of the object. See the descriptions of the constructors for the actual
usage.
<p>
<a name = "SSEC21"></a>
<li><code>\in</code>
<p>
This infix operation needs a vector of two integers to its left and a graphic
object to its right (``vector of two integers'' means a list of two
integers e.g. <code>[15,9]</code>). It determines, if the position given by the two
integer coordinates is inside (e.g. for boxes) or on (e.g. for lines) the
graphic objects. Returns a boolean value.
<a name = "SSEC22"></a>
<li><code>Change( </code><var>object</var><code>, ... ) O</code>
<p>
Changes the shape of a graphic object. The parameters depend on the type
of the object. See the descriptions of the constructors for the actual
usage.
<p>
<a name = "SSEC23"></a>
<li><code>Relabel( </code><var>object</var><code>, </code><var>str</var><code> ) O</code>
<p>
Changes the label of a graphic object. The second argument must always
be a string.
<p>
<a name = "SSEC24"></a>
<li><code>SetWidth( </code><var>object</var><code>, </code><var>w</var><code> ) O</code>
<p>
Changes the line width of the graphic object. The line width <var>w</var> must be
a relatively small integer.
<p>
<a name = "SSEC25"></a>
<li><code>Highlight( </code><var>vertex</var><code> ) O</code>
<li><code>Highlight( </code><var>vertex</var><code>, </code><var>flag</var><code> ) O</code>
<p>
In the first form this operation switches the highlighting status of a
vertex to ON. In the second form the <var>flag</var> decides about ON or OFF.
Highlighting normally means a thicker line width and a change in color.
<p>
<p>
[<a href = "C006S000.htm">Up</a>] [<a href ="C006S001.htm">Previous</a>] [<a href ="C006S003.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<P>
<address>xgap manual<br>Mai 2003
</address></body></html>