-----------------------------------------------------------------------------
| 2936 | |
| 2937 | //----------------------------------------------------------------------------- |
| 2938 | void MainWindow::executeTool(QObject* object) |
| 2939 | { |
| 2940 | QTE_D(); |
| 2941 | |
| 2942 | auto const tool = qobject_cast<AbstractTool*>(object); |
| 2943 | if (tool && !d->activeTool) |
| 2944 | { |
| 2945 | // try to reset the ROI if invalid |
| 2946 | kv::vector_3d min_pt, max_pt; |
| 2947 | d->roi->GetXMin(min_pt.data()); |
| 2948 | d->roi->GetXMax(max_pt.data()); |
| 2949 | if (((max_pt - min_pt).array() <= 0.0).any()) |
| 2950 | { |
| 2951 | d->UI.worldView->resetROI(); |
| 2952 | d->project->config->set_value("ROI", d->roiToString()); |
| 2953 | } |
| 2954 | |
| 2955 | bool ignore_metadata = |
| 2956 | d->freestandingConfig->get_value<bool>( |
| 2957 | "ignore_metadata", false); |
| 2958 | |
| 2959 | kv::sfm_constraints_sptr constraints = d->sfmConstraints; |
| 2960 | if (ignore_metadata) |
| 2961 | { |
| 2962 | constraints = std::make_shared<kv::sfm_constraints>(*constraints); |
| 2963 | constraints->set_metadata(nullptr); |
| 2964 | } |
| 2965 | |
| 2966 | d->setActiveTool(tool); |
| 2967 | tool->setActiveFrame(d->activeCameraIndex); |
| 2968 | tool->setTracks(d->tracks); |
| 2969 | tool->setCameras(d->cameraMap()); |
| 2970 | tool->setLandmarks(d->landmarks); |
| 2971 | tool->setSfmConstraints(constraints); |
| 2972 | tool->setVideoPath(stdString(d->videoPath)); |
| 2973 | tool->setMaskPath(stdString(d->maskPath)); |
| 2974 | tool->setConfig(d->project->config); |
| 2975 | tool->setROI(d->roi.Get()); |
| 2976 | tool->setDepthLookup(d->depthLookup()); |
| 2977 | if (!d->frames.empty()) |
| 2978 | { |
| 2979 | tool->setLastFrame(static_cast<int>(d->frames.lastKey())); |
| 2980 | } |
| 2981 | |
| 2982 | if (!tool->execute()) |
| 2983 | { |
| 2984 | d->setActiveTool(nullptr); |
| 2985 | } |
| 2986 | else |
| 2987 | { |
| 2988 | // Initialize the progress bar |
| 2989 | d->updateProgress(tool, tool->description(), 0); |
| 2990 | } |
| 2991 | } |
| 2992 | } |
| 2993 | |
| 2994 | //----------------------------------------------------------------------------- |
| 2995 | void MainWindow::reportToolError(QString const& msg) |
nothing calls this directly
no test coverage detected