Modeltype-specific drawing area representationModeltype-specific drawing area representationRE: Modeltype-specific drawing area representationWilfrid Utzhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=216402013-07-26T11:26:59Z2013-07-10T13:30:25ZIt is possible to define a GraphRep which is used for drawing the background of the drawing area. Model attributes can be displayed on the drawing area Fields can be painted on the drawing area which may look like swimlanes but are not modeling objects. <br /><br />To define a GraphRep for a model type, please follow the steps below:<br /><br /><strong>Step 1: Prepare Class Hierarchy</strong><br />IMPORTANT: The class __ModelTypeMetaData__ does not exist in the default library/empty library, it needs to be created manuallyas a sub-class of the __LibraryMetaData__.<br /><br /><strong>Step 2: Define GraphRep Attribute</strong><br />Add a class attribute of type STRING or LONGSTRING to the class "__ModelTypeMetaData__" of the dynamic library. This attribute will be used as GraphRep definition for the treated model type. You may choose any attribute name, e.g. "ModelTypeA model GraphRep" for a model type "ModelType A".<br /><br /><strong>Step 3: Add a GraphRep Specification to ModelType</strong><br />Add a graphrep specification to the model type defnition. The model type definition is contained in the library attribute "Modi". There you have to specify the name of the attribute which contains the GraphRep definition, e.g. graphrep:"ModelTypeA model GraphRep".<br /><br /><div class="code"><span class="code-lines">1</span>MODELTYPE "ModelType A" ....graphrep:"ModelTypeA model GraphRep"</div><br /><br />The model types's GraphRep is painted as first object in its layer. The layer index is specified at the GRPAHREP element in the model type's GraphRep. If a high layer index is specified at the model type's GraphRep, it is more a foreground than a background graphics. To draw a graphics which lies behind all objects, you have to specify the lowest index used at a modeling object's GraphRep. In the model type's GraphRep, model attributes can be accessed via ATTR and AVAL. This applies also for custom model attributes. (see custom model attributes <a href="https://www.adoxx.org/live/live/en_GB/faq/-/message_boards/view_message/21615">http://www.adoxx.org/live/en_GB/faq/-/message_boards/view_message/21615</a>)<br /><br />At a model type's GraphRep, the following variables are preset:<br />w -- the current drawing area width<br />h -- the current drawing area height<br />So the GraphRep may depened on the current drawing area size. That makes it possible to draw lanes across the whole width or height, or to place a text at the bottom of the drawing area.<br /><br /><em>Examples:</em><br />Show the name, modeltype and count of objects and relations on the drawing area<br /><div class="code"><span class="code-lines"> 1</span>GRAPHREP layer:-1<br /><span class="code-lines"> 2</span>AVAL name:"Name" # model name<br /><span class="code-lines"> 3</span>AVAL type:"Type" # model type name<br /><span class="code-lines"> 4</span>AVAL count:"Number of objects and relations"<br /><span class="code-lines"> 5</span>SET y:0.5cm<br /><span class="code-lines"> 6</span>FONT "Verdana" h:24pt style:"outline" color:gray<br /><span class="code-lines"> 7</span>TEXT (name + " (" + type + ")") x:0.5cm y: (y) w:l h:t<br /><span class="code-lines"> 8</span>SET y: (y + 24pt + 0.3cm)<br /><span class="code-lines"> 9</span>FONT "Verdana" h:12pt color:gray<br /><span class="code-lines">10</span>TEXT ("Object count: " + count) x:0.5cm y: (y) w:l h:t <br /></div><br /><br />The following model type GraphRep displays the value of the attribute "Description" as headline and a copyright remark as footline. Also a vertical arrow is painted from the top to the bottom of the drawing area.<br /><div class="code"><span class="code-lines"> 1</span>GRAPHREP layer:-1<br /><span class="code-lines"> 2</span>SHADOW off<br /><span class="code-lines"> 3</span># horizontal lane which is the description's background<br /><span class="code-lines"> 4</span>PEN color:$c0dd80<br /><span class="code-lines"> 5</span>FILL color:$e0ffa0<br /><span class="code-lines"> 6</span>RECTANGLE w: (w) h:2.5cm<br /><span class="code-lines"> 7</span># description; width is drawing area width<br /><span class="code-lines"> 8</span>ATTR "Description" w: (w) h:2.5cm<br /><span class="code-lines"> 9</span># vertical arrow<br /><span class="code-lines">10</span>PEN w:0.3cm color:$c0dd80<br /><span class="code-lines">11</span>LINE x1: (w - 2cm) y1:0.5cm x2: (w - 2cm) y2: (h - 0.5cm)<br /><span class="code-lines">12</span>POLYLINE 3 x1: (w - 3cm) y1: (h - 2cm)<br /><span class="code-lines">13</span> x2: (w - 2cm) y2: (h - 0.5cm)<br /><span class="code-lines">14</span> x3: (w - 1cm) y3: (h - 2cm)<br /><span class="code-lines">15</span># copyright remark at the drawing area bottom<br /><span class="code-lines">16</span>FONT "Verdana" h:9pt color:$6060a0 italic<br /><span class="code-lines">17</span>TEXT "Creative Commons" x:0.2cm y: (h) h:b<br /></div>Wilfrid Utz2013-07-10T13:30:25ZModeltype-specific drawing area representationhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=216272014-03-27T12:27:50Z2013-07-10T13:21:30ZIs is possible to have different representations for the drawing area depending on the modeltype?2013-07-10T13:21:30Z