A Spanish court ruling on pollution from industrial pig farming could have far-reaching implications for how animals are kept across Europe.