Menu

Initial direction of wxSFOrthoLineShape

iwbnwif
2014-01-01
2014-04-04
  • iwbnwif

    iwbnwif - 2014-01-01

    I would like to discuss a change to the wxSFOrthoLineShape class that would help when drawing "Org Chart" type diagrams.

    At the moment the class will decide on the direction to take depending on the line's relative 'width' and 'height'. This causes problems for org charts because it means the initial segment of the line will be horizontal if the subordinate shape is further to the left / right than it is below.

    The code that causes this is in the following lines of wxSFOrthoLineShape::DrawLineSegment:

    nDirection = fabs( trg.y - src.y ) / fabs( trg.x - src.x );
    wxRealPoint ptCenter( (src.x + trg.x)/2, (src.y + trg.y)/2 );
    if( nDirection < 1 )
        ...
    

    I would like to propose that if the line is anchored to connection points, then an ortho line should always start vertical if the connection point type is cpTOPMIDDLE / cpBOTTOMMIDDLE and horizontal if it is cpCENTERLEFT / cpCENTERRIGHT.

    However to do this a wxLineShape would need to keep a pointer to the wxSFConnectionPoints for source and target (at the moment it is only recording the wxRealPoint).

    Any thoughts?

     
  • Michal Bližňák

    Try the latest trunk (rev 426), especially new function wxSFConnectionPoint::SetOrthoDirection(...). Also, functions related to the connection points' creation now returns pointer to the newly created connection point. Please, let me to know whether the improvements fulfill your needs.

     
  • iwbnwif

    iwbnwif - 2014-04-04

    Thank you very much, that is an even better solution and works perfectly for me!

    A little off topic, but when do the Doxygen docs get generated? Should it be part of my build or is it something you do before checking them into SVN? I ask because I noticed that the header files include the new documentation but the html I checked out from SVN doesn't.

     

    Last edit: iwbnwif 2014-04-04

Log in to post a comment.