Recent

Author Topic: TADiagram - Lazarus Library  (Read 7461 times)

Researching

  • Full Member
  • ***
  • Posts: 121
TADiagram - Lazarus Library
« on: February 01, 2020, 05:16:56 am »
Want to create a Diagram Library for Lazarus.
Initial requirements:
SHAPES                    : FlowChart, mind map,
PROPERTIES             : texts, comments for nodes and links,
SAVE AS/IMPORT      :  TXT, XML, CSV

Any suggestions? Any unwaited, unobvoius problems from your experience...

Greately appreciated:
1. high level concepts: properties of a "perfect library"
//? entry points, interfaces...
2. low level concepts: requirements to make the library HW efficient
// and OS-portable in what depends on code, not on compiler
3. 3D advices: to make it 3d capable in the future.
4. possible open source candidates and/or other libraries.

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: TADiagram - Lazarus Library
« Reply #1 on: February 01, 2020, 10:51:36 am »
there where two components posted in this forums if you search for them.
1) was a port of an old delphi library (simple graph, draw objects or something)
2) the other a new library written from one of the forum attendants.

Sorry I can't remember more details, search the forums.

Researching

  • Full Member
  • ***
  • Posts: 121
Re: TADiagram - Lazarus Library
« Reply #2 on: February 01, 2020, 11:05:04 am »
As far as understand for now...
(supposed to be converted to OOP class hierarchy):

Needed objects:
entity [<name>,<type>,<content>,<outsideView>,<insideView>];
entity.type    ::=   <diagram>|<package>|<shape>|<link>;
content         ::=   <diagram>,<text>,<graphics>;
diagram        ==    diagramField;              //as drawing area, *recursive
package        ::=   set<of entities>;
shape           :=   [*entity*\<type=shape>+<x,y>,<size>];
link               :=   [*entity*+<start>,<end>];

// shape=: structure(value | M ) | comment


----------- Any suggestions on this?

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: TADiagram - Lazarus Library
« Reply #3 on: February 01, 2020, 12:15:27 pm »
As far as understand for now...
(supposed to be converted to OOP class hierarchy):

Needed objects:
entity [<name>,<type>,<content>,<outsideView>,<insideView>];
entity.type    ::=   <diagram>|<package>|<shape>|<link>;
content         ::=   <diagram>,<text>,<graphics>;
diagram        ==    diagramField;              //as drawing area, *recursive
package        ::=   set<of entities>;
shape           :=   [*entity*\<type=shape>+<x,y>,<size>];
link               :=   [*entity*+<start>,<end>];

// shape=: structure(value | M ) | comment


----------- Any suggestions on this?
simple graph is a single component with the ability to draw a number of objects move and resize them as needed using the mouse. There is no support for specific logic entities, uml, erd or flaw charts. It has the ability to link them through a link object but since it is based on the "simple graph" theory where link back to ones self is not allowed you can't use it to link back to any type of graph. It supports a number of different shapes for graph and multi line links but thats about it.

Draw objects is the opposite a number of different shapes that can be moved/resized etc at run time, with a couple of specific links (lines between them) like L shaped link Z shaped link etc but no container (ee diagram) you need to provide your own, a simple Tscrollbox should do the trick.
If I remember correctly it has already been used on a open source flaw charting application, I think there is a link for the application in this forum somewhere. I can not search now my self but if you can't find anything post a request and I will try to locate the app from home later today.

As for the requirements of the diagramming you seem to ask for input I would say start with a very specific type of diagram something simple like an hierarchy diagram of shorts with very specific shapes and roules of interactivity as an example
1) supported shapes are circles and rectangles
2) they auto center on the working area,
3) the children should auto auto center to their parent
etc.
Do not try to define a generic structure at this point just the simplest you might need and then build on top of it as you go along.

Good luck.

wp

  • Hero Member
  • *****
  • Posts: 11915
