home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / libs / plotlib.lha / Plot_1.lzh / Source / PltL3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-15  |  25.6 KB  |  731 lines

  1. /****************************************************************
  2. *                                                                                                                                *
  3. *     Filename : PltL3.c                                                                                        *
  4. *                                                                                                                                *
  5. *****************************************************************
  6. *                                                                                                                                *
  7. *        Comment : Level 3 der Plotlibrary. Alle Funktionen für die    *
  8. *                            Plotterausgabe.                                                                        *
  9. *                                                                                                                                *
  10. *                                Funktionen                                                        *
  11. *                            ==========                                                        *
  12. *                                                                                                                                *
  13. *            PlOpenGraphics()        öffnet das Graphiksystem                            *
  14. *            PlCloseGraphics()        schliesst das Graphiksystem                        *
  15. *            PlClearGraphics()        löscht den Bildschirm                                    *
  16. *            PlGetMaxX()                    max. horiz. Auflösung                                    *
  17. *            PlGetMaxY()                    max. vert. Auflösung                                    *
  18. *            PlDrawText()                schreibt eine Text                                        *
  19. *            PlSetLineStyle()        setzt Linienattribute                                    *
  20. *            PlGetTextSize()            holt Textgrösse                                                *
  21. *            PlSetTextSize()            setzt 8*8 Text                                                *
  22. *            PlGetFgColor()            holt Stiftfarbe                                                *
  23. *            PlSetFgColor()            setzt Stiftfarbe                                            *
  24. *            PlGetBackColor()        holt Hintergrundefarbe                                *
  25. *            PlSetBackColor()        setzt Hintergrundfarbe                                *
  26. *            PlDrawLine()                zeichnet eine Line                                        *
  27. *            PlDrawPolyLine()        zeichnet Kurvenzug                                        *
  28. *            PlFillPolyLine()        zeichnet Polygon                                            *
  29. *            PlSetFillStyle()        setzt Füllmuster                                            *
  30. *            PlDrawRectangle()        zeichnet ein Rechteck                                    *
  31. *            PlGetMaxColor()            holt max. verfügbare Farbenanzahl            *
  32. *            PlRotate()                    dreht die Plotausgabe                                    *
  33. *            PlTrans()                        Minitransformation für Plotter                *
  34. *                                                                                                                                *
  35. *                Rev : V1.0                                                                                            *
  36. *                                                                                                                                *
  37. *        History : V1.0 erstellen dieses Files                            04/12/89    *
  38. *                                                                                                                                *
  39. *                Doc : Plotlibrary User's Guide                                                    *
  40. *                                                                                                                                *
  41. *             Bugs : keine bekannten                                                                        *
  42. *                                                                                                                                *
  43. *            Autor : Oesch Silvano                                                                            *
  44. *                                                                                                                                *
  45. *            Datum : 04/12/89                                                                                    *
  46. *                                                                                                                                *
  47. ****************************************************************/
  48.  
  49. /****************************************************************
  50. *                                                                                                                                *
  51. *    Plotlibrary Includedateien                                                                        *
  52. *                                                                                                                                *
  53. ****************************************************************/
  54.  
  55. #include "Plot.h"
  56. #include "PltL3.h"
  57.  
  58. /****************************************************************
  59. *                                                                                                                                *
  60. *    globale statische Variablen                                                                        *
  61. *                                                                                                                                *
  62. *****************************************************************
  63. *                                                                                                                                *
  64. *    Die meisten der unten aufgeführten Variablen werden in einer    *
  65. *    späteren Erweiterung ausgelagert in eine Datei die dann beim    *
  66. *    öffnen der Graphik nachgeladen wird. Dieses nachladen                    *
  67. *    ermöglicht eine weitere unterstützung verschiedener Plotter        *
  68. *    welche nicht unbedingt HPGL verstehen. Weiter können so auch    *
  69. *    verschiedene Blattgrössen definiert werden.                                        *
  70. *                                                                                                                                *
  71. ****************************************************************/
  72.  
  73. static int apen;
  74. static FILE *plotfile = NULL;
  75.  
  76. static float     zoll = 2.541,
  77.                             hz = 7.4,
  78.                             lz = 10.5,
  79.                             xz,yz,xpz,ypz;
  80.  
  81. static int     steps = 1024,
  82.                         pens = 6,
  83.                         xp,yp,xop,yop;
  84.  
  85. static char HpPU[]="PU";                        /* alle benötigten HPGL            */
  86. static char HpPD[]="PD";                        /* Befehle auf einen Blick    */
  87. static char HpPA[]="PA";
  88. static char HpIP[]="IP";
  89. static char HpSC[]="SC";
  90. static char HpSP[]="SP";
  91. static char HpEA[]="EA";
  92. static char HpRO[]="RO";
  93. static char HpDF[]="DF";
  94. static char HpIN[]="IN";
  95. static char HpIW[]="IW";
  96. static char HpPG[]="PG";
  97. static char HpSI[]="SI";
  98. static char HpLB[]="LB";
  99. static char HpLT[]="LT";
  100. static char HpCS[]="CS";
  101.  
  102. static char defname[]="Plot.plt";
  103.  
  104. /****************************************************************
  105. *                                                                                                                                *
  106. *    externe Variablen                                                                                            *
  107. *                                                                                                                                *
  108. ****************************************************************/
  109.  
  110. extern struct Plot *plot;
  111. extern int plerr;
  112.  
  113. /****************************************************************
  114. *                                                                                                                                *
  115. *    Function : PlOpenGraphics()                                                                        *
  116. *                                                                                                                                *
  117. *****************************************************************
  118. *                                                                                                                                *
  119. *         Input : void                                                                                                *
  120. *                                                                                                                                *
  121. *        Output : int returnset                                                                            *
  122. *                            != FALSE        alle klar                                                        *
  123. *                            == FALSE            Fehler                                                            *
  124. *                                                                                                                                *
  125. *****************************************************************
  126. *                                                                                                                                *
  127. *     Comment : Hier werden alle Plotterwerte initialisiert und        *
  128. *                         die Ausgabedatei geöffnet. Bei einer späteren            *
  129. *                         Erweiterung wird zusätzlich ein Plottertreiber            *
  130. *                         nachgeladen.                                                                                *
  131. *                                                                                                                                *
  132. ****************************************************************/
  133.  
  134. int PlOpenGraphics()
  135. {
  136.  
  137.     int returnset;                                        /* allg Rückgabewert                */
  138.     float mem;                                                /* temp. Speicher                        */
  139.     char *filename;                                        /* Dateinamen                                */
  140.  
  141.     xz = plot->xlength/zoll;                    /* berechnen der Ausgabe-        */
  142.     yz = plot->ylength/zoll;                    /* grössen sowie der                */
  143.     xpz = plot->xout/zoll;                        /* Ausgabepunkte                        */
  144.     ypz = plot->yout/zoll;
  145.  
  146.     if (plot->pldisp & ROTATE)                /* Wenn gedreht                            */
  147.         swap(lz,hz,mem);                                /* vertausche länge mit            */
  148.                                                                         /* der höhe                                    */
  149.  
  150.     if ((xz+xpz > lz) or                            /* liegt noch alles in den    */
  151.             (yz+ypz > hz))                                /* Papiergrenzen                        */
  152.     {                                                                    /* Nein, Fehler                            */
  153.         seterror(PLSIZE);
  154.         setreturn(FALSE);
  155.     }
  156.     else                                                            /* Ja                                                */
  157.     {
  158.  
  159.         xp = (int)(xz*steps);                        /* berechne Punkte                    */
  160.         yp = (int)(yz*steps);
  161.         xop = (int)(xpz*steps);
  162.         yop = (int)((hz-yz-ypz)*steps);
  163.  
  164.         if (plot->pldisp & ROTATE)            /* Vertauschte Werte                */
  165.             swap(lz,hz,mem);                            /* rücksetzten                            */
  166.         if (plot->outname)                            /* Wenn Namen gegeben                */
  167.             filename = plot->outname;            /* nimm diesen                            */
  168.         else                                                        /* sonst                                        */
  169.             filename = defname;                        /* nimm default                            */
  170.  
  171.         plotfile = fopen(filename,"w");    /* öffne Datei                            */
  172.         if (plotfile)                                        /* alles klar ?                            */
  173.         {                                                                /* initialisiere Plotter        */
  174.             fprintf(plotfile,"%s;\n",HpDF);
  175.             if (plot->pldisp & ROTATE)        /* Drehen ?                                    */
  176.                 PlRotate(90);
  177.             fprintf(plotfile,"%s 2;\n",HpCS);
  178.             setreturn(TRUE);                            /* alles klar                                */
  179.         }
  180.         else                                                        /* setzte Fehler                        */
  181.         {
  182.             seterror(PLOPER);
  183.             setreturn(FALSE);
  184.         }
  185.     }
  186.     return(returnset);                                /* und zurück                                */
  187. }
  188.  
  189. /****************************************************************
  190. *                                                                                                                                *
  191. *    Function : PlCloseGraphics()                                                                    *
  192. *                                                                                                                                *
  193. *****************************************************************
  194. *                                                                                                                                *
  195. *         Input : void                                                                                                *
  196. *                                                                                                                                *
  197. *        Output : void                                                                                                *
  198. *                                                                                                                                *
  199. *****************************************************************
  200. *                                                                                                                                *
  201. *     Comment : setzt Papiervorschub und schliesst das Datenfile        *
  202. *                                                                                                                                *
  203. ****************************************************************/
  204.  
  205. void PlCloseGraphics()
  206. {
  207.     if (plotfile)                                            /* nur wenn geöffnet                */
  208.     {
  209.         fprintf(plotfile,"%s;\n",HpPG);    /* Seitenvorschub                        */
  210.         fclose(plotfile);                                /* Datei schliessen                    */
  211.     }
  212. }
  213.  
  214. /****************************************************************
  215. *                                                                                                                                *
  216. *    Function : PlGetMaxColor()                                                                        *
  217. *                                                                                                                                *
  218. *****************************************************************
  219. *                                                                                                                                *
  220. *         Input : void                                                                                                *
  221. *                                                                                                                                *
  222. *        Output : int maxcolor                max setzbares Farbregister            *
  223. *                                                                                                                                *
  224. *****************************************************************
  225. *                                                                                                                                *
  226. *     Comment : gibt die Anzahl verschiedener Farbstifte zurück.        *
  227. *                                                                                                                                *
  228. ****************************************************************/
  229.  
  230. int PlGetMaxColor()
  231. {
  232.     return(pens);                                            /* max. Farbstifte                    */
  233. }
  234.  
  235. /****************************************************************
  236. *                                                                                                                                *
  237. *    Function : PlGetMaxX()                                                                                *
  238. *                                                                                                                                *
  239. *****************************************************************
  240. *                                                                                                                                *
  241. *         Input : void                                                                                                *
  242. *                                                                                                                                *
  243. *        Output : int maxx                max. horizontaler setzbarer Punkt        *
  244. *                                                                                                                                *
  245. *****************************************************************
  246. *                                                                                                                                *
  247. *     Comment : gibt die max. horizontale Auflösung des Plotters        *
  248. *                         zurück.                                                                                        *
  249. *                                                                                                                                *
  250. ****************************************************************/
  251.  
  252. int PlGetMaxX()
  253. {
  254.     return(xp);                                                /* horiz. Punkte                        */
  255. }
  256.  
  257. /****************************************************************
  258. *                                                                                                                                *
  259. *    Function : PlGetMaxY()                                                                                *
  260. *                                                                                                                                *
  261. *****************************************************************
  262. *                                                                                                                                *
  263. *         Input : void                                                                                                *
  264. *                                                                                                                                *
  265. *        Output : int maxy                max. vertikaler setzbarer Punkt            *
  266. *                                                                                                                                *
  267. *****************************************************************
  268. *                                                                                                                                *
  269. *     Comment : gibt die max. verzikale Auflösung des Plotters            *
  270. *                         zurück.                                                                                        *
  271. *                                                                                                                                *
  272. ****************************************************************/
  273.  
  274. int PlGetMaxY()
  275. {
  276.     return(yp);                                                /* vert. Punkte                            */
  277. }
  278.  
  279. /****************************************************************
  280. *                                                                                                                                *
  281. *    Function : PlSetTextSize()                                                                        *
  282. *                                                                                                                                *
  283. *****************************************************************
  284. *                                                                                                                                *
  285. *         Input : void                                                                                                *
  286. *                                                                                                                                *
  287. *        Output : void                                                                                                *
  288. *                                                                                                                                *
  289. *****************************************************************
  290. *                                                                                                                                *
  291. *     Comment : setzt die Textgrösse auf 80*40 Zeichen und Linien    *
  292. *                                                                                                                                *
  293. ****************************************************************/
  294.  
  295. void PlSetTextSize()
  296. {
  297.  
  298.     fprintf(plotfile,"%s %f %f;\n",
  299.                                         HpSI,
  300.                                         plot->xlength/118.5,
  301.                                         plot->ylength/60.0);
  302. }
  303.  
  304. /****************************************************************
  305. *                                                                                                                                *
  306. *    Function : PlClearGraphics()                                                                    *
  307. *                                                                                                                                *
  308. *****************************************************************
  309. *                                                                                                                                *
  310. *         Input : void                                                                                                *
  311. *                                                                                                                                *
  312. *        Output : void                                                                                                *
  313. *                                                                                                                                *
  314. *****************************************************************
  315. *                                                                                                                                *
  316. *     Comment : löscht das Papier Ha, Ha, Ha !!                                        *
  317. *                         Muss vorhanden sein wegen Kompatibilität.                    *
  318. *                                                                                                                                *
  319. ****************************************************************/
  320.  
  321. void PlClearGraphics()
  322. {
  323. }
  324.  
  325. /****************************************************************
  326. *                                                                                                                                *
  327. *    Function : PlDrawText()                                                                                *
  328. *                                                                                                                                *
  329. *****************************************************************
  330. *                                                                                                                                *
  331. *         Input : x,y,string                                                                                    *
  332. *                            int x                        Koordinatenpunkt für untere                *
  333. *                            int y                        linke Ecke des Textes                            *
  334. *                            char *string        Text                                                            *
  335. *                                                                                                                                *
  336. *        Output : void                                                                                                *
  337. *                                                                                                                                *
  338. *****************************************************************
  339. *                                                                                                                                *
  340. *     Comment : schreibt einen Text an den Punkt(x/y) in der                *
  341. *                         aktuellen Farbe                                                                        *
  342. *                                                                                                                                *
  343. ****************************************************************/
  344.  
  345. void PlDrawText(x,y,string)
  346. int x,y;
  347. char *string;
  348. {
  349.  
  350.     PlTrans(&x,&y);                                        /* translaten                                */
  351.     fprintf(plotfile,"%s %d %d;",            /* positionieren                        */
  352.                                         HpPU,x,y);
  353.     fprintf(plotfile,"%s%s\x03;\n",        /* Text ausgeben                        */
  354.                                         HpLB,string);
  355. }
  356.  
  357. /****************************************************************
  358. *                                                                                                                                *
  359. *    Function : PlGetFgColor()                                                                            *
  360. *                                                                                                                                *
  361. *****************************************************************
  362. *                                                                                                                                *
  363. *         Input : void                                                                                                *
  364. *                                                                                                                                *
  365. *        Output : int color                aktuelle Farbe                                        *
  366. *                                                                                                                                *
  367. *****************************************************************
  368. *                                                                                                                                *
  369. *     Comment : gibt die aktuelle Stiftfarbe zurück welche in            *
  370. *                         der Variablen apen gespeichert ist.                                *
  371. *                                                                                                                                *
  372. ****************************************************************/
  373.  
  374. int PlGetFgColor()
  375. {
  376.     return(apen);                                            /* aktuelle Farbe                        */
  377. }
  378.  
  379. /****************************************************************
  380. *                                                                                                                                *
  381. *    Function : PlSetFgColor()                                                                            *
  382. *                                                                                                                                *
  383. *****************************************************************
  384. *                                                                                                                                *
  385. *         Input : int color                            neue Farbe                                    *
  386. *                                                                                                                                *
  387. *        Output : void                                                                                                *
  388. *                                                                                                                                *
  389. *****************************************************************
  390. *                                                                                                                                *
  391. *     Comment : setzt eine neue Stiftfarbe und speichert diese            *
  392. *                         in der Variablen apen.                                                            *
  393. *                                                                                                                                *
  394. ****************************************************************/
  395.  
  396. void PlSetFgColor(color)
  397. int color;
  398. {
  399.  
  400.     apen = color;                                            /* speichern                                */
  401.     fprintf(plotfile,"%s %d;",                /* und setzten                            */
  402.                                         HpSP,color);
  403.  
  404. }
  405.  
  406. /****************************************************************
  407. *                                                                                                                                *
  408. *    Function : PlGetBackColor()                                                                        *
  409. *                                                                                                                                *
  410. *****************************************************************
  411. *                                                                                                                                *
  412. *         Input : void                                                                                                *
  413. *                                                                                                                                *
  414. *        Output : int color                                                                                    *
  415. *                                                                                                                                *
  416. *****************************************************************
  417. *                                                                                                                                *
  418. *     Comment : Immer Weiss, hat keine Bedeutung nur für                        *
  419. *                         Kompatiblität.                                                                            *
  420. *                                                                                                                                *
  421. ****************************************************************/
  422.  
  423. int PlGetBackColor()
  424. {
  425.     return(TRUE);
  426. }
  427.  
  428. /****************************************************************
  429. *                                                                                                                                *
  430. *    Function : PlSetBackColor()                                                                        *
  431. *                                                                                                                                *
  432. *****************************************************************
  433. *                                                                                                                                *
  434. *         Input : int color                    neue Hintergrundfarbe                        *
  435. *                                                                                                                                *
  436. *        Output : void                                                                                                *
  437. *                                                                                                                                *
  438. *****************************************************************
  439. *                                                                                                                                *
  440. *     Comment : Nur für Kompatibilität. Zuweisung damit Compiler        *
  441. *                         keine Warnings ausgeben.                                                        *
  442. *                                                                                                                                *
  443. ****************************************************************/
  444.  
  445. void PlSetBackColor(color)
  446. int color;
  447. {
  448.     color = color;                                        /* gegen Warnings                        */
  449. }
  450.  
  451. /****************************************************************
  452. *                                                                                                                                *
  453. *    Function : PlDrawLine()                                                                                *
  454. *                                                                                                                                *
  455. *****************************************************************
  456. *                                                                                                                                *
  457. *         Input : x1,y1,x2,y2                                                                                *
  458. *                            int x1                        Startkoordinate(x1/y1)                    *
  459. *                            int y1                                                                                        *
  460. *                            int x2                        Endkoordinate(x2,y2)                        *
  461. *                            int y2                                                                                        *
  462. *                                                                                                                                *
  463. *        Output : void                                                                                                *
  464. *                                                                                                                                *
  465. *****************************************************************
  466. *                                                                                                                                *
  467. *     Comment : zeichnet eine absolute Line in der aktuellen                *
  468. *                         Stiftfarbe.                                                                                *
  469. *                                                                                                                                *
  470. ****************************************************************/
  471.  
  472. void PlDrawLine(x1,y1,x2,y2)
  473. int x1,
  474.         y1,
  475.         x2,
  476.         y2;
  477. {
  478.  
  479.     PlTrans(&x1,&y1);                                    /* translate                                */
  480.     PlTrans(&x2,&y2);                                    /* translate                                */
  481.     fprintf(plotfile,"%s %d %d;%s %d %d;\n",
  482.                                         HpPU,x1,y1,            /* und zeichnen                            */
  483.                                         HpPD,x2,y2);
  484. }
  485.  
  486. /****************************************************************
  487. *                                                                                                                                *
  488. *    Function : PlDrawPolyLine()                                                                        *
  489. *                                                                                                                                *
  490. *****************************************************************
  491. *                                                                                                                                *
  492. *         Input : counter,array                                                                            *
  493. *                            int counter                    Anzahl Koordinatenpunkte            *
  494. *                            GPT    *array                    Array der Koordinatenpunkte        *
  495. *                                                                                                                                *
  496. *        Output : void                                                                                                *
  497. *                                                                                                                                *
  498. *****************************************************************
  499. *                                                                                                                                *
  500. *     Comment : Zeichnet eine folge von Linien auf den Plotter            *
  501. *                         in den aktuellen Farben. Die Fläche wird nicht            *
  502. *                         ausgefüllt.                                                                                *
  503. *                                                                                                                                *
  504. ****************************************************************/
  505.  
  506. void PlDrawPolyLine(counter,array)
  507. int counter;
  508. GPT    *array;
  509. {
  510.  
  511.     PlFillPolyLine(counter,array);        /* Aufruf von Fill                    */
  512.  
  513. }
  514.  
  515.  
  516. /****************************************************************
  517. *                                                                                                                                *
  518. *    Function : PlFillPolyLine()                                                                        *
  519. *                                                                                                                                *
  520. *****************************************************************
  521. *                                                                                                                                *
  522. *         Input : counter,array                                                                            *
  523. *                            int counter                    Anzahl Koordinatenpunkte            *
  524. *                            GPT    *array                    Array der Koordinatenpunkte        *
  525. *                                                                                                                                *
  526. *        Output : int returnset                Rückgabewert                                    *
  527. *                                                                                                                                *
  528. *****************************************************************
  529. *                                                                                                                                *
  530. *     Comment : Zeichnet eine folge von Linien auf den Plotter            *
  531. *                         in den aktuellen Farben. Die Fläche wird nicht            *
  532. *                         ausgefüllt.                                                                                *
  533. *                                                                                                                                *
  534. ****************************************************************/
  535.  
  536. int PlFillPolyLine(counter,array)
  537. int counter;
  538. GPT    *array;
  539. {
  540.     int i,x1,y1;
  541.  
  542.     x1 = *array++;                                        /* Startpunkt zuweisen            */
  543.     y1 = *array++;
  544.     PlTrans(&x1,&y1);                                    /* translaten                                */
  545.     fprintf(plotfile,"%s %d %d;%s;\n",
  546.                                         HpPU,x1,y1,HpPD);
  547.     for (i=1;i<counter;i++)                        /* alle restlichen Punkte        */
  548.     {
  549.         x1 = *array++;                                    /* zuweisen und                            */
  550.         y1 = *array++;
  551.         PlTrans(&x1,&y1);                                /* translaten                                */
  552.         fprintf(plotfile,"%s %d %d;\n",    /* schreiben                                */
  553.                                             HpPA,x1,y1);
  554.     }
  555.     fprintf(plotfile,"%s;\n",HpPU);
  556.     return(TRUE);                                            /* ohne Worte                                */
  557. }
  558.  
  559. /****************************************************************
  560. *                                                                                                                                *
  561. *    Function : PlSetFillStyle()                                                                        *
  562. *                                                                                                                                *
  563. *****************************************************************
  564. *                                                                                                                                *
  565. *         Input : int style                Füllmuster                                                *
  566. *                                                                                                                                *
  567. *        Output : void                                                                                                *
  568. *                                                                                                                                *
  569. *****************************************************************
  570. *                                                                                                                                *
  571. *     Comment : Ein Plotter kann kein Polygon ausfüllen, desshalb    *
  572. *                         nur wegen Kompatibilität.                                                    *
  573. *                                                                                                                                *
  574. ****************************************************************/
  575.  
  576. void PlSetFillStyle(style)
  577. int style;
  578. {
  579.     style = style;
  580. }
  581.  
  582. /****************************************************************
  583. *                                                                                                                                *
  584. *    Function : PlDrawRectangle()                                                                    *
  585. *                                                                                                                                *
  586. *****************************************************************
  587. *                                                                                                                                *
  588. *         Input : x1,y1,x2,y2                                                                                *
  589. *                            int x1                    linke                                                            *
  590. *                            int y1                    obere Ecke                                                *
  591. *                            int x2                    rechte                                                        *
  592. *                            int y2                    untere Ecke                                                *
  593. *                                                                                                                                *
  594. *        Output : void                                                                                                *
  595. *                                                                                                                                *
  596. *****************************************************************
  597. *                                                                                                                                *
  598. *     Comment : Zeichnet ein Rechteck in der aktuellen Farbe                *
  599. *                                                                                                                                *
  600. ****************************************************************/
  601.  
  602. void PlDrawRectangle(x1,y1,x2,y2)
  603. int x1,
  604.         y1,
  605.         x2,
  606.         y2;
  607. {
  608.  
  609.     PlTrans(&x1,&y1);                                    /* translaten                                */
  610.     PlTrans(&x2,&y2);
  611.                                                                         /* und schreiben                        */
  612.     fprintf(plotfile,"%s %d %d;%s %d %d;\n",
  613.                                         HpPU,x1,y1,HpEA,x2,y2);
  614. }
  615.  
  616. /****************************************************************
  617. *                                                                                                                                *
  618. *    Function : PlGetTextSize()                                                                        *
  619. *                                                                                                                                *
  620. *****************************************************************
  621. *                                                                                                                                *
  622. *         Input : axis                        Breite oder Höhe                                        *
  623. *                                                                                                                                *
  624. *        Output : int size                Grösse in Punkten                                        *
  625. *                                                                                                                                *
  626. *****************************************************************
  627. *                                                                                                                                *
  628. *     Comment : gibt die Textgrösse für die entsprechende Achse        *
  629. *                         zurück.                                                                                        *
  630. *                                                                                                                                *
  631. ****************************************************************/
  632.  
  633. int PlGetTextSize(axis)
  634. int axis;
  635. {
  636.     if (axis == XSIZE)                                /* X-Achse ?                                */
  637.         return(xp/79);                                    /* Ja                                                */
  638.     else                                                            /* sonst Y-Achse                        */
  639.         return(yp/47);
  640. }
  641.  
  642. /****************************************************************
  643. *                                                                                                                                *
  644. *    Function : PlSetLineStyle()                                                                        *
  645. *                                                                                                                                *
  646. *****************************************************************
  647. *                                                                                                                                *
  648. *         Input : int typ                        Liniendarstellung                                *
  649. *                                                                                                                                *
  650. *        Output : void                                                                                                *
  651. *                                                                                                                                *
  652. *****************************************************************
  653. *                                                                                                                                *
  654. *     Comment : setzt den entsprechenden Linientyp.                                *
  655. *                                                                                                                                *
  656. ****************************************************************/
  657.  
  658. void PlSetLineStyle(typ)
  659. int typ;
  660. {
  661.  
  662.     static int style[] =                            /* Verhältnisdefinition            */
  663.     {
  664.         2,1,
  665.         2,2,
  666.         2,4,
  667.         2,6
  668.     };
  669.  
  670.     if (typ == SOL_LINE)                            /* ausgezogene Linie                */
  671.         fprintf(plotfile,"%s;",HpLT);        /* setzte diese                            */
  672.     else                                                            /* sonst                                        */
  673.     {
  674.         typ--;                                                    /* für array                                */
  675.         fprintf(plotfile,"%s %d %f;\n",    /* setzte Linientyp                    */
  676.                                             HpLT,
  677.                                             style[typ*2],
  678.                                             style[typ*2+1]/2.0);
  679.     }
  680. }
  681.  
  682. /****************************************************************
  683. *                                                                                                                                *
  684. *    Function : PlRotate()                                                                                    *
  685. *                                                                                                                                *
  686. *****************************************************************
  687. *                                                                                                                                *
  688. *         Input : int phi                Winkel in Grad                                            *
  689. *                                                                                                                                *
  690. *        Output : void                                                                                                *
  691. *                                                                                                                                *
  692. *****************************************************************
  693. *                                                                                                                                *
  694. *     Comment : Dreht die Ausgabe um 90 Grad.                                            *
  695. *                                                                                                                                *
  696. ****************************************************************/
  697.  
  698. static void PlRotate(phi)
  699.     int phi;
  700.     {
  701.         fprintf(plotfile,"%s %d;\n",        /* schreibe Winkel                    */
  702.                                             HpRO,phi);
  703.     }
  704.  
  705. /****************************************************************
  706. *                                                                                                                                *
  707. *    Function : PlTrans()                                                                                    *
  708. *                                                                                                                                *
  709. *****************************************************************
  710. *                                                                                                                                *
  711. *         Input : x,y                                                                                                *
  712. *                            int x                        Zeiger auf Koordinatenpunkt                *
  713. *                            int y                                                                                            *
  714. *                                                                                                                                *
  715. *        Output : void                                                                                                *
  716. *                                                                                                                                *
  717. *****************************************************************
  718. *                                                                                                                                *
  719. *     Comment : Verschiebt und spiegelt die Plotausgabe zusätzlich    *
  720. *                         genüber der normalen Ausgabe.                                            *
  721. *                                                                                                                                *
  722. ****************************************************************/
  723.  
  724. static void PlTrans(x,y)
  725. int *x,*y;
  726. {
  727.     *x = *x+xop;                                            /* einfache Rechenoperation    */
  728.     *y = -*y+yp+yop;
  729. }
  730.  
  731.