mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
[Fwk] Updated headers and added unit tests, fixed minor issues related to text stream operator overload
This commit is contained in:
parent
1bdb68e3d7
commit
3e9e5779ab
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,17 +34,16 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include "cafInternalPdmValueFieldSpecializations.h"
|
||||
#include "cafPdmXmlColor3f.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
@ -75,7 +74,6 @@ public:
|
||||
{
|
||||
return variantValue == variantValue2;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
|
56
Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt
Normal file
56
Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt
Normal file
@ -0,0 +1,56 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
find_package ( Qt4 COMPONENTS QtCore )
|
||||
include (${QT_USE_FILE})
|
||||
|
||||
project ( cafPdmCvf_UnitTests )
|
||||
|
||||
include_directories (
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${cafPdmCore_SOURCE_DIR}
|
||||
${cafPdmXml_SOURCE_DIR}
|
||||
${cafPdmCvf_SOURCE_DIR}
|
||||
|
||||
${LibCore_SOURCE_DIR}
|
||||
)
|
||||
|
||||
|
||||
set( PROJECT_FILES
|
||||
|
||||
cafPdmCvf_UnitTests.cpp
|
||||
gtest/gtest-all.cpp
|
||||
|
||||
cafPdmCoreVec3dTest.cpp
|
||||
cafPdmCoreColor3fTest.cpp
|
||||
cafPdmCoreMat4dTest.cpp
|
||||
)
|
||||
|
||||
# add the executable
|
||||
add_executable (${PROJECT_NAME}
|
||||
${PROJECT_FILES}
|
||||
)
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
message(STATUS ${PROJECT_NAME}" - Qt includes : " ${QT_LIBRARIES})
|
||||
|
||||
target_link_libraries ( ${PROJECT_NAME}
|
||||
cafPdmCore
|
||||
cafPdmXml
|
||||
LibCore
|
||||
cafPdmCvf
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
# Copy Qt Dlls
|
||||
if (MSVC)
|
||||
set (QTLIBLIST QtCore QtGui)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
|
||||
# Debug
|
||||
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll ${CMAKE_CURRENT_BINARY_DIR}/Debug/${qtlib}d4.dll)
|
||||
|
||||
# Release
|
||||
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll ${CMAKE_CURRENT_BINARY_DIR}/Release/${qtlib}4.dll)
|
||||
endforeach( qtlib )
|
||||
endif(MSVC)
|
@ -0,0 +1,59 @@
|
||||
#include "cafPdmCoreColor3f.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
||||
TEST(SerializeTest, PdmCoreColor3f)
|
||||
{
|
||||
float r = 0.4f;
|
||||
float g = 0.2f;
|
||||
float b = 0.18f;
|
||||
cvf::Color3f myColor(r, g, b);
|
||||
|
||||
QString textString;
|
||||
{
|
||||
QTextStream out(&textString);
|
||||
out << myColor;
|
||||
|
||||
EXPECT_EQ(0, textString.compare("0.4 0.2 0.18"));
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Color3f decoded;
|
||||
QTextStream out(&textString);
|
||||
out >> decoded;
|
||||
|
||||
EXPECT_TRUE(decoded == myColor);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(VariantTest, PdmCoreColor3f)
|
||||
{
|
||||
float r = 0.4f;
|
||||
float g = 0.2f;
|
||||
float b = 0.18f;
|
||||
cvf::Color3f myColor(r, g, b);
|
||||
|
||||
QVariant myVariant = caf::PdmValueFieldSpecialization<cvf::Color3f>::convert(myColor);
|
||||
|
||||
cvf::Color3f decoded;
|
||||
caf::PdmValueFieldSpecialization<cvf::Color3f>::setFromVariant(myVariant, decoded);
|
||||
|
||||
EXPECT_FLOAT_EQ(myColor.r(), decoded.r());
|
||||
EXPECT_FLOAT_EQ(myColor.g(), decoded.g());
|
||||
EXPECT_NEAR(myColor.b(), decoded.b(), 0.01); // For some reason, 0.18 is not close enough to use EXPECT_FLOAT_EQ
|
||||
}
|
||||
|
||||
TEST(SerializeSeveralTest, PdmCoreColor3f)
|
||||
{
|
||||
float r = 0.4f;
|
||||
float g = 0.2f;
|
||||
float b = 0.18f;
|
||||
cvf::Color3f myColor(r, g, b);
|
||||
|
||||
QString textString;
|
||||
{
|
||||
QTextStream out(&textString);
|
||||
out << myColor << " " << myColor;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
#include "cafPdmCoreMat4d.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "cvfMatrix4.h"
|
||||
|
||||
cvf::Mat4d createMatrix()
|
||||
{
|
||||
double m00 = 0.00;
|
||||
double m01 = 0.01;
|
||||
double m02 = 0.02;
|
||||
double m03 = 0.03;
|
||||
double m10 = 0.10;
|
||||
double m11 = 0.11;
|
||||
double m12 = 0.12;
|
||||
double m13 = 0.13;
|
||||
double m20 = 0.20;
|
||||
double m21 = 0.21;
|
||||
double m22 = 0.22;
|
||||
double m23 = 0.23;
|
||||
double m30 = 0.30;
|
||||
double m31 = 0.31;
|
||||
double m32 = 0.32;
|
||||
double m33 = 0.33;
|
||||
|
||||
cvf::Mat4d myVector(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33);
|
||||
|
||||
return myVector;
|
||||
}
|
||||
|
||||
TEST(SerializeTest, PdmCoreMat4d)
|
||||
{
|
||||
cvf::Mat4d myMatrix = createMatrix();
|
||||
|
||||
QString textString;
|
||||
{
|
||||
QTextStream out(&textString);
|
||||
out << myMatrix;
|
||||
|
||||
EXPECT_EQ(0, textString.compare("0 0.01 0.02 0.03 0.1 0.11 0.12 0.13 0.2 0.21 0.22 0.23 0.3 0.31 0.32 0.33"));
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Mat4d decoded;
|
||||
QTextStream out(&textString);
|
||||
out >> decoded;
|
||||
|
||||
EXPECT_TRUE(decoded.equals(myMatrix));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(VariantTest, PdmCoreMat4d)
|
||||
{
|
||||
cvf::Mat4d myMatrix = createMatrix();
|
||||
|
||||
QVariant myVariant = caf::PdmValueFieldSpecialization<cvf::Mat4d>::convert(myMatrix);
|
||||
|
||||
cvf::Mat4d decoded;
|
||||
caf::PdmValueFieldSpecialization<cvf::Mat4d>::setFromVariant(myVariant, decoded);
|
||||
|
||||
EXPECT_TRUE(decoded.equals(myMatrix));
|
||||
}
|
||||
|
||||
TEST(SerializeSeveralTest, PdmCoreMat4d)
|
||||
{
|
||||
cvf::Mat4d myMatrix = createMatrix();
|
||||
|
||||
QString textString;
|
||||
{
|
||||
QTextStream out(&textString);
|
||||
out << myMatrix << " " << myMatrix;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
TEST(SerializeTest, PdmCoreVec3d)
|
||||
{
|
||||
double a = 2.4;
|
||||
double b = 12.4;
|
||||
double c = 232.778;
|
||||
|
||||
cvf::Vec3d myVector(a, b, c);
|
||||
|
||||
QString textString;
|
||||
{
|
||||
QTextStream out(&textString);
|
||||
out << myVector;
|
||||
|
||||
EXPECT_EQ(0, textString.compare("2.4 12.4 232.778"));
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec3d decoded;
|
||||
QTextStream out(&textString);
|
||||
out >> decoded;
|
||||
|
||||
EXPECT_TRUE(decoded.equals(myVector));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(VariantTest, PdmCoreVec3d)
|
||||
{
|
||||
double a = 2.4;
|
||||
double b = 12.4;
|
||||
double c = 232.778;
|
||||
|
||||
cvf::Vec3d myVector(a, b, c);
|
||||
|
||||
QVariant myVariant = caf::PdmValueFieldSpecialization<cvf::Vec3d>::convert(myVector);
|
||||
|
||||
cvf::Vec3d decoded;
|
||||
caf::PdmValueFieldSpecialization<cvf::Vec3d>::setFromVariant(myVariant, decoded);
|
||||
|
||||
EXPECT_TRUE(decoded.equals(myVector));
|
||||
}
|
||||
|
||||
TEST(SerializeSeveralTest, PdmCoreVec3d)
|
||||
{
|
||||
double a = 2.4;
|
||||
double b = 12.4;
|
||||
double c = 232.778;
|
||||
|
||||
cvf::Vec3d myVector(a, b, c);
|
||||
|
||||
QString textString;
|
||||
{
|
||||
QTextStream out(&textString);
|
||||
out << myVector << " " << myVector;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 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 "gtest/gtest.h"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
int result = RUN_ALL_TESTS();
|
||||
|
||||
char text[5];
|
||||
std::cin.getline(text, 5);
|
||||
|
||||
return result;
|
||||
}
|
8510
Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/gtest/gtest-all.cpp
Normal file
8510
Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/gtest/gtest-all.cpp
Normal file
File diff suppressed because it is too large
Load Diff
18007
Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/gtest/gtest.h
Normal file
18007
Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/gtest/gtest.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2014 Ceetron Solutions AS
|
||||
// Copyright (C) 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:
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,17 +34,16 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfMatrix4.h"
|
||||
#include "cafPdmCoreMat4d.h"
|
||||
|
||||
#include "cafInternalPdmValueFieldSpecializations.h"
|
||||
#include "cafPdmUiFieldSpecialization.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
|
||||
#include "cafPdmCoreMat4d.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfMatrix4.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -59,7 +58,6 @@ public:
|
||||
return PdmValueFieldSpecialization< cvf::Mat4d >::convert(value);
|
||||
}
|
||||
|
||||
|
||||
/// Set the field value from a QVariant
|
||||
static void setFromVariant(const QVariant& variantValue, cvf::Mat4d& value)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,17 +34,17 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
|
||||
#include "cafInternalPdmValueFieldSpecializations.h"
|
||||
#include "cafPdmUiFieldSpecialization.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
|
||||
class Vec3dDummy
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -36,10 +36,9 @@
|
||||
|
||||
#include "cafPdmXmlColor3f.h"
|
||||
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Color3f& value)
|
||||
QTextStream& operator >> (QTextStream& str, cvf::Color3f& value)
|
||||
{
|
||||
QString text;
|
||||
|
||||
@ -49,11 +48,13 @@ void operator >> (QTextStream& str, cvf::Color3f& value)
|
||||
str >> b;
|
||||
|
||||
value.set(r, g, b);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void operator << (QTextStream& str, const cvf::Color3f& value)
|
||||
QTextStream& operator << (QTextStream& str, const cvf::Color3f& value)
|
||||
{
|
||||
str << value.r() << " " << value.g() << " " << value.b();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
@ -46,5 +45,5 @@ class QTextStream;
|
||||
/// QTextStream Stream operator for cvf::Color3f
|
||||
//==================================================================================================
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Color3f& value);
|
||||
void operator << (QTextStream& str, const cvf::Color3f& value);
|
||||
QTextStream& operator >> (QTextStream& str, cvf::Color3f& value);
|
||||
QTextStream& operator << (QTextStream& str, const cvf::Color3f& value);
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -36,10 +36,9 @@
|
||||
|
||||
#include "cafPdmXmlMat4d.h"
|
||||
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Mat4d& value)
|
||||
QTextStream& operator >> (QTextStream& str, cvf::Mat4d& value)
|
||||
{
|
||||
for (int r = 0; r < 4; ++r)
|
||||
{
|
||||
@ -48,15 +47,24 @@ void operator >> (QTextStream& str, cvf::Mat4d& value)
|
||||
str >> value(r, c);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void operator << (QTextStream& str, const cvf::Mat4d& value)
|
||||
QTextStream& 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) << " ";
|
||||
str << value(r, c);
|
||||
|
||||
if (r * c < 9)
|
||||
{
|
||||
str << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
@ -42,5 +41,5 @@
|
||||
|
||||
class QTextStream;
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Mat4d& value);
|
||||
void operator << (QTextStream& str, const cvf::Mat4d& value);
|
||||
QTextStream& operator >> (QTextStream& str, cvf::Mat4d& value);
|
||||
QTextStream& operator << (QTextStream& str, const cvf::Mat4d& value);
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -36,36 +36,25 @@
|
||||
|
||||
#include "cafPdmXmlVec3d.h"
|
||||
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Vec3d& value)
|
||||
QTextStream& operator >> (QTextStream& str, cvf::Vec3d& value)
|
||||
{
|
||||
bool streamStatusOk = true;
|
||||
QString text;
|
||||
|
||||
cvf::Vec3d tmp;
|
||||
for (int r = 0; r < 3; ++r)
|
||||
{
|
||||
str >> tmp[r];
|
||||
double x, y, z;
|
||||
str >> x;
|
||||
str >> y;
|
||||
str >> z;
|
||||
|
||||
if (str.status() != QTextStream::Ok)
|
||||
{
|
||||
streamStatusOk = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (streamStatusOk)
|
||||
{
|
||||
value = tmp;
|
||||
}
|
||||
value.set(x, y, z);
|
||||
return str;
|
||||
}
|
||||
|
||||
void operator << (QTextStream& str, const cvf::Vec3d& value)
|
||||
QTextStream& operator << (QTextStream& str, const cvf::Vec3d& value)
|
||||
{
|
||||
for (int r = 0; r < 3; ++r)
|
||||
{
|
||||
str << value[r];
|
||||
if (r < 2) str << " ";
|
||||
}
|
||||
str << value.x() << " " << value.y() << " " << value.z();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) 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:
|
||||
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
@ -42,5 +41,5 @@
|
||||
|
||||
class QTextStream;
|
||||
|
||||
void operator >> (QTextStream& str, cvf::Vec3d& value);
|
||||
void operator << (QTextStream& str, const cvf::Vec3d& value);
|
||||
QTextStream& operator >> (QTextStream& str, cvf::Vec3d& value);
|
||||
QTextStream& operator << (QTextStream& str, const cvf::Vec3d& value);
|
||||
|
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
find_package ( Qt4 COMPONENTS QtCore )
|
||||
find_package ( Qt4 COMPONENTS QtCore QtGui )
|
||||
include (${QT_USE_FILE})
|
||||
|
||||
project ( cafPdmCore_UnitTests )
|
||||
@ -42,6 +42,7 @@ target_link_libraries ( ${PROJECT_NAME}
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
# Copy Qt Dlls
|
||||
if (MSVC)
|
||||
set (QTLIBLIST QtCore )
|
||||
|
@ -1,10 +1,6 @@
|
||||
#include "TapCvfSpecialization.h"
|
||||
|
||||
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
#include "cafPdmXmlVec3d.h"
|
||||
#include "cafPdmUiCoreVec3d.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(TapCvfSpecialization, "TapCvfSpecialization");
|
||||
|
||||
|
@ -35,7 +35,9 @@ if (USE_CEE_VIZ)
|
||||
add_subdirectory(VizFwk/LibCore)
|
||||
add_subdirectory(AppFwk/cafPdmCvf)
|
||||
|
||||
add_subdirectory(AppFwk/cafPdmCvf/cafPdmCvf_UnitTests)
|
||||
|
||||
add_subdirectory(AppFwk/cafTests/cafTestCvfApplication)
|
||||
|
||||
set_property(TARGET LibCore cafPdmCvf cafTestCvfApplication PROPERTY FOLDER "CeeViz")
|
||||
set_property(TARGET LibCore cafPdmCvf cafPdmCvf_UnitTests cafTestCvfApplication PROPERTY FOLDER "CeeViz")
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user