public void WriteImageFile(string fname, IndigoObject mol, string format, string comment,float weight)
        {
            switch (format)
            {
                case "png":{indigo.setOption("render-output-format", "png");break;}
                case "svg":{indigo.setOption("render-output-format", "svg");break;}
                case "pdf":{indigo.setOption("render-output-format", "pdf");break;}
                case "emf":{indigo.setOption("render-output-format", "emf");break;}

                default: throw new Exception("format not handled by Indigo: " + format);
            }

            // http://ggasoftware.com/opensource/indigo/api/options#rendering
            //png, svg, pdf are allowed. On Windows, emf is also allowed.
            indigo.setOption ("render-bond-length","18");

            indigo.setOption ("render-relative-thickness",  Math.Round (weight,2).ToString ());

            indigo.setOption("render-coloring", true);
            indigo.setOption("render-margins", 1, 1);
            //indigo.setOption("render-atom-ids-visible", true);
            indigo.setOption("render-comment", comment);
            indigo.setOption("render-implicit-hydrogens-visible", false);
            indigo.setOption("render-label-mode", "hetero");
            indigo.setOption("render-comment-font-size", "15");
            indigo.setOption("render-comment-offset", "6");
            mol.layout();
            renderer.renderToFile(mol, fname);

            //indigo.setOption("render-output-format", "svg");
        }
Пример #2
0
        public void renderGridToFile(IndigoObject items, int[] refatoms, int ncolumns, string filename)
        {
            if (refatoms != null)
            if (refatoms.Length != items.count ())
                throw new IndigoException ("renderGridToFile(): refatoms[] size must be equal to the number of objects");

            _indigo.checkResult(_renderer_lib.indigoRenderGridToFile (items.self, refatoms, ncolumns, filename));
        }
Пример #3
0
        public byte[] renderGridToBuffer(IndigoObject items, int[] refatoms, int ncolumns)
        {
            IndigoObject bufh = _indigo.writeBuffer ();

            if (refatoms != null)
            if (refatoms.Length != items.count ())
                throw new IndigoException ("renderGridToFile(): refatoms[] size must be equal to the number of objects");

            _indigo.checkResult (_renderer_lib.indigoRenderGrid (items.self, refatoms, ncolumns, bufh.self));
            return bufh.toBuffer ();
        }
Пример #4
0
		public Bitmap renderToBitmap (IndigoObject obj)
		{
			_indigo.setSessionID ();
			
			_indigo.checkResult (_indigo._indigo_lib.indigoSetOption ("render-output-format", "png"));
			byte[] res = renderToBuffer (obj);
			
			MemoryStream stream = new MemoryStream ();
			stream.Write (res, 0, res.Length);
			stream.Seek (0, SeekOrigin.Begin);
			
			return (Bitmap)Image.FromStream (stream);
		}
Пример #5
0
		public byte[] renderToBuffer (IndigoObject obj)
		{
			_indigo.setSessionID ();
			using (IndigoObject bufh = _indigo.writeBuffer()) {
				_indigo.checkResult (_renderer_lib.indigoRender (obj.self, bufh.self));
				byte* buf;
				int bufsize;
				_indigo.checkResult (_indigo._indigo_lib.indigoToBuffer (bufh.self, &buf, &bufsize));

				byte[] res = new byte[bufsize];
				for (int i = 0; i < bufsize; ++i)
					res [i] = buf [i];
				return res;
			}
		}
Пример #6
0
 public IndigoObject createSaver(IndigoObject output, string format)
 {
     setSessionID();
     return(new IndigoObject(this, output, _indigo_lib.indigoCreateSaver(output.self, format)));
 }
Пример #7
0
 public void addCatalyst(IndigoObject molecule)
 {
     dispatcher.setSessionID();
     _indigo_lib.indigoAddCatalyst(self, molecule.self);
 }
Пример #8
0
 public void renderToFile(IndigoObject obj, string filename)
 {
     _indigo.setSessionID ();
     _indigo.checkResult (_renderer_lib.indigoRenderToFile (obj.self, filename));
 }
Пример #9
0
 public int arrayAdd(IndigoObject item)
 {
     dispatcher.setSessionID();
     return dispatcher.checkResult(_indigo_lib.indigoArrayAdd(self, item.self));
 }
Пример #10
0
 public void setAtomMappingNumber(IndigoObject reaction_atom, int number)
 {
     dispatcher.setSessionID();
     _indigo_lib.indigoSetAtomMappingNumber(self, reaction_atom.self, number);
 }
