[gelöst] V-Modell mit pic(1) darstellen: Grafik horizontal abgeschnitten

Vom einfachen Programm zum fertigen Debian-Paket, Fragen rund um Programmiersprachen, Scripting und Lizenzierung.
Antworten
Benutzeravatar
paedubucher
Beiträge: 856
Registriert: 22.02.2009 16:19:02
Lizenz eigener Beiträge: GNU Free Documentation License
Wohnort: Schweiz
Kontaktdaten:

[gelöst] V-Modell mit pic(1) darstellen: Grafik horizontal abgeschnitten

Beitrag von paedubucher » 21.08.2021 21:14:13

Für pädagogische Zwecke (d.h. zur Abschreckung) möchte ich eine Variante des V-Modells als Grafik festhalten. Hierzu verwende ich pic(1) und pic2graph(1). Der Code ist nicht das Problem, den habe ich einigermassen hingekriegt (v-modell.pic):

Code: Alles auswählen

.PS
AF: box wid 1.6 ht 0.25 "Anforderungen"
SA: box same "Systemarchitektur" at AF.se + (0.1, -0.5)
KA: box same "Komponentenarchitektur" at SA.se + (0.1, -0.5)
MS: box same "Modulspezifikation" at KA.se + (0.1, -0.5)
IM: box same "Implementierung" at MS.se + (0.1, -0.5)
UT: box same "Unittests" at IM.ne + (0.1, 0.5)
IT: box same "Integrationstests" at UT.ne + (0.1, 0.5)
ST: box same "Systemtests" at IT.ne + (0.1, 0.5)
AT: box same "Abnahmetests" at ST.ne + (0.1, 0.5)

arrow from AF.s to SA.n - (0.25, 0) ->
arrow from SA.s to KA.n - (0.25, 0) ->
arrow from KA.s to MS.n - (0.25, 0) ->
arrow from MS.s to IM.n - (0.25, 0) ->
arrow from IM.n + (0.25, 0) to UT.s ->
arrow from UT.n + (0.25, 0) to IT.s ->
arrow from IT.n + (0.25, 0) to ST.s ->
arrow from ST.n + (0.25, 0) to AT.s ->

arrow dotted "validiert durch" above from AF.e to AT.w ->
arrow dotted from SA.e to ST.w ->
arrow dotted from KA.e to IT.w ->
arrow dotted from MS.e to UT.w ->
.PE
Nun generiere ich folgendermassen eine PNG-Datei daraus:

Code: Alles auswählen

$ pic v-modell.pic | pic2graph -colorspace RGB -density 150 -format png >v-modell.png
Auch das haut hin, doch dann das Ergebnis, oh Schreck!

Bild

Leider wird das rechts abgeschnitten. So probiere ich es mit der klassischen Variante, via groff zu PostScript:

Code: Alles auswählen

$ pic <v-modell.pic | groff >v-modell.ps
Doch die Grafik wird rechts an der gleiche Stelle abgeschnitten. Wie kann ich die Software dazu zwingen, mir die volle Breite auszugeben? Ich vermute, es hat wohl was mit der Standard-Seitenbreite (wohl US Letter) zu tun, kenne mich aber in diesem Bereich zu schlecht aus.

Ich könnte natürlich versuchen die Grafik horizontal zu stauchen, doch dann muss ich die Pfeile usw. neu ausrichten. Dazu habe ich keine Lust.

Nachtrag: Dass ich sowas im Unterforum für Softwareentwicklung poste ist doch eigentlich eine Frechheit. Das ist doch ein Anwendungsprogramm! :P
Zuletzt geändert von Meillo am 29.08.2021 12:12:08, insgesamt 1-mal geändert.
Grund: Als geloest markiert
Habe nun, ach! Java
Python und C-Sharp,
Und leider auch Visual Basic!
Durchaus programmiert mit heissem Bemühn.
Da steh' ich nun, ich armer Tor!
Und bin so klug als wie zuvor.

eggy
Beiträge: 3331
Registriert: 10.05.2008 11:23:50

Re: V-Modell mit pic(1) darstellen: Grafik horizontal abgeschnitten

Beitrag von eggy » 21.08.2021 21:32:49

