Replace old color API using global const variable with new one using functions

This commit is contained in:
Simon Giraudot 2019-01-24 14:18:49 +01:00
parent 59a169a300
commit e3e0efb4f8
28 changed files with 73 additions and 73 deletions

View File

@ -479,7 +479,7 @@ void xAlci_main_window::setup(int w, int h)
tab_widget->addTab(cad_tab,"cad");
tab_widget->addTab(arr_tab,"arrangement");
*widget << CGAL::LineWidth(2) << CGAL::BackgroundColor(CGAL::WHITE);
*widget << CGAL::LineWidth(2) << CGAL::BackgroundColor(CGAL::white());
resize(w,h);
double ratio = 1.0;//(double)h/w;
widget->set_window(-1, 1, -ratio, ratio, true);

View File

@ -277,11 +277,11 @@ inline std::ostream & operator<<(std::ostream & os, const Arr::Vertex & vertex)
inline Window_stream & operator<<(Window_stream & ws, Arr & arr)
{
Arr::Edge_iterator ei;
ws << CGAL::BLUE;
ws << CGAL::blue();
for (ei = arr.edges_begin(); ei != arr.edges_end(); ++ei)
ws << (*ei).curve();
Arr::Vertex_iterator vi;
ws << CGAL::RED;
ws << CGAL::red();
for (vi = arr.vertices_begin(); vi != arr.vertices_end(); ++vi)
ws << (*vi).point();
return ws;
@ -474,7 +474,7 @@ public:
m_window->flush();
#else
m_window->lock();
*m_window << CGAL::BackgroundColor(CGAL::WHITE) << CGAL::RED;
*m_window << CGAL::BackgroundColor(CGAL::white()) << CGAL::red();
(*m_window) << arr;
m_window->unlock();
App->flush();
@ -490,9 +490,9 @@ public:
ps_stream.set_line_width(1);
CGAL::Arr_drawer<Arr, CGAL::Postscript_file_stream> drawer(ps_stream);
// drawer.draw_faces(arr.faces_begin(), arr.faces_end());
ps_stream << CGAL::BLUE;
ps_stream << CGAL::blue();
drawer.draw_halfedges(arr.halfedges_begin(), arr.halfedges_end());
ps_stream << CGAL::RED;
ps_stream << CGAL::red();
drawer.draw_vertices(arr.vertices_begin(), arr.vertices_end());
// draw_arr(arr, drawer, ps_stream);

View File

@ -67,7 +67,7 @@ void draw_points_and_hull(const std::vector<Point_3>& points,
std::vector<Point_3>::const_iterator p_it;
CGAL::Geomview_stream geomview;
geomview << CGAL::RED;
geomview << CGAL::red();
for (p_it = points.begin(); p_it != points.end(); p_it++)
{
geomview << *p_it;
@ -78,7 +78,7 @@ void draw_points_and_hull(const std::vector<Point_3>& points,
Point_3 point;
Polyhedron_3 polyhedron;
geomview << CGAL::BLUE;
geomview << CGAL::blue();
if ( CGAL::assign(point, object) )
geomview << point;
else if ( CGAL::assign(segment, object) )

View File

@ -57,13 +57,13 @@ int main()
// use different colors, and put a few sleeps/clear.
gv << CGAL::BLUE;
gv << CGAL::blue();
std::cout << "Drawing 2D Delaunay triangulation in wired mode.\n";
gv.set_wired(true);
gv << D;
#if 1 // It's too slow ! Needs to use OFF for that.
gv << CGAL::RED;
gv << CGAL::red();
std::cout << "Drawing its Voronoi diagram.\n";
gv.set_wired(true);
D.draw_dual(gv);

View File

@ -50,25 +50,25 @@ int main()
gv.clear(); // remove the pickplane.
gv << K::Point_2 (200, 100);
gv << CGAL::BLUE;
gv << CGAL::blue();
gv << K::Point_3 (200, 100, 100);
gv << CGAL::RED;
gv << CGAL::red();
gv << K::Segment_2 (K::Point_2(200, 100),
K::Point_2(300, 100));
gv << CGAL::GREEN;
gv << CGAL::green();
gv << K::Segment_3 (K::Point_3(200, 100, 100),
K::Point_3(300, 100, 200));
gv << CGAL::DEEPBLUE;
gv << CGAL::deep_blue();
gv << K::Sphere_3 (K::Point_3(100, 100, 100), 1000);
gv << CGAL::VIOLET;
gv << CGAL::violet();
gv << K::Triangle_2 (K::Point_2(200, 200),
K::Point_2(220, 220),
K::Point_2(180, 220));
gv << CGAL::ORANGE;
gv << CGAL::orange();
gv << K::Triangle_3 (K::Point_3(200, 200, 50),
K::Point_3(220, 220, 80),
K::Point_3(180, 220, 100));
gv << CGAL::PURPLE;
gv << CGAL::purple();
gv << K::Tetrahedron_3 (K::Point_3(100, 100, 180),
K::Point_3(120, 70, 220),
K::Point_3(100, 100, 220),
@ -76,7 +76,7 @@ int main()
gv << CGAL::Bbox_2(10, 10, 30, 30);
gv << CGAL::Bbox_3(10, 10, 10, 30, 30, 30);
gv << CGAL::RED;
gv << CGAL::red();
gv << K::Ray_2(K::Point_2(205,205), K::Point_2(500,500));
gv << K::Ray_3(K::Point_3(250,250,250), K::Point_3(500,500,500));
gv << K::Line_2(K::Point_2(195,195), K::Point_2(500,500));

View File

@ -173,9 +173,9 @@ SegmentDelaunayGraphGraphicsItem<T>::drawAll(QPainter *painter, const QStyleOpti
vit != t->finite_vertices_end(); ++vit) {
typename T::Site_2 s = vit->site();
if ( s.is_input() ) {
//*widget << CGAL::RED;
//*widget << CGAL::red();
} else {
//*widget << CGAL::YELLOW;
//*widget << CGAL::yellow();
}
if ( s.is_point() ) {
QPointF point = matrix.map(convert(s.point()));

View File

@ -208,9 +208,9 @@ SegmentDelaunayGraphLinfGraphicsItem<T>::drawAll(QPainter *painter, const QStyle
vit != t->finite_vertices_end(); ++vit) {
typename T::Site_2 s = vit->site();
if ( s.is_input() ) {
//*widget << CGAL::RED;
//*widget << CGAL::red();
} else {
//*widget << CGAL::YELLOW;
//*widget << CGAL::yellow();
}
if ( s.is_point() ) {
QPointF point = matrix.map(convert(s.point()));

View File

@ -28,8 +28,8 @@ typedef HDS::Face_handle Face_handle;
int main() {
HDS hds;
Face_handle f = hds.faces_push_back( Face( CGAL::RED));
f->color = CGAL::BLUE;
CGAL_assertion( f->color == CGAL::BLUE);
Face_handle f = hds.faces_push_back( Face( CGAL::red()));
f->color = CGAL::blue();
CGAL_assertion( f->color == CGAL::blue());
return 0;
}

View File

@ -287,14 +287,14 @@ int main(int , char** )
std::cout << "The data points are displayed in blue in the geomview"
<< " application." << std::endl;
gv << CGAL::BLUE;
gv << CGAL::blue();
visu_points(gv,sample_3);
//show the gradients
if(method>0){
std::cout << "The function gradients are displayed by red lines "
<<" in the geomview application." << std::endl;
gv <<CGAL::RED;
gv <<CGAL::red();
gv << Segment_3(Point_3(h/3,h/3,w),Point_3(h/3,h/3,w)+ Vector_3(-g,-g,0));
gv << Segment_3(Point_3(-h/3,h/3,w),Point_3(-h/3,h/3,w)+Vector_3(g,-g,0));
gv << Segment_3(Point_3(-h/3,-h/3,w),Point_3(-h/3,-h/3,w)+Vector_3(g,g,0));

View File

@ -217,21 +217,21 @@ int main()
}
char ch;
gv << CGAL::VIOLET;
gv << CGAL::violet();
visu_points(gv,points);
gv << CGAL::RED << Segment(p, p+ 0.3*normal);
gv << CGAL::ORANGE <<p;
gv << CGAL::red() << Segment(p, p+ 0.3*normal);
gv << CGAL::orange() <<p;
std::cout << "Visualizing the intersection of "
<< "3D Voronoi diagram with tangent plane at "
<< p << "." << std::endl;
gv << CGAL::BLUE;
gv << CGAL::blue();
T.draw_dual(gv);
Face_iterator fit = T.finite_faces_begin(),
fend = T.finite_faces_end();
for(;fit != fend;fit++)
gv <<CGAL::BLACK<<T.dual(fit);
gv <<CGAL::black()<<T.dual(fit);
std::cout << "Enter any character to quit" << std::endl;
std::cin >> ch;

View File

@ -174,7 +174,7 @@ void output_distribution_to_png(std::vector<double>& elements,
const double scale = double_options["scale"];
*widget << CGAL::FillColor(CGAL::BLACK);
*widget << CGAL::FillColor(CGAL::black());
// *widget << Segment_2(Point_2(0., 0.), Point_2(1., 0.));
for(int k=0;k<number_of_classes;k++)
if(distribution[k]>0)
@ -184,12 +184,12 @@ void output_distribution_to_png(std::vector<double>& elements,
height = ( (distribution[k]+0.)/number_of_cells ) * scale;
else
height = ( std::log(distribution[k]+0.)/std::log(number_of_cells) ) * (-scale);
*widget << CGAL::BLACK
*widget << CGAL::black()
<< Rectangle_2(Point_2(k*width, 0),
Point_2((k+1)*width, height));
}
else
*widget << CGAL::RED << Segment_2(Point_2(k*width, 0),
*widget << CGAL::red() << Segment_2(Point_2(k*width, 0),
Point_2((k+1)*width, 0));
widget->unlock();

View File

@ -34,10 +34,10 @@ void display_distribution(Distribution_displayer* display,
const double height = ( distribution[k]+0. ) * echelle;
display->fill_rectangle(k * width, 0,
(k+1)* width, height,
CGAL::BLACK);
CGAL::black());
}
else
display->segment(k * width, 0.,
(k+1) * width, 0.,
CGAL::RED);
CGAL::red());
}

View File

@ -99,7 +99,7 @@ bool process_aux_2(const std::vector<Qualities>& qualities,
displays[i]->segment(x_position_of_length_bound, 0.0,
x_position_of_length_bound, -0.05,
CGAL::BLUE);
CGAL::blue());
}
*out_stream << "saving " << filename.c_str() << "...\n";

View File

@ -180,7 +180,7 @@ void parse_argv(int argc, char** argv, int extra_args = 0)
//
// const double scale = double_options["scale"];
//
//// *widget << CGAL::FillColor(CGAL::BLACK);
//// *widget << CGAL::FillColor(CGAL::black());
// // *widget << Segment_2(Point_2(0., 0.), Point_2(1., 0.));
// for(int k=0;k<number_of_classes;k++)
// if(distribution[k]>0)
@ -190,12 +190,12 @@ void parse_argv(int argc, char** argv, int extra_args = 0)
// height = ( (distribution[k]+0.)/number_of_cells ) * scale;
// else
// height = ( std::log(distribution[k]+0.)/std::log(number_of_cells) ) * (-scale);
//// *widget << CGAL::BLACK
//// *widget << CGAL::black()
//// << Rectangle_2(Point_2(k*width, 0),
//// Point_2((k+1)*width, height));
// }
// else
//// *widget << CGAL::RED << Segment_2(Point_2(k*width, 0),
//// *widget << CGAL::red() << Segment_2(Point_2(k*width, 0),
//// Point_2((k+1)*width, 0));
//
// // widget->unlock();

View File

@ -48,11 +48,11 @@ class SNC_SM_BooleColor
typedef typename Refs_::Mark Mark;
public:
Color color(SVertex_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfedge_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfloop_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SFace_const_handle, Mark m) const
{ return ( m ? CGAL_NEF3_DGREY : CGAL_NEF3_LGREY ); }
};

View File

@ -48,11 +48,11 @@ class SNC_SM_BooleColor
typedef typename Map_::Mark Mark;
public:
Color color(SVertex_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfedge_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfloop_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SFace_const_handle, Mark m) const
{ return ( m ? CGAL_NEF_DGREY : CGAL_NEF_LGREY ); }
};

View File

@ -44,11 +44,11 @@ class SM_BooleColor
typedef typename Map_::Mark Mark;
public:
Color color(SVertex_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfedge_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfloop_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SFace_const_handle, Mark m) const
{ return ( m ? CGAL_NEF_DGREY : CGAL_NEF_LGREY ); }
};

View File

@ -254,7 +254,7 @@ class Sphere_point : public VPoint, public Gen_object {
public:
Sphere_point() {}
Sphere_point(const CGAL::Sphere_point<R>& p,
CGAL::Color c = CGAL::BLACK, unsigned w = 10) :
CGAL::Color c = CGAL::black(), unsigned w = 10) :
VPoint(Approximator<R>::approximate(p)), p_(p), c_(c), w_(w) {}
Sphere_point(const Sphere_point<R>& p) : VPoint(p), Gen_object()
{ p_ = p.p_; c_ = p.c_; w_ = p.w_; }
@ -297,7 +297,7 @@ class Sphere_segment : public VSegment, public Gen_object {
public:
Sphere_segment() {}
Sphere_segment(const CGAL::Sphere_segment<R>& s,
CGAL::Color c = CGAL::BLACK, unsigned w = 2)
CGAL::Color c = CGAL::black(), unsigned w = 2)
: VSegment(Approximator<R>::approximate(s)), s_(s), c_(c), w_(w) {}
Sphere_segment(const Sphere_segment<R>& s) : VSegment(s), Gen_object()
{ s_ = s.s_; c_ = s.c_; w_ = s.w_; }
@ -350,7 +350,7 @@ class Sphere_circle : public VSegment, public Gen_object {
public:
Sphere_circle() {}
Sphere_circle(const CGAL::Sphere_circle<R>& s,
CGAL::Color c = CGAL::BLACK, unsigned w = 2)
CGAL::Color c = CGAL::black(), unsigned w = 2)
: VSegment(Approximator<R>::approximate(s)), s_(s), c_(c), w_(w) {}
Sphere_circle(const Sphere_circle<R>& s) : VSegment(s), Gen_object()
{ s_ = s.s_; c_ = s.c_; w_ = s.w_; }
@ -539,27 +539,27 @@ Unit_sphere& operator=(const Unit_sphere& S)
template <typename R>
void push_back(const CGAL::Sphere_point<R>& p,
CGAL::Color c = CGAL::YELLOW, unsigned w = 5)
CGAL::Color c = CGAL::yellow(), unsigned w = 5)
{ objects_.push_back(new Sphere_point<R>(p,c,w)); }
template <typename R>
void push_back(const CGAL::Sphere_segment<R>& s,
CGAL::Color c = CGAL::BLACK, unsigned w = 1)
CGAL::Color c = CGAL::black(), unsigned w = 1)
{ objects_.push_back(new Sphere_segment<R>(s,c,w)); }
template <typename R>
void push_back(const CGAL::Sphere_circle<R>& s,
CGAL::Color c = CGAL::BLACK, unsigned w = 1)
CGAL::Color c = CGAL::black(), unsigned w = 1)
{ objects_.push_back(new Sphere_circle<R>(s,c,w)); }
template <typename R>
void push_back(const CGAL::Sphere_triangle<R>& t,
CGAL::Color c = CGAL::WHITE)
CGAL::Color c = CGAL::white())
{ triangles_.push_back(new Sphere_triangle<R>(t,c)); }
template <typename R>
void push_back_triangle_edge(const CGAL::Sphere_segment<R>& s,
CGAL::Color c = CGAL::BLUE, unsigned w = 1)
CGAL::Color c = CGAL::blue(), unsigned w = 1)
{ triangle_edges_.push_back(new Sphere_segment<R>(s,c,w)); }
void set_style(int style) {
@ -718,11 +718,11 @@ class SM_BooleColor
typedef typename Map_::Mark Mark;
public:
Color color(SVertex_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfedge_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SHalfloop_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
{ return ( m ? CGAL::black() : CGAL::white() ); }
Color color(SFace_const_handle, Mark m) const
{ return ( m ? CGAL_NEF_DGREY : CGAL_NEF_LGREY ); }
};

View File

@ -32,7 +32,7 @@ int main()
PDT::Vertex_iterator vit;
for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit)
if (T.degree(vit) == 6)
vit->info() = CGAL::RED;
vit->info() = CGAL::red();
return 0;
}