Пример #11
0
 /// <summary>
 /// Inserts a structure under a specified id
 /// </summary>
 /// <param name="record">Indigo object with a chemical structure (molecule or reaction)</param>
 /// <param name="id">record id</param>
 /// <returns> inserted record id</returns>
 public int insert(IndigoObject record, int id)
 {
     _indigo.setSessionID();
     return(Bingo.checkResult(_indigo, _lib.bingoInsertRecordObjWithId(_id, record.self, id)));
 }
Пример #12
0
 public System.Collections.IEnumerable iterateMatches(IndigoObject query)
 {
     dispatcher.setSessionID();
     return new IndigoObject(dispatcher, dispatcher.checkResult(_indigo_lib.indigoIterateMatches(self, query.self)), this);
 }
Пример #13
0
 public System.Collections.IEnumerable iterateMatches(IndigoObject query)
 {
     dispatcher.setSessionID();
     return(new IndigoObject(dispatcher, this, _indigo_lib.indigoIterateMatches(self, query.self)));
 }
Пример #14
0
 public int countMatches(IndigoObject query)
 {
     dispatcher.setSessionID();
     return dispatcher.checkResult(_indigo_lib.indigoCountMatches(self, query.self));
 }
Пример #15
0
 public int countMatchesWithLimit(IndigoObject query, int embeddings_limit)
 {
     dispatcher.setSessionID();
     return dispatcher.checkResult(_indigo_lib.indigoCountMatchesWithLimit(self, query.self, embeddings_limit));
 }
Пример #16
0
 public IndigoObject match(IndigoObject query)
 {
     dispatcher.setSessionID();
     int res = dispatcher.checkResult(_indigo_lib.indigoMatch(self, query.self));
     if (res == 0)
         return null;
     return new IndigoObject(dispatcher, res, this);
 }
Пример #17
0
 public void unignoreAtom(IndigoObject atom)
 {
     dispatcher.setSessionID();
     dispatcher.checkResult(_indigo_lib.indigoUnignoreAtom(self, atom.self));
 }
Пример #18
0
 public void addCatalyst(IndigoObject molecule)
 {
     dispatcher.setSessionID();
     dispatcher.checkResult(_indigo_lib.indigoAddCatalyst(self, molecule.self));
 }
Пример #19
0
 public int arrayAdd(IndigoObject item)
 {
     dispatcher.setSessionID();
     return(_indigo_lib.indigoArrayAdd(self, item.self));
 }
Пример #20
0
 public IndigoObject mapMolecule(IndigoObject query_reaction_molecule)
 {
     dispatcher.setSessionID();
     int mapped = dispatcher.checkResult(_indigo_lib.indigoMapMolecule(self, query_reaction_molecule.self));
     if (mapped == 0)
         return null;
     return new IndigoObject(dispatcher, mapped);
 }
Пример #21
0
 public int countMatches(IndigoObject query)
 {
     dispatcher.setSessionID();
     return(_indigo_lib.indigoCountMatches(self, query.self));
 }
Пример #22
0
 public IndigoObject mapBond(IndigoObject query_bond)
 {
     dispatcher.setSessionID();
     int mapped = dispatcher.checkResult(_indigo_lib.indigoMapBond(self, query_bond.self));
     if (mapped == 0)
         return null;
     return new IndigoObject(dispatcher, mapped);
 }
Пример #23
0
 public void append(IndigoObject obj)
 {
     dispatcher.setSessionID();
     _indigo_lib.indigoAppend(self, obj.self);
 }
Пример #24
0
 public IndigoObject decomposeMolecule(IndigoObject mol)
 {
     dispatcher.setSessionID();
     int res = dispatcher.checkResult(_indigo_lib.indigoDecomposeMolecule(self, mol.self));
     if (res == 0)
         return null;
     return new IndigoObject(dispatcher, res, this);
 }
Пример #25
0
 public IndigoObject addBond(IndigoObject dest, int order)
 {
     dispatcher.setSessionID();
     return(new IndigoObject(dispatcher, this, _indigo_lib.indigoAddBond(self, dest.self, order)));
 }
Пример #26
0
 public void addDecomposition(IndigoObject q_match)
 {
     dispatcher.setSessionID();
     dispatcher.checkResult(_indigo_lib.indigoAddDecomposition(self, q_match.self));
 }
