Com\’è dura la professione!

5 aprile 2013

Springs and forces in QXmlEdit 0.8.5

Filed under: Open Source,QT,qxmledit,xml — lbell @ 20:45
Tags: , ,

A force directed layout graph (http://en.wikipedia.org/wiki/Force-directed_graph_drawing) is is well suited for hierarchical structures or directed graph, perfect to visualize the relationships existent between the elements of a XML structure.

QXmlEdit 0.8.5 lets you view the content of the current data or another file of your choice creating a graphic scene of the current screen dimensions, inserts the graphical representation of the elements in random positions inside it. The nodes migrate into an equilibrium configuration automatically under the application of a force similar to the binding of the electric particles, to reach an optimal distribution in the general case. A damping factor is applied to avoid a long stabilization time of the configuration.

The panel can be reached with one of these methods depending on the data to show:

  • The current file open in the editor

Edit a file and select the menu item “Relations” from the “View” menu.

  • A file on the file system

Choose the “Relations…” item from the”Tools” menu and use the browse button to load a file or drop in a file.

  • The map panel

From the Tools menu, choose the View Map item, before loading any file, check the the “Analyze relations” option; after loading the file, operate the “View Relations…” button.

When the panel is open it is possible to

  • View the structure

The panel shows the relations between elements. Each circle represent an XML element. The lines show a relationship between element types. To evenly distribute the elements on the view area, each element is repelling the others, the nodes are connected by simulated springs.

strcture

  • Move the items

The elements can be dragged with the mouse causing the movement of the other elements until reaching a new equilibrium point. Zoom controls can modify the view.

Each time the “Reset” button is pressed, a new initial casual combination is generated and the elements move themselves to reach a new equilibrium point.

img_06

  • Isolate a single element

Checking the “Center Selected” option, hides all the elements that are not diretcly connected with the selected one. By clicking on one node, you can filter the display of nodes showing only the data related to the selected element.

img_08

The data can be shown also in tabluar format

Each element on the rows show its absolute and relative count and the references made to any other element.

img_09

The settings can be tuned.

 The intensity of the replusive force can be changed using the “Force” slider. The effective distance that the force can act can be set using the “Radius” slider. The lenght of the lines connecting elements can be regulated using the “Spring” slider.

Annunci

22 dicembre 2010

Explore a XML file structure with QXmlEdit

Filed under: Open Source,QT,qxmledit,xml — lbell @ 22:08
Tags: , ,

One of QXmlEdit peculiar characteristics is the possibility to change the quantity and the type of informations shown on a XML file to examine it from various prospectives.

If the XML file is very large and complex it happens to focus on some details missing the big picture. Let us take for example a Qt user interface file, we can face the following situation:


 

it is very difficult, at least for me, to follow the widgets’s structure or differentiate between them. As a first help we can activate a display style that can list in the space reserved to element tag name, the value of one or more attributes that can characterize the element itself. The predefined style provided with QXmlEdit installer displays near to the element tag, the value of ‘name’, ‘id’ or ‘build’ attributes, if any. The styles can be created and installed by the end users; they can be applied using the ‘paint can’ icon button at the bottom right of the data tree.


The style makes the visualization more intuitive and the data structure stand out very quickly.

 

To solve the problem of seeing the element text together with his tag, we can activate the compact view visualization as shown in the following screenshot. The text, if present and if no attributes exist, appears in the column reserved to the attributes with a different color.


 

We can have an overview of the XML file while maintaining the desired level of detail.


Crea un sito o un blog gratuitamente presso WordPress.com.