View File

@ -36,7 +36,7 @@ int main(int, char**)
P3DT3::Vertex_iterator vit;
for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit) {
if (T.degree(vit) == 16) {
vit->info() = CGAL::RED;
vit->info() = CGAL::red();
}
}

View File

@ -23,6 +23,6 @@ typedef Polyhedron::Halfedge_handle Halfedge_handle;
int main() {
Polyhedron P;
Halfedge_handle h = P.make_tetrahedron();
h->facet()->color = CGAL::RED;
h->facet()->color = CGAL::red();
return 0;
}

View File

@ -29,6 +29,6 @@ typedef Polyhedron::Halfedge_handle Halfedge_handle;
int main() {
Polyhedron P;
Halfedge_handle h = P.make_tetrahedron();
h->vertex()->color = CGAL::RED;
h->vertex()->color = CGAL::red();
return 0;
}

View File

@ -47,7 +47,7 @@ int main() {
Polyhedron P;
P.make_tetrahedron( p,q,r,s);
CGAL::Geomview_stream geo;
geo << CGAL::GREEN << P;
geo << CGAL::green() << P;
// wait for a mouse click.
Point click;

View File

@ -22,11 +22,11 @@ int main() {
t.insert(Point(2,2));
Finite_faces_iterator fc = t.finite_faces_begin();
for( ; fc != t.finite_faces_end(); ++fc) fc->info() = CGAL::BLUE;
for( ; fc != t.finite_faces_end(); ++fc) fc->info() = CGAL::blue();
Point p(0.5,0.5);
Face_handle fh = t.locate(p);
fh->info() = CGAL::RED;
fh->info() = CGAL::red();
return 0;
}

View File

@ -66,7 +66,7 @@ int main()
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
if (T.degree(vit) == 6)
vit->info() = CGAL::RED;
vit->info() = CGAL::red();
std::cout << " Visualization of T" << std::endl;
gv.set_wired(true);

View File

@ -136,7 +136,7 @@ int main()
std::cout <<" Locating point (1,1,1) :" << std::endl;
Point p(1,1,1);
gv.set_vertex_color(CGAL::ORANGE);
gv.set_vertex_color(CGAL::orange());
gv << p;
Locate_type lt;
int li, lj;
@ -144,7 +144,7 @@ int main()
sleep(3);
gv << CGAL::VIOLET;
gv << CGAL::violet();
if ( lt == Triangulation::CELL ) {
std::cout <<" CELL" << std::endl;
visu_cell(gv,T,c);

View File

@ -74,7 +74,7 @@ int main()
gv << T;
std::cout <<" Visualizing the Voronoi edges" << std::endl;
gv << CGAL::RED;
gv << CGAL::red();
T.draw_dual(gv);
char ch;

View File

@ -30,7 +30,7 @@ int main()
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
if (T.degree(vit) == 6)
vit->info() = CGAL::RED;
vit->info() = CGAL::red();
return 0;
}