postscript_file_stream.h

来自「CGAL is a collaborative effort of severa」· C头文件 代码 · 共 781 行 · 第 1/2 页

H
781
字号
      r = Ray_2<R>(Point_2<R>( RT(x1), RT(y1)),                        Point_2<R>( RT(x2), RT(y2)));  }  return w;}#endif // CGAL_POSTSCRIPT_FILE_STREAM_RAY_2#endif //CGAL_RAY_2_H#ifdef CGAL_TRIANGLE_2_H#ifndef CGAL_POSTSCRIPT_FILE_STREAM_TRIANGLE_2#define CGAL_POSTSCRIPT_FILE_STREAM_TRIANGLE_2template< class R >Postscript_file_stream&operator<<(Postscript_file_stream& w, const Triangle_2<R>& t){  double x0 = CGAL::to_double(t.vertex(0).x()),         y0 = CGAL::to_double(t.vertex(0).y()),         x1 = CGAL::to_double(t.vertex(1).x()),         y1 = CGAL::to_double(t.vertex(1).y()),         x2 = CGAL::to_double(t.vertex(2).x()),         y2 = CGAL::to_double(t.vertex(2).y());  w.draw_segment(x0, y0, x1, y1);  w.draw_segment(x1, y1, x2, y2);  w.draw_segment(x2, y2, x0, y0);  return w;}template< class R >Postscript_file_stream&operator>>(Postscript_file_stream& w, Triangle_2<R>& t){  typedef typename R::RT   RT;  double x,y;  int key = 0;#if ( __LEDA__ < 362 )  w.state = 1;#else  w.set_state( 1);#endif // __LEDA__ < ...  leda_point first, second, third, p;  leda_drawing_mode save = w.set_mode(leda_xor_mode);  if ( !( w >> first)) { w.set_mode( save); return w; }  int save_but[8];  w.std_buttons(save_but);  key = w.read_mouse_seg( first.xcoord(), first.ycoord(), x, y);  if ( key == MOUSE_BUTTON(3))  {      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  else  {      w << leda_segment( first.xcoord(), first.ycoord(), x, y);      second = leda_point( x, y);  }  key = w.read_mouse_seg( second.xcoord(), second.ycoord(), x, y);  if ( key == MOUSE_BUTTON(3))  {      w << leda_segment( first, second );      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  else  {      w << leda_segment( second.xcoord(), second.ycoord(), x, y);      third = leda_point( x, y);  }  w << leda_segment( first, second );  w << leda_segment( second, third );  double x0 = first.xcoord();  double y0 = first.ycoord();  double x1 = second.xcoord();  double y1 = second.ycoord();  double x2 = third.xcoord();  double y2 = third.ycoord();  w.set_mode( save);  w.draw_segment(x0,y0, x1, y1);  w.draw_segment(x1,y1, x2, y2);  w.draw_segment(x2,y2, x0, y0);  t = Triangle_2<R>(Point_2<R>( RT(x0), RT(y0)),                         Point_2<R>( RT(x1), RT(y1)),                         Point_2<R>( RT(x2), RT(y2)));  return w;}template< class R >Postscript_file_stream&read(Postscript_file_stream& w, Triangle_2<R>& t){  typedef typename R::RT   RT;  double x,y;  int key = 0;#if ( __LEDA__ < 362 )  w.state = 1;#else  w.set_state( 1);#endif // __LEDA__ < ...  leda_point first, second, third, p;  leda_drawing_mode save = w.set_mode(leda_xor_mode);  if ( !( w >> first)) { w.set_mode( save); return w; }  int save_but[8];  w.std_buttons(save_but);  key = w.read_mouse_seg( first.xcoord(), first.ycoord(), x, y);  if ( key == MOUSE_BUTTON(3))  {      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  else  {      w << leda_segment( first.xcoord(), first.ycoord(), x, y);      second = leda_point( x, y);  }  key = w.read_mouse_seg( second.xcoord(), second.ycoord(), x, y);  if ( key == MOUSE_BUTTON(3))  {      w << leda_segment( first, second );      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  else  {      w << leda_segment( second.xcoord(), second.ycoord(), x, y);      third = leda_point( x, y);  }  w << leda_segment( first, second );  w << leda_segment( second, third );  double x0 = first.xcoord();  double y0 = first.ycoord();  double x1 = second.xcoord();  double y1 = second.ycoord();  double x2 = third.xcoord();  double y2 = third.ycoord();  w.set_mode( save);  t = Triangle_2<R>(Point_2<R>( RT(x0), RT(y0)),                         Point_2<R>( RT(x1), RT(y1)),                         Point_2<R>( RT(x2), RT(y2)));  return w;}#endif // CGAL_POSTSCRIPT_FILE_STREAM_TRIANGLE_2#endif // CGAL_TRIANGLE_2_H#ifdef CGAL_CIRCLE_2_H#ifndef CGAL_POSTSCRIPT_FILE_STREAM_CIRCLE_2#define CGAL_POSTSCRIPT_FILE_STREAM_CIRCLE_2template< class R >Postscript_file_stream&operator<<(Postscript_file_stream& w, const Circle_2<R>& c){  double cx = CGAL::to_double(c.center().x()),         cy = CGAL::to_double(c.center().y()),         r = CGAL::to_double(c.squared_radius());  w.draw_circle(cx, cy , sqrt(r));  return w;}template< class R >Postscript_file_stream&operator>>(Postscript_file_stream& w, Circle_2<R>& c){  typedef  typename R::RT  RT;  double x,y;  int key = 0;#if ( __LEDA__ < 362 )  w.state = 1;#else  w.set_state( 1);#endif // __LEDA__ < ...  leda_point p;  leda_drawing_mode save = w.set_mode(leda_xor_mode);  if ( !( w.read( p))) { w.set_mode( save); return w; }  double cx = p.xcoord();  double cy = p.ycoord();  Point_2<R> center = Point_2<R>( RT(cx), RT(cy));  int save_but[8];  w.std_buttons(save_but);  key = w.read_mouse_circle(cx, cy, x, y);  if ( key == MOUSE_BUTTON(3))  {      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  double dx = x - cx;  double dy = y - cy;  double sqr = dx*dx+dy*dy;  w.set_mode( save);  w.set_buttons( save_but);  w.draw_circle(cx, cy , sqrt(sqr));  c = Circle_2<R>(center, RT(sqr));  return w;}template< class R >Postscript_file_stream&read(Postscript_file_stream& w, Circle_2<R>& c){  typedef  typename R::RT  RT;  double x,y;  int key = 0;#if ( __LEDA__ < 362 )  w.state = 1;#else  w.set_state( 1);#endif // __LEDA__ < ...  leda_point p;  leda_drawing_mode save = w.set_mode(leda_xor_mode);  if ( !( w.read( p))) { w.set_mode( save); return w; }  double cx = p.xcoord();  double cy = p.ycoord();  Point_2<R> center = Point_2<R>( RT(cx), RT(cy));  int save_but[8];  w.std_buttons(save_but);  key = w.read_mouse_circle(cx, cy, x, y);  if ( key == MOUSE_BUTTON(3))  {      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  double dx = x - cx;  double dy = y - cy;  double sqr = dx*dx+dy*dy;  w.set_mode( save);  w.set_buttons( save_but);  c = Circle_2<R>(center, RT(sqr));  return w;}#endif // CGAL_POSTSCRIPT_FILE_STREAM_CIRCLE_2#endif // CGAL_CIRCLE_2_H#ifdef CGAL_ISO_RECTANGLE_2_H#ifndef CGAL_POSTSCRIPT_FILE_STREAM_ISO_RECTANGLE_2#define CGAL_POSTSCRIPT_FILE_STREAM_ISO_RECTANGLE_2template< class R >Postscript_file_stream&operator<<(Postscript_file_stream& w, const Iso_rectangle_2<R>& r){  double xmin = CGAL::to_double(r.min().x()),         ymin = CGAL::to_double(r.min().y()),         xmax = CGAL::to_double(r.max().x()),         ymax = CGAL::to_double(r.max().y());  w.draw_segment(xmin, ymin, xmax, ymin);  w.draw_segment(xmax, ymin, xmax, ymax);  w.draw_segment(xmax, ymax, xmin, ymax);  w.draw_segment(xmin, ymax, xmin, ymin);  return w;}template< class R >Postscript_file_stream&operator>>(Postscript_file_stream& w, Iso_rectangle_2<R>& r){  typedef typename R::RT    RT;  double x,y;  int key = 0;#if ( __LEDA__ < 362 )  w.state = 1;#else  w.set_state( 1);#endif // __LEDA__ < ...  leda_point first, second;  leda_drawing_mode save = w.set_mode(leda_xor_mode);  if ( !( w.read( first))) { w.set_mode( save); return w; }  int save_but[8];  w.std_buttons(save_but);  key = w.read_mouse_rect( first.xcoord(), first.ycoord(), x, y);  if ( key == MOUSE_BUTTON(3))  {      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  r = Iso_rectangle_2<R>(Point_2<R>( RT(first.xcoord()),                                               RT(first.ycoord())),                              Point_2<R>( RT(x), RT(y)));  w.set_mode( save);  w.draw_rectangle( first.xcoord(), first.ycoord(), x, y);  w.set_buttons( save_but);  return w;}template< class R >Postscript_file_stream&read(Postscript_file_stream& w, Iso_rectangle_2<R>& r){  typedef typename R::RT    RT;  double x,y;  int key = 0;#if ( __LEDA__ < 362 )  w.state = 1;#else  w.set_state( 1);#endif // __LEDA__ < ...  leda_point first, second;  leda_drawing_mode save = w.set_mode(leda_xor_mode);  if ( !( w.read( first))) { w.set_mode( save); return w; }  int save_but[8];  w.std_buttons(save_but);  key = w.read_mouse_rect( first.xcoord(), first.ycoord(), x, y);  if ( key == MOUSE_BUTTON(3))  {      w.set_buttons( save_but);      w.set_mode( save);#if ( __LEDA__ < 362 )      w.state = 0;#else      w.set_state( 0);#endif // __LEDA__ < ...      return w;  }  r = Iso_rectangle_2<R>(Point_2<R>( RT(first.xcoord()),                                               RT(first.ycoord())),                              Point_2<R>( RT(x), RT(y)));  w.set_mode( save);  w.set_buttons( save_but);  return w;}#endif // CGAL_POSTSCRIPT_FILE_STREAM_ISO_RECTANGLE_2#endif // CGAL_ISO_RECTANGLE_2_H#ifdef CGAL_BBOX_2_H#ifndef CGAL_POSTSCRIPT_FILE_STREAM_BBOX_2#define CGAL_POSTSCRIPT_FILE_STREAM_BBOX_2inlinePostscript_file_stream&operator<<(Postscript_file_stream& w, const Bbox_2& b){#if (__LEDA__ >= 400)  leda_line_style style = w.set_line_style(leda_dotted);#else  line_style style = w.set_line_style(leda_dotted);#endif // 400  double xmin = b.xmin(),         ymin = b.ymin(),         xmax = b.xmax(),         ymax = b.ymax();  w.draw_segment(xmin, ymin, xmax, ymin);  w.draw_segment(xmax, ymin, xmax, ymax);  w.draw_segment(xmax, ymax, xmin, ymax);  w.draw_segment(xmin, ymax, xmin, ymin);  w.set_line_style(style);  return w;}#endif // CGAL_POSTSCRIPT_FILE_STREAM_BBOX_2#endif // CGAL_BBOX_2_HCGAL_END_NAMESPACE

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?