Le 22 oct. 04, � 14:24, Eckhart Guth�hrlein a �crit :

You can attach named paths to objects and then labels these. Here is my
first try, seems to work:

Thank very much Eckhart, I read the metaObj manual, but I didn't realised showing that one can attached a labelObj to arbitrary objects (just for Matrix and trees).

Now it works !
It is my first Metapost figure (I am switching
from pstricks).
As graph (in the sens nodes + arcs, not curve functions)
will be frequentjy used (at least by me).

I am thinking about some highlevel  class (using MetaObj)
- class Node for creating node
- class Arc for connecting nodes.
The goal is that the data (coordinate, various labels, ...)
will be as simple as possible.
Also it should be easy to pick the Node and Arc class,
and personnalide them gor its own graph.

For now, I'm trying to anderstand how the label options
works,
A new problem is that the label sep is to big from thes arcs, and
I'm not able to ajust it. The "labshift" option doesn't seem
to work with ncarc, althought it works for the nodes.


P.S. is one of the Metapost lists still alive?


Here is the full exemple (with only 2 nodes) I don use the inline context feature because it doesnt work for me, and I have to work on several workstation, so I still stay (for now) with the indenpendent file I'm sorry for the "latex" line on a context list, but Metafun is not clean installed (texlive 2003), I wanting for the next texlive... And I hope context will be install by default with Metafun .

Thank you very much.

-- Maurice Diamantini,

verbatimtex   % -*-latex-*-
    %&latex
    \documentclass{article}
    \usepackage[latin1]{inputenc}
    \begin{document}
    \sffamily
etex

input mp-tool ; % some initializations and auxiliary macros
input mp-spec ; % macros that support special features
input metaobj.mp ; % suffixe non indispensable ?

beginfig(1) ;

    % For now node positions will be hardcoded
    numeric u; u=1cm;
    z0=(0u,2u);
    z1=(3u,4u);
    % % verbatimtex \small etex;

setCurveDefaultOption("arcangle", 25);
%
% building nodes of the graph. Nodes are object that arc will be able to
% refere to.
% Later, I will have to build my own Class "Activity" with some other
% parameters (labels above and under the circle, ...)
%
newCircle.n0(btex \large 0 etex) "circmargin(0.1u)";
ObjLabel.n0(btex b0 etex) "labshift((0, -.5u))";
ObjLabel.n0(btex u0 etex) "labshift((0, .5u))";
n0.c = z0;


    newCircle.n1(btex  \large 1 etex) "circmargin(0.1u)";
    ObjLabel.n1(btex b1 etex)  "labshift((0, -.5u))";
    ObjLabel.n1(btex u1 etex)  "labshift((0, .5u))";
    n1.c = z1;

    %
    % build some Arcs, with various label or other parameters
    % I'll have to make some vardef fonction for that.
    % For now, all arcs related stuffs are in th esame place
    %
    % - Howto reduce the label separation ? ("labshift" doen't work)

    ncarc.n0(n0)(n1)  "name(n0_n1)";
    ObjLabel.n0(btex $\times$ etex) "labpathname(n0_n1)",
                                    "labpos(0.8)";
    ObjLabel.n0(btex $0\rightarrow 1$ etex)
                            "labpathname(n0_n1)",
                            "labpos(0.8)",
                            "labangle(0)",
                            "labshift((0, -0.5u))",
                            "labdir(bot)" ;


ncarc.n1(n1)(n0) "name(n1_n0)";

    ObjLabel.n1(btex $\times$ etex) "labpathname(n1_n0)",
                                    "labpos(0.8)";
    ObjLabel.n1(btex $1\rightarrow 0$ etex)
                            "labpathname(n1_n0)",
                            "labpos(0.8)",
                            "labangle(180)",
                            "labdir(top)" ;

    drawObj(n0, n1);

endfig ;
end .


_______________________________________________ ntg-context mailing list [EMAIL PROTECTED] http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to