Exemplo n.º 1
0
        /// <summary>
        /// Get molfile form of molecule doing a conversion from another format as necessary
        /// </summary>
        /// <returns></returns>

        public string GetMolfileString()
        {
            string molfile = "", helm = "";

            if (Lex.IsDefined(MolfileString))
            {
                return(MolfileString);
            }

            else if (Lex.IsDefined(ChimeString))
            {
                molfile = ChimeStringToMolfileString(ChimeString);
            }

            else if (Lex.IsDefined(SmilesString))
            {
                molfile = CdkMol.SmilesStringToMolfileString(SmilesString);
            }

            else if (Lex.IsDefined(InchiString))
            {
                molfile = CdkMol.InChIStringToMolfileString(PrimaryValue.ToString());
            }

            else if (Lex.IsDefined(HelmString))
            {
                molfile = HelmConverter.HelmToMolfile(this, HelmString);
            }

            else if (Lex.IsDefined(SequenceString))
            {
                helm       = HelmConverter.SequenceToHelm(SequenceString);
                HelmString = helm;
                if (Lex.IsDefined(helm))
                {
                    molfile = HelmConverter.HelmToMolfile(this, HelmString);
                }
            }

            else if (Lex.IsDefined(FastaString))
            {
                helm       = HelmConverter.FastaToHelm(FastaString);
                HelmString = helm;
                if (Lex.IsDefined(helm))
                {
                    molfile = HelmConverter.HelmToMolfile(this, HelmString);
                }
            }

            else
            {
                molfile = "";
            }

            MolfileString = molfile;             // save for later possible reuse
            return(MolfileString);
        }
Exemplo n.º 2
0
 public void set(PrimaryValue pValue)
 {
     if (_type == pValue._type)
     {
         _value = pValue._value;
         return;
     }
     throw new ModelException("PrimaryValues are not of the same type.");
 }
Exemplo n.º 3
0
        public override void Draw(
            float offsetX,
            float offsetY,
            Renderer2D renderer)
        {
            DrawGauge(offsetX, offsetY, renderer, SecondaryValue, SecondaryGaugeColor);
            DrawGauge(offsetX, offsetY, renderer, PrimaryValue, PrimaryGaugeColor);

            float fontSize = Height - (2f * BorderWidth);

            fontSize      *= 0.8f;
            renderer.Color = TextColor;
            string format = asInteger ? "F0" : "F1";

            if (string.IsNullOrEmpty(Label)) // ラベルがなければ両方の数字を左右に分けて出す
            {
                // primaryは左寄せ
                renderer.AddText(
                    PrimaryValue.ToString(format),
                    offsetX + LocalLeftX + (BorderWidth * 2f),
                    offsetY + LocalTopY + (BorderWidth * 2f),
                    fontSize);

                // secondaryは右寄せ
                renderer.AddText(
                    SecondaryValue.ToString(format),
                    offsetX + LocalLeftX + Width - (BorderWidth * 2f),
                    offsetY + LocalTopY + (BorderWidth * 2f),
                    fontSize,
                    AlignX.Right);
            }
            else // ラベルがあれば左にラベル、右にプライマリの数値
            {
                renderer.AddText(
                    Label,
                    offsetX + LocalLeftX + (BorderWidth * 2f),
                    offsetY + LocalTopY + (BorderWidth * 2f),
                    fontSize);

                // 数字は右寄せ
                renderer.AddText(
                    PrimaryValue.ToString(format),
                    offsetX + LocalLeftX + Width - (BorderWidth * 2f),
                    offsetY + LocalTopY + (BorderWidth * 2f),
                    fontSize,
                    AlignX.Right);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Matches a record by it's ID.
 /// </summary>
 public static iCondition isID(this iCondition pCon, PrimaryValue pID)
 {
     return Eq(pCon, pCon.PrimaryKey(), pID);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 public PrimaryValue(PrimaryValue pValue)
 {
     _value = pValue._value;
     _type  = pValue._type;
 }