blob: 09d65d441c04e93827ef4eaad8e637265d4b4b51 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Images generation</title>
<link rel="stylesheet" type="text/css" href="userguide.css">
</head>
<body>
<h2>Images generation</h2>
<p><span class="code">&lt;image&gt;</span> tag must be defined under a <span class="code">&lt;gendoc&gt;</span> tag.</p>
<p>It shall define one of the following attributes:</p>
<ul>
<li><span class="code">object</span> for diagram generation, filled with an ID of the diagram. <a href="#_Displaying_diagrams">See Diagram generation section</a>.</li>
<li><span class="code">filePath</span> for static image generation, filled with the image absolute path. <a href="#_Displaying_static_images">See static image generation section</a>.</li>
</ul>
<p>The drawing are correspond to the entire cell:</p>
<table class="xlsx" width="490">
<tr>
<th></th><th>A</th><th width="40">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;context model='D:/&hellip;/myModel.uml'/&gt;
&lt;gendoc&gt;</br>
<td width="40"/>
</tr>
<tr valign="top" height="150px">
<th>2</th>
<td><strong style="font-weight:900;">&lt;image &hellip; /&gt;</strong></td>
<td/>
</tr>
<tr>
<th>3</th>
<td>&lt;gendoc&gt;</td>
<td width="40"/>
</tr>
</table>
<h3>Customize image size</h3>
<p><span class="code">&lt;image&gt;</code> tag provides the following attributes to handle image size customization:
keepW, keepH, maxW, maxH. They are used in association with the dimensions of the drawing area inside &lt;image&gt; tag:</p>
<ul>
<li><strong>keepW</strong>: output image width will be the same as drawing area width</li>
<li><strong>keepH</strong>: output image height will be the same as drawing area height</li>
<li><strong>maxW</strong>: output image width will not oversize drawing area width</li>
<li><strong>maxH</strong>: output image height will not oversize drawing area height</li>
</ul>
<p>Possible values for these attributes: <span class="code">false</span>(default), <span class="code">true</span>.</p>
<p>For the following initial image:</p>
<img src="img/image_gen_orig.png" width="350"/>
<ul>
<li>Fix image width, height is computed proportionally, the image
overlap partially the next rows.</li>
</ul>
<table class="sample" width="900px">
<tbody>
<tr class="heading">
<td width="50%"><p><strong>Template content</strong></p></td>
<td width="50%"><p><strong>Output</strong></p></td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;gendoc&gt;</td>
<td width="20"/>
</tr>
<tr valign="top" height="75">
<th>2</th>
<td class="code">&lt;image object='&hellip;'
<span class="blue">keepW=&lsquo;true&rsquo; keepH=&lsquo;false&rsquo;/&gt;</span></td>
<td/>
</tr>
<tr height="130" valign="top">
<th>3</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th><td></td><td width="20"/>
</tr>
<tr height="75">
<th>2</th>
<td rowspan="2"><img class="border" src="img/image_gen_orig.png" width="350"/></td>
<td/>
</tr>
<tr height="130">
<th>3</th><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<ul>
<li>Fix image height, width is computed proportionally</li>
</ul>
<table class="sample" width="900px">
<tbody>
<tr class="heading">
<td width="50%"><p><strong>Template content</strong></p></td>
<td width="50%"><p><strong>Output</strong></p></td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;gendoc&gt;</td>
<td width="20"/>
</tr>
<tr valign="top" height="75">
<th>2</th>
<td class="code">&lt;image object='&hellip;'
<span class="blue">keepW=&lsquo;false&rsquo; keepH=&lsquo;true&rsquo;/&gt;</span></td>
<td/>
</tr>
<tr>
<th>3</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th width="20"></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th><td></td><td width="20"/>
</tr>
<tr height="75">
<th>2</th>
<td width="390"><img class="border" src="img/image_gen_orig.png" height="65"/></td>
<td/>
</tr>
<tr>
<th>3</th><td/><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<ul>
<li><strong><u>TO BE AVOIDED</u></strong> : Fix image height and width</li>
</ul>
<table class="sample" width="900px">
<tbody>
<tr class="heading">
<td width="50%"><p><strong>Template content</strong></p></td>
<td width="50%"><p><strong>Output</strong></p></td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
<tr valign="top" height="75">
<th>2</th>
<td class="code">&lt;image object='&hellip;'
<span class="blue">keepW=&lsquo;true&rsquo; keepH=&lsquo;true&rsquo;/&gt;</span></td>
<td/>
</tr>
<tr>
<th>3</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th width="20"></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th><td></td><td width="20"/>
</tr>
<tr height="75">
<th>2</th>
<td width="390"><img class="border" src="img/image_gen_orig.png" width="340" height="65"/></td>
<td/>
</tr>
<tr>
<th>3</th><td/><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<ul>
<li>Ensure the image will not oversize a specified width
<ul>
<li>Case 1 : Image is smaller than the drawing area<br/>
Output corresponds to origin image dimensions, and the picture
may overlap with the following rows.</li>
</ul>
</li>
</ul>
<table class="sample" width="800px">
<tbody>
<tr class="heading">
<td width="50%"><p><strong>Template content</strong></p></td>
<td width="50%"><p><strong>Output</strong></p></td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
<tr valign="top" height="75">
<th>2</th>
<td class="code">&lt;image object='&hellip;'
<span class="blue">maxW=&lsquo;true&rsquo;</span>/&gt;</span></td>
<td/>
</tr>
<tr height="100">
<th>3</th>
<td valign="top">&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th width="20"></th><th>A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th><td></td><td width="20"/>
</tr>
<tr height="75">
<th>2</th>
<td valign="top" rowspan="2" width="390"><img class="border" src="img/image_gen_orig.png" width="280"/></td>
<td/>
</tr>
<tr height="100">
<th>3</th><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<ul>
<li>Case 2 : Image is larger than the drawing area<br/>
Output corresponds to drawing area dimension:</li>
</ul>
<table width="920px" class="sample">
<tbody>
<tr class="heading">
<td width="50%">
<p><strong>Template content</strong></p>
</td>
<td width="50%">
<p><strong>Output</strong></p>
</td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th width="20"></th><th width="240">A</th><th width="220">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
<tr valign="top" height="75">
<th>2</th>
<td class="code">&lt;image object='&hellip;'
<span class="blue">maxW=&lsquo;true&rsquo;</span>/&gt;</span></td>
<td/>
</tr>
<tr height="100">
<th>3</th>
<td valign="top">&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th width="20"></th><th width="240">A</th><th width="160">B</th>
</tr>
<tr>
<th>1</th><td></td><td width="20"/>
</tr>
<tr height="75">
<th>2</th>
<td valign="top" rowspan="2" width="240"><img class="border" src="img/image_gen_orig.png" width="245"/></td>
<td/>
</tr>
<tr height="100">
<th>3</th><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<ul>
<li>Ensure the image will not oversize a specified height
<ul>
<li>Case 1 : Image is smaller than the drawing area<br/>
Output corresponds to origin image dimensions</li>
</ul>
</li>
</ul>
<table width="920px" class="sample">
<tbody>
<tr class="heading">
<td width="50%">
<p><strong>Template content</strong></p>
</td>
<td width="50%">
<p><strong>Output</strong></p>
</td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th width="20"></th><th width="440">A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
<tr valign="top" height="140">
<th>2</th>
<td class="code">&lt;image object='&hellip;'
<span class="blue">maxH=&lsquo;true&rsquo;</span>/&gt;</span></td>
<td/>
</tr>
<tr height="100">
<th>3</th>
<td valign="top">&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th width="20"></th><th width="380">A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th><td></td><td width="20"/>
</tr>
<tr height="140">
<th>2</th>
<td valign="top" width="240"><img class="border" src="img/image_gen_orig.png" height="75"/></td>
<td/>
</tr>
<tr height="100">
<th>3</th><td/><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<ul>
<li>Case 2 : Image is larger than the drawing area<br/>
Output corresponds to drawing area dimension:</li>
</ul>
<table width="920px" class="sample">
<tbody>
<tr class="heading">
<td width="50%">
<p><strong>Template content</strong></p>
</td>
<td width="50%">
<p><strong>Output</strong></p>
</td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th width="20"></th><th width="440">A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
<tr valign="top" height="140">
<th>2</th>
<td class="code">&lt;image object='&hellip;'
<span class="blue">maxH=&lsquo;true&rsquo;</span>/&gt;</span></td>
<td/>
</tr>
<tr height="100">
<th>3</th>
<td valign="top">&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th width="20"></th><th width="380">A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th><td></td><td width="20"/>
</tr>
<tr height="140">
<th>2</th>
<td valign="top" width="240"><img class="border" src="img/image_gen_orig.png" height="130"/></td>
<td/>
</tr>
<tr height="100">
<th>3</th><td/><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<a name="_Displaying_diagrams"/><h3>Displaying diagrams</h3>
<p>Attribute object shall be filled by an ID of the diagram. Diagram ID can be generated by
<a href="bundles.html#_Gmf">service getDiagram from bundle gmf</a>, called on the diagram:</p>
<table width="800px" class="sample">
<tbody>
<tr class="heading">
<td width="50%">
<p><strong>Template content</strong></p>
</td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="800px">
<tr>
<th width="20"></th><th width="760">A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td class="code">&lt;context model='${model}' importedBundles='gmf;papyrus'/&gt;<br/>
&lt;gendoc&gt;<br/>
&emsp;[for (diag : Diagram| self.getPapyrusDiagrams()]</td>
<td width="20"/>
</tr>
<tr valign="top" height="140">
<th>2</th>
<td class="code">
&emsp;&emsp;&lt;image object='[diag.getDiagram()/]' maxW='true' keepH='false'/&gt;
</td>
<td/>
</tr>
<tr height="100">
<th>3</th>
<td valign="top">
&emsp;[/for]<br/>
&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<a name="_Displaying_static_images"/><h3>Displaying static images</h3>
<p><span class="code">&lt;image&gt;</span> tag can also be used for static image generation, with the following content:</p>
<ul>
<li>attribute <span class="code">filePath</span> shall contain the absolute path of the static image. <br />
The following image formats are supported : GIF, JPG, JPEG, BMP, PNG, SVG</li>
<li><span class="code">&lt;image&gt;</span> tag shall contain an empty drawing area (alignment, text adaptation, &hellip;)</li>
<li>size attributes can be used : <span class="code">keepW</span>, <span class="code">keepH</span>,
<span class="code">maxW</span>, <span class="code">maxH</span></li>
</ul>
<p>The following example shows the display of a static image:</p>
<table width="920px" class="sample">
<tbody>
<tr class="heading">
<td width="50%">
<p><strong>Template content</strong></p>
</td>
<td width="50%">
<p><strong>Output</strong></p>
</td>
</tr>
<tr>
<td width="50%" valign="top">
<table class="xlsx" width="480">
<tr>
<th width="20"></th><th width="440">A</th><th width="20">B</th>
</tr>
<tr>
<th>1</th>
<td>&lt;context model='${model_path}'/&gt;<br/>
&lt;gendoc&gt;<br/>
Project logo is displayed below&nbsp;:</td>
<td width="20"/>
</tr>
<tr valign="top" height="140">
<th>2</th>
<td class="code">&emsp;&lt;image filePath='D:/gendoc_logo.jpg' maxW='true'/&gt;
</td>
<td/>
</tr>
<tr height="100">
<th>3</th>
<td valign="top">&lt;/gendoc&gt;</td>
<td width="20"/>
</tr>
</table>
</td>
<td width="50%">
<table class="xlsx" width="420">
<tr>
<th width="20"></th><th width="380">A</th><th width="20">B</th>
</tr>
<tr height="55" valign="top">
<th>1</th><td>Project logo is displayed below&nbsp;:</td><td width="20"/>
</tr>
<tr height="140">
<th>2</th>
<td valign="top" width="240"><img class="border" src="img/logo.png" height="130"/></td>
<td/>
</tr>
<tr height="100">
<th>3</th><td/><td width="20"/>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>