a new arrow type for pstricks connector?

Denis Girou Denis.Girou at idris.fr
Mon Feb 23 17:28:23 CET 1998


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

>>>>> "Maurice.Diamantini" == Maurice DIAMANTINI <diam at ensta.fr> writes:

    Maurice.Diamantini> I'd like to use pstrick for the UML Object Modeling Langage notation.

    Maurice.Diamantini> So I have to draw some new end of connections like :
    Maurice.Diamantini> - an empty triangle  (heritage) : this look like a standard arrow,
    Maurice.Diamantini> - an empty diamond (aggregation by reference),
    Maurice.Diamantini> - a full black diamond (aggregation by value),

    Maurice.Diamantini> ..................................................

    Maurice.Diamantini> - is there a way to extend the array type of connector
    Maurice.Diamantini>    perhaps as "x-x"  which could say :
    Maurice.Diamantini>    "use special arrows as defined by some special command like pstDrawAnArrow"

  According to the way PSTricks manage arrows, you may built new ones defining
\psas at NewArrow macros (\psas@ is the required name prefix - more precisely
you have to define \@namedef{psas at NewArrow}{...}).

  You must define both the TeX and PostScript parts. I already show some
months ago how to define the ]-[ arrows, defining both the TeX \psas@[ macro
and the PostScript BracketOut one). Nevertheless, this case is rather easy,
as it is written strongly following the code of the Bracket macro.

  But what is also interesting is that we can built new arrows using the
defined dots (of course look at the "beta" documentation, which strongly
extend the original dots). We can't used directly the definitions of them,
as we must change some values to define correctly the point of connection
(I don't know exactly where the values of the dot definitions come from
- probably from the fonts - but they define the size and center position
of the dots, and we can found relevant values by attempts and errors...)

  I give you here an example of how to define the "d" and "d*" arrows, for
diamond and black diamond. I hope that with this example you and the other
interested persons will be able to write a little package for all this
language notation...


  P.S * For special characters, you may have to extend the table
\pst at arrowtable (see the ]-[ case).

      * If you look at the code, you will see that there are undocumented dot
variants (the various B... ones, for Bold variations).

      * I'm convainced that there is dead code for dots definition (between
the lines "\def\tx at SQ{SQ }" and "\pst at gdot{0 DS moveto 0 DS neg L stroke}}"
(and corresponding ones in pstricks.pro), coming from the 0.93 version and
obsolete with beta macros (and of course 97 version). I leave these lines only
by care... Dot type definitions now use the \newpsfontdot and \newpsfontdotH
macros.


\documentclass{article}

\usepackage{pstricks}

\pagestyle{empty}

\begin{document}

% Definition of new arrows "diamond" and "diamond*" (d and d*)
% using adapted dot definitions
\makeatletter
\newpsfontdot{ArrowDiamond}%
[1.9 0.0 0.0 1.9 0.1 -0.70775]{Symbol}{<E0>}
\newpsfontdot{ArrowDiamond*}%
[2.3 0.0 0.0 2.3 0.38 -0.6]{Symbol}{<A8>}
\@namedef{psas at d}{\psk at dotsize \psds at ArrowDiamond 90 rotate 0 0 Dot}
\@namedef{psas at d*}{\psk at dotsize \@nameuse{psds at ArrowDiamond*} 90 rotate 0 0 Dot}
\makeatother

\begin{pspicture}(4,4)
  \psline[arrowscale=2]{d-d}(0,4)(4,4)
  \psline[arrowscale=4]{d-d*}(0,2)(4,2)
  \psline[arrowscale=10]{d->}(4,0)
\end{pspicture}

\begin{pspicture}(3,5)
  \psset{arrowscale=3,arrows=d-d}
  \psline(3,3)
  \psarc(0,0){2}{0}{90}
  \psarc[arrowsize=2mm]{d*-d*}(1,1){2}{20}{70}
\end{pspicture}

% Definition of new arrows ]-[ (both TeX and PostScript code)
\makeatletter
\edef\pst at arrowtable{\pst at arrowtable,]-[}
\def\tx at BracketOut{BracketOut }
\@namedef{psas@[}{%
/BracketOut { CLW mul add dup CLW sub 2 div /x ED mul CLW 1.75 mul sub
/y ED /z CLW 2 div def x neg y moveto x neg CLW 2 div L x CLW 2 div
L x y L stroke 0 CLW moveto } def
\psk at bracketlength \psk at tbarsize \tx at BracketOut}
\makeatother

\begin{pspicture}(3,5)
  \psset{arrowscale=3,arrows=]-[}
  \psline(3,3)
  \psarc(0,0){2}{0}{90}
  \psarc(1,1){2}{20}{70}
\end{pspicture}

\end{document}

D.G.

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list