FUNCTION TransfQualif, qualP, lineStyle, userSym

;+
; NAME:
;	Transform Qualifiers
; PURPOSE:
;	Transforms the qualifiers used by PV-WAVE
;	with the variable !p.linestyle and !p.psym into
;	an mdisp format for writing them in an mdisp file.
; CALLING SEQUENCE:
;	result = TransfQualif( qualifier, lineStyle, userSym )
; INPUT PARAMETERS:
;	qualifier: The WAVE/IDL plot symbol number (see !p.psym)
;	lineStyle: The WAVE/IDL linestyle number (see !p.linestyle)
;	userSym: The user-defined symbol number  (see manuals)
; RESULT OF FUNCTION:
; 	the mdisp qualifier stored in the mdisp files.
; SEE ALSO:
;	http://
; MODIFICATION HISTORY:
;	Cretaed: in 1991 by A.Csillaghy, ETHZ.
;-

  IF N_Elements( lineStyle ) EQ 0 THEN lineStyle = 0

  idx = Where( qualP LT 0 ,  nQualNeg ) ; need to connect points with a line

  qual = Abs( qualP )
  nEls = N_Elements( qual )
  newQual = Replicate( 0, nEls )

  IF Total(idx) NE -1 THEN $
      newQual(idx) = lineStyle(idx)*20 + 40

  idx = Where( qual EQ 1 )
  IF Total( idx ) NE -1 THEN newQual( idx ) = newQual(idx) + 1 ; plus sign 
  idx = Where( qual EQ 2 )
  IF Total( idx ) NE -1 THEN newQual( idx ) = newQual(idx) ; star
  idx = Where( qual GE 3 AND qual LE 7 )
  IF Total( idx ) NE -1 THEN $
    newQual( idx ) = newQual(idx) + 35*(nQualNeg EQ 0) + 15*(nqualNeg NE 0) $
	 + qual( idx )
  idx = Where( qual EQ 8 )
  IF Total( idx ) NE -1 THEN BEGIN
    IF N_Elements( userSym ) EQ 0 THEN userSym = 0
    newQual( idx ) = newQual( idx ) + userSym + 22
  END
 
  RETURN, newQual

END ; transform qualifier wave -> mdisp
  