Re: TADiagram - Lazarus Library
« Reply #4 on: February 01, 2020, 01:31:04 pm »
The name of your diagram library, TADiagram, reminds me that the same exists within TAChart. Alexander Klenin, the former maintainer, started it with some units, but I think it is not complete - I never used it. Maybe you can find out how to use it and what is missing.

Researching

  • Full Member
  • ***
  • Posts: 121
Re: TADiagram - Lazarus Library
« Reply #5 on: February 02, 2020, 02:17:42 pm »
Wp, do you mean that there is some unfinished functionality in TAChart?

To every one: what could be more promising?:
* build my own base for library?
* build on top of some one's source?

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: TADiagram - Lazarus Library
« Reply #6 on: February 02, 2020, 06:20:00 pm »
To every one: what could be more promising?:
* build my own base for library?
* build on top of some one's source?

I would choose on top of an existing library that gives me the most abilities I need and the freedom to add/remove features easily.

From the known libraries I would go with something like the simple graph. It has the base to be extended in both directions ee drawing engines/canvas etc and the entities, links. As far as I remember it supports saving/loading, copy/paste, bezier links and export in bitmaps. It would be easier to focus on your entities, logic etc. Printing might be as simple as exporting the graph to bitmap and sending that to the printer.

Well you get the idea I hope but most important is what will make you more productive not only today but in the future too ee is it faster to reinvent the wheel or learn to balance on some one else's wheel.

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
Re: TADiagram - Lazarus Library
« Reply #7 on: February 02, 2020, 07:39:27 pm »
@Researching

Look at here https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/tachart/?root=lazarus, there are 3 files:
- tadiagram.pas
- tadiagramdrawing.pas
- tadiagramlayout.pas

It's all in TAChart.
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

nsl

  • New Member
  • *
  • Posts: 16
Re: TADiagram - Lazarus Library
« Reply #8 on: February 03, 2020, 03:48:41 pm »
Researching, you may also like to look at the TECSheme control in the Eye-Candy controls package https://wiki.lazarus.freepascal.org/Eye-Candy_Controls#TECScheme
Lazarus 2.1 on Windows 10 / macOS Mojave

PeterEvans

  • New Member
  • *
  • Posts: 24
Re: TADiagram - Lazarus Library
« Reply #9 on: February 04, 2020, 12:12:31 am »
Hello Researching,
Here are some of my ideas for a general purpose diagram library.

SHAPES : Square, Rectangle, Circle.
DIAGRAM : Flow Chart, Mind Map, Family Tree.
SAVE AS/IMPORT : TXT, XML, CSV, JPG, PDF.


(1) I would like to be able to create my diagram programmatically. Then display it.
I would like to define the dimensions of the Shape. For example, 100 pixels wide.

(2) I would like to see shapes on the screen and be able to select them.

(3) I would like to be able to create my own shape and be able to add it to the screen so that the user can select it.

For example, a simple Square shape in which I place the text %NAME%

At run time I would substitute a person's name into the square.

(4) All text to be Unicode. The names of the shapes can be Unicode.

For example, Japanese text, Russian text.

(5) Connections between shapes. Consider a simple Square shape.
I want a connection at top centre, right centre, bottom centre, left centre.
I want the connection to be a single line or double line.
Better still to be of varying widths.

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: TADiagram - Lazarus Library
« Reply #10 on: February 05, 2020, 06:52:09 am »
Hello Researching,
Here are some of my ideas for a general purpose diagram library.

SHAPES : Square, Rectangle, Circle.
DIAGRAM : Flow Chart, Mind Map, Family Tree.
SAVE AS/IMPORT : TXT, XML, CSV, JPG, PDF.


(1) I would like to be able to create my diagram programmatically. Then display it.
I would like to define the dimensions of the Shape. For example, 100 pixels wide.

(2) I would like to see shapes on the screen and be able to select them.

(3) I would like to be able to create my own shape and be able to add it to the screen so that the user can select it.

For example, a simple Square shape in which I place the text %NAME%

At run time I would substitute a person's name into the square.

(4) All text to be Unicode. The names of the shapes can be Unicode.

For example, Japanese text, Russian text.

