TSimpleGraph
v1.50
|
Copyright ©
Kambiz R. Khojasteh. All rights reserved.
Get future component updates from http://www.delphiarea.com.
Delphi 4 | Delphi 5 | Delphi 6 | Delphi 7 |
TSimpleGraph is a visual component, which provides a simple user interface for drawing simple graphs/digraphs. User can draw nodes (vertices) on the control's client area and link them together (graph's edges or arcs) by either keyboard or mouse. Currently the component supports three different shapes for the nodes, however the new shapes can be added. The component is fully customizable and has methods for supporting Delphi's clipboard and printer objects.
TSimpleGraph
= class(TCustomControl) TSimpleGraph is a windowed control that provides a canvas for drawing a graph. It also manages relation between graph objects and the application.
|
TGraphObjectList
= class(TList)
|
TGrephObjectClass
= class of TGraphObject
|
TGraphLinkClass
= class of TGraphLink
|
TGraphNodeClass
= class of TGraphNode
|
TPolygonalNode
= class(TGraphNode) (Abstract) |
TRectangularNode
= class(TGraphNode) |
TRoundRectangularNode
= class(TGraphNode) |
TEllipticNode
= class(TGraphNode) |
TTriangularNode
= class(TPolygonalNode) |
TRhomboidalNode
= class(TPolygonalNode) |
TPentagonalNode
= class(TPolygonalNode) |
TGraphScrollBar
= class(TPersistent) |
function
ReadGraphObject(Stream: TStream; Owner: TSimpleGraph): TGraphObject; |
procedure
WriteGraphObject(Stream: TStream; GraphObject: TGraphObject); |
function
IsBetween(Value: Integer; Bound1, Bound2: Integer): Boolean; |
function
TransformRgn(Rgn: HRGN; const XForm: TXForm): HRGN; |
procedure
RotatePoints(var Points: array of TPoint; const Angle: Extended; const
Org: TPoint); Rotates points specified by the Points parameter across a point specified by the Org parameter. The amount of rotation specifies by the Angle parameter in radians. |
procedure
OffsetPoints(var Points: array of TPoint; dX, dY: Integer); Moves the specified points by the specified offsets. |
function
CenterOfPoints(var Points: array of TPoint): TPoint; Returns the center point of the specified points. |
function
BoundsRectOfPoints(var Points: array of TPoint): TRect; Returns the bounding rectangle of the specified points. |
function
MakeRect(const Corner1, Corner2: TPoint): TRect; Returns a rectangle that is reperesented by its two corner points. |
function
CenterOfRect(const Rect: TRect): TPoint; Returns the center point of the rectangle specified by Rect parameter. |
function
LineSlopeAngle(const LinePt1, LinePt2: TPoint): Extended; Returns the slope angle of the line that pass through the points specified by LinePt1 and LinePt2 parameters. |
function
DistanceToLine(const LinePt1, LinePt2, QueryPt: TPoint): Integer; Returns the distance of a point specified by QuaryPt parameter from the line that pass through the points specified by LinePt1 and LinePt2 parameters. |
function
NextPointOfLine(const LineAngle: Extended; const ThisPoint: TPoint;
Distance: Integer): TPoint; Returns the cordinates of the point, which is on a line reperesented by LineAngle and ThisPoint parameters. The distance of the returned point from the point specified by ThisPoint parameter, is specified by Distance parameter. |
function
IntersectLines(const Line1Pt: TPoint; const Line1Angle: Extended; const
Line2Pt: TPoint; const Line2Angle: Extended; out Intersect: TPoint):
Boolean ; If the two specified lines intersect each other, the function returns True and sets the Intersect parameter to the intersection point. Otherwise, the function returns False. |
function
IntersectLineRect(const LineAngle: Extended; const Bounds: TRect; Backward:
Boolean): TPoint; Retruns the intersection cordinate of a rectangle specified by the Bounds parameter with a line that pass through center of the rectangle with an angle specified by LineAngle parameter in radians. Because there are two intersection points, use Backward parameter to specify your desired one. |
function
IntersectLineRoundRect(const LineAngle: Extended; const Bounds: TRect;
Backward: Boolean; Rgn: HRgn): TPoint; Retruns the intersection cordinate of a round rectangle specified by Bounds and Rgn parameters with a line that pass through center of the round rectangle with an angle specified by LineAngle parameter in radians. Because there are two intersection points, use Backward parameter to specify your desired one. |
function
IntersectLineEllipse(const LineAngle: Extended; const Bounds: TRect;
Backward: Boolean): TPoint; Retruns the intersection cordinate of an ellipse specified by the Bounds parameter with a line that pass through center of the ellipse with an angle specified by LineAngle parameter in radians. Because there are two intersection points, use Backward parameter to specify your desired one. |
function
IntersectLinePolygon(const LineAngle: Extended; const Vertices: array
of TPoint; Backward: Boolean): TPoint; Retruns the intersection cordinate of a polygon specified by its vertices with a line that pass through center of the polygon with an angle specified by LineAngle parameter in radians. Because there are at least two intersection points, use Backward parameter to specify your desired one. The verices of the polygon should be in clockwise order, and the first vertex should be at 12 O'clock. |
Key | Function | |
Left | Moves the selected objects to the left by the number of graph's units specified by the GridSize property. | |
Right | Moves the selected objects to the right by the number of graph's units specified by the GridSize property. | |
Up | Moves up the selected objects by the number of graph's units specified by the GridSize property. | |
Down | Moves down the selected objects by the number of graph's units specified by the GridSize property. | |
Ctrl+Left | Moves the selected objects to the left by one graph's unit. | |
Ctrl+Right | Moves the selected objects to the right by one graph's unit. | |
Ctrl+Up | Moves up the selected objects by one graph's unit. | |
Ctrl+Down | Moves down the selected objects by one graph's unit. | |
Shift+Left | Decreases width of the selected objects by the number of graph's units specified by the GridSize property. | |
Shift+Right | Increases the width of the selected objects by the number of graph's units specified by the GridSize property. | |
Shift+Up | Decreases the height of the selected objects by the number of graph's units specified by the GridSize property. | |
Shift+Down | Increases the height of the selected objects by the number of graph's units specified by the GridSize property. | |
Shift+Ctrl+Left | Decreases width of the selected objects by one graph's unit. | |
Shift+Ctrl+Right | Increases width of the selected objects by one graph's unit. | |
Shift+Ctrl+Up | Decreases height of the selected objects by one graph's unit. | |
Shift+Ctrl+Down | Increases height of the selected objects by one graph's unit. | |
Del | Deletes the selected objects. | |
Enter | Fires the OnObjectDblClick event for each selected object (= mouse double click). | |
Esc | Deselects the selected objects. | |
Ins | Inserts a new node. | |
Ctrl+Ins | Links selected nodes together. | |
Tab | Selects the next node. | |
Shift+Tab | Selects the prior node. | |
Ctrl+Tab | Selects the next link. | |
Shift+Ctrl+Tab | Selects the prior link. | |
Ctrl+X | Cuts the selected objects in the Clipboard. | |
Ctrl+C | Copies the selected objects in the Clipboard. | |
Ctrl+V | Pastes the Clipboard's Contents in the graph. | |
NumPad Plus | Increases the zoom factor by ZoomStep value (= mouse wheel up). | |
NumPad Minus | Decreases the zoom factor by ZoomStep value (= mouse wheel down). |
Special thanks to:
TSimpleGraph component is freeware. You may copy component's files AS LONG AS YOU COPY ALL OF THEM. If you want to change the source code in order to improve the component's features, performance, etc. please send me the new source code so that I can have a look at it. The changed source code should contain descriptions what you have changed, and of course your name. The only thing you MAY NOT CHANGE is the ORIGINAL COPYRIGHT INFORMATION.
TSimpleGraph component is provided "AS IS" without any warranty of any kind, either express or implied. The entire risk as to the quality and performance of the software is with you. The author is NOT liable for any DAMAGES resulting from the use and misuse of the component, especially he is NOT liable for DAMAGES that were caused BY ANY VERSION WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF.
|
END OF DOCUMENT |