Tuesday, 9 February 2010

Parsing and drawing molecular structures with delphi part II

Today I've released the last version of my program with several changes into the graph script implementation. This new version has a little windows with a simple syntax highlighting system with the usually tokens that I use in my script. The scripting language is very easy to use and very intuitive instead of only writing numbers with no sense. Now we can create and manipulate the way the graphs are created by simple commands. I'm working on the syntax checker that will tell you the error line and a little description of the problem.

Now we can write:


layout.node(x).ToNode(y).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];


where:

layout, is the canvas where we need to create our node or to look for our node. node(x) is the first node to need to be created and this will be connected to toNode(y). We can finish this sentence here (with a semicolon mark ";") or going on calling the parameters. Where we have, the EdgeType, SizeBox, LineColor and PenWidth parameters. On the EdgeType parameter, we can use this list:
  • SimpleEdge
  • SimpleArrowEdge
  • SimpleDoubleArrowEdge
  • SimpleDoubleLinkedArrowEdge
  • DottedEdge
  • DottedArrowEdge
  • DottedDoubleArrowEdge
  • DottedDoubleLinkedArrowEdge
Each of one of these edges, will draw a different kind of component into the layout. For the SizeBox we can specify an integer number in pixels to build or resize the length of every box inside the command. The line colour is a typical delphi constant like clRed, clBlue, clYellow, etc. and the last property as an integer number as well as the SizeBox, PenWidth, that will change the width of the line drawn.

This script will generate the next diagram:

I'll try to finish all the things that I have in mind this week in order to focus on other parts of the application. Due to the last petitions into the post "Automation Object Library for Vijeo Citect", I'm being forced to show you (willingly) my last achievements into this field. I'm still merging my last application "Thundax Box Manager" with the last version of my "Canvas test Framework", and I'm very keen on releasing the new application "Thundax P-zaggy" that will contain all the modules to work with graphs.

You can now download the last released version from SourceForge:
I hope you enjoy!.

0 comments:

Post a Comment