All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Public Attributes
SciFigs::IrregularGrid2DDraw Class Reference

Brief description of class still missing. More...

#include <IrregularGrid2DDraw.h>

List of all members.

Public Member Functions

 IrregularGrid2DDraw ()
void setCellLimits ()
void setCellNodes (const IrregularGrid2D &grid, const GraphContentOptions &gc)
void setVisibleArea (const IrregularGrid2D &grid, const GraphContentOptions &gc)
 ~IrregularGrid2DDraw ()

Public Attributes

int * limx
int * limy
int * nodex
int * nodey
int nx
int ny
int startix
int startiy
int stopix
int stopiy

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References limx, limy, nodex, and nodey.

{limx=0;limy=0;nodex=0;nodey=0;}

Description of destructor still missing

References limx, limy, nodex, and nodey.

{delete [] limx; delete [] limy;delete [] nodex; delete [] nodey;}

Member Function Documentation

Returns the x and y limits of the cells inside the visible areaas well as the screen coordinates of the cell nodes. start/stop/ix/iy must have been initialized before calling this function (see getVisibleArea() and getCellNodes())

References limx, limy, nodex, nodey, nx, ny, and TRACE.

Referenced by SciFigs::IrregularGrid2DPlot::paintData(), and SciFigs::LiveGridLayer::paintData().

{
  TRACE;
  // Calculate the limits of blocks in for x axis (limx)
  limx=new int [ nx + 1 ];
  limx[ 0 ]=(3 * nodex[ 0 ] - nodex[ 1 ] ) >> 1;
  for(int ix=1;ix < nx;ix++ )
    limx[ ix ]=(nodex[ ix - 1 ] + nodex[ ix ] ) >> 1;
  limx[ nx ]=(3 * nodex[ nx - 1 ] - nodex[ nx - 2 ] ) >> 1;

  // Calculate the limits of blocks in for y axis (limy)
  limy=new int [ ny + 1 ];
  limy[ 0 ]=(3 * nodey[ 0 ] - nodey[ 1 ] ) >> 1;
  for(int iy=1;iy < ny;iy++ )
    limy[ iy ]=(nodey[ iy - 1 ] + nodey[ iy ] ) >> 1;
  limy[ ny ]=(3 * nodey[ ny - 1 ] - nodey[ ny - 2 ] ) >> 1;
}

Returns the x and y screen coordinates of the cell nodes inside the visible areaas start/stop/ix/iy must have been initialized before calling this function (see getVisibleArea())

References nodex, nodey, nx, ny, startix, startiy, stopix, stopiy, TRACE, QGpCoreTools::IrregularGrid2D::x(), SciFigs::GraphContentOptions::xr2s(), QGpCoreTools::IrregularGrid2D::y(), and SciFigs::GraphContentOptions::yr2s().

Referenced by SciFigs::IrregularGrid2DPlot::paintData(), and SciFigs::LiveGridLayer::paintData().

{
  TRACE;
  // Create two int vectors containing the x and y of nodes (centers of blocks)
  nx=stopix-startix+1;
  ASSERT(nx>0);
  nodex=new int[nx];
  int * ptr=nodex;
  for(int ix=startix; ix<=stopix; ix++, ptr++) {
    *ptr=gc.xr2s(grid.x(ix));
  }

  ny=stopiy-startiy+1;
  ASSERT(ny>0);
  nodey=new int[ny];
  ptr=nodey;
  for(int iy=startiy; iy<=stopiy; iy++, ptr++) {
    *ptr=gc.yr2s(grid.y(iy));
  }
}

Returns the x and y index limits of the visible area. The grid index order is the same as the axis, hence there is no need to check the correctness of startix<stopix, this is always true.

References QGpCoreTools::IrregularGrid2D::indexOfX(), QGpCoreTools::IrregularGrid2D::indexOfY(), QGpCoreTools::IrregularGrid2D::nx(), QGpCoreTools::IrregularGrid2D::ny(), startix, startiy, stopix, stopiy, TRACE, TRACE_BUG, TRACE_BUG_INT, TRACE_BUG_N, SciFigs::GraphContentOptions::xVisMax(), SciFigs::GraphContentOptions::xVisMin(), SciFigs::GraphContentOptions::yVisMax(), and SciFigs::GraphContentOptions::yVisMin().

Referenced by SciFigs::IrregularGrid2DPlot::paintData(), and SciFigs::LiveGridLayer::paintData().

{
  TRACE;
  TRACE_BUG;
  startix=grid.indexOfX(gc.xVisMin());
  stopix=grid.indexOfX(gc.xVisMax());
  TRACE_BUG_INT(startix);
  TRACE_BUG_INT(stopix);
  TRACE_BUG_INT(grid.nx());
  startix--;
  stopix++;
  if(startix<0) startix=0;
  if(stopix>=grid.nx()) stopix=grid.nx()-1;
  ASSERT(stopix-startix+1>0);

  TRACE_BUG_N(1);
  startiy=grid.indexOfY(gc.yVisMin());
  stopiy=grid.indexOfY(gc.yVisMax());
  TRACE_BUG_INT(startiy);
  TRACE_BUG_INT(stopiy);
  TRACE_BUG_INT(grid.ny());
  startiy--;
  stopiy++;
  if(startiy<0) startiy=0;
  if(stopiy>=grid.ny()) stopiy=grid.ny()-1;
  ASSERT(stopiy-startiy+1>0);
}

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines