zoomFactor

Syntax

int zoomFactor

Description

An integer between 1 and 16 to indicate the current zoom factor of the proxy preview window, or 0 if the proxy zoom factor has not yet been set. (In the current implementation, the zoomFactor variable is essentially the same as the built-in scaleFactor variable.)

Example

%ffp

ctl(0): STATICTEXT, "Please right click on the preview to set a cross.", size=(100,20)


OnCtl(n): {

  if (n == CTL_PREVIEW && e == FME_RIGHTCLICKED_DOWN) {
    j0 = getPreviewCoordX() * zoomFactor;
    j1 = getPreviewCoordY() * zoomFactor;
    doAction(CA_PREVIEW );
  }
  return false;
}


ForEveryTile: {

  int g, h, z, color;
  int PreviewX = j0/zoomFactor;
  int PreviewY = j1/zoomFactor;

  // Calculate color of the cross
  color = ( src(PreviewX, PreviewY, 0) + src(PreviewX, PreviewY, 1) + src(PreviewX, PreviewY, 2) ) /3;
  if (color > 128 && color < 196) color=0; 
  if (color > 64 && color < 128) color=255;
  else color =255-color;

  // Display Cross
  if (doingProxy){
    for (z=0; z < Z; z++) {
      for (g=-7; g < 8; g++)
        if (g < -1 || g > 1) pset(PreviewX + g, PreviewY, z, color);
      for (h=-7; h < 8; h++)
        if (h < -1 || h > 1) pset(PreviewX, PreviewY + h, z, color );	
    }
  }

  return true;
}

See Also

Constants, scaleFactor, setZoom