    	SUBROUTINE LAYOUT_ZOOM( XF, YF, XP, YP )
C
C  PROGRAMMER: R.S. ZHOU		JUNE-1986
C
C	THIS ROUTINE ZOOMS PICKED LAYOUT SEGMENTS
C	BY "XF" AND "YF" WITH THE PIVOT AT (XP, YP).
C	IF XP OR YP .EQ. 99.0, THE SEGMENTS ARE ZOOMED
C	AROUND THEIR OWN INDIVIDUAL PIVOTS.
C
    	INCLUDE		'LAYOUT.CBS'
     	LOGICAL		SKIP, ONE
     	REAL*4		IFPACK_DECTEK
     	DIMENSION	IR1(9), IR2(9), IR3(9)
     	DATA IR1/ 3, 3, 3, 3, 3, 3, 3, 3, 4 /
     	DATA IR2/ 4, 4, 4, 4, 0, 4, 0, 4, 5 /
     	DATA IR3/ 5, 5, 5, 5, 4, 5, 0, 0, 0 /

     	IF( XF.LE.0.0 .OR.  YF.LE.0.0 ) RETURN
     	IF( XF.EQ.1.0 .AND. YF.EQ.1.0 ) RETURN

    	XOP = XP
    	YOP = YP
    	ZFX = IFPACK_DECTEK(XF)
    	ZFY = IFPACK_DECTEK(YF)
    	ONE = .FALSE.
    	IF( XOP.EQ.99.0 .OR. YOP.EQ.99.0 ) ONE = .TRUE.

    	DO  222 I = 1, NLG
    	    IS = NLS(I)
     	    SKIP = .FALSE.
     	    DO  111 J=1, NLC
     		IF( NSN(J).NE.IS ) GOTO 111
     		XPS = P00(1,J)
     		YPS = P00(2,J)
     		ZXO = ZXF(J)
     		ZYO = ZYF(J)
     		ZXF(J) = IFPACK_DECTEK(ZXO*ZFX)
     		ZYF(J) = IFPACK_DECTEK(ZYO*ZFY)
     		ZXO = ZXF(J)/ZXO
     		ZYO = ZYF(J)/ZYO
     		IF( .NOT.ONE ) THEN
     		    XPS = XOP + (XPS-XOP)*ZXO
     		    YPS = YOP + (YPS-YOP)*ZYO
     		    P00(1,J) = XPS
     		    P00(2,J) = YPS
     		ENDIF
     		IT3 = NID(J)
     		IT1 = IR1(IT3)
     		IT2 = IR2(IT3)
     		IT3 = IR3(IT3)
     		IF( .NOT.SKIP ) THEN
     		    IF( IT2.EQ.0 ) THEN
     			CALL IFSEG_TRAN(IS,XPS,YPS,RAN(J),ZXF(J),ZXF(J))
     		    ELSE
     			CALL IFSEG_TRAN(IS,XPS,YPS,RAN(J),ZXF(J),ZYF(J))
     		    ENDIF
     		ENDIF
     		P00(IT1,J) = P00(IT1,J)*ZXO
     		IF( IT2.GT.0 ) P00(IT2,J) = P00(IT2,J)*ZYO
     		IF( IT3.GT.0 ) P00(IT3,J) = P00(IT3,J)*ZXO
     		IF( NFL(J).EQ.0 ) GOTO 222
     		SKIP = .TRUE.
111	    CONTINUE
222	CONTINUE

     	CALL IFINIT_DUMP

    	RETURN
    	END

    	SUBROUTINE LAYOUT_ZOOM_SCALE( IP, XFT, YFT )
C
C  THIS ROUTINE ASSIGNS DIFFERNET ZOOMING SCALE FACTORS "XFT,YFT"
C  ACCORDING TO "IP" FOR LAYOUT PLOTTING.
C
    	SAVE IOPL

    	IOP = IP
    	XFT = 1.0
    	YFT = 1.0
    	IF( IOP.EQ.1 ) THEN
    	    XFT = 0.99
    	    YFT = 0.99
    	ELSE IF( IOP.EQ.2 ) THEN
     	    YFT = 0.99
     	ELSE IF( IOP.EQ.3 ) THEN
    	    XFT = 1.02
    	    YFT = 0.99
    	ELSE IF( IOP.EQ.4 ) THEN
     	    XFT = 0.99
     	ELSE IF( IOP.EQ.5 ) THEN
    	    IF(IOPL.NE.10) THEN
    	        IOPL = 10
    	    ELSE
    	        IOPL = 1
    	    ENDIF
    	ELSE IF( IOP.EQ.6 ) THEN
     	    XFT = 1.02
     	ELSE IF( IOP.EQ.7 ) THEN
    	    XFT = 0.99
    	    YFT = 1.02
    	ELSE IF( IOP.EQ.8 ) THEN
     	    YFT = 1.02
     	ELSE IF( IOP.EQ.9 ) THEN
    	    XFT = 1.02
    	    YFT = 1.02
    	ELSE IF( IOP.EQ.0 ) THEN
    	    IF(IOPL.NE.25) THEN
    	        IOPL = 25
    	    ELSE
    	        IOPL = 10
    	    ENDIF
    	ENDIF
    	IF( IOPL.EQ.0 ) IOPL = 1
    	XFT = XFT ** IOPL
    	YFT = YFT ** IOPL

    	RETURN
    	END

