Attribute-dependant dimensions of graphical representation...Attribute-dependant dimensions of graphical representation...RE: Attribute-dependant dimensions of graphical representation...Sabin Popescuhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=216852013-07-11T06:36:07Z2013-07-11T06:30:54ZThe code sequence below creates a graphical representation that includes the features that you mentioned<br /><br />In the first block, the TEXT element displays a standard text (in this case "E5 Event"), the element TEXTBOX does not produce direct output to the drawing area, but it calculates the needed (rectangle) area for the TEXT element. The results are stored in the global variables textx1, texty1, textx2 and texty2 respectively. As these global variables will be overwritten by the element ATTRBOX in the second block, we save them in the local variables n_text1_x1, n_text1_x2, n_text1_y1, n_text1_y2 respectively.<br /><br /><div class="code"><span class="code-lines"> 1</span>GRAPHREP<br /><span class="code-lines"> 2</span>SHADOW off<br /><span class="code-lines"> 3</span>FONT color: black <br /><span class="code-lines"> 4</span><br /><span class="code-lines"> 5</span>TEXT "E5 Event" x: -0.95cm y: -0.4cm<br /><span class="code-lines"> 6</span>TEXTBOX "E5 Event" x: -0.95cm y: -0.4cm <br /><span class="code-lines"> 7</span>SET n_text1_x1: (textx1)<br /><span class="code-lines"> 8</span>SET n_text1_x2: (textx2)<br /><span class="code-lines"> 9</span>SET n_text1_y1: (texty1)<br /><span class="code-lines">10</span>SET n_text1_y2: (texty2)<br /></div><br />The second block uses the elements ATTR and ATTRBOX to display the contents of the attribute "Name", calculate the needed rectangular area needed for the ATTR element and saves the results in the local variables n_text2_x1, n_text2_x2, n_text2_y1, n_text2_y2.<br /><br /><div class="code"><span class="code-lines">1</span>ATTR "Name" x: -0.95cm y: (texty2 + 0.1cm) w:l<br /><span class="code-lines">2</span>ATTRBOX "Name" x: -0.95cm y: (texty2 + 0.1cm) w:l<br /><span class="code-lines">3</span>SET n_text2_x1: (textx1)<br /><span class="code-lines">4</span>SET n_text2_x2: (textx2)<br /><span class="code-lines">5</span>SET n_text2_y1: (texty1)<br /><span class="code-lines">6</span>SET n_text2_y2: (texty2)<br /></div><br />The third block draws a rectabgle aroung the two texts displayed by the first two blocks and a line between the area needed for the TEXT element and the area needed by the ATTR element.For consistency reasons the dimensions of the rectangle are calculated as follows:<br /> * the <strong>x-coordinate of the upper left corner</strong> is the left-most upper-left corner of the two text areas<br /> * the <strong>y-coordinate of the upper-left corner</strong> is the y-coordinate of the upper-left corner of the first text area<br /> * the <strong>width</strong> is the difference between the right-most lower-right corner of the two text areas and the left-most upper-left corner of the two text areas <br /> * the <strong>height</strong> is the difference between the y-coordinate of the bottom-right corner of the second text area and the y-coordinate of the top-left corner of the first text area.<br /><br /><div class="code"><span class="code-lines">1</span>RECTANGLE x: ( min(n_text1_x1, n_text2_x1) - 0.05cm ) y: (n_text1_y1) <br /><span class="code-lines">2</span> w: (max(n_text1_x2, n_text2_x2) - min(n_text1_x1, n_text2_x1) + 0.1cm) h: (n_text2_y2 - n_text1_y1)<br /><span class="code-lines">3</span>LINE x1: (min(n_text1_x1, n_text2_x1) - 0.05cm ) y1: ((n_text1_y2 + n_text2_y1) / 2) <br /><span class="code-lines">4</span> x2: (max(n_text1_x2, n_text2_x2) + 0.05cm) y2: ((n_text1_y2 + n_text2_y1) / 2)<br /></div>Sabin Popescu2013-07-11T06:30:54ZAttribute-dependant dimensions of graphical representation...https://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=216452014-03-27T11:14:12Z2013-07-10T13:48:49ZHow can I create a GraphRep that is a rectangle with two boxes:<br /> - in the first box I want to have some standard text <br /> - in the second box the value of the attribute Name<br />Is it possible that this rectangular is adapted depending on the length of the attribute?2013-07-10T13:48:49Z