Hydrodynamics of weakly deformed soliton lattices. Differential geometry and Hamiltonian theory