<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphic-notation appVersion="0.8.0" version="0.8.0">
<properties>
<property name="color" short-description="color" type="brush"/>
<property name="isSmallMolecule" short-description="isSmallMolecule" type="boolean" value="false"/>
<property name="type" short-description="type" type="String" value=""/>
</properties>
<nodes>
<node icon="icon0" kernelType="biouml.standard.type.Substance" type="molecule-substance">
<propertyRef name="color"/>
<propertyRef name="isSmallMolecule" value="false"/>
</node>
<node icon="icon1" kernelType="biouml.standard.type.Protein" type="molecule-protein">
<propertyRef name="type" value=""/>
</node>
<node icon="icon2" isCompartment="true" type="compartment"/>
</nodes>
<edges/>
<reactions>
<reaction icon="icon3" type="reaction"/>
</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(2,2);
    brush = new Brush(new Color(0.0, 0.0, 0.0));
    pen = options.getDefaultPen();
    if(isNode)
    {
        var ellipse = new EllipseView(pen, brush, 0, 0, d.width, d.height);
        container.add(ellipse);
    }
    else
    {
        var inNode = de.getValue("input", null);
        var outNode = de.getValue("output", null);
        if(inNode != null && outNode != null && (inNode.getAttributes().getValue("isSmallMolecule")==true || outNode.getAttributes().getValue("isSmallMolecule")==true))
        {
            var path = JSUtility.getArcPath(de);
        }
        else
        {
            var path = JSUtility.getPath(de);
        }
        if(role == 'product')
        {
            var arrow = new ArrowView(pen, brush, path, null, ArrowView.createTriangleTip(pen, brush, 15, 5));
            container.add(arrow);
        }
        else if(role == 'reactant')
        {
            var arrow = new ArrowView(pen, brush, path, 0, 0);
            container.add(arrow);
        }
        else if(role == 'modifier')
        {
            var dx2 = (path.xpoints[0]-path.xpoints[path.npoints-1])*(path.xpoints[0]-path.xpoints[path.npoints-1])
            var dy2 = (path.ypoints[0]-path.ypoints[path.npoints-1])*(path.ypoints[0]-path.ypoints[path.npoints-1])
            if(dx2+dy2>250)
            {
                var pen2 = new Pen(1, new Color(0.7, 0.7, 0.7));
                var arrow = new ArrowView(pen2, brush, path, 0, 0);
                container.add(arrow);
            }
        }
    }
    return false;
}]]></nodeView>
<nodeView type="molecule-protein"><![CDATA[function f(container, node, options, g)
{
    if(node.getValue("type", null) == 'channel')
    {
        var pen, brush;
        brush = new Brush(new Color(0.5, 0.5, 0.5));
        pen = options.getDefaultPen();
        var ellipse1 = new EllipseView(pen, brush, 0, 0, 20, 40);
        container.add(ellipse1);
        var ellipse2 = new EllipseView(pen, brush, 30, 0, 20, 40);
        container.add(ellipse2);
    }
    else
    {
        var titleStr = node.getValue('title', '');
        var title = new ComplexTextView("<b>"+titleStr+"</b>", options.getNodeTitleFont(), options.getFontRegistry(), ComplexTextView.TEXT_ALIGN_CENTER, options.getMaxTitleSize(), g);
        container.add(title, CompositeView.X_CC | CompositeView.Y_CC, new Point(0, 0));
    }
    return false;
}]]></nodeView>
<nodeView type="molecule-substance"><![CDATA[function f(container, node, options, g)
{
    if(node.getValue("isSmallMolecule", false) == false)
    {
        var d, pen, brush, titlePen;
        d = new Dimension(60,20);
        brush = node.getValue("color", new Brush(new Color(1.0, 1.0, 1.0)));
        pen = options.getDefaultPen();
        if(brush.getPaint().getGreen()+brush.getPaint().getRed()+brush.getPaint().getBlue() < 300)
        {
            titlePen = new ColorFont("Arial", Font.PLAIN, 12, Color.white);
        }
        else
        {
            titlePen =  options.getNodeTitleFont();
        }
        var title = new ComplexTextView(node.getValue('title', ''), titlePen, options.getFontRegistry(), ComplexTextView.TEXT_ALIGN_CENTER, options.getMaxTitleSize(), g);
        if(title.getBounds().width+10 > d.width)
        {
            d.width = title.getBounds().width+10;
        }
        if(title.getBounds().height+5 > d.height)
        {
            d.height = title.getBounds().height+5;
        }
        var box = new BoxView(pen, brush, 0, 0, d.width, d.height);
        container.add(box);
        container.add(title, CompositeView.X_CC | CompositeView.Y_CC, new Point(0, 0));
    }
    else
    {
        var title = new ComplexTextView(node.getValue('title', ''),  options.getNodeTitleFont(), options.getFontRegistry(), ComplexTextView.TEXT_ALIGN_CENTER, options.getMaxTitleSize(), g);
        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", null);
    if(d.width == 0 && d.height == 0)
    {
        d.width = 250;
        d.height = 200;
    }
    pen = new Pen(2, Color.black);
    var rect = new RoundRectangle2D.Float(0, 0, d.width, d.height, 20, 20);
    var box = new BoxView(pen, null, rect);
    container.add(box);
    var rect2 = new RoundRectangle2D.Float(5, 5, d.width-10, d.height-10, 10, 10);
    var box2 = new BoxView(pen, null, rect2);
    container.add(box2);
    return false;
}]]></nodeView>
</viewBuilder>
<icons/>
<semanticController prototype="biouml.model.DefaultSemanticController"/>
<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="50000"/>
<wi n="lengthPenalty" v="1"/>
</v>
</o>
<o n="sl" t="ru.biosoft.graph.SubgraphLayouter">
<v>
<wi n="layerDeltaX" v="150"/>
<wi n="layerDeltaY" v="150"/>
</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>
<compartment>
<compartmentInfo color="255,255,255" height="218" kernel="stub/aaa" kernel_type="compartment" shape="0" width="490" x="41" y="22"/>
<nodes>
<node height="50" kernel="stub/1" kernel_type="molecule-substance" width="50" x="130" y="164">
<property name="color" short-description="color" type="brush" value="255;255;255"/>
<property name="isLabel" short-description="isLabel" type="boolean" value="false"/>
<property name="isSmallMolecule" short-description="isSmallMolecule" type="boolean" value="false"/>
</node>
<node height="50" kernel="stub/2" kernel_type="molecule-substance" width="50" x="378" y="157">
<property name="color" short-description="color" type="brush"/>
<property name="isLabel" short-description="isLabel" type="boolean" value="false"/>
<property name="isSmallMolecule" short-description="isSmallMolecule" type="boolean" value="false"/>
</node>
<node height="50" kernel="stub/channel" kernel_type="molecule-protein" width="50" x="433" y="75">
<property name="type" short-description="type" type="String" value="channel"/>
</node>
<node height="50" kernel="stub/protein" kernel_type="molecule-protein" width="50" x="262" y="162">
<property name="type" short-description="type" type="String" value=""/>
</node>
<node height="50" kernel="stub/rdx" kernel_type="molecule-substance" width="50" x="338" y="70">
<property name="color" short-description="color" type="brush"/>
<property name="isSmallMolecule" short-description="isSmallMolecule" type="boolean" value="true"/>
</node>
<node height="50" kernel="stub/reaction_0" kernel_type="reaction" width="50" x="280" y="149">
<property elementType="String" name="nodeRoles" short-description="nodeRoles" type="array">
<item>reactant</item>
<item>product</item>
<item>modifier</item>
<item>reactant</item>
<item>product</item>
</property>
<property elementType="String" name="nodes" short-description="nodes" type="array">
<item>1</item>
<item>2</item>
<item>protein</item>
<item>rtfhfg</item>
<item>rdx</item>
</property>
</node>
<node height="50" kernel="stub/rtfhfg" kernel_type="molecule-substance" width="50" x="171" y="65">
<property name="color" short-description="color" type="brush"/>
<property name="isSmallMolecule" short-description="isSmallMolecule" type="boolean" value="true"/>
</node>
</nodes>
<edges/>
</compartment>
</nodes>
<edges/>
<filters>
<a n="filters" t="[Lbiouml.model.DiagramFilter;">
<v/>
</a>
</filters>
</diagram>
</example>
</examples>
</graphic-notation>
