Merge branch 'dev' into hdf-prototype

This commit is contained in:
Magne Sjaastad
2017-08-14 10:47:44 +02:00
443 changed files with 20467 additions and 3429 deletions
+15
View File
@@ -6,6 +6,17 @@ project (CeeApp)
find_package (Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl REQUIRED)
include (${QT_USE_FILE})
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_CXX_FLAGS "-std=c++0x")
endif()
# Improvement Cmake 3.x
# If we have compiler requirements for this library, list them
#target_compile_features(lib
# PUBLIC cxx_auto_type
# PRIVATE cxx_variadic_templates)
#libraries
add_subdirectory (cafProjectDataModel/cafPdmCore)
@@ -19,6 +30,10 @@ add_subdirectory(cafUserInterface)
#executables
add_subdirectory(cafTests/cafTestApplication)
if( UNIX )
set(THREAD_LIBRARY "pthread")
endif()
add_subdirectory (cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests)
add_subdirectory (cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests)
add_subdirectory (cafProjectDataModel/cafProjectDataModel_UnitTests)
+2
View File
@@ -49,6 +49,8 @@ add_library( ${PROJECT_NAME}
cvfStructGridGeometryGenerator.cpp
cvfStructGridGeometryGenerator.h
cvfStructGridScalarDataAccess.h
cafVecIjk.cpp
cafVecIjk.h
${MOC_FILES_CPP}
)
+10
View File
@@ -241,4 +241,14 @@ bool Utils::fileExists(const QString& fileName)
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Utils::fileExtension(const QString & fileName)
{
QFileInfo fi(fileName);
return fi.suffix();
}
} // namespace caf
+1
View File
@@ -65,6 +65,7 @@ public:
static bool getSaveDirectoryAndCheckOverwriteFiles(const QString& defaultDir, std::vector<QString> fileNames, QString* saveDir);
static bool fileExists(const QString& fileName);
static QString fileExtension(const QString& fileName);
};
}
+73
View File
@@ -0,0 +1,73 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2017 Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "cafVecIjk.h"
namespace caf {
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
VecIjk::VecIjk(size_t i, size_t j, size_t k)
{
m_values = { i, j, k };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t VecIjk::i() const
{
return m_values[0];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t VecIjk::j() const
{
return m_values[1];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t VecIjk::k() const
{
return m_values[2];
}
}; //namespace caf
+59
View File
@@ -0,0 +1,59 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2017 Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
#include <array>
namespace caf
{
class VecIjk
{
public:
VecIjk(size_t i, size_t j, size_t k);
size_t i() const;
size_t j() const;
size_t k() const;
private:
std::array<size_t, 3> m_values;
};
}
@@ -2,6 +2,7 @@
#pragma once
#include <iostream>
#include <cstdlib>
#define CAF_ASSERT(expr) \
do \
@@ -54,6 +54,7 @@ public:
virtual ~PdmChildArrayField();
PdmChildArrayField& operator() () { return *this; }
const PdmChildArrayField& operator() () const { return *this; }
// Reimplementation of PdmPointersFieldHandle methods
@@ -40,6 +40,7 @@ message(STATUS ${PROJECT_NAME}" - Qt includes : " ${QT_LIBRARIES})
target_link_libraries ( ${PROJECT_NAME}
cafPdmCore
${QT_LIBRARIES}
${THREAD_LIBRARY}
)
@@ -509,11 +509,10 @@ TEST(BaseTest, PdmPtrField)
EXPECT_EQ(ihd2, accessedIhd);
accessedIhd = ihd1->m_ptrField.value();
EXPECT_EQ(ihd2, accessedIhd);
accessedIhd = ihd1->m_ptrField.v();
caf::PdmPointer<InheritedDemoObj> accessedPdmPtr;
EXPECT_EQ(ihd2, accessedIhd);
accessedPdmPtr = ihd1->m_ptrField.v();
accessedPdmPtr = ihd1->m_ptrField();
EXPECT_EQ(ihd2, accessedPdmPtr.p());
accessedPdmPtr = ihd1->m_ptrField();
EXPECT_EQ(ihd2, accessedPdmPtr.p());
@@ -55,9 +55,7 @@ public:
/*Conversion*/ operator DataType* () const { return m_fieldValue; }
DataType* operator->() const { return m_fieldValue; }
const PdmPointer<DataType>& operator()() const { return m_fieldValue; }
const PdmPointer<DataType>& v() const { return m_fieldValue; }
DataType* operator()() const { return m_fieldValue; }
bool operator==(const DataTypePtr& fieldValue) { return m_fieldValue == fieldValue; }
@@ -26,6 +26,7 @@ target_link_libraries ( ${PROJECT_NAME}
cafPdmCore
cafPdmXml
${QT_LIBRARIES}
${THREAD_LIBRARY}
)
# Copy Qt Dlls
@@ -40,6 +40,7 @@ target_link_libraries ( ${PROJECT_NAME}
cafPdmXml
cafProjectDataModel
${QT_LIBRARIES}
${THREAD_LIBRARY}
)
source_group("" FILES ${PROJECT_FILES})
@@ -23,6 +23,7 @@ set( QOBJECT_HEADERS
cafPdmUiCheckBoxTristateEditor.h
cafPdmUiColorEditor.h
cafPdmUiComboBoxEditor.h
cafPdmUiDateEditor.h
cafPdmUiDefaultObjectEditor.h
cafPdmUiDoubleSliderEditor.h
cafPdmUiFilePathEditor.h
@@ -64,6 +65,8 @@ set( PROJECT_FILES
cafPdmUiColorEditor.h
cafPdmUiComboBoxEditor.cpp
cafPdmUiComboBoxEditor.h
cafPdmUiDateEditor.cpp
cafPdmUiDateEditor.h
cafPdmUiDoubleSliderEditor.cpp
cafPdmUiDoubleSliderEditor.h
cafPdmUiDragDropInterface.h
@@ -0,0 +1,131 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2017 Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "cafPdmUiDateEditor.h"
#include "cafFactory.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmUiDefaultObjectEditor.h"
#include "cafPdmUiFieldEditorHandle.h"
#include "cafPdmUiOrdering.h"
#include "cafSelectionManager.h"
#include <QApplication>
#include <QDate>
#include <QGridLayout>
#include <QIntValidator>
#include <QLabel>
#include <QLineEdit>
#include <QMainWindow>
#include <QMessageBox>
#include <QPalette>
#include <QStatusBar>
#include <QString>
namespace caf
{
CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiDateEditor);
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiDateEditor::configureAndUpdateUi(const QString& uiConfigName)
{
CAF_ASSERT(!m_dateEdit.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())
{
m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64))));
}
else
{
m_label->setText(field()->uiName(uiConfigName));
}
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
m_dateEdit->setEnabled(!field()->isUiReadOnly(uiConfigName));
caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject());
if (uiObject)
{
uiObject->editorAttribute(field()->fieldHandle(), uiConfigName, &m_attributes);
}
if (!m_attributes.dateFormat.isEmpty())
{
m_dateEdit->setDisplayFormat(m_attributes.dateFormat);
}
m_dateEdit->setDate(field()->uiValue().toDate());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDateEditor::createEditorWidget(QWidget* parent)
{
m_dateEdit = new QDateEdit(parent);
m_dateEdit->setCalendarPopup(true);
connect(m_dateEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
return m_dateEdit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDateEditor::createLabelWidget(QWidget* parent)
{
m_label = new QLabel(parent);
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiDateEditor::slotEditingFinished()
{
this->setValueToField(m_dateEdit->date());
}
} // end namespace caf
@@ -0,0 +1,93 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2017 Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
#include "cafPdmUiFieldEditorHandle.h"
#include <QDateEdit>
#include <QLabel>
#include <QPointer>
#include <QString>
#include <QWidget>
namespace caf
{
//==================================================================================================
///
//==================================================================================================
class PdmUiDateEditorAttribute : public PdmUiEditorAttribute
{
public:
QString dateFormat;
public:
PdmUiDateEditorAttribute()
{
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class PdmUiDateEditor : public PdmUiFieldEditorHandle
{
Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
public:
PdmUiDateEditor() {}
virtual ~PdmUiDateEditor() {}
protected:
virtual QWidget* createEditorWidget(QWidget * parent);
virtual QWidget* createLabelWidget(QWidget * parent);
virtual void configureAndUpdateUi(const QString& uiConfigName);
protected slots:
void slotEditingFinished();
private:
QPointer<QDateEdit> m_dateEdit;
QPointer<QLabel> m_label;
PdmUiDateEditorAttribute m_attributes;
};
} // end namespace caf
@@ -46,9 +46,12 @@
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiDateEditor.h"
#include <QGridLayout>
#include <QWidget>
#include <QDate>
#include <QDateTime>
@@ -59,6 +62,8 @@ namespace caf
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiCheckBoxEditor, bool);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, QString);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiDateEditor, QDate);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiDateEditor, QDateTime);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, int);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, double);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, float);
@@ -186,6 +186,10 @@ void PdmUiListEditor::configureAndUpdateUi(const QString& uiConfigName)
{
m_isEditOperationsAvailable = false;
}
else
{
m_isEditOperationsAvailable = true;
}
PdmUiListEditorAttribute attributes;
caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject());
@@ -52,7 +52,9 @@ namespace caf
//--------------------------------------------------------------------------------------------------
PdmUiPropertyViewDialog::PdmUiPropertyViewDialog(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName)
{
initialize(parent, object, windowTitle, uiConfigName, QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
initialize(parent, object, windowTitle, uiConfigName);
}
//--------------------------------------------------------------------------------------------------
@@ -61,7 +63,9 @@ PdmUiPropertyViewDialog::PdmUiPropertyViewDialog(QWidget* parent, PdmObject* obj
PdmUiPropertyViewDialog::PdmUiPropertyViewDialog(QWidget* parent, PdmObject* object, const QString& windowTitle,
const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons)
{
initialize(parent, object, windowTitle, uiConfigName, standardButtons);
m_buttonBox = new QDialogButtonBox(standardButtons);
initialize(parent, object, windowTitle, uiConfigName);
}
//--------------------------------------------------------------------------------------------------
@@ -75,20 +79,28 @@ PdmUiPropertyViewDialog::~PdmUiPropertyViewDialog()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiPropertyViewDialog::initialize(QWidget* parent, PdmObject* object, const QString& windowTitle,
const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons)
QDialogButtonBox* PdmUiPropertyViewDialog::dialogButtonBox()
{
m_pdmObject = object;
m_windowTitle = windowTitle;
m_uiConfigName = uiConfigName;
setupUi(standardButtons);
return m_buttonBox;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiPropertyViewDialog::setupUi(const QDialogButtonBox::StandardButtons& standardButtons)
void PdmUiPropertyViewDialog::initialize(QWidget* parent, PdmObject* object, const QString& windowTitle,
const QString& uiConfigName)
{
m_pdmObject = object;
m_windowTitle = windowTitle;
m_uiConfigName = uiConfigName;
setupUi();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiPropertyViewDialog::setupUi()
{
setWindowTitle(m_windowTitle);
@@ -102,11 +114,12 @@ void PdmUiPropertyViewDialog::setupUi(const QDialogButtonBox::StandardButtons& s
m_pdmUiPropertyView->showProperties(m_pdmObject);
// Buttons
QDialogButtonBox* buttonBox = new QDialogButtonBox(standardButtons);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
//CAF_ASSERT(m_buttonBox->buttons().size() > 0);
dialogLayout->addWidget(buttonBox);
connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
dialogLayout->addWidget(m_buttonBox);
}
@@ -54,15 +54,18 @@ public:
PdmUiPropertyViewDialog(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons);
~PdmUiPropertyViewDialog();
QDialogButtonBox* dialogButtonBox();
private:
void initialize(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons);
void setupUi(const QDialogButtonBox::StandardButtons& standardButtons);
void initialize(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName);
void setupUi();
private:
QString m_windowTitle;
QString m_uiConfigName;
PdmObject* m_pdmObject;
PdmUiPropertyView* m_pdmUiPropertyView;
QDialogButtonBox* m_buttonBox;
};
} // End of namespace caf