;------
; PROGRAM NAME: JUMPER.UCM
; CALLED FROM MENUS AVCOMV, INST & PROC
;
; WRITTEN BY: TOM HODUKAVICH
; DATE: DEC-22-88
;
; PURPOSE: THIS COMMAND ALLOWS THE USER TO PLACE A "JUMPER",
; WHICH IS A 180 DEGREE ARC WITH RADIUS OF 0:1:0 WORKING
; UNITS, AT THE POINT AT WHICH ONE LINE INTERSECTS ANOTHER.
; THE COMMAND ALSO MAY BE USED WITH LINE STRINGS. THE JUMPER
; LINE IS ALWAYS SELECTED FIRST, THEN, THE LINE TO BE JUMPED.
; THE JUMPER IS PLACED ON THE SAME LEVEL AND AT THE SAME LINE
; WEIGHT AS THE JUMPER LINE, WITH LINE CODE = 0. AFTER THE
; JUMPER IS PLACED, THE PORTION OF THE JUMPER LINE WITHIN THE
; ARC RADIUS IS PARTIALLY DELETED.
; AFTER PLACING A JUMPER, THE USER MAY RESET TO EXIT, OR
; CONTINUE BY SELECTING ADDITIONAL LINES. THE USER MAY ALSO
; EXIT THE COMMAND AT ANY TIME BY SELECTING ANOTHER MENU COMMAND.
;
; ------
SET R1=ACTLEV ;SAVE ACTIVE LEVEL
SET R2=IDSYMB ;SAVE ELEMENT SYMBOLOGY
SET R9=CONTRL ;SAVE CONTROL PARAMETERS
SET R8=OUTFLG
SET A14=EU.UOR
SET A14=A14*2
SET A13=-1*A14
SET CONTRL=CONTRL!256 ;INHIBIT PRIMITIVE CMD ST,CF, AND PR FIELDS
SET OUTFLG=OUTFLG!8 ;ENABLE SLI OPTION
START: CMD LOCELE
A1: SET WWSECT=4 ;SET FILE POINTERS TO FILE BEGINNING
SET WWBYTE=0
MSG 'CFPLACE LINE JUMPER' ;PROMPT USER TO IDENTIFY JUMPER LINE
MSG 'STRESET TO EXIT'
MSG 'PRIDENTIFY JUMPER LINE'
GET1: GET P,A,R,EXIT,M,SLI,K,SLI
GO GET1
A: PNT XUR,YUR,,,,,12,0 ;MASK FOR LINES AND LINE STRINGS
TST RELERR NE 0, GET1 ;TEST FOR NO LINE FOUND
MSG1: MSG 'PRIDENTIFY LINE TO BE JUMPED'
SET CUGRAF=0 ;RESET CUGRAF ON RECYCLE
SET I15=XUR ;SAVE X,Y COORDINATES
SET A15=YUR
SET R4=CUREBL ;SAVE FILE POINTERS TO
SET R5=CUREBY ;JUMPER LINE
SET R30 = 0 ;JUMPER/2ND LINE FLAG
TST UELETY EQ 4,LSTR ;TEST FOR LINE STRING
SET I1=LN.BEG(1) ;SAVE LINE ENDPOINTS
SET A1=LN.BEG(2)
SET I2=LN.BEG(3)
SET A2=LN.BEG(4)
BACK1: SET ACTLEV=XYZLEV ;SET ACTIVE LEVEL TO JUMPER LEVEL
SET IDSYMB=SY.DSP ;SET SYMBOLOGY TO JUMPER SYMBOLOGY
SET CUGRAF=ID.GRF ;SET ACTIVE GG# TO JUMPER GG#
KEY 'LC=0' ;SET LINE CODE = 0
MSG 'ST '
MSG 'ERRESET TO REJECT JUMPER LINE' ;PROMPT USER TO SELECT 2ND
GET2: GET P,B,R,RSTART,M,SLI,K,SLI ;LINE OR REJECT JUMPER
GO GET2
RSTART: RST ;SEARCH FOR ANOTHER LINE
TST RELERR NE 0,START ;TEST FOR NO LINE FOUND
GO MSG1
B: CMD LOCELE ;LOCATE 2ND LINE
SET WWSECT=4
SET WWBYTE=0 ;RESET FILE POINTERS
PNT XUR,YUR,,,,,12,0 ;MASK FOR LINES AND LINE STRINGS
TST RELERR NE 0,NOLINE ;TEST FOR NO LINE FOUND
SET I15=XUR ;SAVE 2ND POINT X,Y COORDINATES
SET A15=YUR
GET3: MSG 'PRDATA POINT TO ACCEPT'
MSG 'ERRESET TO REJECT' ;PROMPT TO ACCEPT/REJECT 2ND LINE
GET P,C,R,RST,M,SLI,K,SLI
GO B
RST: RST ;SEARCH FOR ANOTHER LINE
TST RELERR NE 0, NOLINE ;TEST FOR NO LINE FOUND
GO GET3
NOLINE: MSG 'PRNO LINE FOUND'
MSG 'ERTRY AGAIN OR RESET TO START OVER' ;PROMPT USER TO
GET P,B,R,START,M,SLI,K,SLI ;ENTER A DIFFERENT
GO NOLINE ;DATA POINT
C: MSG 'PR '
SET R6=CUREBL ;SAVE FILE POINTERS TO SECOND LINE
SET R7=CUREBY
SET R30=1 ;JUMPER/2ND LINE FLAG
TST UELETY EQ 4,LSTR ;TEST FOR LINE STRING
SET I3=LN.BEG(1) ;SAVE ENDPOINTS OF 2ND LINE
SET A3=LN.BEG(2)
SET I4=LN.BEG(3)
SET A4=LN.BEG(4)
BACK2: SET R3=0 ;VERTICAL JUMPER FLAG
TST I1 NE I3,D ;TEST FOR SAME LINE SELECTED TWICE
TST A1 NE A3,D
GO ERR1 ;*********************************
D: SET I5=I2-I1 ;*
TST I5 NE 0, NOTVRT ;*TEST FOR VERTICAL JUMPER
D2: SET R3 = 1 ;*SET VERTICAL JUMPER FLAG
GO SETI6 ;*
NOTVRT: SET A5=A2-A1 ;*
SET A5=A5/I5 ;*DETERMINE SLOPE JUMPER LINE
TST A5 GE 500,D2 ;*TEST FOR SLOPE NEAR VERTICAL
TST A5 LE -500,D2 ;*
SETI6: SET I6=I4-I3 ;*
TST I6 NE 0, NOT2 ;*TEST FOR VERTICAL 2ND LINE
V2: TST R3 NE 0,NOX ;*REJECT IF BOTH LINES VERTICAL
GO VERT2 ;*
NOT2: SET A6=A4-A3 ;*
SET A6=A6/I6 ;*DETERMINE SLOPE 2ND LINE
TST A6 GT 500,V2 ;*TEST FOR SLOPE NEAR VERTICAL
TST A6 LT -500,V2 ;*
TST R3 NE 0,VERT1 ;* * * * * * * * * * * *
SET I7=I1-I4 ;*THIS SECTION CONTAINS A GEOMETRIC *
SET A7=A6*I7 ;*ALGORITHM WHICH DETERMINES THE
SET A7=A4+A7 ;*POINT OF INTERSECTION BETWEEN THE *
SET I8=A7-A1 ;*JUMPER LINE AND THE 2ND LINE
SET A8=A5-A6 ;* * * * * * * * * * * * *
TST A8 EQ 0,NOX ;*REJECT IF LINES HAVE SAME SLOPE
SET A8=I8/A8 ;*
SET I0=I1+A8 ;*DETERMINE X-COORDINATE
SET A0=A5*A8 ;*
SET A0=A1+A0 ;*DETERMINE Y-COORDINATE
GO TSTOK ;*
VERT1: SET I7=I1-I3 ;*PROCEDURE FOR VERTICAL JUMPER
SET A7=A6*I7 ;*
SET A0=A3+A7 ;*
SET I0=I1 ;*
GO TSTOK ;*
VERT2: SET I7=I3-I1 ;*PROCEDURE FOR VERTICAL 2ND LINE
SET A7=A5*I7 ;*
SET A0=A1+A7 ;*
SET I0=I3 ;***********************************
TSTOK: SET WWSECT=4 ;***********************************
SET WWBYTE=0 ;*RESET FILE POINTERS
CMD LOCELE ;*
SET R0=1 ;*LINE COUNT FLAG
PNT I0,A0,,,,,12,0 ;*ELEMENT MASK
RELERR: TST RELERR NE 0,NOX ;* THIS SECTION DETERMINES
BACK3: TST CUREBL NE R4,CUREBL ;*WHETHER THE LINES ACTUALLY
TST CUREBY NE R5,CUREBL ;*INTERSECT BY MAKING SURE THEY
GO OK1 ;*CAN BOTH BE LOCATED AT THE
CUREBL: TST CUREBL NE R6,RST2 ;*CALCULATED INTERSECTION POINT
TST CUREBY NE R7,RST2 ;*
OK1: TST R0 NE 1,OK2 ;*
SET R0=2 ;*
RST ;*
TST R4 NE R6,RELERR ;*TEST FOR 2 SEGMENTS OF SAME
TST R5 NE R7,RELERR ;*LINE STRING
TST I0 GT I1,J ;*
TST I0 LT I2,NOX ;*FOR LINE STRINGS TEST IF
GO K ;*INTERSECTION POINT IS IN X-RANGE
J: TST I0 GT I2,NOX ;*OF BOTH SEGMENTS
K: TST I0 GT I3,L ;*
TST I0 LT I4,NOX ;*
GO OK2 ;*
L: TST I0 GT I4,NOX ;* SCREEN OUT ANY OTHER LINES
RST2: RST ;*PASSING THROUGH INTERSECTION POINT
GO RELERR ;***********************************
OK2: CMD PARCC ;ACTIVATE PLACE ARC BY CENTER CMD
CVT I10=':1' ;CONVERT RADIUS TO POSITIONAL UNITS
TST R3 NE 0,VERT3 ;TEST FOR VERTICAL JUMPER
TST A5 GT 500, VERT3 ;TEST FOR SLOPE NEAR VERTICAL
TST A5 LT -500,VERT3 ;***********************************
SET I15=I10*I10 ;*THIS SECTION CONTAINS A GEOMETRIC
SET A10=A5*A5 ;*ALGORITHM THAT DETERMINES THE
SET A10=A10+1 ;*BEGINNING AND END POINTS OF THE ARC
SET A9=I15/A10 ;*ON THE JUMPER LINE (EXCEPT FOR
SQR A8,A9 ;*VERTICAL OR NEAR-VERTICAL JUMPER
SET A9=A5*A8 ;*LINES)
ARC: SET I11=I0+A8 ;*DETERMINE X,Y OF ARC BEGINNING POINT
SET A11=A0+A9 ;*
SET I12=I0-A8 ;*DETERMINE X,Y OF ARC END POINT
SET A12=A0-A9 ;************************************
PNT3: PNT I11,A11
PNT I0,A0
PNT I12,A12
SET CUGRAF=0 ;RESET CUGRAF
CMD DLPELE
SET WWSECT=R4 ;SET FILE POINTERS TO JUMPER LINE
SET WWBYTE=R5
PNT I12,A12 ;PARTIALLY DELETE SECTION OF JUMPER
PNT I11,A11 ;LINE
GO START ;RECYCLE
VERT3: SET A11=A0-I10 ;PROCEDURE FOR VERTICAL JUMPER
SET I11=I0 ;PLACE ARC TO RIGHT SIDE OF JUMPER LINE
SET A12=A0+I10
SET I12=I0
GO PNT3
NOX: CMD LOCELE ;ERROR MESSAGE FOR NO INTERSECTION
MSG 'ERLINES DO NOT INTERSECT -- RESELECT LINES' ;RECYCLE
GO A1 ;*************************************
LSTR: SET R10= LS.NVR ;THIS SECTION (LSTR THROUGH
SET I10=1000000 ;LINE2) IDENTIFIES THE
SET R11=-1 ;PARTICULAR SEGMENT OF A LINE
SET R12=0 ;STRING WHICH HAS BEEN
SET R13=1 ;SELECTED BY THE USER
SET R14=2
SET I11=LS.VER(1)
SET I12=LS.VER(2)
SET R15=1 ;INITIALIZE LOOP
GO INCR
NXTSEG: SET I11=I13
SET I12=I14
INCR: SET R15=R15+1 ;INCREMENT LOOP COUNTER
TST R15 LE R10,SETR11 ;TEST FOR LOOP COMPLETION
TST I10 GE 1000000,ERR2 ;TEST FOR FAILURE TO IDENTIFY SEGMENT
TST R30 NE 0,BACK2 ;CHECK JUMPER/2ND LINE FLAG FOR
GO BACK1 ;RETURN
SETR11: SET R11=R11+2
SET R12=R12+2 ;INCREMENT SUBSCRIPT VARIABLES
SET R13=R13+2
SET R14=R14+2
SET I13=LS.VER(R13)
SET I14=LS.VER(R14)
TST I11 EQ I13,VTCLST ;TEST FOR VERTICAL
TST I15 GE I11,CHECKX ;SEGMENT...DETERMINE
TST I15 LT I13,SETI7 ;IF I15 IS IN X-RANGE
GO CHECKY ;OF SEGMENT
CHECKX: TST I15 GT I13,SETI7
GO CHECKY
SETI7: SET I7 = I15-I11 ;THIS TEST IS NECESSARY TO
TST I7 GT A14,NXTSEG ;AVOID REJECTING LINE SEGMENTS
TST I7 LT A13,NXTSEG ;WITH VERY HIGH SLOPE
CHECKY: TST I12 EQ I14,DELTA
TST A15 GE I12,CHECK2 ;DETERMINE IF A15 IS
TST A15 LT I14,SETI8 ;IN Y-RANGE OF SEGMENT
GO DELTA
CHECK2: TST A15 GT I14,SETI8
GO DELTA
SETI8: SET I8=A15 -I12 ;THIS TEST IS NECESSARY TO
TST I8 GT A14,NXTSEG ;AVOID REJECTING SEGMENTS WITH
TST I8 LT A13,NXTSEG ;VERY SMALL SLOPE
DELTA: SET I7=I13-I11
SET I8=I14-I12
SET A0= I8/I7 ;DETERMINE SLOPE
SET I7=I15-I11
SET I8=I7*A0 ;DETERMINE Y-COORDINATE
SET I8=I12+I8 ;CORRESPONDING TO I15
SET I9=A15 -I8
TSTI9: TST I9 GE 0,STORE ;DETERMINE ABSOLUTE VALUE OF
SET I9=I9*-1 ;DIFFERENCE BETWEEN A15 AND
GO STORE ;COMPUTED Y-VALUE
VTCLST: TST A15 GE I12,TSTYUR
TST A15 LT I14,NXTSEG ;PROCEDURE FOR VERTICAL
GO SETI9 ;SEGMENT
TSTYUR: TST A15 GT I14,NXTSEG
SETI9: SET I9 = I15-I11
GO TSTI9
STORE: TST I9 GT I10,NXTSEG ;REJECT SEGMENT IF A MORE LIKELY ONE
SET I10=I9 ;HAS BEEN IDENTIFIED
TST R30 NE 0,LINE2 ;CHECK JUMPER/2ND LINE FLAG
SET I1=I11
SET A1=I12
SET I2=I13 ;SAVE BEGINNING AND END POINTS OF
SET A2=I14 ;JUMPER SEGMENT
GO NXTSEG
LINE2: SET I3=I11 ;SAVE ENDPOINTS OF 2ND LINE SEGMENT
SET A3=I12
SET I4=I13
SET A4=I14
GO NXTSEG ;**************************************
ERR1: CMD LOCELE ;SAME LINE ERROR MESSAGE
MSG 'ERYOU SELECTED SAME LINE TWICE--START OVER'
GO A1 ;RECYCLE
ERR2: CMD LOCELE ;FAILURE TO IDENTIFY LINE STRING SEGMENT
MSG 'ERERROR IN FINDING LSTR SEGMENT-START OVER'
GO A1 ;RECYCLE
SLI: SET WWSECT=4 ;SLI EXIT PROCEDURE
SET WWBYTE=0 ;RESET FILE POINTERS
SET CONTRL=R9 ;RESTORE ACTIVE LEVEL, SYMBOLOGY,
SET ACTLEV=R1 ;AND CONTROL PARAMETERS
SET IDSYMB=R2
SET OUTFLG=R8
SET CUGRAF=0 ;RESET CUGRAF
MSG 'ST ' ;CLEAR MESSAGE FIELDS
MSG 'CF '
MSG 'PR '
MSG 'ER '
SLI ;SEND LAST INPUT TO FILE BUILDER
GO END
EXIT: MSG 'ER ' ;NORMAL EXIT PROCEDURE
EXITUC: SET WWSECT=4
SET WWBYTE=0 ;RESET FILE POINTERS
SET CONTRL=R9 ;RESTORE ACTIVE LEVEL, SYMBOLOGY
SET ACTLEV=R1 ;AND CONTROL PARAMETERS
SET IDSYMB=R2
SET OUTFLG=R8
SET CUGRAF=0 ;RESET CUGRAF
MSG 'ST '
MSG 'CFCOMMAND COMPLETE'
MSG 'PR '
END: END ;EXIT COMMAND