#include <CGAL/Random.h>
#include <iostream>
#include <fstream>
#include <cassert>
enum Red_blue {
RED = 1,
BLUE = 2,
PURPLE = 3
};
std::ostream&
{
if ( rb == RED ) { os << "Red"; }
else if ( rb == BLUE ) { os << "Blue"; }
else if ( rb == PURPLE ) { os << "Purple"; }
return os;
}
struct Red_blue_convert_info
{
typedef Red_blue Info;
typedef const Info& result_type;
inline
const Info& operator()(const Info& info0, bool) const {
return info0;
}
inline
const Info& operator()(const Info& info0, const Info& , bool) const {
return info0;
}
};
struct Red_blue_merge_info
{
typedef Red_blue Info;
typedef Info result_type;
inline
Info operator()(const Info& info0, const Info& info1) const {
if ( info0 == info1 ) { return info0; }
return PURPLE;
}
};
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
#include <CGAL/Segment_Delaunay_graph_filtered_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_storage_traits_with_info_2.h>
typedef
CGAL::Segment_Delaunay_graph_storage_traits_with_info_2<Gt,
Red_blue,
Red_blue_convert_info,
Red_blue_merge_info>
ST;
typedef SDG2::Finite_vertices_iterator FVIT;
typedef SDG2::Site_2 Site_2;
int main()
{
std::ifstream ifs("data/sitesxx.rb.cin");
assert( ifs );
SDG2 sdg;
Site_2 site;
std::cout << std::endl;
std::cout << "Input sites:" << std::endl;
std::cout << "------------" << std::endl;
while ( ifs >> site ) {
char c;
ifs >> c;
Red_blue info = (c == 'r') ? RED : BLUE;
std::cout << site << std::flush;
std::cout << "\r\t\t\t" << info << std::endl;
sdg.insert(site, info);
}
std::cout << std::endl;
assert( sdg.is_valid(true, 1) );
std::cout << std::endl << std::endl;
std::cout << "Output sites:" << std::endl;
std::cout << "-------------" << std::endl;
for (FVIT it = sdg.finite_vertices_begin();
it != sdg.finite_vertices_end(); ++it) {
std::cout << it->site() << std::flush;
std::cout << "\r\t\t\t" << it->storage_site().info() << std::endl;
}
std::cout << std::endl;
return 0;
}