9 Replies Latest reply on Feb 12, 2008 12:01 PM by simonbaker

    gpd.xml bend coordinates

    simonbaker

      [I'm separating this question from another thread -- I would really appreciate some help on this question, especially the bendpoints]

      I would greatly appreciate some more help with this topic as we are using JGraph to re-draw our process definition graph for the user. I don't understand how to use the various x, y, h.., w.. values to position the transition labels and draw the bends in the arrows.

      For example, here is a typical node in gpd.xml file:

      Code:




      <bendpoint w1="-162" h1="-29" w2="5" h2="66"/>
      <bendpoint w1="-188" h1="-59" w2="130" h2="42"/>



      <bendpoint w1="-312" h1="84" w2="-1" h2="62"/>






      Can the author of the GPD process designer help us understand how to interpret the attributes in the "label" and "bendpoint" elements so we can redraw these features in another coordinate system?

      Thanks
      SB

        • 1. Re: gpd.xml bend coordinates
          simonbaker

          Sorry, cut and paste lost the code. Here:

          
           <node name="Manager - Review Holds" x="290" y="301" width="256" height="40">
           <transition name="Officer - Adjust Holds">
           <label x="43" y="-4"/>
           <bendpoint w1="-162" h1="-29" w2="5" h2="66"/>
           <bendpoint w1="-188" h1="-59" w2="130" h2="42"/>
           </transition>
           <transition name="Manager - Adjust Hold">
           <label x="62" y="-18"/>
           <bendpoint w1="-312" h1="84" w2="-1" h2="62"/>
           </transition>
           <transition name="Done">
           <label x="5" y="-10"/>
           </transition>
           </node>
          


          • 2. Re: gpd.xml bend coordinates
            simonbaker

            I think I have deciphered the bendpoint and label coordinates of the edges (arrows) connecting the nodes.

            <bendpoint w1="-162" h1="-29" w2="5" h2="66"/>
            


            w1, h1 is the horizontal and vertical offset of a bendpoint relative to the center of the rectangle representing the node the arrow starts on. w2, h2 is the same point but relative to the center of the rectangle representing the node the arrow points to. So w2, h2 are redundant coordinates for convenience.

            <label x="43" y="-4"/>
            

            The edge (arrow) label coordinates seem to be relative to either: 1) the center bendpoint if there are an odd number of bendpoints, or 2) the midpoint between the two middle bendpoints if there are an even number of bendpoints. We can treat the center points of the two node rectangles as bendpoints for the purposes of the calculation if there are no formal bendpoints.


            • 3. Re: gpd.xml bend coordinates
              kukeltje

              are w2 and h2 still redundant if a transition has more bendpoints? and to what are w1 and h1 relative then?

              Good (interesting) work btw... Maybe this should be added as comment or annotations in the gpd.xsd

              • 4. Re: gpd.xml bend coordinates
                simonbaker

                w1,h1 always seem to be relative to the source node rectangle center, even for many bendpoints.

                w2,h2 likewise seem always relative to the target node rectangle center even for many bendpoints. In other words, bendpoint coordinates have their origins at the node rectangles -- they are not offsets from another bendpoint.

                However, I find the w1,h1 coordinates more stable than the w2,h2 coordinates when you change the graph. If I move the source or target node rectangle, the bendpoints all stay in the same place relative to the source (that's how it is implemented) and the w1,h1 coordinates don't change as you'd expect. The w2,h2 coordinates should change, but they don't! However, if I then reposition a bendpoint, the w2,h2 coordinates update to the correct values.

                I tested by closing and reopening the processdefinition.xml and gpd.xml files after any change to the diagram.

                I'm not sure exactly what version designer I'm using, it may be 3.0.12, but certainly not the latest so perhaps the w2,h2 coordinate updating is fixed in later versions.


                • 5. Re: gpd.xml bend coordinates
                  kukeltje

                  Just out of curiosity, did you choose jGraph over e.g. SVG or did you not consider SVG at all. Personally I'd be interested in an xslt that converts the gpd.xml to SVG. Cool dynamic overlay things can be done than including zooming etc... without the need to use a jpg

                  • 6. Re: gpd.xml bend coordinates
                    kukeltje

                    So bendpoints are in fact nothing more than line-segments with a kind of weird coordinate system. Besides that, you cannot draw a diagram without having the original processdefinition.xml as wel, since you have to know where the transitions go to. I wonder why Koen implemented it this way. Maybe it has something to do with Eclipse GEF or something... now I'm even more in favour of having one file with GPD info within the processelements using namespaces and not to separate sections in one file, see

                    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=107992&postdays=0

                    • 7. Re: gpd.xml bend coordinates
                      koen.aers

                      So yes, it is completely GEF related. And indeed, merging the info in one file would solve these issues.

                      Cheers,
                      Koen

                      • 8. Re: gpd.xml bend coordinates
                        simonbaker

                         

                        "kukeltje" wrote:
                        Just out of curiosity, did you choose jGraph over e.g. SVG or did you not consider SVG at all. Personally I'd be interested in an xslt that converts the gpd.xml to SVG. Cool dynamic overlay things can be done than including zooming etc... without the need to use a jpg


                        Someone else on our team looked at SVG and thought it was a good candidate, I wish I knew more about it. Time and learning curve are always our problem. We needed a "bird's eye view" navigator auxiliary graph, like Yahoo maps, where you move a miniature retangle in a larger one to scroll the main graph, and JGraph had that. Otherwise, JGraph is a substantial package to learn also although the paid support from the developer is fairly good. I would prefer to do everything from scratch or as close to it as possible, maybe SVG would be better for that. I hope to check it out sometime.

                        • 9. Re: gpd.xml bend coordinates
                          simonbaker

                           

                          "kukeltje" wrote:
                          So bendpoints are in fact nothing more than line-segments with a kind of weird coordinate system. Besides that, you cannot draw a diagram without having the original processdefinition.xml as wel, since you have to know where the transitions go to. I wonder why Koen implemented it this way. Maybe it has something to do with Eclipse GEF or something... now I'm even more in favour of having one file with GPD info within the processelements using namespaces and not to separate sections in one file, see

                          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=107992&postdays=0


                          You're right, it is a chore to relate the two files. In our implementation, I get the transition info from the deployed ProcessDefinition (just a little easier than the xml), not the xml file, but I use the gpd.xml file for the layout.