(5) Connections between shapes. Consider a simple Square shape.
I want a connection at top centre, right centre, bottom centre, left centre.
I want the connection to be a single line or double line.
Better still to be of varying widths.
Simple Graph supports all all of them it comes with a demo program that show cases the designer. I think you can find it on github or the online package manager.

Researching

  • Full Member
  • ***
  • Posts: 121
Re: TADiagram - Lazarus Library
« Reply #11 on: February 05, 2020, 11:18:29 am »
After PeterEvans:
SHAPE EDITOR + SHAPE BASKET//WITH CATHEGORIES + RECENT
SHAPES BASIC: Circle, Polygon
LINK    EDITOR + LINK    BASKET//WITH CATHEGORIES + RECENT

DIAGRAM STRUCTURES EDITOR
DIAGRAM STRUCTURES BASIC: Flow Chart, Mind Map, Tree
SAVE AS/IMPORT :XML, CSV, TXT, (ACTUALLY - INTERNAL FORMATS)
EXPORT : *.ODT(!IMPORTANT), JPG, pdf.
// sorry: either there is already a PDF writing library, which I just include, or this functionality will lack.

After sstvmaster, HeavyUser, nsl

Will be taken to consideration:
 https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/tachart/?root=lazarus, there are 3 files:
- tadiagram.pas
- tadiagramdrawing.pas
- tadiagramlayout.pas
SimpleGraph
https://wiki.lazarus.freepascal.org/Eye-Candy_Controls#TECScheme

PeterEvans

  • New Member
  • *
  • Posts: 24
Re: TADiagram - Lazarus Library
« Reply #12 on: February 06, 2020, 12:49:27 am »
Thank you HeavyUser and Researching for your responses.

I found under a Lazarus Package - EvsSimpleGraph.
This is based on TSimpleGraph v2.80 by Kambiz R. Khojasteh.

Going to http://www.delphiarea.com/products/delphi-components/simplegraph/
one finds that is at v2.91 of 25 Jan 2014.
On 2 Feb 2014 Kambix Khojasteh stated
 "I am sorry but I have no plan to extend SimpleGraph.
It is a while that I’ve stopped programming in Delphi. I only maintain the components/packages on this site.".

When was EvsSimpleGraph updated? Unfortunately the Lazarus Package page does not give the release date. This would be a useful addition to the Lazarus Package page. Does EvsSimpleGraph have the changes v2.80 through 2.91 of TSimpleGraph? Unfortunately I do not know.

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: TADiagram - Lazarus Library
« Reply #13 on: February 06, 2020, 01:50:49 am »
Thank you HeavyUser and Researching for your responses.

I found under a Lazarus Package - EvsSimpleGraph.
This is based on TSimpleGraph v2.80 by Kambiz R. Khojasteh.

Going to http://www.delphiarea.com/products/delphi-components/simplegraph/
one finds that is at v2.91 of 25 Jan 2014.
On 2 Feb 2014 Kambix Khojasteh stated
 "I am sorry but I have no plan to extend SimpleGraph.
It is a while that I’ve stopped programming in Delphi. I only maintain the components/packages on this site.".

When was EvsSimpleGraph updated? Unfortunately the Lazarus Package page does not give the release date. This would be a useful addition to the Lazarus Package page. Does EvsSimpleGraph have the changes v2.80 through 2.91 of TSimpleGraph? Unfortunately I do not know.
I have no idea but this is the wrong question. What do you need that is not supported by the component and is that feature part of the newer version?

Researching

  • Full Member
  • ***
  • Posts: 121
Re: TADiagram - Lazarus Library
« Reply #14 on: February 06, 2020, 09:06:41 pm »
Inspiring replies, colleagues.
What I'm up to: begin really get introduced to meant packages.

Question: what is the best or just efficient approach of investigating unknown code?
In the past, what I did: use refactoring features to rename semantically every one identifier. Rather boring and time-consuming task.
Is there any better approach or a way to do this quickly?

 

TinyPortal © 2005-2018