Пример #27
0
 /// <summary>
 /// Execute similarity search operation
 /// </summary>
 /// <param name="query">indigo object (molecule or reaction)</param>
 /// <param name="min">Minimum similarity value</param>
 /// <param name="max">Maximum similairy value</param>
 /// <returns>Bingo search object instance</returns>
 public BingoObject searchSim(IndigoObject query, float min, float max)
 {
     return(searchSim(query, min, max, null));
 }
Пример #28
0
 public void append(IndigoObject obj)
 {
     dispatcher.setSessionID();
    dispatcher.checkResult(_indigo_lib.indigoAppend(self, obj.self));
 }
Пример #29
0
        public Metafile renderToMetafile(IndigoObject obj)
        {
            _indigo.setSessionID ();

            _indigo.checkResult (_indigo._indigo_lib.indigoSetOption ("render-output-format", "emf"));
            byte[] res = renderToBuffer (obj);

            MemoryStream ms = new MemoryStream (res);
            Metafile mf = new Metafile (ms);

            return mf;
        }
Пример #30
0
 public int atomMappingNumber(IndigoObject reaction_atom)
 {
     dispatcher.setSessionID();
     return dispatcher.checkResult(_indigo_lib.indigoGetAtomMappingNumber(self, reaction_atom.self));
 }
Пример #31
0
 public IndigoObject reactionProductEnumerate(IndigoObject reaction, IndigoObject monomers)
 {
     setSessionID();
     return(new IndigoObject(this, _indigo_lib.indigoReactionProductEnumerate(reaction.self, monomers.self)));
 }
Пример #32
0
 public void setAtomMappingNumber(IndigoObject reaction_atom, int number)
 {
     dispatcher.setSessionID();
     dispatcher.checkResult(_indigo_lib.indigoSetAtomMappingNumber(self, reaction_atom.self, number));
 }
Пример #33
0
 public void transform(IndigoObject reaction, IndigoObject monomer)
 {
     setSessionID();
     _indigo_lib.indigoTransform(reaction.self, monomer.self);
 }
Пример #34
0
        public ReactingCenter reactingCenter(IndigoObject bond)
        {
            int c;
            dispatcher.setSessionID();

            if (dispatcher.checkResult(_indigo_lib.indigoGetReactingCenter(self, bond.self, &c)) == 1)
                return (ReactingCenter)c;
            throw new IndigoException("reactingCenter(): unexpected result");
        }
Пример #35
0
 public void cmlAppend(IndigoObject item)
 {
     dispatcher.setSessionID();
     _indigo_lib.indigoCmlAppend(self, item.self);
 }
Пример #36
0
 public void setReactingCenter(IndigoObject bond, ReactingCenter type)
 {
     dispatcher.setSessionID();
     dispatcher.checkResult(_indigo_lib.indigoSetReactingCenter(self, bond.self, (int)type));
 }
Пример #37
0
 public void unignoreAtom(IndigoObject atom)
 {
     dispatcher.setSessionID();
     _indigo_lib.indigoUnignoreAtom(self, atom.self);
 }
Пример #38
0
 public IndigoObject addBond(IndigoObject dest, int order)
 {
     dispatcher.setSessionID();
     return new IndigoObject(dispatcher, dispatcher.checkResult(_indigo_lib.indigoAddBond(self, dest.self, order)), this);
 }
Пример #39
0
 public int countMatchesWithLimit(IndigoObject query, int embeddings_limit)
 {
     dispatcher.setSessionID();
     return(_indigo_lib.indigoCountMatchesWithLimit(self, query.self, embeddings_limit));
 }
Пример #40
0
 public IndigoObject merge(IndigoObject what)
 {
     dispatcher.setSessionID();
     return new IndigoObject(dispatcher, dispatcher.checkResult(_indigo_lib.indigoMerge(self, what.self)), this);
 }
Пример #41
0
 public void addDecomposition(IndigoObject q_match)
 {
     dispatcher.setSessionID();
     _indigo_lib.indigoAddDecomposition(self, q_match.self);
 }
Пример #42
0
 public IndigoObject exactMatch(IndigoObject obj1, IndigoObject obj2)
 {
     return(exactMatch(obj1, obj2, ""));
 }
Пример #43
0
 public int atomMappingNumber(IndigoObject reaction_atom)
 {
     dispatcher.setSessionID();
     return(_indigo_lib.indigoGetAtomMappingNumber(self, reaction_atom.self));
 }
Пример #44
0
 public int commonBits(IndigoObject obj1, IndigoObject obj2)
 {
     setSessionID();
     return(_indigo_lib.indigoCommonBits(obj1.self, obj2.self));
 }
