DXF Navigation

Help
jabii
2006-02-06
2013-04-25
  • jabii
    jabii
    2006-02-06

    Hi Ed --
    We hope to use YCAD to render DXF drawings to our own JPanel.  We'll want to superimpose our own graphic objects on top of the YCAD image as part of a set of interactive features--and hence we want to handle mouse events ourselves.  Therefore navigation of the YCAD image in terms of the panel grid is crucial for us. 

    It looks to me as though we can determine the origin of the image on the panel by calling YxxfPrtTilemode1::getLocation().  Am I on the right track here?  Further, how would I go about translating units on the YCAD drawing to pixels?

    Many thanks in advance for whatever hints you're able to offer.

     
    • M Simpson
      M Simpson
      2006-04-24

      I'm doing a similar thing to you, and am also encountering difficulties with the translation of coordinates.  Have you got any further?  From what I can gather, we need to perform the same matrix translations as YCAD does when it translates screen to world and vice versa.  The YCAD class YxxfGfxMatrix has the necessary calculations.

      What is driving me to despair is trying to change the size of drawing dynamically using the YxxfPrt... classes with a buffered image.  What keeps happening, and what I don't want, is that when the user resizes the window, the display area remains what it was originally, so only takes up a portion of the window.  I have tried setting the size for the Viewer, the current YxxfTilemode1, the Vroot and all of their respective YxxfGfxContexts' dspwin size, but YxxfPrtDrawingView keeps changing  them back to the original.  Is there any way to stop this happening without going into the code and adding a getter for YxxfPrtDrawingView in vhandler?

       
      • jabii
        jabii
        2006-04-24

        I can't respond in detail today--but will be back with you by next week.  In the meantime--yes, I managed to make progress to my satisfaction.  To respond briefly  to your last point (I hope not stupidly) I believe I noticed the sort of behavior you describe early on.  If memory serves (I don't have the src at hand) I simply resized the buffered image using current viewport settings when the user resized the window, and rerendered the dxf to it.  In re:windows to cad coordinate translation, I didn't want use the built-in pane because we need to handle the mouse events ourselves.  I need to restructure the project in the next few days so I'll have occasion to get you the details.

         
    • jabii
      jabii
      2006-04-24

      What I mean of course is that I resized the buffered image to the new window, and rendered the DXF using current viewport settings.