private void getLinkProperties(
            IBaseNode node1, IBaseNode node2, object portObject1, object portObject2,
            out ReactionNode reactionNode, out MoleculeNode moleculeNode, out ReactionLinkType reactionLinkType)
        {
            var rNode1 = node1 as ReactionNode;
            var rNode2 = node2 as ReactionNode;

            if (rNode1 == null && rNode2 == null)
            {
                throw new MoBiException(AppConstants.Exceptions.ReactionNodeMissingInLink);
            }

            var mNode1 = node1 as MoleculeNode;
            var mNode2 = node2 as MoleculeNode;

            if (mNode1 == null && mNode2 == null)
            {
                throw new MoBiException(AppConstants.Exceptions.MoleculeNodeMissingInLink);
            }

            if (rNode1 != null)
            {
                reactionNode     = rNode1;
                moleculeNode     = mNode2;
                reactionLinkType = (ReactionLinkType)portObject1;
            }
            else
            {
                reactionNode     = rNode2;
                moleculeNode     = mNode1;
                reactionLinkType = (ReactionLinkType)portObject2;
            }
        }
        private void createReactionLink(ReactionLinkType type, ReactionNode reactionNode, IMoleculeNode moleculeNode)
        {
            var reactionLink = new ReactionLink();

            reactionLink.Initialize(type, reactionNode, moleculeNode);
            reactionLink.SetColorFrom(DiagramOptions.DiagramColors);
        }
 public RemoveNamedPartnerUICommand(IMoBiContext context, IMoBiReactionBuildingBlock reactionBuildingBlock, IReactionBuilder reactionBuilder, string moleculeName, ReactionLinkType linkType)
 {
     _context = context;
     _reactionBuildingBlock = reactionBuildingBlock;
     _reactionBuilder       = reactionBuilder;
     _moleculeName          = moleculeName;
     _linkType = linkType;
 }
Beispiel #4
0
 public ReactionPort(ReactionLinkType reactionLinkType)
 {
     LinkType     = reactionLinkType;
     UserObject   = LinkType;
     Style        = GoPortStyle.Ellipse;
     Size         = new SizeF(8, 8);
     AutoRescales = false;
 }
Beispiel #5
0
        public void Initialize(ReactionLinkType reactionLinkType, ReactionNode reactionNode, IMoleculeNode moleculeNode)
        {
            Type = reactionLinkType;

            switch (Type)
            {
            case ReactionLinkType.Educt:
                base.Initialize(moleculeNode, reactionNode);
                break;

            case ReactionLinkType.Product:
                base.Initialize(reactionNode, moleculeNode);
                break;

            case ReactionLinkType.Modifier:
                base.Initialize(moleculeNode, reactionNode);
                break;

            default:
                throw new OSPSuiteException("No valid ReactionLinkType = " + Type);
            }

            this.ToBack();
        }