void Controller::done() { if( !segments_.empty() ) { if( !last_sat_solution_.empty() ) { logger.debug( mmlt_msg( "Adding separators and non-separable segments to triangulation..." ) ); for( const SegmentIndex& seg_index : last_sat_solution_ ) { logger.debug(mmlt_msg("Segment index: %1").arg(seg_index)); const Segment& segment = segments_[seg_index]; triangulation_.insert_constraint(segment.source(), segment.target()); } } const Segment& shortest_triangulation_segment = segments_[triangulation_.shortest_segment(segments_)]; logger.info( mmlt_msg("shortest constrained triangulation segment: %1 (%2)") .arg(shortest_triangulation_segment.to_string()) .arg(segment_length_to_string(shortest_triangulation_segment)) ); if( settings_.draw_triangulation ) { draw_triangulation(); } } output_status(); logger.print(mmlt_msg("iterations=%1 gap=%2").arg(stats_.iteration).arg(stats_.gap())); logger.time( mmlt_msg( "SAT solving" ), stats_.sat_solving_time); }
void Canvas_Delegate_Riemann_Mapping::paint_event() { /*if (left_canvas_) { std::cout << "Entering left Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl; } else { std::cout << "Entering right Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl; }*/ if (image_mode_ && *draw_2_curves_flag_ == DRAWING_CURVES && !shower_) { draw_background_image(); } if (tiling_->nb_vertices()>0 && *draw_2_curves_flag_ == DRAWING_CURVES) { draw_tiling(*tiling_); } if ((*draw_2_curves_flag_ == DRAWING_CURVES || !shower_) && input_triangulation_->nb_triangles() > 0) { if (input_triangulation_->nb_triangles() == input_triangulation_->nb_colors()) { if (shower_) { draw_empty_triangulation(*input_triangulation_); } else { if (image_mode_) { draw_triangulation_from_image(); } else { draw_triangulation(*input_triangulation_); } } } else { std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: tried to draw unfit triangulation" << std::endl; } } else if(shower_) { if (image_mode_) { draw_shower_triangulation_from_image(); } else { draw_triangulation(*output_triangulation_); } } if (is_vertex_highlighted_ && (!is_node_point_under_mouse_) && (!is_node_point_selected_) && (*draw_2_curves_flag_==DRAW_2_CURVES_DONE || !shower_) && (!is_tangent_control_point_under_mouse_)) { //std::cout << "about to hightlight triangle" << std::endl; if (*draw_2_curves_flag_ == DRAW_2_CURVES_DONE && shower_) { if (index_vertex_highlighted_ < output_triangulation_->nb_triangles()) { Triangle T; if (output_triangulation_->get_triangle(index_vertex_highlighted_, T)) { mark_triangle(T, QColor("red")); } } else { std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: tried to draw a triangle with bad index" << std::endl; } } else { if (index_vertex_highlighted_ < input_triangulation_->nb_triangles()) { Triangle T; if (input_triangulation_->get_triangle(index_vertex_highlighted_, T)) { mark_triangle(T, QColor("red")); } } else { std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: tried to draw a triangle with bad index" << std::endl; } } //std::cout << "triangle highlighted" << std::endl; } draw_nodes(*nodes_, nodes_radius_in_pixels_/scale_); if (*draw_curve_flag_==DRAW_CURVE_NODES && nodes_->size()>0) { mark_circle(Circle((*nodes_)[0], nodes_radius_in_pixels_/scale_), QColor("red")); draw_incomplete_curve(*nodes_); } else { draw_curve(*curve_); } if (beziers_mode()) { draw_tangents(*nodes_, *tangent_factors_, 0.8*nodes_radius_in_pixels_/scale_); } if (is_node_point_under_mouse_) { if(node_point_under_mouse_<nodes_->size()) { mark_circle(Circle((*nodes_)[node_point_under_mouse_], nodes_radius_in_pixels_/scale_), QColor("green")); } else { std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: node index problem" << std::endl; throw(QString("ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: node index problem")); } } if (is_tangent_control_point_under_mouse_ && !is_node_point_under_mouse_ && beziers_mode()) { if(tangent_control_point_under_mouse_<nodes_->size() && tangent_factors_->size() == nodes_->size()) { unsigned int i = tangent_control_point_under_mouse_, N = nodes_->size(); Point T((*nodes_)[i].get_affix() + (*tangent_factors_)[i] * ((*nodes_)[(i+1)%N].get_affix() - (*nodes_)[(N+i-1)%N].get_affix())); mark_circle(Circle(T, 0.8*nodes_radius_in_pixels_/scale_), QColor("green")); } else { std::cout << "ERROR in Canvas_Delegate_Draw_Curve::paint_event: tangent index problem" << std::endl; throw(QString("ERROR in Canvas_Delegate_Draw_Curve::paint_event: tangent index problem")); } } /*if (left_canvas_) { std::cout << "Leaving left Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl; } else { std::cout << "Leaving right Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl; }*/ return; }