|
From: Ethan M. <merritt@u.washington.edu> - 2005-02-18 17:54:26
|
[I'm moving discussion to the mailing list]
Recent SourceForge Patch #1143563
Initial Comment:
Here is a good start at a new plot element with a
number of uses. The basic syntax is
set rectangle <id> from <position> to <position>
{front|back} {rectcolor <colorspec>}
{fillstyle <fillstyle>}
The rectcolor and fillstyle are optional for any
particular rectangle; if you don't give them it will
inherit defaults from a general setting controlled by
set style rectangle {rectcolor <colorspec>}
{fs <fillstyle>}
The from/to positions specify diagonal corners of the
rectangle. They may of course be screen coords, graph
coords, or plot coords.
There is a simple demo file in the patchset, and "help
set rect" or "help set style rect" should get you started.
----------------------------------------------------------------------
>Comment By: Petr Mikulik (mikulik)
>Just my few first ideas:
>set rect ... {noborder | border} {lt | ls ...}
Those already work. They are part of the generic
<fillstyle> and <rectcolor> syntax.
>What about, rather for a future
>set shape rect ....
>set object rect ...
>if we want hexagons, circles, ...?
I originally hoped to implement this without using the
pm3d polygon routines, which meant limiting it to rectangles.
But I ended up using pm3d routines heavily so yes, extending
it to other polygons would not be difficult.
It would be easy to modify the syntax to
set polygon from <xy0> to <xy1> to <xy2> ...
for an arbitrary number of vertices. The only real change
needed is to allocate the vertices dynamically rather than
simply reserved space for the 2 corners of a rectangle.
>Could the rectangle be rotated?
Not using code that's already in place.
What would you expect to happen if you rotate a polygon
whose vertices are specified in screen or graph coordinates?
> Could it support not only "from ... to", but also "at ... size" and maybe
> "{center|left|right}" -- that would to accommodate labels.
If you limit it to rectangles, then one could have
set rect at <coords> width <x> height <y> {center}
Something similar would work for regular polygons (square, pentagon, n-gon).
But it's not obvious how to extend this to a general polygon specified
by its vertices.
> Are rect drawn before labels?
They are supposed to be, but I see there's a bug if the setting is "front".
> Could the above-mentioned size be given as "stringwidth"?
> Then we could give "size" in the "character" units.
Very few drivers can pass back enough information to do this in the
core code.
I was thinking instead that a future bit of work could implement
set label "foo" ... {box|nobox}
That way drivers (PostScript, gd, pdf) with an internal notion of
textbox size could just stroke the textbox after writing the label text.
The enhanced text code *tries* to keep this information in a generic way,
but it does an imperfect job.
--
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center
Mailstop 357742
University of Washington, Seattle, WA 98195
|