Take me to pcigeomatics.com

PCI Geomatics Help Center

How can we help you today?

VTRANS

PCI Geomatics -

doc
doc @title{VTRANS}{Apply Vector Scaling}
doc
doc This script applies a scaling to all vertices in a PCIDSK vector
doc layer.  The scaling values are asked interactively.  Note that the
doc vector layer is updated in place, so your original data is altered.
doc
doc This script can also be used as a model for other types of transformation.
doc Complex transformations can be applied to vertice values in a similar
doc manner.
doc
doc NOTE: This script only works with EASI/PACE V6.0.1 or beyond.  It 
doc       does _not_ work with EASI/PACE V6.0
doc
doc See Also: VECREG, VECPRO, VECREP
doc_end

status_title "VTRANS"
status_s FILE
status_s DBVS

local int fd, iShape, i
local double dXScale, dYScale
local Vertex ptr pasVertices

!----------------------------------------------------------------
!	Ask the user for the X and Y scaling.
!	This should come from a parameter but we don't really
!	have anything applicable.
!----------------------------------------------------------------

input "X Scaling:" dXScale
input "Y Scaling:" dYScale

!----------------------------------------------------------------
!	Loop over all shapes applying transform.
!----------------------------------------------------------------

fd = DBOpen( file, "r+" )

iShape = VECNextShape( fd, DBVS, -1 )

while( iShape != -1 )

  pasVertices = VECGetVertices( fd, DBVS, iShape )

  for i = 1 to f$len(pasVertices)
    pasVertices[i].x = pasVertices[i].x + dXScale
    pasVertices[i].y = pasVertices[i].y + dYScale
  endfor

  call VECSetVertices( fd, DBVS, iShape, f$len(pasVertices), pasVertices )

  call EFree( pasVertices )

  iShape = VECNextShape( fd, DBVS, iShape )
endwhile

!----------------------------------------------------------------
!	Cleanup
!----------------------------------------------------------------


call DBClose( fd )



Have more questions? Submit a request

Comments

Powered by Zendesk