Re: If and how to control the margin between canvas and plot borders

Thanks Tom,

after switching to a 3D display with a 2D renderer your solution with the transformation matrix does it.


Olav

Tom Whittaker wrote:

Thanks, I will look into the Javadoc issue. I've been trying to keep the javadoc jar file in sync with the releases but I must have a mistake in my "build" procedure.

Regarding the box size, here is the code snippet from the subs.py that does this -- you'll have to cast it into Java, though...unless you're using Jython!


  def setBoxSize(self, percent=.70, clip=1, showBox=1, snap=0):
    """
    Set the size of the VisAD 'box' for the <display> as a percentage
    (fraction). The default is .70 (70%).   If <clip> is true, the
    display will be clipped at the border of the box; otherwise, data
    displays may spill over.  If <showBox> is true, the wire-frame will
    be shown; otherwise, it will be turned off.  If <snap> is true, the
    box will be reoriented to an upright position.
    """
    pc=self.getProjectionControl()
    if (not snap) or (self.pcMatrix == None):
      self.pcMatrix=pc.getMatrix()

    if len(self.pcMatrix) > 10:
      self.pcMatrix[0]=percent
      self.pcMatrix[5]=percent
      self.pcMatrix[10]=percent
    else:
      self.pcMatrix[0]=percent/.64
      self.pcMatrix[3]=-percent/.64

    pc.setMatrix(self.pcMatrix)
    dr = self.getDisplayRenderer();

    if __ok3d:
      try:
         if isinstance(dr, DisplayRendererJ3D):
           dr.setClip(0, clip,  1.,  0.0,  0.0, -1.);
           dr.setClip(1, clip, -1.,  0.0,  0.0, -1.);
           dr.setClip(2, clip,  0.0,  1.,  0.0, -1.);
           dr.setClip(3, clip,  0.0, -1.,  0.0, -1.);
           #dr.setClip(4, 1,  0.0,  0.0,  1., -1.);
           #dr.setClip(5, 1,  0.0,  0.0, -1., -1.);
         elif isinstance(dr, DisplayRendererJ2D):
           if clip:
             dr.setClip(-1., 1., -1., 1.)
           else:
             dr.unsetClip()
      except:
         pass

    dr.setBoxOn(showBox)


tom


rybatzki wrote:

Hi,

if a similar message from me is always on the list then it is a mistake, but as I can't see it, I will ask this question a second time. For my current project I have to compose pictures from different plots to generate a video from them. The off screen rendering works fine. The only problem is that the images from the off screen displays have a large empty border around the plots. So the question is, how can I reduce this border programmatically?


Olav


PS: I suggest to repackage the Javadoc jar file. I have noticed the email from tom that there is a new build of VisAD. The size of the docs jar file is far to high. It contains the documentation twice under a folder called docs. One time as the documentation itself ordered into different sub folders and the second time as a jar file of these folders.




  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: