User 870ab5b546
30-03-2015 18:53:49
MarvinJS 14.11.10 has the following Javascript method:
Returns an object which provides information about the current structure on the canvas. This information can be useful for choosing the best export format. The properties:Key | Type | Notes |
---|
'atomCount' | integer | the number of atoms |
'bondCount' | integer | the number of bonds |
'rGroupAttachmentCount' | integer | the number of R-Group attachments |
'electronFlowArrowCount' | integer | the number of electron flow arrows |
'straightArrowCount' | integer | the number of reaction arrow or other straight arrows |
'graphicalObjectCount' | integer | the number of graphical objects such as boxes or ellipses |
'sGroupCount' | integer | the number of expanded and contracted abbreviations and other S-Groups |
'rGroupCount' | integer | the number of R-Groups |
'hasQueryProperties' | boolean {true, false} | true if any atom or bond has advanced any query properties, true otherwise |
'is3DStructure' | boolean {true, false} | true any atom has a valid z coordinate, false otherwise |
'isReaction' | boolean {true, false} | true if the structure has at least one atom, and has exactly one straight arrow, false otherwise |
'isRGroupMolecule' | boolean {true, false} | true if the structure has at least one atom, at least one R-Group and at least one R-Group attachment point, false otherwise
|
This method appears to have been eliminated in MarvinJS 15.3.23.0; it is not listed in the API, and my program halts when it encounters the line,
if (marvinSketcherInstance.getStructureInfo().atomCount === 0) {
Why has it been eliminated, is there a workaround, and do you plan to reintroduce it or something similar?
User 870ab5b546
31-03-2015 12:30:33
I would add that the Javascript code above did NOT cause an error message to be displayed in the console when it failed, so it took a while for me to trace the source of the problem. I don't understand why I didn't see an error message in the console.
ChemAxon f052bdfe3c
03-04-2015 14:25:28
We have plans to create a workaround of this particular usage. Could you send me a more detailed description how did you use this?
Thanks a lot,
Efi
User 870ab5b546
03-04-2015 18:44:29
We use it to make sure that a student's response contains a structure of some kind. It's a simple check that we prefer to do in Javascript, rather than sending it back to the server to count the atoms.
ChemAxon 7c2d26e5cf
27-04-2015 09:19:22
User 870ab5b546
27-04-2015 13:46:27
Yes and no. Does isEmpty() return true for the following MRV? If it returns false, then it is not suitable.
<cml><MDocument><MChemicalStruct><molecule molID="m1"><atomArray/><bondArray/></molecule></MChemicalStruct><MRectangle lineColor="#000000" id="o1"><MPoint x="-5.25" y="-0.3333333333333333"/><MPoint x="0.125" y="-0.3333333333333333"/><MPoint x="0.125" y="3.3333333333333335"/><MPoint x="-5.25" y="3.3333333333333335"/></MRectangle><MRectangle lineColor="#000000" id="o2"><MPoint x="3.4583333333333335" y="-0.4583333333333333"/><MPoint x="8.583333333333334" y="-0.4583333333333333"/><MPoint x="8.583333333333334" y="3.25"/><MPoint x="3.4583333333333335" y="3.25"/></MRectangle><MPolyline headLength="0.6" headWidth="0.4" id="o3"><MRectanglePoint rectRef="o1" pos="5"/><MRectanglePoint rectRef="o2" pos="7"/></MPolyline></MDocument></cml>
ChemAxon 7c2d26e5cf
29-04-2015 10:38:44
Of course, in the referred case, isEmpty() returns with false. Unless the canvas is dirty, this function returns with true.
User 870ab5b546
29-04-2015 13:29:55
Then isEmpty() is not suitable, and I would like you to restore getStructureInfo().