Optical spectroscopy of GX 339-4 during the high—soft and low—hard states — II. Line ionization and emission region