Merge branch 'dev' into pre-proto

This commit is contained in:
Bjørnar Grip Fjær
2017-08-01 12:44:11 +02:00
128 changed files with 5129 additions and 423 deletions

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)

View File

@@ -49,6 +49,8 @@ add_library( ${PROJECT_NAME}
cvfStructGridGeometryGenerator.cpp
cvfStructGridGeometryGenerator.h
cvfStructGridScalarDataAccess.h
cafVecIjk.cpp
cafVecIjk.h
${MOC_FILES_CPP}
)

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

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);
};
}

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

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;
};
}

View File

@@ -2,6 +2,7 @@
#pragma once
#include <iostream>
#include <cstdlib>
#define CAF_ASSERT(expr) \
do \

View File

@@ -40,6 +40,7 @@ message(STATUS ${PROJECT_NAME}" - Qt includes : " ${QT_LIBRARIES})
target_link_libraries ( ${PROJECT_NAME}
cafPdmCore
${QT_LIBRARIES}
${THREAD_LIBRARY}
)

View File

@@ -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());

View File

@@ -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; }

View File

@@ -26,6 +26,7 @@ target_link_libraries ( ${PROJECT_NAME}
cafPdmCore
cafPdmXml
${QT_LIBRARIES}
${THREAD_LIBRARY}
)
# Copy Qt Dlls

View File

@@ -40,6 +40,7 @@ target_link_libraries ( ${PROJECT_NAME}
cafPdmXml
cafProjectDataModel
${QT_LIBRARIES}
${THREAD_LIBRARY}
)
source_group("" FILES ${PROJECT_FILES})

View File

@@ -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);
}

View File

@@ -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