[Lemon-commits] [lemon_svn] alpar: r2482 - in hugo/trunk: doc/images lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:53:00 CET 2006
Author: alpar
Date: Thu Jan 26 07:43:59 2006
New Revision: 2482
Added:
hugo/trunk/doc/images/nodeshape_3.eps
hugo/trunk/doc/images/nodeshape_3.png (contents, props changed)
hugo/trunk/doc/images/nodeshape_4.eps
hugo/trunk/doc/images/nodeshape_4.png (contents, props changed)
Modified:
hugo/trunk/lemon/graph_to_eps.h
Log:
MALE and FEMALE node shape added.
Added: hugo/trunk/doc/images/nodeshape_3.eps
==============================================================================
--- (empty file)
+++ hugo/trunk/doc/images/nodeshape_3.eps Thu Jan 26 07:43:59 2006
@@ -0,0 +1,77 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: LEMON GraphToEps figure
+%%Creator: LEMON GraphToEps function
+%%BoundingBox: 0 0 256 372
+%%EndComments
+/lb { setlinewidth setrgbcolor newpath moveto
+ 4 2 roll 1 index 1 index curveto stroke } bind def
+/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
+/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
+/sq { newpath 2 index 1 index add 2 index 2 index add moveto
+ 2 index 1 index sub 2 index 2 index add lineto
+ 2 index 1 index sub 2 index 2 index sub lineto
+ 2 index 1 index add 2 index 2 index sub lineto
+ closepath pop pop pop} bind def
+/di { newpath 2 index 1 index add 2 index moveto
+ 2 index 2 index 2 index add lineto
+ 2 index 1 index sub 2 index lineto
+ 2 index 2 index 2 index sub lineto
+ closepath pop pop pop} bind def
+/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
+ setrgbcolor 1.1 div c fill
+ } bind def
+/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
+ setrgbcolor 1.1 div sq fill
+ } bind def
+/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
+ setrgbcolor 1.1 div di fill
+ } bind def
+/nfemale { 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+ newpath 5 index 5 index moveto 5 index 5 index 5 index 3.01 mul sub
+ lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto
+ 5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke
+ 5 index 5 index 5 index c fill
+ setrgbcolor 1.1 div c fill
+ } bind def
+/nmale {
+ 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+ newpath 5 index 5 index moveto
+ 5 index 4 index 1 mul 1.5 mul add
+ 5 index 5 index 3 sqrt 1.5 mul mul add
+ 1 index 1 index lineto
+ 1 index 1 index 7 index sub moveto
+ 1 index 1 index lineto
+ exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto
+ stroke
+ 5 index 5 index 5 index c fill
+ setrgbcolor 1.1 div c fill
+ } bind def
+/arrl 1 def
+/arrw 0.3 def
+/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
+/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
+ /w exch def /len exch def
+ newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
+ len w sub arrl sub dx dy lrl
+ arrw dy dx neg lrl
+ dx arrl w add mul dy w 2 div arrw add mul sub
+ dy arrl w add mul dx w 2 div arrw add mul add rlineto
+ dx arrl w add mul neg dy w 2 div arrw add mul sub
+ dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
+ arrw dy dx neg lrl
+ len w sub arrl sub neg dx dy lrl
+ closepath fill } bind def
+/cshow { 2 index 2 index moveto dup stringwidth pop
+ neg 2 div fosi .35 mul neg rmoveto show pop pop} def
+
+gsave
+100 dup scale
+%Edges:
+gsave
+grestore
+%Nodes:
+gsave
+1 1 1 0.2 1 0.2 nmale
+grestore
+grestore
+showpage
Added: hugo/trunk/doc/images/nodeshape_3.png
==============================================================================
Binary file. No diff available.
Added: hugo/trunk/doc/images/nodeshape_4.eps
==============================================================================
--- (empty file)
+++ hugo/trunk/doc/images/nodeshape_4.eps Thu Jan 26 07:43:59 2006
@@ -0,0 +1,77 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: LEMON GraphToEps figure
+%%Creator: LEMON GraphToEps function
+%%BoundingBox: 0 -199 200 200
+%%EndComments
+/lb { setlinewidth setrgbcolor newpath moveto
+ 4 2 roll 1 index 1 index curveto stroke } bind def
+/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
+/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
+/sq { newpath 2 index 1 index add 2 index 2 index add moveto
+ 2 index 1 index sub 2 index 2 index add lineto
+ 2 index 1 index sub 2 index 2 index sub lineto
+ 2 index 1 index add 2 index 2 index sub lineto
+ closepath pop pop pop} bind def
+/di { newpath 2 index 1 index add 2 index moveto
+ 2 index 2 index 2 index add lineto
+ 2 index 1 index sub 2 index lineto
+ 2 index 2 index 2 index sub lineto
+ closepath pop pop pop} bind def
+/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
+ setrgbcolor 1.1 div c fill
+ } bind def
+/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
+ setrgbcolor 1.1 div sq fill
+ } bind def
+/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
+ setrgbcolor 1.1 div di fill
+ } bind def
+/nfemale { 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+ newpath 5 index 5 index moveto 5 index 5 index 5 index 3.01 mul sub
+ lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto
+ 5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke
+ 5 index 5 index 5 index c fill
+ setrgbcolor 1.1 div c fill
+ } bind def
+/nmale {
+ 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+ newpath 5 index 5 index moveto
+ 5 index 4 index 1 mul 1.5 mul add
+ 5 index 5 index 3 sqrt 1.5 mul mul add
+ 1 index 1 index lineto
+ 1 index 1 index 7 index sub moveto
+ 1 index 1 index lineto
+ exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto
+ stroke
+ 5 index 5 index 5 index c fill
+ setrgbcolor 1.1 div c fill
+ } bind def
+/arrl 1 def
+/arrw 0.3 def
+/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
+/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
+ /w exch def /len exch def
+ newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
+ len w sub arrl sub dx dy lrl
+ arrw dy dx neg lrl
+ dx arrl w add mul dy w 2 div arrw add mul sub
+ dy arrl w add mul dx w 2 div arrw add mul add rlineto
+ dx arrl w add mul neg dy w 2 div arrw add mul sub
+ dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
+ arrw dy dx neg lrl
+ len w sub arrl sub neg dx dy lrl
+ closepath fill } bind def
+/cshow { 2 index 2 index moveto dup stringwidth pop
+ neg 2 div fosi .35 mul neg rmoveto show pop pop} def
+
+gsave
+100 dup scale
+%Edges:
+gsave
+grestore
+%Nodes:
+gsave
+1 1 1 0.2 1 0.2 nfemale
+grestore
+grestore
+showpage
Added: hugo/trunk/doc/images/nodeshape_4.png
==============================================================================
Binary file. No diff available.
Modified: hugo/trunk/lemon/graph_to_eps.h
==============================================================================
--- hugo/trunk/lemon/graph_to_eps.h (original)
+++ hugo/trunk/lemon/graph_to_eps.h Thu Jan 26 07:43:59 2006
@@ -385,7 +385,17 @@
///\image html nodeshape_2.png
///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
///
- DIAMOND=2
+ DIAMOND=2,
+ /// = 3
+ ///\image html nodeshape_3.png
+ ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
+ ///
+ MALE=3,
+ /// = 4
+ ///\image html nodeshape_4.png
+ ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
+ ///
+ FEMALE=4
};
private:
@@ -750,6 +760,8 @@
{
switch(t) {
case CIRCLE:
+ case MALE:
+ case FEMALE:
return p.normSquare()<=r*r;
case SQUARE:
return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r;
@@ -813,8 +825,22 @@
for(NodeIt n(g);n!=INVALID;++n) {
double ns=_nodeSizes[n]*_nodeScale;
xy<double> p(ns,ns);
- bb.add(p+mycoords[n]);
- bb.add(-p+mycoords[n]);
+ switch(_nodeShapes[n]) {
+ case CIRCLE:
+ case SQUARE:
+ case DIAMOND:
+ bb.add(p+mycoords[n]);
+ bb.add(-p+mycoords[n]);
+ break;
+ case MALE:
+ bb.add(-p+mycoords[n]);
+ bb.add(xy<double>(1.5*ns,1.5*sqrt(3)*ns)+mycoords[n]);
+ break;
+ case FEMALE:
+ bb.add(p+mycoords[n]);
+ bb.add(xy<double>(-ns,-3.01*ns)+mycoords[n]);
+ break;
+ }
}
if (bb.empty()) {
bb = BoundingBox<double>(xy<double>(0,0));
@@ -858,6 +884,33 @@
os << "/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill\n"
<< " setrgbcolor " << 1+_nodeBorderQuotient << " div di fill\n"
<< " } bind def\n";
+ os << "/nfemale { 0 0 0 setrgbcolor 3 index "
+ << _nodeBorderQuotient/(1+_nodeBorderQuotient)
+ << " 1.5 mul mul setlinewidth\n"
+ << " newpath 5 index 5 index moveto "
+ << "5 index 5 index 5 index 3.01 mul sub\n"
+ << " lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto\n"
+ << " 5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke\n"
+ << " 5 index 5 index 5 index c fill\n"
+ << " setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
+ << " } bind def\n";
+ os << "/nmale {\n"
+ << " 0 0 0 setrgbcolor 3 index "
+ << _nodeBorderQuotient/(1+_nodeBorderQuotient)
+ <<" 1.5 mul mul setlinewidth\n"
+ << " newpath 5 index 5 index moveto\n"
+ << " 5 index 4 index 1 mul 1.5 mul add\n"
+ << " 5 index 5 index 3 sqrt 1.5 mul mul add\n"
+ << " 1 index 1 index lineto\n"
+ << " 1 index 1 index 7 index sub moveto\n"
+ << " 1 index 1 index lineto\n"
+ << " exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto\n"
+ << " stroke\n"
+ << " 5 index 5 index 5 index c fill\n"
+ << " setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
+ << " } bind def\n";
+
+
os << "/arrl " << _arrowLength << " def\n";
os << "/arrw " << _arrowWidth << " def\n";
// l dx_norm dy_norm
@@ -1039,6 +1092,10 @@
os<< "nsq";break;
case DIAMOND:
os<< "ndi";break;
+ case MALE:
+ os<< "nmale";break;
+ case FEMALE:
+ os<< "nfemale";break;
}
os<<'\n';
}
More information about the Lemon-commits
mailing list