mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
caf::Pdm: Added support for Fields of cvf::Mat4d to use for viewpoint storage
p4#: 20378
This commit is contained in:
parent
3e4b0520d4
commit
dc4ba13469
@ -10,4 +10,5 @@ include_directories(
|
||||
|
||||
add_library( ${PROJECT_NAME}
|
||||
cafPdmFieldCvfColor.cpp
|
||||
cafPdmFieldCvfMat4d.cpp
|
||||
)
|
||||
|
@ -19,16 +19,13 @@
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
#include "cvfLibCore.h"
|
||||
#include "cvfBase.h"
|
||||
|
||||
// Includes needed for field editor registration
|
||||
#include "cvfColor3.h"
|
||||
#include "cafPdmUiColorEditor.h"
|
||||
#include "cafFactory.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(caf::PdmUiColorEditor, cvf::Color3f);
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Color3f& value)
|
||||
|
@ -20,14 +20,8 @@
|
||||
#pragma once
|
||||
#include <QVariant>
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "cafPdmUiItem.h"
|
||||
#include "cafPdmObjectFactory.h"
|
||||
|
||||
#include "cafPdmFieldImpl.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
53
cafPdmCvf/cafPdmFieldCvfMat4d.cpp
Normal file
53
cafPdmCvf/cafPdmFieldCvfMat4d.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
// Includes needed for field editor registration
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMatrix4.h"
|
||||
|
||||
//#include "cafPdmUiMatrixEditor.h"
|
||||
//#include "cafPdmField.h"
|
||||
|
||||
//CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(caf::PdmUiMatrixEditor, cvf::Mat4d);
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Mat4d& value)
|
||||
{
|
||||
for (int r = 0; r < 4 ; ++r)
|
||||
{
|
||||
for (int c = 0; c < 4 ; ++c)
|
||||
{
|
||||
str >> value(r, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void operator << (QTextStream& str, const cvf::Mat4d& value)
|
||||
{
|
||||
for (int r = 0; r < 4 ; ++r)
|
||||
{
|
||||
for (int c = 0; c < 4 ; ++c)
|
||||
{
|
||||
str << value(r, c) << " " ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
81
cafPdmCvf/cafPdmFieldCvfMat4d.h
Normal file
81
cafPdmCvf/cafPdmFieldCvfMat4d.h
Normal file
@ -0,0 +1,81 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
#pragma once
|
||||
#include <QVariant>
|
||||
#include <QList>
|
||||
//#include <QStringList>
|
||||
//#include <QXmlStreamReader>
|
||||
//#include <QXmlStreamWriter>
|
||||
#include <QTextStream>
|
||||
|
||||
//#include "cafPdmUiItem.h"
|
||||
//#include "cafPdmObjectFactory.h"
|
||||
|
||||
#include "cafPdmFieldImpl.h"
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMatrix4.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
template <typename T> class PdmField;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
/// Partial specialization for PdmField< cvf::Mat4d >
|
||||
//==================================================================================================
|
||||
|
||||
template <>
|
||||
class PdmFieldTypeSpecialization < cvf::Mat4d >
|
||||
{
|
||||
public:
|
||||
/// Convert the field value into a QVariant
|
||||
static QVariant convert(const cvf::Mat4d& value)
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
/// Set the field value from a QVariant
|
||||
static void setFromVariant(const QVariant& variantValue, cvf::Mat4d& value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// Methods to get a list of options for a field
|
||||
static QList<PdmOptionItemInfo> valueOptions( bool* useOptionsOnly, const cvf::Mat4d& )
|
||||
{
|
||||
return QList<PdmOptionItemInfo>();
|
||||
}
|
||||
|
||||
/// Methods to retrieve the possible PdmObject pointed to by a field
|
||||
static void childObjects(const PdmField< cvf::Mat4d >& field, std::vector<PdmObject*>* objects)
|
||||
{ }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
/// QTextStream Stream operator for cvf::Color3f
|
||||
//==================================================================================================
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Mat4d& value);
|
||||
void operator << (QTextStream& str, const cvf::Mat4d& value);
|
Loading…
Reference in New Issue
Block a user