<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphic-notation appVersion="0.8.0" requiredPlugins="biouml.plugins.kegg" version="0.8.0">
<properties>
<property name="EC" short-description="EC" type="String" value=""/>
</properties>
<nodes>
<node icon="icon0" kernelType="biouml.standard.type.Substance" type="molecule-substance"/>
<node icon="icon1" kernelType="biouml.standard.type.Protein" type="molecule-protein">
<propertyRef name="EC" value=""/>
</node>
<node icon="icon2" type="diagram-reference"/>
<node icon="icon3" isCompartment="true" type="compartment"/>
</nodes>
<edges>
<edge icon="icon4" type="relation-semantic"/>
</edges>
<reactions>
<reaction icon="icon5" type="reaction"/>
<reaction icon="icon6" type="unknown"/>
</reactions>
<viewOptions/>
<viewBuilder prototype="biouml.model.DefaultDiagramViewBuilder">
<nodeView type="reaction"><![CDATA[function f(container, de, options, g, isNode, role)
{
    var d, pen, brush;
    d = new Dimension(4,4);
    brush = new Brush(new Color(0.0, 0.0, 0.0));
    pen = options.getDefaultPen();
    if(isNode)
    {
        var reaction = de.getValue('kernel', null);
        var useProtein = false;
        if(reaction != null && reaction instanceof Reaction)
        {
            var refs = reaction.getSpecieReferences();
            var i;
            var text = "";
            for(i=0; i<refs.length; i++)
            {
                var ref = refs[i];
                if(ref.getRole() == 'modifier')
                {
                    var kernel= Module.getModule(reaction).getKernel(ref.getSpecie());
                    if(kernel != null)
                    {
                        var kernelNodes = Diagram.getDiagram(de.getDiagramElement()).getKernelNodes(kernel);
                        if(kernelNodes != null)
                        {
                            var mNode = kernelNodes.get(0);
                            var pView = mNode.getView();
                            var oldModel = pView.getModel();
                            if(oldModel == null || !(oldModel.getKernel() instanceof Reaction))
                            {
                                container.add(pView, CompositeView.X_CC, new Point(0, 0));
                                pView.setModel(de.getDiagramElement());
                                useProtein = true;
                            }
                            else
                            {
                                brush = new Brush(new Color(1.0, 1.0, 1.0));
                                var box = new BoxView(pen, brush, 0, 0, pView.getBounds().width, pView.getBounds().height);
                                container.add(box);
                                var titleStr = mNode.getTitle();
                                var title = new TextView(titleStr,  new ColorFont("Arial", Font.BOLD, 16, Color.black), g);
                                container.add(title, CompositeView.X_CC | CompositeView.Y_CC, new Point(0, 0));
                            }
                            break;
                        }
                    }
                }
            }
        }
        if(!useProtein)
        {
            var ellipse = new EllipseView(pen, brush, 0, 0, d.width, d.height);
            container.add(ellipse);
        }
    }
    else
    {
        var path = JSUtility.getPath(de);
        if(role == 'product')
        {
            var arrow = new ArrowView(pen, brush, path, null, ArrowView.createTriangleTip(pen, brush, 10, 3));
            container.add(arrow);
        }
        else if(role == 'reactant')
        {
            var type = de.getValue("rType", "irreversible");
            var arrow;
            if(type == "reversible")
            {
                arrow = new ArrowView(pen, brush, path, ArrowView.createTriangleTip(pen, brush, 10, 3), null);
            }
            else
            {
                arrow = new ArrowView(pen, brush, path, 0, 0);
            }
            container.add(arrow);
        }
    }
    return false;
}]]></nodeView>
<nodeView type="relation-semantic"><![CDATA[function f(container, edge, options, g)
{
    var pen, brush;
    var arrow;
    
    if(edge.getValue("inhibition", null) != null)
    {
        brush = new Brush(new Color(0.0, 0.0, 0.0));
        pen = new Pen(1, new Color(0.0, 0.0, 0.0));
        arrow = new ArrowView(pen, brush, JSUtility.getPath(edge), null, ArrowView.createLineTip(pen, brush, 3, 6));
    }
    else if(edge.getValue("phosphorylation", null) != null || edge.getValue("activation", null) != null || edge.getValue("expression", null) != null)
    {
        brush = new Brush(new Color(0.0, 0.0, 0.0));
        pen = new Pen(1, new Color(0.0, 0.0, 0.0));
        arrow = new ArrowView(pen, brush, JSUtility.getPath(edge), null, ArrowView.createTriangleTip(pen, brush, 10, 3));
    }
    else
    {
        brush = new Brush(new Color(1.0, 1.0, 1.0));
        var myArray= new Array();
        myArray[0]= 7.0;
        myArray[1]= 3.0;
        var stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10, myArray, 0);
        pen = new Pen(stroke, new Color(0.0, 0.0, 0.0));
        arrow = new ArrowView(pen, brush, JSUtility.getPath(edge), null, ArrowView.createTriangleTip(pen, brush, 10, 3));
    }
    container.add(arrow);
    return false;
}]]></nodeView>
<nodeView type="molecule-protein"><![CDATA[function f(container, node, options, g)
{
    var d, pen, brush;
    d = node.getValue('shapeSize', new Dimension(90,34));
    d.height = 34;
    if(d.width<90)
    {
        d.width=90;
    }
    var titleStr = node.getValue('EC', '');
    if(titleStr == '')
    {
        titleStr = node.getValue('title', '');
    }
    titleStr = titleStr.split(",")[0];
    if(d.width<titleStr.length()*10)
    {
        d.width=titleStr.length()*10;
    }
    brush = new Brush(new Color(1.0, 1.0, 1.0));
    pen = options.getDefaultPen();
    var ellipse = new BoxView(pen, brush, 0, 0, d.width, d.height);
    container.add(ellipse);
    var title = new TextView(titleStr,  new ColorFont("Arial", Font.BOLD, 16, Color.black), g);
    container.add(title, CompositeView.X_CC | CompositeView.Y_CC, new Point(0, 0));
    return false;
}]]></nodeView>
<nodeView type="unknown"><![CDATA[function f(container, de, options, g, isNode, role)
{
    brush = new Brush(new Color(0.0, 0.0, 0.0));
    pen = options.getDefaultPen();
    if(isNode)
    {
        
    }
    else
    {
        var path = JSUtility.getPath(de);
        var arrow = new ArrowView(pen, brush, path, null, ArrowView.createTriangleTip(pen, brush, 10, 3));
        container.add(arrow);
    }
    return false;
}]]></nodeView>
<nodeView type="molecule-substance"><![CDATA[function f(container, node, options, g)
{
    var d, pen, brush;
    d = new Dimension(16,16);
    brush = new Brush(new Color(1.0, 1.0, 1.0));
    pen = options.getDefaultPen();
    var ellipse = new EllipseView(pen, brush, 0, 0, d.width, d.height);
    container.add(ellipse);
    
    return true;
}]]></nodeView>
<nodeView type="diagram-reference"><![CDATA[function f(container, node, options, g)
{
    var d, pen, brush, titlePen;
    d = node.getValue('shapeSize', new Dimension(60,30));
    brush = node.getValue("color", new Brush(new Color(1.0, 1.0, 1.0)));
    pen = options.getDefaultPen();
    titlePen = new ColorFont("Arial", Font.BOLD, 16, Color.black);
    var title = new ComplexTextView(node.getValue('title', ''), titlePen, options.getFontRegistry(), ComplexTextView.TEXT_ALIGN_CENTER, d.width/10, g);
    var rect2 = new RoundRectangle2D.Float(0, 0, d.width, d.height, 10, 10);
    var box = new BoxView(pen, brush, rect2);
    container.add(box);
    container.add(title, CompositeView.X_CC | CompositeView.Y_CC, new Point(0, 0));
    return false;
}]]></nodeView>
<nodeView type="compartment"><![CDATA[function f(container, node, options, g)
{
    var d, pen, brush;
    d = node.getValue('shapeSize', new Dimension(60,60));
    pen = new Pen(1, new Color(0.5, 0.5, 0.5));
    var box = new BoxView(pen, null, 0, 0, d.width*1.1, d.height*1.3);
    container.add(box);
    return false;
}]]></nodeView>
</viewBuilder>
<icons>
<icon name="icon4">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAcUlEQVR42u3SvQkAIQwGUAd0B7FwDgsnsNfawhlUCLiDSziBxXeQm+B+KwOBBMIjhAg8DLGBa0BrDSEEzDnvASklSClhrUWM8QR671BKca614L3n2jnHA8YY7mutyDmDiDDGgNYapZQXNvj1BvuRPgIOvHraEZF1GCwAAAAASUVORK5CYII=</icon>
<icon name="icon0">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAnElEQVR42q2TQQrEIAxFe1PBla70Eu4EtwrSW7rRxS9fmFKZTpmigYAmPw+S6IZJ234l9n0f/G9ACAFKKUgpIYTozjNjzD0CnHMwxiDG+CVkjDlqbgHee1hr0Vrr91rr4DTmqKF2AJRSoLVGSum2+AqhhlrWnICcc+/1qfgKoZY1J4BTfgv4bGYNYLqF6SFOr3HJQ1rylJd8prd2ABE+ks5kz6XrAAAAAElFTkSuQmCC</icon>
<icon name="icon1">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAPUlEQVR42mP4TyFgGHgDnj59+p+BgYEsDNZ7586d/1paWmDTfv36RRQGAZAekN5RAwaFARSng2GQFyg1AAAsMnqAQp4ZdQAAAABJRU5ErkJggg==</icon>
<icon name="icon2">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAYUlEQVR42u2TsQ0AMQgD2X8rJJQBUpA1EGVS8DITPCLFF2/JBRLnBkPRFF0JUNUYY5QMJgPmnLHWCncPM3tl7IIBS8ycSeeckiGwJCI57L1LhsD+AXLhCu0etJv4jWfq6AHO2tOoxZmGkwAAAABJRU5ErkJggg==</icon>
<icon name="icon3">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAPklEQVR42u2TsQkAQAgD3X81hdSOYhXJCL7d40HKuy6WmYwIAhhNjlxzd1YVp8iRa6q9IvcCF/glsD7T9s4NcVvaSjCGJWEAAAAASUVORK5CYII=</icon>
<icon name="icon5">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAiElEQVR42u2SoQoEIRiE/wc2Cr6DySImi203iF1si1g12raZ9gmEOdh23MKFW7iyA9OGj2EYwo+iB/AJyDljWRZ479+8rivGGN8BUkqUUtBaQ631dO8d1lrEGM/Mvu9IKWHOCTqOA8YYaK2hlALn/LLqtm1gjME5ByEEiAghhBsa3L7Bc6Q/AF45DdHIbj3SUAAAAABJRU5ErkJggg==</icon>
<icon name="icon6">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAiElEQVR42u2SoQoEIRiE/wc2Cr6DySImi203iF1si1g12raZ9gmEOdh23MKFW7iyA9OGj2EYwo+iB/AJyDljWRZ479+8rivGGN8BUkqUUtBaQ631dO8d1lrEGM/Mvu9IKWHOCTqOA8YYaK2hlALn/LLqtm1gjME5ByEEiAghhBsa3L7Bc6Q/AF45DdHIbj3SUAAAAABJRU5ErkJggg==</icon>
</icons>
<semanticController prototype="biouml.plugins.kegg.KeggPathwaySemanticController"/>
<examples>
<example name="test">
<diagram diagramType="biouml.model.xml.XmlDiagramType" notation="">
<diagramInfo/>
<layouterInfo>
<o n="layouterInfo" t="ru.biosoft.graph.ForceDirectedLayouter">
<v>
<wi n="initialPlacement" v="1"/>
<wi n="edgeLength" v="150"/>
<wf n="repulsion" v="1.0"/>
<wi n="repulsionDistance" v="10"/>
<wf n="gravity" v="0.06"/>
<wi n="orientation" v="0"/>
<wi n="distanceMethod" v="0"/>
<wf n="attraction" v="1.0"/>
<wf n="magneticIntencity" v="0.0"/>
<wi n="iterationNumber" v="100"/>
<wf n="minTemperature" v="0.0"/>
<wf n="maxTemperature" v="0.0"/>
<o n="dpl" t="ru.biosoft.graph.DiagonalPathLayouter">
<v>
<wi n="lineDistance" v="10"/>
<o n="selfLoopLayouter" t="ru.biosoft.graph.SelfLoopLayouter">
<v>
<wi n="loopLength" v="30"/>
</v>
</o>
</v>
</o>
<wb n="horisontalMovementAllowed" v="true"/>
<wb n="verticalMovementAllowed" v="true"/>
<o n="pathWeighter" t="ru.biosoft.graph.PathWeighter">
<v>
<wi n="bendPenalty" v="500"/>
<wi n="confluencePenalty" v="5"/>
<wi n="lengthPenalty" v="1"/>
</v>
</o>
<o n="sl" t="ru.biosoft.graph.SubgraphLayouter">
<v>
<wi n="layerDeltaX" v="350"/>
<wi n="layerDeltaY" v="350"/>
</v>
</o>
</v>
</o>
</layouterInfo>
<compartmentInfo color="255,255,255" height="150" kernel="stub/test" kernel_type="info-diagram" shape="0" width="150" x="0" y="0"/>
<nodes>
<node height="50" kernel="stub/1" kernel_type="molecule-substance" width="50" x="137" y="184"/>
<node height="50" kernel="stub/2" kernel_type="molecule-substance" width="50" x="431" y="181"/>
<node height="34" kernel="stub/3" kernel_type="molecule-protein" width="90" x="243" y="129">
<property name="EC" short-description="EC" type="String" value="1.3.99.7"/>
</node>
<node height="50" kernel="stub/aaa" kernel_type="diagram-reference" width="50" x="115" y="47"/>
<node height="50" kernel="stub/reaction_0" kernel_type="reaction" width="50" x="274" y="173">
<property elementType="String" name="nodeRoles" short-description="nodeRoles" type="array">
<item>reactant</item>
<item>product</item>
<item>modifier</item>
</property>
<property elementType="String" name="nodes" short-description="nodes" type="array">
<item>1</item>
<item>2</item>
<item>3</item>
</property>
</node>
</nodes>
<edges>
<edge in="1" kernel="stub/relation-semantic_0: $&quot;1&quot; to $aaa" kernel_type="relation-semantic" out="aaa">
<path>
<segment segmentType="moveTo" x0="141" y0="183"/>
<segment segmentType="lineTo" x0="145" y0="78"/>
</path>
</edge>
</edges>
<filters>
<a n="filters" t="[Lbiouml.model.DiagramFilter;">
<v/>
</a>
</filters>
</diagram>
</example>
</examples>
</graphic-notation>
