problem with Marvin 4.1.0alpha20

User 870ab5b546

29-07-2006 20:52:07

I'm doing this procedure:





Code:
        MObject   mObj;


        MPolyline arrow;


        DPoint3   point1, point0;


...


            mObj = mDoc.getObject(objIndex);


            if ((mObj instanceof MPolyline) &&   // object is a MPolyline


                !(mObj instanceof MRectangle) &&  // but not a Rectangle


                !(mObj instanceof MEFlow)) {     // and not a flow


                arrow = (MPolyline) mObj;


                if (!arrow.isArrow()) throwException("Please connect your "+


                                     "rectangles with arrows, not with lines.");


      System.out.println("   now getting the endpoints of a reaction arrow.");


                MPoint arrowpoint0 = arrow.getPoint(0);


                MPoint arrowpoint1 = arrow.getPoint(1);


      System.out.println("   now getting the locations of the endpoints (new Marvin 4.1 method).");








The code fails at one of the getPoint() lines at the end. The second to last message appears in the log, but the last one never does. It didn't fail until we started using Marvin 4.1.0alpha20.





The Marvin document on which the code is operating is below. It appears that the way you define MPolylines has changed: At least in the example below, they are defined by a new object, MRectanglePoint, which refers to the point in a rectangle to which they the MPolyline points. Do you have a new method that gets the rectangle to which a MPolyline endpoint is fixed? Why doesn't getPoint() work on MPolylines that are defined by MRectanglePoint endpoints?





-- Bob





Code:
<?xml version="1.0" ?>


<MDocument>


  <MEFlow id="o1" arcAngle="192.23868445537119" headSkip="0.15"


          headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a7 m1.a11" />


    <MAtomSetPoint atomRefs="m1.a11 m1.a22" weights="0.25 0.75" />


  </MEFlow>


  <MChemicalStruct>


    <molecule molID="m1">


      <atomArray


          atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30"


          elementType="C C C C C C C C C C Cl C C C C C C C C C C Al Cl Cl Cl C C C C H"


          formalCharge="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0"


          x2="5.425000190734863 4.091330849686605 4.091330849686605 5.425000190734863 6.758669531783122 6.758669531783122 -12.016666412353516 -13.350345534181551 -10.68298729052548 -12.786666412353515 -11.246666412353516 2.1583333015441895 0.8246639604959309 0.8246639604959309 2.1583333015441895 3.492002642592448 3.492002642592448 4.825681764420484 4.055681764420484 5.595681764420484 6.159360886248519 -7.875 -7.875 -6.335 -7.875 -0.46666666865348816 -0.46666666865348805 -1.5556111116807712 -0.06808533919560578 3.692749520228723"


          y2="15.948366705825112 15.178349765266072 13.63831588414799 12.86829894358895 13.63831588414799 15.178349765266072 14.326666793823243 13.556666793823242 13.556666793823243 15.660345915651277 15.660345915651277 5.740033690383218 4.970016749824177 3.4299828687060963 2.659965928147056 3.4299828687060963 4.970016749824177 5.740016749824177 7.0736958716522125 7.0736958716522125 4.970016749824177 15.225000381469727 16.765000381469726 15.225000381469727 13.685000381469727 16.91666603088379 15.37666603088379 14.287721587856506 13.889140258398625 16.665875537751237"


          />


      <bondArray>


        <bond atomRefs2="a1 a2" order="1" />


        <bond atomRefs2="a1 a6" order="2" />


        <bond atomRefs2="a2 a3" order="2" />


        <bond atomRefs2="a3 a4" order="1" />


        <bond atomRefs2="a4 a5" order="2" />


        <bond atomRefs2="a5 a6" order="1" />


        <bond atomRefs2="a7 a8" order="1" />


        <bond atomRefs2="a7 a9" order="1" />


        <bond atomRefs2="a7 a10" order="1" />


        <bond atomRefs2="a7 a11" order="1" />


        <bond atomRefs2="a12 a13" order="1" />


        <bond atomRefs2="a12 a17" order="2" />


        <bond atomRefs2="a13 a14" order="2" />


        <bond atomRefs2="a14 a15" order="1" />


        <bond atomRefs2="a15 a16" order="2" />


        <bond atomRefs2="a16 a17" order="1" />


        <bond atomRefs2="a17 a18" order="1" />


        <bond atomRefs2="a18 a19" order="1" />


        <bond atomRefs2="a18 a20" order="1" />


        <bond atomRefs2="a18 a21" order="1" />


        <bond atomRefs2="a22 a23" order="1" />


        <bond atomRefs2="a22 a24" order="1" />


        <bond atomRefs2="a22 a25" order="1" />


        <bond atomRefs2="a26 a27" order="1" />


        <bond atomRefs2="a27 a28" order="1" />


        <bond atomRefs2="a27 a29" order="1" />


        <bond atomRefs2="a2 a30" order="1" />


      </bondArray>


    </molecule>


  </MChemicalStruct>


  <MEFlow id="o3" arcAngle="-150.0" headSkip="0.15" headLength="0.5"


          headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a2 m1.a30" />


    <MAtomSetPoint atomRefs="m1.a2 m1.a27" weights="0.25 0.75" />


  </MEFlow>


  <MRectangle id="o4">


    <MPoint x="-15.166666984558105" y="17.96666717529297" />


    <MPoint x="-5.074999809265137" y="17.96666717529297" />


    <MPoint x="-5.074999809265137" y="11.899999618530273" />


    <MPoint x="-15.166666984558105" y="11.899999618530273" />


  </MRectangle>


  <MRectangle id="o5">


    <MPoint x="-3.383333444595337" y="17.850000381469727" />


    <MPoint x="7.933333396911621" y="17.850000381469727" />


    <MPoint x="7.933333396911621" y="11.841666221618652" />


    <MPoint x="-3.383333444595337" y="11.841666221618652" />


  </MRectangle>


  <MRectangle id="o6">


    <MPoint x="-1.1083333492279053" y="8.633333206176758" />


    <MPoint x="8.574999809265137" y="8.633333206176758" />


    <MPoint x="8.574999809265137" y="1.225000023841858" />


    <MPoint x="-1.1083333492279053" y="1.225000023841858" />


  </MRectangle>


  <MPolyline id="o7" headLength="0.8" headWidth="0.5">


    <MRectanglePoint pos="5" rectRef="o4" />


    <MRectanglePoint pos="7" rectRef="o5" />


  </MPolyline>


  <MPolyline id="o8" headLength="0.8" headWidth="0.5">


    <MRectanglePoint pos="6" rectRef="o5" />


    <MRectanglePoint pos="4" rectRef="o6" />


  </MPolyline>


</MDocument>


User 870ab5b546

29-07-2006 23:58:00

P.S. The new "sticky reaction arrows" should make it a lot easier for us to find out which rectangles an arrow is connecting, but we need these methods:





MObject[2] MPolyline.getEndPoints() (might return MPoint or MRectanglePoint or even MPolyline in either array cell)


String MRectanglePoint.getRectRef()


int MRectanglePoint.getPosition()


String MObject.getID()

ChemAxon 7c2d26e5cf

31-07-2006 17:32:30

We will check it.

User 870ab5b546

01-08-2006 03:14:43

I take it back. Here are the methods we need:





MPolyline MMidpoint.getPolyline()MRectangle MRectanglePoint.getRectangle()


MMidPoint MPolyline.getMidPoint()Also useful:





int MObject.getIndex()Documentation questions on Marvin 4.1:





(1) Are MRectanglePoint and MMidPoint classes within MPoint in Marvin 4.1? If so, then MPolyline.getPoints() and MPolyline.getPoint(int i) return MPoints that may be MRectanglePoints or MMidPoints, correct? If not, then the two methods need to be changed so that they return MObjects, not MPoints.





(2) What values of i in MPolyline.getPoint(int i) are permitted for different subclasses of MPolylines, and what values do they return? When MPolyline is not an instanceof MRectangle (is an MEFlow or a regular line/arrow), do the permissible values remain 0 and 1 in Marvin 4.1, returning the tail and head respectively, or are the permissible values in Marvin 4.1 now 0, 1, and 2, returning the tail, midpoint, and head? (If the latter, we don't need the getMidPoint() method above.) What values of i are permitted when MPolyline is an instanceof MRectangle?





Your answers are greatly appreciated.

ChemAxon 7c2d26e5cf

03-08-2006 14:42:42

Yes, MPoints and MRectanglePoint are the extensions of the MPoint class.


MPolyline.getPoints() and MPolyline.getPoints(int) can return with an instance of MPoints or its any extensioned class.


In the new release the apidoc of requested classes will be also available. Theoretically, the new release will be available this week.





Because the release date is very close, we can not accept more feature requests for Marvin 4.1. But we will consider your requests after release.

User 870ab5b546

03-08-2006 21:34:27

And a JChem version that will be able to use the new classes will also be released at the same time?

ChemAxon a3d59b832c

04-08-2006 06:33:40

Unfortunately, the JChem code is not that stable yet. It is planned to be released in a month or two. (However, further alpha releases will be coming during this time, if needed.)





Szabolcs