openmolecules.org

 
Home » DataWarrior » Functionality » FlyingObjects.dwar's picture and description fields (How to create a visualization like flyingobjects.dwar?)
FlyingObjects.dwar's picture and description fields [message #304] Fri, 02 February 2018 03:45 Go to next message
etcdata is currently offline  etcdata
Messages: 2
Registered: February 2018
Junior Member
Hello,

The flyingobjects.dwar file which comes with DW has a picture and description associated with each row in the data table.

Can you point me to some documentation describing how such a visualization file is created?


Thank you.
Re: FlyingObjects.dwar's picture and description fields [message #306 is a reply to message #304] Sun, 04 February 2018 19:54 Go to previous messageGo to next message
thomas is currently offline  thomas
Messages: 141
Registered: June 2014
Senior Member
There is not official explanation and there is no direct way from DataWarrior to import images or html content.

But you can do that with a little editing of the dwar file in a text editor.

Lets assume you intend to add html and jpeg files to a column named 'Name'. You start with:
-a dwar file without any associated html or jpeg content.
-a folder with html files and one with jpeg files, both to be associated with the rows of the dwar file.

First you need to define one of the dwar's columns to carry the detail information.
This is done by defining column properties. Lets assume you want to add the detail links to
a column called 'Name'. For that you need to extend the column properties section, if there is one.
Otherwise you create a new one just after the </datawarrior-fileinfo> line. For that you add these lines:
<column properties>
<columnName="Name">
<columnProperty="detailCount 2">
<columnProperty="detailType0 image/jpeg">
<columnProperty="detailName0 Picture">
<columnProperty="detailSource0 relPath:images/">
<columnProperty="detailName1 Description">
<columnProperty="detailType1 text/html">
<columnProperty="detailSource1 relPath:html/">
</column properties>

These lines define for the column 'Name' two detail types (indicated by '0' and '1'):
- mime type 'image/jpeg' with the name 'Picture' to be found in a directory 'images'
- mime type 'text/html' with the name 'Description' to be found in a directory 'html'
Likewise you might use 'absPath' to define a complate detail directory path rather than a relative path from the dwar file.

Now you may concatenate detail file references to the respective cell content of the 'Name' column.
For instance you may add to a cell containing the name 'Aermacchi' the following: '|#|0:aermacchi.jpg|#|1:aermacchi.html'.
'|#|' serves as separator. Then comes a number (here 0 or 1) referring to the detail number in the properties section.
After the columns comes the detail file name. It must reflect the defined mime type.

If you open the updated dwar file in DataWarrior, if will show you the detail information. You may
the save the file under a different name and DataWarrior will ask you, whether the detail shall
be imported directly into the dwar file. If you do so, the directories with the individual files are not needed anymore.

I hope, I was clear and this solves your question...

Thomas

[Updated on: Sun, 04 February 2018 19:55]

Report message to a moderator

Re: FlyingObjects.dwar's picture and description fields [message #312 is a reply to message #306] Tue, 06 February 2018 11:34 Go to previous message
etcdata is currently offline  etcdata
Messages: 2
Registered: February 2018
Junior Member
Yes you have solved my question, thank you.

Inspection of the flyingobjects.dwar file shows that pictures are encoded to text for embedding and digging around in the source code revealed that the BinaryEncoder class is responsible for doing the encoding. I'll be able to generate dwar with embedded content now.


Previous Topic: Option to freeze columns and rows.
Next Topic: calculated props after file merge/append
Goto Forum:
  


Current Time: Tue May 22 02:11:49 CEST 2018

Total time taken to generate the page: 0.00584 seconds