[Contents] [TitleIndex] [WordIndex

Google Summer of Code 2016 - Xcos Automatic Layout II

Table of contents:

Overview

The idea of Xcos Automatic Layout to provide options to automatically update the layout of an Xcos schema including its links and blocks, so that the diagrams could be kept well-presented. Based on the optimal route for a link, I will improve the positions of blocks including Split Blocks and Normal Blocks. I will also try to implement the preview functionality.

Schedule

  1. Week01 - Check the previous feature (05.23-05.29): Review my previous work based on the latest master branch. Check whether everything works well and try to improve Optimal Link Style if possible.

  2. Week02-05 - Automatic Position of Split Block (05.30-06.26): Implement this feature. Test it and make a commit.

  3. Week04-09 - Automatic Position of Basic Block (06.27-07.24): Implement this feature. Test it and make a commit. This feature might be more difficult and possibly require more time.

  4. Week10-12 - Auto-layout Preview (07.25-08.14): Implement this feature. Test it and make a commit.

  5. Week13 - Final (08.15 - 08.21): Beautify codes, make final commits and write documentation.

Tasks

Implementation

Block Auto-Position - Split Block

Option to set a new position for the SplitBlock. Select the SplitBlocks and press 'P' to find a new position for the SplitBlocks and their links.

Block Auto-Position - Normal Block

Option to set a new position for the Normal Block (BasicBlock excluding SplitBlock and TextBlock). Select the Normal Blocks and press 'N' to find a new position for the Normal Blocks.

  1. Select the blocks which has only 1 IN/OUT port. (Start/End blocks)
    • Choose multiple start/end blocks.
    • Choose several single start/end blocks.
  2. Select the blocks which are not Start/End blocks.
    • If there are blocks on left which are closed, move the block and its right blocks.
    • If there are blocks on right which are closed, move this block and its right blocks.
    • If there are blocks above which are closed, move the block downwards.
    • If there are blocks below which are closed, move this block downwards.
  3. Select some blocks which are connected.
    • Hierarchical Flat connection:
      • make them horizontally aligned if there are more ports in horizontal direction.
      • make them vertically aligned if there are more ports in vertical direction.
    • Tree connection:
      • calculate the depth and the width of the tree.
      • choose the root (the first OUT block) as start block.
      • arrange the positions of the blocks in each level.
    • Reversed Tree connection: (debugging)
      • calculate the depth and the width of the tree.
      • choose the last IN block as start block.
      • arrange the positions of the blocks in each level.
    • Cycled connection: (unfinished)
      • deal with it as a hierarchical flat connection or tree connection.
      • Choose the block on the first left as the start block.

Result

Block Auto-Position - Split Block

Here are 2 testings for Split Blocks.

Example 1.1

Diagram-A in original version:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/SBAP01.png?raw=true

Diagram-A after using SBAP:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/SBAP02.png?raw=true

Example 1.2

Diagram-B in original version:

https://github.com/sampig/Scilab-XcosAutomaticLayout/blob/master/resources/images/SBAP11.png?raw=true

Diagram-B after using SBAP:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/SBAP12.png?raw=true

Block Auto-Position - Normal Block

Here are 3 testings for Split Blocks.

Example 2.1

Diagram-C in original version:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/NBAP01.png?raw=true

Diagram-C after using NBAP for the start/end blocks:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/NBAP02.png?raw=true

Example 2.2

Diagram-D in original version:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/NBAP11.png?raw=true

Diagram-D after using NBAP for keeping a distance away:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/NBAP12.png?raw=true

Example 2.3

Diagram-E in original version:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/NBAP21.png?raw=true

Diagram-E after using NBAP for connected blocks:

https://github.com/sampig/Scilab-XcosAutomaticLayout/raw/master/resources/images/NBAP22.png?raw=true

Future Work

Block Auto-Position - Normal Block

Besides the auto-position for blocks in a Cycled connection, what we want to implement is:

  1. when we select all blocks in a diagram, all the blocks will be in a better position for good-looking.

Relative files which need to be modified:

  1. org.scilab.modules.xcos.utils.NormalBlockAutoPositionUtils

Dynamic Auto Layout Preview

For now, the Scilab/Xcos only supports straight/vertical/horizontal link style preview when creating a link. What we want to implement is:

  1. there is an optimal link style preview when creating a link.
  2. the existing link will be previewed with a dashed line when moving a block.

Relative files which need to be modified:

  1. org.scilab.modules.xcos.preferences.XcosOptions

  2. org.scilab.modules.xcos.utils.XcosRouteUtils

Code Review in Scilab

Block Auto-Position - Split Block

Block Auto-Position - Normal Block

Personal Repository in GitHub

Scilab-XcosAutomaticLayout


Email: <zhuchenf@gmail.com>


2022-09-08 09:27