color set

ChemAxon 587f88acea

23-06-2004 12:24:04

Hello,





is it possible to add my own color set?


Or to change one of the color sets?

ChemAxon 7c2d26e5cf

23-06-2004 14:35:52

Hello Tanja,


Yes, it is possible. You can define your own colors for atom / bond sets in Marvin.





In Marvin Beans:


Use MarvinPane.setAtomSetColor to change color for an atom set and MarvinPane.setBondSetColor for a bond set.


http://www.chemaxon.com/marvin/doc/api/chemaxon/marvin/beans/MarvinPane.html#setAtomSetColor(int,%20java.awt.Color)


http://www.chemaxon.com/marvin/doc/api/chemaxon/marvin/beans/MarvinPane.html#setBondSetColor(int,%20java.awt.Color)





In Marvin Applets:


You can use atomSetColor and bondSetColor applet parameters to define custom colors.


http://www.chemaxon.com/marvin/doc/dev/viewman.html#parameters.atomSetColor


http://www.chemaxon.com/marvin/doc/dev/viewman.html#parameters.bondSetColor





The following applet example demonstrates how to color atom / bond sets:


http://www.chemaxon.com/test/marvin/doc/dev/example-view6.html

ChemAxon 587f88acea

19-07-2004 09:07:45

Hello,





I can change the colour, but which function is responsible for redawing or showing the color changes?





I can´t see any changes by displaying atoms?





Tanja

ChemAxon 587f88acea

19-07-2004 13:37:46

I have solved the most problems, but there is one left.


I need a function to set the set for a special atom.


I only found something like this for MView, but not for MSketch. Is there anything like this?


Tanja

ChemAxon 7c2d26e5cf

19-07-2004 14:28:44

Tanja wrote:
I have solved the most problems, but there is one left.


I need a function to set the set for a special atom.


I only found something like this for MView, but not for MSketch. Is there anything like this?


Tanja
There are not any function in MSketch to do it. Only the viewer supports defining atom sets.

ChemAxon 587f88acea

05-08-2004 08:16:11

Hello,





I haven´t solved the problem to color all C of a molecule in a special color and all N in another color. Is there any example code available?


By loading the molecule in the sketch pane the molecule should be subsearched and the the special atoms should be colored (e.g. C = red).





Thanks again!


Tanja

ChemAxon fb166edcbd

10-08-2004 19:58:58

Here is an example code that performs substructure search and colors all hits. Usage:





Code:
java ColorHitsTest <query1 file> <query2 file> <target file>






First all atoms are colored green.


Then the target atoms matching query1 are colored red, and the target atoms matching query2 are colored blue. The target is then displayed in a viewer.





Note, that the target is set in the viewer after all atoms have been colored.

User f5e6ccf034

26-05-2008 15:22:29

I am not having any luck with this, i.e.,


Code:



   new MDocument(mol).setAtomSetRGB(1, rgb)





perhaps because I am using MolPrinter directly, not a MarvinPane or MViewPane (they are too high-level for what I am doing). How should I proceed?





Thanks.

ChemAxon 7c2d26e5cf

26-05-2008 20:10:30

Please take a look at to the attached example. Atom coloring work in MolPrinter.


I have also copied here a code sniplet. This part of the code is relevant for you:


Code:
MDocument doc = new MDocument(mol);


doc.setAtomSetRGB(1,0xffbbcc);


mol.getAtom(0).setSetSeq(1);


mol.getAtom(1).setSetSeq(1);


mol.getAtom(2).setSetSeq(1);


MolPrinter p = new MolPrinter(doc);

User f5e6ccf034

26-05-2008 20:33:42

Yes, thanks. I got it to work, too, in the meantime. Only since I am holding on to the MolPrinter object, I also hold on to the MDocument object, i.e., I have this class:


Code:



public class MolDrawer {





    private final MolPrinter printer = new MolPrinter();


    private final MDocument mdoc = new MDocument(new Molecule());





    public void setHighlightColors(...) {


        mdoc.setAtomSetRGB(0, ...);


        mdoc.setAtomSetRGB(1, ...);


    }





    public void draw(Graphics g, Molecule mol, Rectangle r) {


        mdoc.setMainMoleculeGraph(mol);


        printer.setDoc(mdoc);


        printer.paint(g, r);


    }


}





and this seems to work fine.