13 #pragma optimize("",off)
112 Warning(
"Open",
"SVG file already open");
124 ww *=
gPad->GetWNDC();
125 wh *=
gPad->GetHNDC();
129 if (yrange >
fYsize) { yrange =
fYsize; xrange = yrange/ratio;}
136 printf(
"ERROR in TSVG::Open: Cannot open file:%s\n",fname);
187 Error(
"On",
"no SVG file open");
215 if (fillis == 3 || fillis == 2) {
217 x[0] =
x1; y[0] = y1;
218 x[1] =
x2; y[1] = y1;
219 x[2] =
x2; y[2] = y2;
220 x[3] =
x1; y[3] = y2;
223 if (fillsi > 0 && fillsi < 26) {
224 x[0] =
x1; y[0] = y1;
225 x[1] =
x2; y[1] = y1;
226 x[2] =
x2; y[2] = y2;
227 x[3] =
x1; y[3] = y2;
270 PrintFast(21,
"\" fill=\"none\" stroke=");
290 Double_t ixd0, iyd0, ixdi, iydi, ix, iy;
296 xps[1] = xps[0] + border; yps[1] = yps[0] - border;
297 xps[2] = xps[1]; yps[2] =
YtoSVG(yt) + border;
298 xps[3] =
XtoSVG(xt) - border; yps[3] = yps[2];
300 xps[5] = xps[0]; yps[5] = yps[4];
301 xps[6] = xps[0]; yps[6] = yps[0];
313 for (i=1; i<7; i++) {
321 if( idx ) {
MovePS(idx,0); idx = 0; }
322 if( idy ) {
MovePS(0,idy); idy = 0; }
327 if( idy ) {
MovePS(0,idy); idy = 0; }
328 if( !idx ) { idx = ix;
continue;}
338 if( idx ) {
MovePS(idx,0); idx = 0; }
339 if( !idy) { idy = iy;
continue;}
360 xps[1] = xps[0] + border; yps[1] = yps[0] - border;
361 xps[2] =
XtoSVG(xt) - border; yps[2] = yps[1];
362 xps[3] = xps[2]; yps[3] =
YtoSVG(yt) + border;
364 xps[5] = xps[4]; yps[5] = yps[0];
365 xps[6] = xps[0]; yps[6] = yps[0];
385 if( idx ) {
MovePS(idx,0); idx = 0; }
386 if( idy ) {
MovePS(0,idy); idy = 0; }
391 if( idy ) {
MovePS(0,idy); idy = 0; }
392 if( !idx ) { idx = ix;
continue;}
402 if( idx ) {
MovePS(idx,0); idx = 0; }
403 if( !idy) { idy = iy;
continue;}
436 Double_t ixd0, iyd0, ixdi, iydi, ix, iy;
444 ixd0 =
XtoSVG(xy[0].GetX());
445 iyd0 =
YtoSVG(xy[0].GetY());
452 ixdi =
XtoSVG(xy[i].GetX());
453 iydi =
YtoSVG(xy[i].GetY());
459 if( idx ) {
MovePS(idx,0); idx = 0; }
460 if( idy ) {
MovePS(0,idy); idy = 0; }
465 if( idy ) {
MovePS(0,idy); idy = 0; }
466 if( !idx ) { idx = ix;
continue;}
476 if( idx ) {
MovePS(idx,0); idx = 0; }
477 if( !idy) { idy = iy;
continue;}
507 Double_t ixd0, iyd0, ixdi, iydi, ix, iy;
515 ixd0 =
UtoSVG(xy[0].GetX());
516 iyd0 =
VtoSVG(xy[0].GetY());
522 ixdi =
UtoSVG(xy[i].GetX());
523 iydi =
VtoSVG(xy[i].GetY());
529 if( idx ) {
MovePS(idx,0); idx = 0; }
530 if( idy ) {
MovePS(0,idy); idy = 0; }
535 if( idy ) {
MovePS(0,idy); idy = 0; }
536 if( !idx ) { idx = ix;
continue;}
546 if( idx ) {
MovePS(idx,0); idx = 0; }
547 if( !idy) { idy = iy;
continue;}
560 if (xy[0].GetX() == xy[n-1].GetX() && xy[0].GetY() == xy[n-1].GetY())
PrintFast(3,
" cl");
572 if (ms >= 6 && ms <= 19) ms = 20;
573 if (ms == 4) ms = 24;
581 const Int_t kBASEMARKER = 8;
582 Float_t sbase = msize*kBASEMARKER;
593 if ((ms > 19 && ms < 24) || ms == 29 || ms == 33 || ms == 34) {
626 }
else if (ms == 2) {
647 }
else if (ms == 5) {
668 }
else if (ms == 3 || ms == 31) {
709 }
else if (ms == 24 || ms == 20) {
720 }
else if (ms == 25 || ms == 21) {
732 }
else if (ms == 26 || ms == 22) {
739 }
else if (ms == 23 || ms == 32) {
746 }
else if (ms == 27 || ms == 33) {
754 }
else if (ms == 28 || ms == 34) {
769 }
else if (ms == 29 || ms == 30) {
805 if (ms >= 6 && ms <= 19) ms = 20;
806 if (ms == 4) ms = 24;
814 const Int_t kBASEMARKER = 8;
815 Float_t sbase = msize*kBASEMARKER;
826 if ((ms > 19 && ms < 24) || ms == 29 || ms == 33 || ms == 34) {
859 }
else if (ms == 2) {
880 }
else if (ms == 5) {
901 }
else if (ms == 3 || ms == 31) {
942 }
else if (ms == 24 || ms == 20) {
952 }
else if (ms == 25 || ms == 21) {
963 }
else if (ms == 26 || ms == 22) {
970 }
else if (ms == 23 || ms == 32) {
977 }
else if (ms == 27 || ms == 33) {
985 }
else if (ms == 28 || ms == 34) {
1000 }
else if (ms == 29 || ms == 30) {
1039 Double_t ixd0, iyd0, idx, idy, ixdi, iydi, ix, iy;
1049 if (fais == 3 || fais == 2) {
1050 if (fasi > 100 && fasi <125) {
1053 if (fasi > 0 && fasi < 26) {
1059 Error(
"DrawPS",
"Two points are needed");
1073 for (
Int_t i=1;i<
n;i++) {
1081 if( idx ) {
MovePS(idx,0); idx = 0; }
1082 if( idy ) {
MovePS(0,idy); idy = 0; }
1085 if( idy ) {
MovePS(0,idy); idy = 0;}
1086 if( !idx ) { idx = ix;}
1088 else {
MovePS(idx,0); idx = ix;}
1090 if( idx ) {
MovePS(idx,0); idx = 0;}
1091 if( !idy) { idy = iy;}
1093 else {
MovePS(0,idy); idy = iy;}
1100 if (xw[0] == xw[n-1] && yw[0] == yw[n-1])
PrintFast(1,
"z");
1101 PrintFast(21,
"\" fill=\"none\" stroke=");
1176 if (ix != 0 && iy != 0) {
1181 }
else if (ix != 0) {
1184 }
else if (iy != 0) {
1208 PrintStr(
"@<?xml version=\"1.0\" standalone=\"no\"?>");
1217 PrintStr(
"\" xmlns=\"http://www.w3.org/2000/svg\">");
1229 Float_t xps, yps, xncm, yncm, dxwn, dywn, xwkwn, ywkwn, xymax;
1237 if( xsize <= xps && ysize < yps) {
1238 if ( xps > yps ) xymax = xps;
1242 dxwn = ((xps/xymax)-xncm)/2;
1243 dywn = ((yps/xymax)-yncm)/2;
1245 if (xps/yps < 1) xwkwn = xps/yps;
1247 if (yps/xps < 1) ywkwn = yps/xps;
1250 if (xsize < ysize) {
1251 xncm = ywkwn*xsize/ysize;
1253 dxwn = (xwkwn-xncm)/2;
1258 yncm = xwkwn*ysize/xsize;
1259 dywn = (ywkwn-yncm)/2;
1263 yncm = xwkwn*ysize/xsize;
1265 dywn = (ywkwn-yncm)/2;
1269 xncm = ywkwn*xsize/ysize;
1270 dxwn = (xwkwn-xncm)/2;
1328 if (color < 0) color = 0;
1333 if (a<1.)
PrintStr(
Form(
" fill-opacity=\"%3.2f\" stroke-opacity=\"%3.2f\"",a,a));
1348 if (r <= 0. && g <= 0. && b <= 0. ) {
1350 }
else if (r >= 1. && g >= 1. && b >= 1. ) {
1354 snprintf(str,12,
"\"#%2.2x%2.2x%2.2x\"",
Int_t(255.*r)
1378 static const char *fontFamily[] = {
1379 "Times" ,
"Times" ,
"Times",
1380 "Helvetica",
"Helvetica",
"Helvetica" ,
"Helvetica",
1381 "Courier" ,
"Courier" ,
"Courier" ,
"Courier",
1382 "Times" ,
"Times" ,
"ZapfDingbats",
"Times"};
1384 static const char *fontWeight[] = {
1385 "normal",
"bold",
"bold",
1386 "normal",
"normal",
"bold" ,
"bold",
1387 "normal",
"normal",
"bold" ,
"bold",
1388 "normal",
"normal",
"normal",
"normal"};
1390 static const char *fontStyle[] = {
1391 "italic",
"normal" ,
"italic",
1392 "normal",
"oblique",
"normal",
"oblique",
1393 "normal",
"oblique",
"normal",
"oblique",
1394 "normal",
"normal" ,
"normal",
"italic"};
1399 if (txalh <1) txalh = 1;
else if (txalh > 3) txalh = 3;
1401 if (txalv <1) txalv = 1;
else if (txalv > 3) txalv = 3;
1409 if (font > 42 || font < 1) font = 1;
1415 Int_t ifont = font-1;
1418 if( fontsize <= 0)
return;
1420 if (txalv == 3) iy = iy+fontsize;
1421 if (txalv == 2) iy = iy+(fontsize/2);
1441 PrintFast(21,
" text-anchor=\"middle\"");
1442 }
else if (txalh == 3) {
1451 if (strcmp(fontWeight[ifont],
"normal")) {
1455 if (strcmp(fontStyle[ifont],
"normal")) {
1462 if (font == 12 || font == 15) {
1463 Int_t ichar = chars[0]+848;
1467 if (ic == 755) ichar = 8804;
1468 if (ic == 759) ichar = 9827;
1469 if (ic == 760) ichar = 9830;
1470 if (ic == 761) ichar = 9829;
1471 if (ic == 762) ichar = 9824;
1472 if (ic == 766) ichar = 8594;
1473 if (ic == 776) ichar = 247;
1474 if (ic == 757) ichar = 8734;
1475 if (ic == 758) ichar = 402;
1476 if (ic == 771) ichar = 8805;
1477 if (ic == 774) ichar = 8706;
1478 if (ic == 775) ichar = 8226;
1479 if (ic == 779) ichar = 8776;
1480 if (ic == 805) ichar = 8719;
1481 if (ic == 821) ichar = 8721;
1482 if (ic == 834) ichar = 8747;
1483 if (ic == 769) ichar = 177;
1484 if (ic == 772) ichar = 215;
1485 if (ic == 768) ichar = 176;
1486 if (ic == 791) ichar = 8745;
1487 if (ic == 793) ichar = 8835;
1488 if (ic == 794) ichar = 8839;
1489 if (ic == 795) ichar = 8836;
1490 if (ic == 796) ichar = 8834;
1491 if (ic == 893) ichar = 8722;
1492 if (ic == 803) ichar = 169;
1493 if (ic == 819) ichar = 169;
1494 if (ic == 804) ichar = 8482;
1495 if (ic == 770) ichar = 34;
1496 if (ic == 823) ichar = 10072;
1497 if (ic == 781) ichar = 10072;
1498 if (ic == 824) ichar = 9117;
1499 if (ic == 822) ichar = 9115;
1500 if (ic == 767) ichar = 8595;
1501 if (ic == 763) ichar = 8596;
1502 if (ic == 764) ichar = 8592;
1503 if (ic == 788) ichar = 8855;
1504 if (ic == 784) ichar = 8501;
1505 if (ic == 777) ichar = 8800;
1506 if (ic == 797) ichar = 8838;
1507 if (ic == 800) ichar = 8736;
1508 if (ic == 812) ichar = 8656;
1509 if (ic == 817) ichar = 60;
1510 if (ic == 833) ichar = 62;
1511 if (ic == 778) ichar = 8803;
1512 if (ic == 809) ichar = 8743;
1513 if (ic == 802) ichar = 9415;
1514 if (ic == 780) ichar = 8230;
1515 if (ic == 801) ichar = 8711;
1516 if (ic == 783) ichar = 8629;
1517 if (ic == 782) ichar = 8213;
1518 if (ic == 799) ichar = 8713;
1519 if (ic == 792) ichar = 8746;
1520 if (ic == 828) ichar = 9127;
1521 if (ic == 765) ichar = 8593;
1522 if (ic == 789) ichar = 8853;
1523 if (ic == 813) ichar = 8657;
1524 if (ic == 773) ichar = 8733;
1525 if (ic == 790) ichar = 8709;
1526 if (ic == 810) ichar = 8744;
1527 if (ic == 756) ichar = 8260;
1528 if (ic == 807) ichar = 8231;
1529 if (ic == 808) ichar = 8989;
1530 if (ic == 814) ichar = 8658;
1531 if (ic == 806) ichar = 8730;
1532 if (ic == 827) ichar = 9123;
1533 if (ic == 829) ichar = 9128;
1534 if (ic == 786) ichar = 8476;
1535 if (ic == 785) ichar = 8465;
1536 if (ic == 787) ichar = 8472;
1539 if (ic == 918) ichar = 934;
1540 if (ic == 919) ichar = 915;
1541 if (ic == 920) ichar = 919;
1542 if (ic == 923) ichar = 922;
1543 if (ic == 924) ichar = 923;
1544 if (ic == 925) ichar = 924;
1545 if (ic == 926) ichar = 925;
1546 if (ic == 929) ichar = 920;
1547 if (ic == 930) ichar = 929;
1548 if (ic == 936) ichar = 926;
1549 if (ic == 915) ichar = 935;
1550 if (ic == 937) ichar = 936;
1551 if (ic == 935) ichar = 937;
1552 if (ic == 938) ichar = 918;
1553 if (ic == 951) ichar = 947;
1554 if (ic == 798) ichar = 949;
1555 if (ic == 970) ichar = 950;
1556 if (ic == 952) ichar = 951;
1557 if (ic == 961) ichar = 952;
1558 if (ic == 955) ichar = 954;
1559 if (ic == 956) ichar = 955;
1560 if (ic == 957) ichar = 956;
1561 if (ic == 958) ichar = 957;
1562 if (ic == 968) ichar = 958;
1563 if (ic == 934) ichar = 962;
1564 if (ic == 962) ichar = 961;
1565 if (ic == 966) ichar = 969;
1566 if (ic == 950) ichar = 966;
1567 if (ic == 947) ichar = 967;
1568 if (ic == 969) ichar = 968;
1569 if (ic == 967) ichar = 969;
1570 if (ic == 954) ichar = 966;
1571 if (ic == 922) ichar = 952;
1572 if (ic == 753) ichar = 965;
1575 Int_t len=strlen(chars);
1576 for (
Int_t i=0; i<len;i++) {
1577 if (chars[i]!=
'\n') {
1578 if (chars[i]==
'<') {
1580 }
else if (chars[i]==
'>') {
1582 }
else if (chars[i]==
'\305') {
1584 }
else if (chars[i]==
'\345') {
1586 }
else if (chars[i]==
'&') {
1619 return 0.5 + 72*cm/2.54;
1628 return 0.5 + 72*cm/2.54;
1655 Warning(
"TSVG::CellArrayBegin",
"not yet implemented");
1663 Warning(
"TSVG::CellArrayFill",
"not yet implemented");
1671 Warning(
"TSVG::CellArrayEnd",
"not yet implemented");
1679 Warning(
"TSVG::DrawPS",
"not yet implemented");
void SetLineColor(Color_t cindex=1)
Set color index for lines.
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
const char * GetHeaderPS() const
void On()
Activate an already open SVG file.
Double_t UtoSVG(Double_t u)
Convert U from NDC coordinate to SVG.
Collectable string class.
R__EXTERN TStyle * gStyle
void SetFillColor(Color_t cindex=1)
Set color index for fill areas.
void Text(Double_t x, Double_t y, const char *string)
Draw text.
void DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt, Int_t mode, Int_t border, Int_t dark, Int_t light)
Draw a Frame around a box.
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw a Box.
void GetPaperSize(Float_t &xsize, Float_t &ysize) const
Set paper size for PostScript output.
void Off()
Deactivate an already open SVG file.
Float_t GetLineScalePS() const
Double_t CMtoSVG(Double_t u)
void SetLineStyle(Style_t linestyle=1)
Change the line style.
void SetMarkerColor(Color_t cindex=1)
Set color index for markers.
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
Begin the Cell Array painting.
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
void NewPage()
Start the SVG page.
static const double x2[5]
void SetTextColor(Color_t cindex=1)
Set color index for text.
virtual void PrintStr(const char *string="")
Output the string str in the output buffer.
Double_t XtoSVG(Double_t x)
Convert X from world coordinate to SVG.
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
void DrawPS(Int_t n, Float_t *xw, Float_t *yw)
Not needed in SVG case.
void SetLineScale(Float_t=3)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void Close(Option_t *opt="")
Close a SVG file.
void SetLineWidth(Width_t linewidth=1)
Set the lines width.
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y)
Paint PolyMarker.
virtual Color_t GetFillColor() const
char * Form(const char *fmt,...)
virtual const char * GetName() const
Returns name of object.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
virtual ~TSVG()
Default SVG destructor.
2-D graphics point (world coordinates).
void SetColor(Int_t color=1)
Set color with its color index.
static const double x1[5]
void CellArrayEnd()
End the Cell Array painting.
virtual void PrintFast(Int_t nch, const char *string="")
Fast version of Print.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
void CellArrayFill(Int_t r, Int_t g, Int_t b)
Paint the Cell Array.
The color creation and management class.
Int_t GetEntries() const
Return the number of objects in array (i.e.
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
void Open(const char *filename, Int_t type=-111)
Open a SVG file.
R__EXTERN TVirtualPS * gVirtualPS
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
void MovePS(Double_t x, Double_t y)
Move to a new position (ix, iy).
TObject * At(Int_t idx) const
Double_t VtoSVG(Double_t v)
Convert V from NDC coordinate to SVG.
const char * AsString() const
Return the date & time as a string (ctime() format).
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
void Initialize()
Initialize the SVG file.
Double_t YtoSVG(Double_t y)
Convert Y from world coordinate to SVG.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.