Skip to content

Fix build against Slicer 5.x and Qt 5.15 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Modules/Loadable/CameraPath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ string(TOUPPER ${MODULE_NAME} MODULE_NAME_UPPER)
#-----------------------------------------------------------------------------
add_subdirectory(MRML)
add_subdirectory(Logic)
add_subdirectory(Widgets)

#-----------------------------------------------------------------------------
set(MODULE_EXPORT_DIRECTIVE "Q_SLICER_QTMODULES_${MODULE_NAME_UPPER}_EXPORT")
Expand Down Expand Up @@ -45,15 +44,14 @@ set(MODULE_UI_SRCS
set(MODULE_TARGET_LIBRARIES
vtkSlicerModelsModuleLogic
vtkSlicer${MODULE_NAME}ModuleLogic
qSlicer${MODULE_NAME}ModuleWidgets
)

set(MODULE_RESOURCES
Resources/qSlicer${MODULE_NAME}Module.qrc
)

#-----------------------------------------------------------------------------
slicerMacroBuildQtModule(
slicerMacroBuildLoadableModule(
NAME ${MODULE_NAME}
TITLE ${MODULE_TITLE}
EXPORT_DIRECTIVE ${MODULE_EXPORT_DIRECTIVE}
Expand Down
14 changes: 7 additions & 7 deletions Modules/Loadable/CameraPath/Logic/vtkSlicerCameraPathLogic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void vtkSlicerCameraPathLogic::UpdateFromMRMLScene()
//---------------------------------------------------------------------------
void vtkSlicerCameraPathLogic::OnMRMLSceneNodeAdded(vtkMRMLNode* node)
{
if (node==NULL)
if (node == nullptr)
{
vtkErrorMacro("An invalid node is attempted to be added");
return;
Expand All @@ -104,7 +104,7 @@ void vtkSlicerCameraPathLogic::OnMRMLSceneNodeAdded(vtkMRMLNode* node)
//---------------------------------------------------------------------------
void vtkSlicerCameraPathLogic::OnMRMLSceneNodeRemoved(vtkMRMLNode* node)
{
if (node==NULL)
if (node == nullptr)
{
vtkErrorMacro("An invalid node is attempted to be removed");
return;
Expand All @@ -124,23 +124,23 @@ void vtkSlicerCameraPathLogic::OnMRMLSceneNodeRemoved(vtkMRMLNode* node)
//---------------------------------------------------------------------------
char* vtkSlicerCameraPathLogic::LoadCameraPath(const char *fileName, const char *nodeName)
{
char *nodeIDs = NULL;
char *nodeIDs = nullptr;
std::string idList;

if (!fileName)
{
vtkErrorMacro("LoadCameraPath: null file name, cannot load");
return NULL;
return nullptr;
}
if (fileName[0] == '\0')
{
vtkErrorMacro("LoadCameraPath: empty file name, cannot load");
return NULL;
return nullptr;
}
if (!this->GetMRMLScene())
{
vtkErrorMacro("LoadCameraPath: no MRML scene, cannot load");
return NULL;
return nullptr;
}

// turn on batch processing
Expand Down Expand Up @@ -180,7 +180,7 @@ char* vtkSlicerCameraPathLogic::LoadCameraPath(const char *fileName, const char
vtkErrorMacro("LoadCameraPath: coud not read data");
this->GetMRMLScene()->RemoveNode(cameraPathNode.GetPointer());
this->GetMRMLScene()->RemoveNode(storageNode.GetPointer());
return NULL;
return nullptr;
}

// adding camera nodes to scene
Expand Down
8 changes: 6 additions & 2 deletions Modules/Loadable/CameraPath/MRML/vtkMRMLCameraPathNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void vtkMRMLCameraPathNode::SetKeyFrame(vtkIdType index, KeyFrame keyFrame)
vtkIdType otherIndex = this->KeyFrameIndexAt(keyFrame.Time);
if (otherIndex != -1)
{
std::cerr << "A keyframe already exists for t = " << time << std::endl
std::cerr << "A keyframe already exists for t = " << keyFrame.Time << std::endl
<< "Keyframe ID : " << otherIndex << std::endl
<< std::endl;
return;
Expand Down Expand Up @@ -451,7 +451,11 @@ void vtkMRMLCameraPathNode::AddKeyFrame(KeyFrame keyFrame)
void vtkMRMLCameraPathNode::AddKeyFrame(double t,
vtkMRMLCameraNode* camera)
{
KeyFrame keyFrame(camera, t);
vtkNew<vtkMRMLCameraNode> newCamera;
newCamera->SetPosition(camera->GetPosition());
newCamera->SetFocalPoint(camera->GetFocalPoint());
newCamera->SetViewUp(camera->GetViewUp());
KeyFrame keyFrame(newCamera, t);
this->AddKeyFrame(keyFrame);
}

Expand Down
20 changes: 13 additions & 7 deletions Modules/Loadable/CameraPath/MRML/vtkMRMLCameraPathNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ struct KeyFrame
//bool Locked;
//bool Visibility;

KeyFrame(vtkMRMLCameraNode* camera = NULL,
KeyFrame(vtkMRMLCameraNode* camera = nullptr,
double time = 0.0):
Camera(camera),
Time(time)
{}

KeyFrame(const KeyFrame& a)
{
Camera = a.Camera;
Time = a.Time;
}

KeyFrame& operator = (const KeyFrame& a)
{
Camera = a.Camera;
Expand Down Expand Up @@ -98,9 +104,9 @@ class VTK_SLICER_CAMERAPATH_MODULE_MRML_EXPORT vtkMRMLCameraPathNode:
KeyFrame GetKeyFrame(vtkIdType index);
double GetKeyFrameTime(vtkIdType index);
vtkMRMLCameraNode* GetKeyFrameCamera(vtkIdType index);
void GetKeyFramePosition(vtkIdType index, double position[3] = 0);
void GetKeyFrameFocalPoint(vtkIdType index, double focalPoint[3] = 0);
void GetKeyFrameViewUp(vtkIdType index, double viewUp[3] = 0);
void GetKeyFramePosition(vtkIdType index, double position[3] = nullptr);
void GetKeyFrameFocalPoint(vtkIdType index, double focalPoint[3] = nullptr);
void GetKeyFrameViewUp(vtkIdType index, double viewUp[3] = nullptr);

void SetKeyFrames(KeyFrameVector keyFrames);
void SetKeyFrame(vtkIdType index, KeyFrame keyFrame);
Expand Down Expand Up @@ -134,9 +140,9 @@ class VTK_SLICER_CAMERAPATH_MODULE_MRML_EXPORT vtkMRMLCameraPathNode:
vtkMRMLPointSplineNode* viewUps);

void GetCameraAt(double t, vtkMRMLCameraNode* camera);
void GetPositionAt(double t, double position[3] = 0);
void GetFocalPointAt(double t, double focalPoint[3] = 0);
void GetViewUpAt(double t, double viewUp[3] = 0);
void GetPositionAt(double t, double position[3] = nullptr);
void GetFocalPointAt(double t, double focalPoint[3] = nullptr);
void GetViewUpAt(double t, double viewUp[3] = nullptr);
double ClampTime(double t);

protected:
Expand Down
4 changes: 2 additions & 2 deletions Modules/Loadable/CameraPath/MRML/vtkMRMLPointSplineNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ void vtkMRMLPointSplineNode::PrintSelf(ostream& os, vtkIndent indent)
//----------------------------------------------------------------------------
void vtkMRMLPointSplineNode::CreateDefaultDisplayNodes()
{
if (vtkMRMLModelDisplayNode::SafeDownCast(this->GetDisplayNode())!=NULL)
if (vtkMRMLModelDisplayNode::SafeDownCast(this->GetDisplayNode()) != nullptr)
{
// display node already exists
return;
}
if (this->GetScene()==NULL)
if (this->GetScene() == nullptr)
{
vtkErrorMacro("vtkMRMLPointSplineNode::CreateDefaultDisplayNodes failed: scene is invalid");
return;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Loadable/CameraPath/MRML/vtkMRMLPointSplineNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class VTK_SLICER_CAMERAPATH_MODULE_MRML_EXPORT vtkMRMLPointSplineNode :
void AddPoint(double t, double point[3]);
void RemovePoint(double t);
void UpdatePolyData(int framerate);
void Evaluate(double t, double point[3]=0);
void Evaluate(double t, double point[3]=nullptr);

protected:
vtkMRMLPointSplineNode();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,6 @@
<string>Time</string>
</property>
</column>
<column>
<property name="text">
<string>Camera</string>
</property>
</column>
</widget>
</item>
</layout>
Expand All @@ -631,14 +626,14 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="selectedCameraIDLabel">
<widget class="QLabel" name="selectedKeyFrameIDLabel">
<property name="text">
<string>Camera ID :</string>
<string>KeyFrame ID :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="selectedCameraIDLineEdit">
<widget class="QLineEdit" name="selectedKeyFrameIDLineEdit">
<property name="text">
<string>no key frame selected</string>
</property>
Expand Down
42 changes: 0 additions & 42 deletions Modules/Loadable/CameraPath/Widgets/CMakeLists.txt

This file was deleted.

This file was deleted.

Loading