Skip to content

Commit

Permalink
Merge pull request #476 from mwoehlke-kitware/disable-gcps-with-no-ca…
Browse files Browse the repository at this point in the history
…mera

Don't enable GCP editing with no camera
  • Loading branch information
mleotta committed May 14, 2021
2 parents eaf0d89 + 33d6a67 commit 2d06a82
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
26 changes: 21 additions & 5 deletions gui/CameraView.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ class CameraViewPrivate
vtkNew<vtkDoubleArray> elevations;
};

CameraViewPrivate() : featuresDirty(false), renderQueued(false) {}

void setPopup(QAction* action, QMenu* menu);
void setPopup(QAction* action, QWidget* widget);

Expand Down Expand Up @@ -241,9 +239,12 @@ class CameraViewPrivate

double imageBounds[6];

bool featuresDirty;
EditMode editMode = EditMode::None;

bool cameraValid = false;
bool featuresDirty = false;

bool renderQueued;
bool renderQueued = false;
};

//END CameraViewPrivate definition
Expand Down Expand Up @@ -636,6 +637,19 @@ void CameraView::setImageData(vtkImageData* data, QSize dimensions)
this->render();
}

//-----------------------------------------------------------------------------
void CameraView::setActiveCamera(kwiver::arrows::vtk::vtkKwiverCamera* camera)
{
QTE_D();

auto const valid = (camera != nullptr);
if (valid != d->cameraValid)
{
d->cameraValid = valid;
this->setEditMode(d->editMode);
}
}

//-----------------------------------------------------------------------------
void CameraView::setActiveFrame(kwiver::vital::frame_id_t frame)
{
Expand Down Expand Up @@ -915,8 +929,10 @@ void CameraView::setEditMode(EditMode mode)
{
QTE_D();

d->editMode = mode;

d->groundControlPointsWidget->enableWidget(
mode == EditMode::GroundControlPoints);
mode == EditMode::GroundControlPoints && d->cameraValid);
d->registrationPointsWidget->enableWidget(
mode == EditMode::CameraRegistrationPoints);
d->UI.actionPlaceEditCRP->setChecked(
Expand Down
23 changes: 21 additions & 2 deletions gui/CameraView.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,26 @@

class vtkImageData;

namespace kwiver { namespace vital { class landmark_map; } }
namespace kwiver { namespace vital { class track; } }
namespace kwiver {

namespace arrows {

namespace vtk {

class vtkKwiverCamera;

} // namespace vtk

} // namespace arrows

namespace vital {

class landmark_map;
class track;

} // namespace vital

} // namespace kwiver

class GroundControlPointsWidget;
class RulerWidget;
Expand Down Expand Up @@ -78,6 +96,7 @@ public slots:

void setEditMode(EditMode);

void setActiveCamera(kwiver::arrows::vtk::vtkKwiverCamera*);
void setActiveFrame(kwiver::vital::frame_id_t);

void addLandmark(kwiver::vital::landmark_id_t id, double x, double y);
Expand Down
3 changes: 3 additions & 0 deletions gui/MainWindow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ void MainWindowPrivate::updateCameraView()
if (this->activeCameraIndex < 1)
{
this->loadEmptyImage(nullptr);
this->UI.cameraView->setActiveCamera(nullptr);
this->UI.cameraView->setActiveFrame(-1);
this->UI.cameraView->clearLandmarks();
this->UI.cameraView->clearGroundControlPoints();
Expand All @@ -1078,12 +1079,14 @@ void MainWindowPrivate::updateCameraView()
if (!activeFrame)
{
this->loadEmptyImage(nullptr);
this->UI.cameraView->setActiveCamera(nullptr);
this->UI.cameraView->clearLandmarks();
return;
}

// Show camera image
this->loadImage(*activeFrame);
this->UI.cameraView->setActiveCamera(activeFrame->camera);

if (!activeFrame->camera)
{
Expand Down

0 comments on commit 2d06a82

Please sign in to comment.