MarvinSketch Scaling

User 4ceb4fe234

06-06-2008 14:06:53

Dear everybody,





I've a little problem: I got a pretty large MarvinSketch (version 5.0.4) applet but I want the chemical structures to be displayed with a constant scaling size. Thus, is passed a scale of 10 to the applet but this does not seem to work. Can you please give me a hint?





Please find attached the sample html page and the molecule to be loaded.





Best regards





Helge

ChemAxon 909aee4527

09-06-2008 07:19:57

Dear Helge,





for me the sample html page works fine, the structure is scaled so that a C-C single bond is 10 pixel, i.e the magnification is 36%.


Isn't it the detach parameter that causes confusion? In case you use this parameter, the applet behaves like a "button" that opens up MarvinSketch upon click. (The structure is autoscaled on this button.)


When removing the detach and undetachByX parameters, the page seems to be normal.


Does this help?





Kind regards,


Judit

User 4ceb4fe234

09-06-2008 08:29:07

Hi Judit,





what we want to have is an clickable area on our web page that launches MarvinSketch. It doesn't matter whether it's a simple Java Button that must be clicked or a MarvinView applet that has to be double clicked. What we don't want to have is Marvin embedded directly in the web page.





But since the clickable area is very large (about 400x400) the molecules within this area have to be scaled down to make them look nice - we don't want a benzene ring with a diameter of 300 pixel :-)





The sketch solution with the button works very fine if I remove both detach options as you suggested. But why does this not work with the detach options? We would like to have the button image to be scaled.





Or - as an alternative - we could use MarvinSketch. But I was not able to define a working scaling here, too. The parameter winScale seems to have no effect and the parameter tabScale results in a stack trace. Here is my code for this:





<script LANGUAGE="JavaScript1.1">


var mview_mayscript = true;


mview_name = "MVIEW";


mview_begin("Classes2", 400, 400);


mview_param( "mol" , "x.mol" );


mview_param("winScale", "10.4");


mview_param("tabScale", "20.4");


mview_end();


</script>





Do you have any idea?





Thanks in advance





Helge

ChemAxon 909aee4527

09-06-2008 08:55:43

Helge, is it also suitable to have a smaller clickable area?


Code:
msketch_begin("../Classes2", 100, 100);


msketch_param("detach", "hide,size=600x600");






Otherwise I pass the button scaling question to my collleague, Tamas.

User 4ceb4fe234

09-06-2008 09:10:04

Hi Judit,





I'm afraid, this is no option - we have a search page that contains the picture of a chemical structure (which is editable using MarvinSketch). But this chemical structure can be very large (up to several hundred heavy atoms) or very small in case of something like methane. But the applet size is fixed and has to be large to have enough place for the bigger molecules. But the molecules should look the same. Using MarvinBeans, I do the following:





double scale = 26;


Molecule mol = importer.importMol( sMolfile );


String format = "png:w200,b32,#ffffff";


MolImageSize misize = mol.getImageSize( format );


if( misize.scale >= scale )


format = format + ",scale" + String.valueOf( scale );


byte[] data = mol.toBinFormat( format );





The same effect I would like to have for the applets.





Thanks and regards





Helge

ChemAxon 7c2d26e5cf

09-06-2008 10:09:36

Hi Helge,


Please see the last three examples on this page (especially show_image5.jsp) Image Generation Using Marvin Beans.


In these examples Marvin Beans API is compined with Marvin Applets. The beans API is responsible for image generation and Marvin Applets for displaying/editing the selected molecule. They examples demonstrates how to launch applet by clicking on an image.


I hope these examples are useful for you.





Tamas

User 4ceb4fe234

09-06-2008 11:23:35

Hi Tamas,





I've tried this solution and found that it works fine. But it does not fit our needs exactly. We want to have a clickable area on the web page that opens - on click or double click - a MarvinSketch and updates the clickable area (either an image or MarvinApplet) after editing. This works in Marvin very well except for the scaling of the structure in the clickable area.





And if I would use your Ajax solution, I would have two pictures of the same image on the same web page. That's not what we want. Furthermore, this means a lot of network traffic since each molecule has to be sent to the server and rendered there and the picture has to be passed back to the client. This takes - in a fast environment - about 0.5 seconds but will take using the internet easily 1 or 2 seconds.





Therefore, we would prefer a client side solution. Do you have another idea?





Helge

ChemAxon 7c2d26e5cf

10-06-2008 15:00:38

Quote:
Therefore, we would prefer a client side solution. Do you have another idea?
No, currently, I can not suggest other solution.

ChemAxon 909aee4527

03-07-2008 14:25:08

Dear Helge,





just a quick idea first: would it be convenient for you to control the scale factor on the button with a new parameter?





We are still examining further possibilities and will hopefully be back with a useful solution soon.


We are sorry for the inconvenience the delay might cause for you.





Kind regards,


Judit

User 4ceb4fe234

14-07-2008 08:53:21

Hi Judit,





this would be very fine, I think.





But this parameter should control only the maximum scaling size, if possible. Otherwise large molecules won't fit in the button. Or, in other words, downscaling should be possible.





Best Regards





Helge

ChemAxon 909aee4527

15-07-2008 07:20:17

Hi Helge,





we are working on it, and we will notify you as soon as the new parameters are ready to use.


Thank you for your patience.





Kind regards,


Judit

ChemAxon 909aee4527

29-07-2008 07:14:19

Dear Helge,





the new parameters are ready to use in Marvin 5.0.7, released yesterday.





http://www.chemaxon.com/marvin/help/developer/sketchman.html#parameters.maxscale


http://www.chemaxon.com/marvin/help/developer/sketchman.html#parameters.detach





Your example modified by the new parameter is attached.





Please tell us if this solution suits your needs.





Kind regards,


Judit

ChemAxon 909aee4527

03-09-2008 18:51:48

Hello Helge,





have you had the chance to try the parameters yet?





If you still need something to let this work, please tell us and we will implement it.





Kind regards,


Judit