Пример #45
0
 public void setReactingCenter(IndigoObject bond, ReactingCenter type)
 {
     dispatcher.setSessionID();
     _indigo_lib.indigoSetReactingCenter(self, bond.self, (int)type);
 }
Пример #46
0
 public IndigoObject substructureMatcher(IndigoObject target, string mode)
 {
     setSessionID();
     return(new IndigoObject(this, target, _indigo_lib.indigoSubstructureMatcher(target.self, mode)));
 }
Пример #47
0
 public IndigoObject merge(IndigoObject what)
 {
     dispatcher.setSessionID();
     return(new IndigoObject(dispatcher, this, _indigo_lib.indigoMerge(self, what.self)));
 }
Пример #48
0
 public IndigoObject substructureMatcher(IndigoObject target)
 {
     return(substructureMatcher(target, ""));
 }
Пример #49
0
 /// <summary>
 /// Execute substructure search operation
 /// </summary>
 /// <param name="query">Indigo query object (molecule or reaction)</param>
 /// <returns>Bingo search object instance</returns>
 public BingoObject searchSub(IndigoObject query)
 {
     return(searchSub(query, null));
 }
Пример #50
0
 /// <summary>
 /// Perform exact search operation
 /// </summary>
 /// <param name="query">indigo object (molecule or reaction)</param>
 /// <param name="options">exact search options</param>
 /// <returns>Bingo search object instance</returns>
 public BingoObject searchExact(IndigoObject query, string options)
 {
    if (options == null)
    {
       options = "";
    }
    _indigo.setSessionID();
    return new BingoObject(Bingo.checkResult(_indigo, _lib.bingoSearchExact(_id, query.self, options)), _indigo, _lib);
 }
Пример #51
0
 /// <summary>
 /// Perform exact search operation
 /// </summary>
 /// <param name="query">indigo object (molecule or reaction)</param>
 /// <returns>Bingo search object instance</returns>
 public BingoObject searchExact(IndigoObject query)
 {
     return(searchExact(query, null));
 }
Пример #52
0
 /// <summary>
 /// Perform exact search operation
 /// </summary>
 /// <param name="query">indigo object (molecule or reaction)</param>
 /// <returns>Bingo search object instance</returns>
 public BingoObject searchExact(IndigoObject query)
 {
    return searchExact(query, null);
 }
Пример #53
0
 public void renderToHDC(IndigoObject obj, IntPtr hdc, bool printing)
 {
     _indigo.setSessionID ();
     int hdch = _indigo.checkResult (_renderer_lib.indigoRenderWriteHDC ((void*)hdc, printing ? 1 : 0));
     _indigo.checkResult (_renderer_lib.indigoRender (obj.self, hdch));
 }
Пример #54
0
 /// <summary>
 /// Execute similarity search operation
 /// </summary>
 /// <param name="query">indigo object (molecule or reaction)</param>
 /// <param name="min">Minimum similarity value</param>
 /// <param name="max">Maximum similairy value</param>
 /// <returns>Bingo search object instance</returns>
 public BingoObject searchSim(IndigoObject query, float min, float max)
 {
     return searchSim(query, min, max, null);
 }
Пример #55
0
 public IndigoObject decomposeMolecules(IndigoObject scaffold, IndigoObject structures)
 {
     setSessionID();
     return(new IndigoObject(this, _indigo_lib.indigoDecomposeMolecules(scaffold.self, structures.self)));
 }
Пример #56
0
 public void cmlAppend(IndigoObject item)
 {
     dispatcher.setSessionID();
     dispatcher.checkResult(_indigo_lib.indigoCmlAppend(self, item.self));
 }
Пример #57
0
 public void renderToFile(IndigoObject obj, string filename)
 {
     _indigo.setSessionID();
     _indigo.checkResult(_renderer_lib.indigoRenderToFile(obj.self, filename));
 }
Пример #58
0
 public IndigoObject decomposeMolecules(IndigoObject scaffold, IEnumerable structures)
 {
     return(decomposeMolecules(scaffold, toIndigoArray(structures)));
 }
Пример #59
0
 public String getInchi(IndigoObject molecule)
 {
     _indigo.setSessionID();
     return(new String(_indigo.checkResult(_inchi_lib.indigoInchiGetInchi(molecule.self))));
 }
Пример #60
0
 public IndigoObject createDecomposer(IndigoObject scaffold)
 {
     setSessionID();
     return(new IndigoObject(this, _indigo_lib.indigoCreateDecomposer(scaffold.self)));
 }