https://tools.ietf.org/doc/groff-base/pic.ps.gz
"Making Pictures With GNU PIC" von Eric S. Raymond sagt
17.1. Scaling Arguments
The DWB pic(1) program accepts one or two arguments to .PS, which is interpreted as a width and
height in inches to which the results of pic(1) should be scaled (width and height scale independently). If
there is only one argument, it is interpreted as a width to scale the picture to, and height is scaled by the
same proportion.
GNU gpic is less general; it accepts a single width to scale to, or a zero width and a maximum height
to scale to. With two non-zero arguments, it scales to the maximum height.
mit ".PS 5" hab ich ne brauchbare Ausgabegröße für groff hinbekommen.

Weiter vorne stand noch mehr zu scale und was zu A4

Benutzeravatar
paedubucher
Beiträge: 856
Registriert: 22.02.2009 16:19:02
Lizenz eigener Beiträge: GNU Free Documentation License
Wohnort: Schweiz
Kontaktdaten:

Re: V-Modell mit pic(1) darstellen: Grafik horizontal abgeschnitten

Beitrag von paedubucher » 21.08.2021 21:49:46

eggy hat geschrieben: ↑ zum Beitrag ↑
21.08.2021 21:32:49
https://tools.ietf.org/doc/groff-base/pic.ps.gz
"Making Pictures With GNU PIC" von Eric S. Raymond sagt
17.1. Scaling Arguments
The DWB pic(1) program accepts one or two arguments to .PS, which is interpreted as a width and
height in inches to which the results of pic(1) should be scaled (width and height scale independently). If
there is only one argument, it is interpreted as a width to scale the picture to, and height is scaled by the
same proportion.
GNU gpic is less general; it accepts a single width to scale to, or a zero width and a maximum height
to scale to. With two non-zero arguments, it scales to the maximum height.
mit ".PS 5" hab ich ne brauchbare Ausgabegröße für groff hinbekommen.

Weiter vorne stand noch mehr zu scale und was zu A4
Mit ".PS 5" sieht das bei mir dann leider so aus:

Bild

Wenn ich runterskaliere, hat der Text zu wenig Platz in den Boxen. Wenn ich einen noch höheren Wert verwende, als dass horizontal Inches benötigt werden, dann wird noch eher abgeschnitten.

Ich denke es ist weniger ein Skalierungsproblem als ein Seitenbreitenproblem. :|
Habe nun, ach! Java
Python und C-Sharp,
Und leider auch Visual Basic!
Durchaus programmiert mit heissem Bemühn.
Da steh' ich nun, ich armer Tor!
Und bin so klug als wie zuvor.

eggy
Beiträge: 3331
Registriert: 10.05.2008 11:23:50

Re: V-Modell mit pic(1) darstellen: Grafik horizontal abgeschnitten

Beitrag von eggy » 21.08.2021 23:11:16

Wie sieht's damit aus?

Code: Alles auswählen

groff -p v-modell.pic -P-pa3 -Tpdf > test.pdf 

Benutzeravatar
paedubucher
Beiträge: 856
Registriert: 22.02.2009 16:19:02
Lizenz eigener Beiträge: GNU Free Documentation License
Wohnort: Schweiz
Kontaktdaten:

Re: V-Modell mit pic(1) darstellen: Grafik horizontal abgeschnitten

Beitrag von paedubucher » 21.08.2021 23:27:56

eggy hat geschrieben: ↑ zum Beitrag ↑
21.08.2021 23:11:16
Wie sieht's damit aus?

Code: Alles auswählen

groff -p v-modell.pic -P-pa3 -Tpdf > test.pdf 
Das funktioniert super, vielen Dank! Alternativ geht es auch mit -P-l (landscape), sehe ich gerade in der Dokumentation.

Jetzt fragt sich nur noch, wie ich das mit pic und pic2graph machen kann.

Nachtrag: Ich habe jetzt eine Lösung gefunden, jedoch ohne pic2graph, dafür mit einem Umweg über ps2eps:

Code: Alles auswählen

$ pic <v-modell.pic | groff -Tps -P-pa3 | ps2eps | convert -colorspace RGB -density 150 -format PNG - v-modell.png
Da ist das Prachtstück:

Bild
Habe nun, ach! Java
Python und C-Sharp,
Und leider auch Visual Basic!
Durchaus programmiert mit heissem Bemühn.
Da steh' ich nun, ich armer Tor!
Und bin so klug als wie zuvor.

Antworten