This PR introduces the possibility to visualise models using the Blockly visual programming editor. Concept and/or application definitions (termed "mappings", respectively "recipes" in semantique terminology) are converted from json to xml structures that adhere to the schema definition of Blockly elements (-> relates to https://github.com/Sen2Cube-at/sen2cube.at/issues/368). The resulting xml file is then embedded in a html such that the model can be visualised and explored in a webbrowser as shown below. From the user's point of view, the complexity of the visualisation process is hidden and can be triggered by simply calling .visualise() for a specific mapping or recipe.
Implementation details and features
The implementation of the Blockly xml generation is essentially a reverse engineering of the existing XmlToJsonConverter(). The block definitions are based on the block definitions as used for Sen2Cube, which have been modified as follows:
converting field_dropdowns (e.g. appearance, artifacts, reflectance, topography, layer_dropdown) to field_input elements as different values may be used in semantique
adjustments for relaxing expected input types (groupby can take collections also)
adding root block variants a/b such that concept/application parts can be shown individually
The Html embedding of the xml file utilises a reduced subset of the Javascript-based functions offered in Sen2Cube. It contains the different model views (semantic vs. processing view) as used by Sen2Cube. It further offers an export function to render the model in png format. The Javascript also takes care of handling blocks that are not defined in Sen2Cube (e.g. custom verbs or custom measurements/layers).
Challenges & Future Developments
The conversion to label representations is still missing. All numeric types are currently represented as numbers. Representations as labels are feasible but there is no easy way of deciding when to use numbers vs. labels for the Blockly xml representation. This is due to the fact that in the original json structure of a model both types are represented equally as numeric values. Some sort of intelligent recipe evaluation process is needed to make an educated guess if these numeric values should be mapped as numbers or labels for each case. If they should be mapped as labels, one would additionally need to consider the data cube layout to lookup the label names.
Type of change
Select one or more relevant options:
[ ] Bug fix (change which fixes a bug reported in a specific issue)
[x] New feature (change which adds a feature requested in a specific issue)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation update (improved documentation for existing functionality in the package)
[ ] Repository update (change related to non-package files or structures in the GitHub repository)
Summary
This PR introduces the possibility to visualise models using the Blockly visual programming editor. Concept and/or application definitions (termed "mappings", respectively "recipes" in semantique terminology) are converted from json to xml structures that adhere to the schema definition of Blockly elements (-> relates to https://github.com/Sen2Cube-at/sen2cube.at/issues/368). The resulting xml file is then embedded in a html such that the model can be visualised and explored in a webbrowser as shown below. From the user's point of view, the complexity of the visualisation process is hidden and can be triggered by simply calling .visualise() for a specific mapping or recipe.
Implementation details and features
The implementation of the Blockly xml generation is essentially a reverse engineering of the existing
XmlToJsonConverter()
. The block definitions are based on the block definitions as used for Sen2Cube, which have been modified as follows:The Html embedding of the xml file utilises a reduced subset of the Javascript-based functions offered in Sen2Cube. It contains the different model views (semantic vs. processing view) as used by Sen2Cube. It further offers an export function to render the model in png format. The Javascript also takes care of handling blocks that are not defined in Sen2Cube (e.g. custom verbs or custom measurements/layers).
Challenges & Future Developments
The conversion to label representations is still missing. All numeric types are currently represented as numbers. Representations as labels are feasible but there is no easy way of deciding when to use numbers vs. labels for the Blockly xml representation. This is due to the fact that in the original json structure of a model both types are represented equally as numeric values. Some sort of intelligent recipe evaluation process is needed to make an educated guess if these numeric values should be mapped as numbers or labels for each case. If they should be mapped as labels, one would additionally need to consider the data cube layout to lookup the label names.
Type of change
Select one or more relevant options:
Checklist: