/*! a dialog form to set the conic type for conics insertion. */ void MyWindow::conicType() { #ifdef CGAL_USE_CORE // We peform downcasting from QWigdet* to Qt_widget_base_tab*, // as we know that only // Qt_widget_base_tab objects are stored in the tab pages. Qt_widget_base_tab *w_demo_p = dynamic_cast<Qt_widget_base_tab *> (myBar->currentPage()); OptionsForm *form = new OptionsForm(); if ( form->exec() ) { QString type = form->arrComboBox1->currentText(); if (strcmp(type,"Circle") == 0) w_demo_p->conic_type = CIRCLE; else if (strcmp(type,"Segment") == 0) w_demo_p->conic_type = SEGMENT; else if (strcmp(type,"Ellipse") == 0) w_demo_p->conic_type = ELLIPSE; else if (strcmp(type,"Parabola") == 0) w_demo_p->conic_type = PARABOLA; else if (strcmp(type,"Hyperbola") == 0) w_demo_p->conic_type = HYPERBOLA; } #else CGAL_error_msg("Conics were not compiled"); #endif }
void swallow(std::istream &is, const std::string& s ) { std::string t; is >> t; if (s != t) { std::stringstream msg; msg << "input error: expected '" << s << "' but got '" << t << "'"; CGAL_error_msg( msg.str().c_str() ); } }
void swallow(std::istream &is, char d) { char c; do is.get(c); while (isspace(c)); if (c != d) { std::stringstream msg; msg << "input error: expected '" << d << "' but got '" << c << "'"; CGAL_error_msg( msg.str().c_str() ); } }
Geomview_stream& Geomview_stream::operator<<(const std::string & s) { if ((int)s.length() != ::write(out, s.data(), s.length())) { CGAL_error_msg( "write problem in the pipe while sending data to geomview" ); } trace(s); return *this; }
/*! add a tab widget with conic traits */ void MyWindow::add_conic_tab() { #ifdef CGAL_USE_CORE Qt_widget_demo_tab<Conic_tab_traits> *widget = new Qt_widget_demo_tab<Conic_tab_traits> (CONIC_TRAITS , this , tab_number, colors[tab_number%num_of_colors]); init(widget); widget->draw(); //widget->set_window(widget->x_pixel(widget->x_min()), widget->x_pixel(widget->x_max()), // widget->x_pixel(widget->y_min()), widget->x_pixel(widget->y_max())); #else CGAL_error_msg("Conics were not compiled"); #endif }
/*! update widget conic type * \param action - the new conic type */ void MyWindow::updateConicType( QAction *action ) { #ifdef CGAL_USE_CORE // We peform downcasting from QWigdet* to Qt_widget_base_tab*, // as we know that only // Qt_widget_base_tab objects are stored in the tab pages. Qt_widget_base_tab *w_demo_p = static_cast<Qt_widget_base_tab *> (myBar->currentPage()); if ( action == setCircle ) w_demo_p->conic_type = CIRCLE; else if ( action == setSegment ) w_demo_p->conic_type = SEGMENT; else if ( action == setEllipse ) w_demo_p->conic_type = ELLIPSE; else if ( action == setParabola ) w_demo_p->conic_type = PARABOLA; else if ( action == setHyperbola ) w_demo_p->conic_type = HYPERBOLA; #else CGAL_error_msg("Conics were not compiled"); #endif }
/*! change the buttons stste according to the traits type */ void MyWindow::setConicType( ConicType t ) { #ifdef CGAL_USE_CORE switch ( t ) { case CIRCLE: setCircle->setOn( TRUE ); break; case SEGMENT: setSegment->setOn( TRUE ); break; case ELLIPSE: setEllipse->setOn( TRUE ); break; case PARABOLA: setParabola->setOn( TRUE ); break; case HYPERBOLA: setHyperbola->setOn( TRUE ); break; } #else CGAL_error_msg("Conics were not compiled"); #endif }