Autor |
Beitrag |
der organist
Beiträge: 467
Erhaltene Danke: 17
WIN 7
NQC, Basic, Delphi 2010
|
Verfasst: Mi 03.10.12 14:09
Liebe Community,
ich habe bei meinem Projekt zu viele Units gehabt um sie alle noch zu überblicken und brauchte eine Zusammenfassung der Methoden und Klassen mit eventuellen Kommentaren. Von BlueJ (Java) (einige werden es kennen und nicht mögen) kenne ich die Möglichkeit Kommentare nicht nur mit sondern zu kennzeichnen und dann mit einem Tool zu einer HTML-Dokumentation zusammenzufassen. Das habe ich (auch mit Forenhilfe) leider nicht gefunden und deshalb kurzerhand selbst geschrieben.
Was die Unit kann:
Eine Dokumentation erstellen:
- TDocumenter erstellen und CreateDocumentation aufrufen.
- in der zu dokumentieren Unit folgendes einfügen:
- [quote] für Dokumentationsstart
- * für Dokumentationsende
- für einen Bereichsanfang, der nicht beachtet werden soll
- für entsprechendes Bereichsende
In der Dokumentations erscheinen dann alle Klassen mit Methoden und den dazugehörigen Kommentaren:
- Kommentar zur Unit muss an ihrem Anfang stehen
- Kommentar zur Klasse direkt nach ihrer Deklaration (vor Datenfeldern etc)
- Kommentare zu Methoden entweder im Interface nach der Deklaration oder im implementation-Teil zwischen ihrem
Methodenkopf und dem Kopf der nächsten Methode
Ich hänge ein Beispiel an, damit man vergleichen kann, wie die Dokumentation aussieht:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189:
| unit UFigures;
interface
uses URegulars, Math, ExtCtrls, Graphics, Windows, UPosition, Classes, Dialogs, SysUtils, Forms;
function GetIntersection(ALine1, ALine2: TLine): TPoint;
type TFigure = class private procedure CalculateCharacteristics; virtual; abstract; public procedure Paint(APBox: TPaintbox); virtual; abstract; function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean; virtual; abstract; end;
TBar = class(TFigure) private FFrom, FTo: TPoint; FAngleToX, FLength: Double; procedure CalculateCharacteristics; override; public procedure Paint(APBox: TPaintbox); override; function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean; override;
property GetAngleToX: Double read FAngleToX; property GetLength: Double read FLength; property GetFrom: TPoint read FFrom; property GetTo: TPoint read FTo; end;
TAngle = class(TFigure) private FLine1, FLine2: TLine; FAngle, FAngleToX, FLength1, FLength2: Double; procedure CalculateCharacteristics; override; public procedure Paint(APBox: TPaintbox); override; function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean; override;
property GetAngleToX: Double read FAngleToX; property GetAngle: Double read FAngle; property GetLength1: Double read FLength1; property GetLength2: Double read FLength2; function GetFrom: TPoint; function GetCentre: TPoint; function GetTo: TPoint; end;
TArc = class(TFigure) private FRadius,FAngleFrom, FAngleTo:Double; FCentre: TPoint; FCurvature,FCurvatureSum: Double; FFrom, FTo: TPoint; procedure CalculateCharacteristics; override; public procedure Paint(APBox: TPaintbox); override; function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean; override; end;
THelix = class(TFigure)
end;
TLetter = class(TFigure) end;
TNumber = class(TFigure) end;
implementation
function GetIntersection(ALine1, ALine2: TLine): TPoint; var s1x, s1y, s2x, s2y, r1x, r1y, r2x, r2y: Integer; l: Double; begin *censored* end;
procedure TBar.CalculateCharacteristics; begin FAngleToX := Angle(FFrom, FTo, Point(0, 0), Point(1, 0)); FLength := SQRT(SQR(FTo.X - FFrom.X) + SQR(FTo.Y - FFrom.Y)); end;
procedure TBar.Paint(APBox: TPaintbox); begin *censored* end;
function TBar.ConditionsFulfilled(const ARegular: Array of TRegular): Boolean; var MaxCurvature, AngleToX, MaxAngleToX, MinAngleToX: Double; k: Integer; begin *censored* end;
procedure TAngle.CalculateCharacteristics; begin *censored* end;
procedure TAngle.Paint(APBox: TPaintbox); begin *censored* end;
function TAngle.ConditionsFulfilled(const ARegular: Array of TRegular): Boolean; var k, SumBigCurvatures, SumEdges, IndexEdge: Integer; LCurvature: Array of Double; TotalCurvature, MaxBowCurvature: Double; Intersection: TPoint; Line1,Line2:TLine; begin *censored* end;
function TAngle.GetFrom; begin *censored* end;
function TAngle.GetCentre; begin *censored* end;
function TAngle.GetTo; begin *censored* end;
procedure TArc.CalculateCharacteristics; var n,d:TPoint; k:Double; begin *censored* end;
procedure TArc.Paint(APBox: TPaintbox); begin *censored* end;
function TArc.ConditionsFulfilled(const ARegular: array of TRegular): Boolean; var MaxRadius,MinRadius:Double; BowExists:Boolean; k,AmountOfBows: Integer; Line1,Line2:TLine; HCentre,HFrom,HTo:TPoint; begin *censored* end;
end. |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109:
| function GetIntersection(ALine1, ALine2: TLine): TPoint;
TFigure
//* Eine Figur ist das Ergebnis der Analyse und muss ALLE regelmäßigen // // Strukturen (TLine, TBow) beinhalten. *//
private
procedure CalculateCharacteristics; virtual; abstract;
//* Berechnet die Charakteristika einer Figur aus den Werten, die für // // das eindeutig Erzeugen nötig sind. *//
public
procedure Paint(APBox: TPaintbox); virtual; abstract;
function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean;
//* Prüft, ob alle regelmäßigen Figuren aus TRegular einer Figur genügen. *//
TBar (TFigure)
//* selbsterklärend // // Charakteristika: Länge, Winkel zur x-Achse, Anfangs- und Endpunkt *//
private
procedure CalculateCharacteristics; override;
public
procedure Paint(APBox: TPaintbox); override;
function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean;
property GetAngleToX: Double read FAngleToX;
property GetLength: Double read FLength;
property GetFrom: TPoint read FFrom;
property GetTo: TPoint read FTo;
TAngle (TFigure)
//* Ein Winkel ist eine Figur mit ausschließlich zwei Geraden. Diese // // schließen einen Winkel größer 45° und kleiner 135° ein. // // Charakteristisch sind: Lage des 1. Schenkels zur x-Achse, Winkel vom 1. // // zum 2. Schenkel, Länge der Schenkel, Anfangs-,End- und Mittelpunkt *//
private
procedure CalculateCharacteristics; override;
public
procedure Paint(APBox: TPaintbox); override;
function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean;
property GetAngleToX: Double read FAngleToX;
property GetAngle: Double read FAngle;
property GetLength1: Double read FLength1;
property GetLength2: Double read FLength2;
function GetFrom: TPoint;
function GetCentre: TPoint;
function GetTo: TPoint;
TArc (TFigure)
//* Ein Bogen ist eine Figur die aus Bögen (und kurzen Geraden) besteht und // // dabei einen konstanten Radius aufweist. Charakteristisch sind // // Krümmung (= überstrichener Winkel, Anfangspunkt und Drehrichtung, Radius // // und Mittelpunkt. *//
private
procedure CalculateCharacteristics; override;
public
procedure Paint(APBox: TPaintbox); override;
function ConditionsFulfilled(const ARegular: Array of TRegular): Boolean;
THelix (TFigure)
TLetter (TFigure)
//* B, D, J, L, M, N, O, P, Q, R, S, U, V, W, Z *//
TNumber (TFigure)
//* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 *// |
Gruss, Lukas
P.S:
Wer mag, kann gerne die Unit insofern erweitern, dass eine ordentliche PDF dabei herumkommt
Einloggen, um Attachments anzusehen!
_________________ »Gedanken sind mächtiger als Waffen. Wir erlauben es unseren Bürgern nicht, Waffen zu führen - warum sollten wir es ihnen erlauben, selbständig zu denken?« Josef Stalin
|
|
der organist
Beiträge: 467
Erhaltene Danke: 17
WIN 7
NQC, Basic, Delphi 2010
|
Verfasst: Mo 08.10.12 10:53
push?
_________________ »Gedanken sind mächtiger als Waffen. Wir erlauben es unseren Bürgern nicht, Waffen zu führen - warum sollten wir es ihnen erlauben, selbständig zu denken?« Josef Stalin
|
|
Lemmy
Beiträge: 792
Erhaltene Danke: 49
Windows 7 / 10; CentOS 7; LinuxMint
Delphi 7-XE10.1, VS 2015
|
Verfasst: Mo 08.10.12 11:15
sorry, falsch gedrückt...
|
|
|