// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 

// Copyright 2003 Liam Girdwood  

#include <string>
#include <iostream>
#include "import.hh"
#include "astro_object.hh"

int usage (char* name)
{
	std::cout << name << ": cat_name cat_path" << std::endl;
	exit(1);
}

int main (int argc, char* argv[])
{	
	if (argc != 3)
		usage(argv[0]);

	std::string name(argv[1]);
	std::string path(argv[2]);

	Pollux::Import* import = new Pollux::Import(); 
	import->set_name (name);
	import->set_path (path);
	Pollux::Catalog* cat = import->import_catalog();
	
	if (cat) {
		for (double j = -1; j< 20; j++) {
			std::cout << "Test " << j << " limit ";
			std::vector<Castor::AstroObject*> objects;
			cat->clip(0,-90,360,90,j,j+1);
			int i = cat->get_objects(objects);
			std::cout << i << " objects found" << std::endl; 
		}	
		cat->save (name, path);

		Pollux::Catalog* cat2 = new Pollux::Catalog();
		cat2->load (name, path);
		for (double j = -1; j< 20; j++) {
			std::cout << "Test " << j << " limit ";
			std::vector<Castor::AstroObject*> objects;
			cat2->clip(0,-90,360,90,j,j+1);
			int i = cat2->get_objects(objects);
			std::cout << i << " objects found" << std::endl;
		} 
	}
}


syntax highlighted by Code2HTML, v. 0.9.1