Hamiltonian structure of Kadomtsev-Petviashvili type equations