Merge pull request #124 from OPM/FwkManualUpdate

Update of Framework (CVC)
This commit is contained in:
sigurdp 2013-11-20 02:42:25 -08:00
commit a9140ca894
1264 changed files with 489844 additions and 973 deletions

View File

@ -77,7 +77,6 @@ add_executable( ${ProjectName}
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set ( LINUX_LINK_LIBRARIES
lapack
pthread
)

View File

@ -49,7 +49,7 @@
#include "cafAnimationToolBar.h"
#include "cafPdmUiPropertyView.h"
#include "cvfqtBasicAboutDialog.h"
#include "cafAboutDialog.h"
#include "cvfTimer.h"
#include "cafPdmFieldCvfMat4d.h"
@ -702,13 +702,12 @@ void RiuMainWindow::refreshAnimationActions()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotAbout()
{
cvfqt::BasicAboutDialog dlg(this);
caf::AboutDialog dlg(this);
dlg.setApplicationName(RI_APPLICATION_NAME);
dlg.setApplicationVersion(RiaApplication::getVersionStringApp(true));
dlg.setCopyright("Copyright 2011-2013 Statoil ASA, Ceetron AS");
dlg.showCeeVizVersion(false);
dlg.showQtVersion(false);
#ifdef _DEBUG
dlg.setIsDebugBuild(true);
#endif
@ -719,7 +718,7 @@ void RiuMainWindow::slotAbout()
dlg.addVersionEntry(" ", " ");
dlg.addVersionEntry(" ", "Technical Information");
dlg.addVersionEntry(" ", QString(" Qt ") + qVersion());
dlg.addVersionEntry(" ", QString(" ") + dlg.openGLVersionString());
dlg.addVersionEntry(" ", QString(" ") + caf::AboutDialog::versionStringForcurrentOpenGLContext());
dlg.addVersionEntry(" ", caf::Viewer::isShadersSupported() ? " Hardware OpenGL" : " Software OpenGL");
dlg.create();

View File

@ -70,7 +70,8 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
cvf::OverlayAxisCross* axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), standardFont);
axisCross->setAxisLabels("E", "N", "Z");
m_mainRendering->addOverlayItem(axisCross, cvf::OverlayItem::BOTTOM_LEFT, cvf::OverlayItem::VERTICAL);
axisCross->setLayout(cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT);
m_mainRendering->addOverlayItem(axisCross);
this->enableOverlyPainting(true);
this->setReleaseOGLResourcesEachFrame(true);
@ -181,12 +182,14 @@ void RiuViewer::updateLegends()
if (m_legend1.notNull())
{
firstRendering->addOverlayItem(m_legend1.p(), cvf::OverlayItem::BOTTOM_LEFT, cvf::OverlayItem::VERTICAL);
m_legend1->setLayout(cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT);
firstRendering->addOverlayItem(m_legend1.p());
}
if (m_legend2.notNull())
{
firstRendering->addOverlayItem(m_legend2.p(), cvf::OverlayItem::BOTTOM_LEFT, cvf::OverlayItem::VERTICAL);
m_legend2->setLayout(cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT);
firstRendering->addOverlayItem(m_legend2.p());
}
}

16
Fwk/AppFwk/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
cmake_minimum_required (VERSION 2.8)
project (CeeApp)
find_package (Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl REQUIRED)
include (${QT_USE_FILE})
#libraries
add_subdirectory(cafProjectDataModel)
add_subdirectory(cafUserInterface)
#executables
add_subdirectory(cafTests/cafProjectDataModel_UnitTests)
add_subdirectory(cafTests/cafTestApplication)

View File

@ -0,0 +1,943 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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 "cvfBase.h"
#include "cvfStructGrid.h"
#include "cvfStructGridCutPlane.h"
#include "cvfStructGridScalarDataAccess.h"
#include "cvfGeometryBuilderDrawableGeo.h"
#include "cvfPrimitiveSetIndexedUInt.h"
#include "cvfDebugTimer.h"
#include "cvfPlane.h"
#include "cvfScalarMapper.h"
#include "cvfEdgeKey.h"
#include "cvfMeshEdgeExtractor.h"
#include <map>
#include <cstring>
#include <math.h>
namespace cvf {
//==================================================================================================
///
/// \class cvf::StructGridCutPlane
/// \ingroup StructGrid
///
///
///
//==================================================================================================
// Based on description and implementation from Paul Bourke:
// http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/
const uint StructGridCutPlane::sm_edgeTable[256] =
{
0x0 , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c,
0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac,
0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c,
0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc,
0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c,
0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc ,
0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460,
0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0,
0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230,
0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190,
0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0
};
const int StructGridCutPlane::sm_triTable[256][16] =
{
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1},
{3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1},
{3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1},
{3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1},
{9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1},
{9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
{2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1},
{8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1},
{9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
{4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1},
{3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1},
{1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1},
{4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1},
{4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1},
{9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
{5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1},
{2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1},
{9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
{0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
{2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1},
{10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1},
{4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1},
{5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1},
{5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1},
{9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1},
{0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1},
{10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1},
{8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1},
{2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1},
{7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1},
{9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1},
{2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1},
{11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1},
{9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1},
{5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1},
{11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1},
{11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
{1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1},
{9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1},
{5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1},
{2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
{0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
{5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1},
{6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1},
{3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1},
{6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1},
{5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1},
{1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
{10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1},
{6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1},
{8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1},
{7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1},
{3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
{5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1},
{0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1},
{9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1},
{8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1},
{5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1},
{0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1},
{6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1},
{10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1},
{10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1},
{8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1},
{1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1},
{3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1},
{0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1},
{10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1},
{3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1},
{6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1},
{9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1},
{8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1},
{3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1},
{6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1},
{0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1},
{10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1},
{10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1},
{2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1},
{7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1},
{7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1},
{2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1},
{1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1},
{11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1},
{8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1},
{0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1},
{7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
{10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
{2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
{6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1},
{7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1},
{2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1},
{1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1},
{10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1},
{10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1},
{0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1},
{7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1},
{6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1},
{8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1},
{9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1},
{6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1},
{4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1},
{10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1},
{8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1},
{0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1},
{1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1},
{8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1},
{10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1},
{4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1},
{10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
{5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
{11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1},
{9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
{6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1},
{7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1},
{3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1},
{7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1},
{9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1},
{3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1},
{6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1},
{9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1},
{1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1},
{4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1},
{7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1},
{6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1},
{3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1},
{0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1},
{6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1},
{0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1},
{11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1},
{6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1},
{5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1},
{9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1},
{1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1},
{10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1},
{0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1},
{5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1},
{10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1},
{11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1},
{9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1},
{7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1},
{2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1},
{8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1},
{9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1},
{9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1},
{1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1},
{9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1},
{9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1},
{5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1},
{0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1},
{10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1},
{2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1},
{0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1},
{0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1},
{9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1},
{5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1},
{3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1},
{5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1},
{8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1},
{0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1},
{9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1},
{1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1},
{3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1},
{4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1},
{9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1},
{11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1},
{11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1},
{2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1},
{9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1},
{3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1},
{1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1},
{4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1},
{4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1},
{0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1},
{3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1},
{3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1},
{0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1},
{9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1},
{1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}
};
//--------------------------------------------------------------------------------------------------
/// Constructor
//--------------------------------------------------------------------------------------------------
StructGridCutPlane::StructGridCutPlane(const StructGridInterface* grid)
: m_grid(grid),
m_mapScalarSetIndex(UNDEFINED_UINT),
m_scalarMapper(NULL),
m_mapNodeAveragedScalars(false),
m_mustRecompute(true)
{
CVF_ASSERT(grid);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
StructGridCutPlane::~StructGridCutPlane()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void StructGridCutPlane::setPlane(const Plane& plane)
{
m_plane = plane;
m_mustRecompute = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void StructGridCutPlane::setMapScalar(uint scalarSetIndex, const ScalarMapper* mapper, bool nodeAveragedScalars)
{
CVF_ASSERT(mapper);
m_mapScalarSetIndex = scalarSetIndex;
m_scalarMapper = mapper;
m_mapNodeAveragedScalars = nodeAveragedScalars;
m_mustRecompute = true;
}
//--------------------------------------------------------------------------------------------------
/// Generate cut plane geometry from current configuration
///
/// \return Reference to created DrawableGeo object. Returns NULL if no cut plane was generated
///
/// \todo Remove duplicate nodes from returned geometry
/// Current implementation is not optimized in any way
/// Should set normal from plane normal instead of relying on caller to compute them
//--------------------------------------------------------------------------------------------------
ref<DrawableGeo> StructGridCutPlane::generateSurface(const cvf::StructGridScalarDataAccess* dataAccessObject)
{
if (m_mustRecompute)
{
computeCutPlane(dataAccessObject);
m_mustRecompute = false;
}
size_t numVertices = m_vertices.size();
size_t numTriangles = m_triangleIndices.size()/3;
if (numVertices == 0 || numTriangles == 0)
{
return NULL;
}
bool doMapScalar = false;
if (m_mapScalarSetIndex != UNDEFINED_UINT && m_scalarMapper.notNull())
{
CVF_ASSERT(numVertices == m_vertexScalars.size());
doMapScalar = true;
}
ref<Vec3fArray> vertexArr = new Vec3fArray(m_vertices);
ref<UIntArray> indices = new UIntArray(m_triangleIndices);
ref<PrimitiveSetIndexedUInt> primSet = new PrimitiveSetIndexedUInt(PT_TRIANGLES);
primSet->setIndices(indices.p());
ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;;
geo->setVertexArray(vertexArr.p());
geo->addPrimitiveSet(primSet.p());
if (doMapScalar)
{
CVF_ASSERT(numVertices == m_vertexScalars.size());
ref<Color3ubArray> vertexColors = new Color3ubArray;
ref<Vec2fArray> textureCoords = new Vec2fArray;
vertexColors->reserve(numVertices);
textureCoords->reserve(numVertices);
size_t i;
for (i = 0; i < numVertices; i++)
{
Color3ub clr = m_scalarMapper->mapToColor(m_vertexScalars[i]);
vertexColors->add(clr);
Vec2f texCoord = m_scalarMapper->mapToTextureCoord(m_vertexScalars[i]);
textureCoords->add(texCoord);
}
geo->setColorArray(vertexColors.p());
geo->setTextureCoordArray(textureCoords.p());
}
//Trace::show("generateSurface(): Vertices:%d TriConns:%d Tris:%d", vertexArr->size(), indices->size(), indices->size()/3);
return geo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ref<DrawableGeo> StructGridCutPlane::generateMesh(const cvf::StructGridScalarDataAccess* dataAccessObject)
{
if (m_mustRecompute)
{
computeCutPlane(dataAccessObject);
m_mustRecompute = false;
}
size_t numVertices = m_vertices.size();
size_t numLines = m_meshLineIndices.size()/2;
if (numVertices == 0 || numLines == 0)
{
return NULL;
}
MeshEdgeExtractor ee;
ee.addPrimitives(2, &m_meshLineIndices[0], m_meshLineIndices.size());
ref<UIntArray> indices = ee.lineIndices();
ref<PrimitiveSetIndexedUInt> primSet = new PrimitiveSetIndexedUInt(PT_LINES);
primSet->setIndices(indices.p());
ref<Vec3fArray> vertexArr = new Vec3fArray(m_vertices);
ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;;
geo->setVertexArray(vertexArr.p());
geo->addPrimitiveSet(primSet.p());
//Trace::show("generateMesh(): Vertices:%d LineConns:%d Lines:%d", vertexArr->size(), indices->size(), indices->size()/2);
return geo;
}
//--------------------------------------------------------------------------------------------------
/// Generate surface representation of the specified cut plane
///
/// \note Will compute normals before returning geometry
//--------------------------------------------------------------------------------------------------
void StructGridCutPlane::computeCutPlane(const cvf::StructGridScalarDataAccess* dataAccessObject)
{
if (!dataAccessObject) return;
DebugTimer tim("");
bool doMapScalar = false;
if (m_mapScalarSetIndex != UNDEFINED_UINT && m_scalarMapper.notNull())
{
doMapScalar = true;
}
size_t cellCountI = m_grid->cellCountI();
size_t cellCountJ = m_grid->cellCountJ();
size_t cellCountK = m_grid->cellCountK();
// Clear any current data
m_vertices.clear();
m_vertexScalars.clear();
m_triangleIndices.clear();
m_meshLineIndices.clear();
// The indexing conventions for vertices and
// edges used in the algorithm:
// edg verts
// 4-------------5 *------4------* 0 0 - 1
// /| /| /| /| 1 1 - 2
// / | / | 7/ | 5/ | 2 2 - 3
// / | / | |z / 8 / 9 3 3 - 0
// 7-------------6 | | /y *------6------* | 4 4 - 5
// | | | | |/ | | | | 5 5 - 6
// | 0---------|---1 *---x | *------0--|---* 6 6 - 7
// | / | / 11 / 10 / 7 7 - 4
// | / | / | /3 | /1 8 0 - 4
// |/ |/ |/ |/ 9 1 - 5
// 3-------------2 *------2------* 10 2 - 6
// vertex indices edge indices 11 3 - 7
//
size_t k;
for (k = 0; k < cellCountK; k++)
{
size_t j;
for (j = 0; j < cellCountJ; j++)
{
size_t i;
for (i = 0; i < cellCountI; i++)
{
size_t cellIndex = m_grid->cellIndexFromIJK(i, j, k);
Vec3d minCoord;
Vec3d maxCoord;
m_grid->cellMinMaxCordinates(cellIndex, &minCoord, &maxCoord);
// Early reject for cells outside clipping box
if (m_clippingBoundingBox.isValid())
{
BoundingBox cellBB(minCoord, maxCoord);
if (!m_clippingBoundingBox.intersects(cellBB))
{
continue;
}
}
// Check if plane intersects this cell and skip if it doesn't
if (!isCellIntersectedByPlane(m_plane, minCoord, maxCoord))
{
continue;
}
GridCell cell;
bool isClipped = false;
if (m_clippingBoundingBox.isValid())
{
if (!m_clippingBoundingBox.contains(minCoord) || !m_clippingBoundingBox.contains(maxCoord))
{
isClipped = true;
minCoord.x() = CVF_MAX(minCoord.x(), m_clippingBoundingBox.min().x());
minCoord.y() = CVF_MAX(minCoord.y(), m_clippingBoundingBox.min().y());
minCoord.z() = CVF_MAX(minCoord.z(), m_clippingBoundingBox.min().z());
maxCoord.x() = CVF_MIN(maxCoord.x(), m_clippingBoundingBox.max().x());
maxCoord.y() = CVF_MIN(maxCoord.y(), m_clippingBoundingBox.max().y());
maxCoord.z() = CVF_MIN(maxCoord.z(), m_clippingBoundingBox.max().z());
}
}
cell.p[0].set(minCoord.x(), maxCoord.y(), minCoord.z());
cell.p[1].set(maxCoord.x(), maxCoord.y(), minCoord.z());
cell.p[2].set(maxCoord.x(), minCoord.y(), minCoord.z());
cell.p[3].set(minCoord.x(), minCoord.y(), minCoord.z());
cell.p[4].set(minCoord.x(), maxCoord.y(), maxCoord.z());
cell.p[5].set(maxCoord.x(), maxCoord.y(), maxCoord.z());
cell.p[6].set(maxCoord.x(), minCoord.y(), maxCoord.z());
cell.p[7].set(minCoord.x(), minCoord.y(), maxCoord.z());
// Fetch scalar values
double cellScalarValue = 0;
if (doMapScalar)
{
cellScalarValue = dataAccessObject->cellScalar(cellIndex);
// If we're doing node averaging we must populate grid cell with scalar values interpolated to the grid points
if (m_mapNodeAveragedScalars)
{
CVF_ASSERT(false); // This is not supported in this code.
#if 0
// This is not supported now. This is possibly valid code for "neighbour regular grids" (Eg. Rectilinear or regular grids)
// but is not general for general struct grids. So the interpolation stuff must be handled specially for each "real" grid type
if (isClipped)
{
double scalarVal;
if (dataAccessObject->pointScalar(cell.p[0], &scalarVal)) cell.s[0] = scalarVal;
if (dataAccessObject->pointScalar(cell.p[1], &scalarVal)) cell.s[1] = scalarVal;
if (dataAccessObject->pointScalar(cell.p[2], &scalarVal)) cell.s[2] = scalarVal;
if (dataAccessObject->pointScalar(cell.p[3], &scalarVal)) cell.s[3] = scalarVal;
if (dataAccessObject->pointScalar(cell.p[4], &scalarVal)) cell.s[4] = scalarVal;
if (dataAccessObject->pointScalar(cell.p[5], &scalarVal)) cell.s[5] = scalarVal;
if (dataAccessObject->pointScalar(cell.p[6], &scalarVal)) cell.s[6] = scalarVal;
if (dataAccessObject->pointScalar(cell.p[7], &scalarVal)) cell.s[7] = scalarVal;
}
else
{
cell.s[0] = dataAccessObject->gridPointScalar(i, j + 1, k);
cell.s[1] = dataAccessObject->gridPointScalar(i + 1, j + 1, k);
cell.s[2] = dataAccessObject->gridPointScalar(i + 1, j, k);
cell.s[3] = dataAccessObject->gridPointScalar(i, j, k);
cell.s[4] = dataAccessObject->gridPointScalar(i, j + 1, k + 1);
cell.s[5] = dataAccessObject->gridPointScalar(i + 1, j + 1, k + 1);
cell.s[6] = dataAccessObject->gridPointScalar(i + 1, j, k + 1);
cell.s[7] = dataAccessObject->gridPointScalar(i, j, k + 1);
}
#else
cell.s[0] = HUGE_VAL;
cell.s[1] = HUGE_VAL;
cell.s[2] = HUGE_VAL;
cell.s[3] = HUGE_VAL;
cell.s[4] = HUGE_VAL;
cell.s[5] = HUGE_VAL;
cell.s[6] = HUGE_VAL;
cell.s[7] = HUGE_VAL;
#endif
}
}
Triangles triangles;
uint numTriangles = polygonise(m_plane, cell, &triangles);
if (numTriangles > 0)
{
// Add all the referenced vertices
// At the same time registering their index in the 'global' vertex list
uint globalVertexIndices[12];
int iv;
for (iv = 0; iv < 12; iv++)
{
if (triangles.usedVertices[iv])
{
globalVertexIndices[iv] = static_cast<uint>(m_vertices.size());
m_vertices.push_back(Vec3f(triangles.vertices[iv]));
if (doMapScalar)
{
if (m_mapNodeAveragedScalars)
{
m_vertexScalars.push_back(triangles.scalars[iv]);
}
else
{
m_vertexScalars.push_back(cellScalarValue);
}
}
}
else
{
globalVertexIndices[iv] = UNDEFINED_UINT;
}
}
// Build triangles from the cell
const size_t prevNumTriangleIndices = m_triangleIndices.size();
uint t;
for (t = 0; t < numTriangles; t++)
{
m_triangleIndices.push_back(globalVertexIndices[triangles.triangleIndices[3*t]]);
m_triangleIndices.push_back(globalVertexIndices[triangles.triangleIndices[3*t + 1]]);
m_triangleIndices.push_back(globalVertexIndices[triangles.triangleIndices[3*t + 2]]);
}
// Add mesh line indices
addMeshLineIndices(&m_triangleIndices[prevNumTriangleIndices], numTriangles);
}
}
}
}
// Trace::show("Vertices:%d TriConns:%d Tris:%d", m_vertices.size(), m_triangleIndices.size(), m_triangleIndices.size()/3);
// tim.reportTimeMS("computeCutPlane()");
}
//--------------------------------------------------------------------------------------------------
/// Add mesh line indices by analyzing the triangle indices and only adding 'unique' edges
//--------------------------------------------------------------------------------------------------
void StructGridCutPlane::addMeshLineIndices(const uint* triangleIndices, uint triangleCount)
{
std::vector<int64> edges;
edges.reserve(3*triangleCount);
std::vector<int64>::iterator it;
uint t;
for (t = 0; t < triangleCount; t++)
{
uint i;
for (i = 0; i < 3; i++)
{
const uint vertexIdx1 = triangleIndices[3*t + i];
const uint vertexIdx2 = (i < 2) ? triangleIndices[3*t + i + 1] : triangleIndices[3*t];
int64 edgeKeyVal = EdgeKey(vertexIdx1, vertexIdx2).toKeyVal();
it = find(edges.begin(), edges.end(), edgeKeyVal);
if (it == edges.end())
{
edges.push_back(edgeKeyVal);
}
else
{
edges.erase(it);
}
}
}
for (it = edges.begin(); it != edges.end(); ++it)
{
EdgeKey ek = EdgeKey::fromkeyVal(*it);
m_meshLineIndices.push_back(ek.index1());
m_meshLineIndices.push_back(ek.index2());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
uint StructGridCutPlane::polygonise(const Plane& plane, const GridCell& cell, Triangles* triangles)
{
int cubeindex = 0;
if (plane.distanceSquared(cell.p[0]) < 0) cubeindex |= 1;
if (plane.distanceSquared(cell.p[1]) < 0) cubeindex |= 2;
if (plane.distanceSquared(cell.p[2]) < 0) cubeindex |= 4;
if (plane.distanceSquared(cell.p[3]) < 0) cubeindex |= 8;
if (plane.distanceSquared(cell.p[4]) < 0) cubeindex |= 16;
if (plane.distanceSquared(cell.p[5]) < 0) cubeindex |= 32;
if (plane.distanceSquared(cell.p[6]) < 0) cubeindex |= 64;
if (plane.distanceSquared(cell.p[7]) < 0) cubeindex |= 128;
if (sm_edgeTable[cubeindex] == 0)
{
return 0;
}
// Compute vertex coordinates on the edges where we have intersections
if (sm_edgeTable[cubeindex] & 1) triangles->vertices[0] = planeLineIntersection(plane, cell.p[0], cell.p[1], cell.s[0], cell.s[1], &triangles->scalars[0] );
if (sm_edgeTable[cubeindex] & 2) triangles->vertices[1] = planeLineIntersection(plane, cell.p[1], cell.p[2], cell.s[1], cell.s[2], &triangles->scalars[1] );
if (sm_edgeTable[cubeindex] & 4) triangles->vertices[2] = planeLineIntersection(plane, cell.p[2], cell.p[3], cell.s[2], cell.s[3], &triangles->scalars[2] );
if (sm_edgeTable[cubeindex] & 8) triangles->vertices[3] = planeLineIntersection(plane, cell.p[3], cell.p[0], cell.s[3], cell.s[0], &triangles->scalars[3] );
if (sm_edgeTable[cubeindex] & 16) triangles->vertices[4] = planeLineIntersection(plane, cell.p[4], cell.p[5], cell.s[4], cell.s[5], &triangles->scalars[4] );
if (sm_edgeTable[cubeindex] & 32) triangles->vertices[5] = planeLineIntersection(plane, cell.p[5], cell.p[6], cell.s[5], cell.s[6], &triangles->scalars[5] );
if (sm_edgeTable[cubeindex] & 64) triangles->vertices[6] = planeLineIntersection(plane, cell.p[6], cell.p[7], cell.s[6], cell.s[7], &triangles->scalars[6] );
if (sm_edgeTable[cubeindex] & 128) triangles->vertices[7] = planeLineIntersection(plane, cell.p[7], cell.p[4], cell.s[7], cell.s[4], &triangles->scalars[7] );
if (sm_edgeTable[cubeindex] & 256) triangles->vertices[8] = planeLineIntersection(plane, cell.p[0], cell.p[4], cell.s[0], cell.s[4], &triangles->scalars[8] );
if (sm_edgeTable[cubeindex] & 512) triangles->vertices[9] = planeLineIntersection(plane, cell.p[1], cell.p[5], cell.s[1], cell.s[5], &triangles->scalars[9] );
if (sm_edgeTable[cubeindex] & 1024) triangles->vertices[10] = planeLineIntersection(plane, cell.p[2], cell.p[6], cell.s[2], cell.s[6], &triangles->scalars[10]);
if (sm_edgeTable[cubeindex] & 2048) triangles->vertices[11] = planeLineIntersection(plane, cell.p[3], cell.p[7], cell.s[3], cell.s[7], &triangles->scalars[11]);
// Create the triangles
memset(triangles->usedVertices, 0, sizeof(triangles->usedVertices));
const int* triConnects = sm_triTable[cubeindex];
uint n = 0;
while (triConnects[n] != -1)
{
triangles->triangleIndices[n] = triConnects[n];
triangles->usedVertices[triConnects[n]] = true;
n++;
}
uint numTriangles = n/3;
return numTriangles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Vec3d StructGridCutPlane::planeLineIntersection(const Plane& plane, const Vec3d& p1, const Vec3d& p2, const double s1, const double s2, double* s)
{
// From http://local.wasp.uwa.edu.au/~pbourke/geometry/planeline/
//
// P1 (x1,y1,z1) and P2 (x2,y2,z2)
//
// P = P1 + u (P2 - P1)
//
// A*x1 + B*y1 + C*z1 + D
// u = ---------------------------------
// A*(x1-x2) + B*(y1-y2) + C*(z1-z2)
CVF_ASSERT(s);
const Vec3d v = p2 - p1;
double denominator = -(plane.A()*v.x() + plane.B()*v.y() + plane.C()*v.z());
if (denominator != 0)
{
double u = (plane.A()*p1.x() + plane.B()*p1.y() + plane.C()*p1.z() + plane.D())/denominator;
if (u > 0.0 && u < 1.0)
{
*s = s1 + u*(s2 - s1);
return (p1 + u*v);
}
else
{
if (u >= 1.0)
{
*s = s2;
return p2;
}
else
{
*s = s1;
return p1;
}
}
}
else
{
*s = s1;
return p1;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool StructGridCutPlane::isCellIntersectedByPlane(const Plane& plane, const Vec3d& cellMinCoord, const Vec3d& cellMaxCoord)
{
// See http://zach.in.tu-clausthal.de/teaching/cg_literatur/lighthouse3d_view_frustum_culling/index.html
// Start by finding the "positive vertex" and the "negative vertex" relative to plane normal
Vec3d pVertex(cellMinCoord);
Vec3d nVertex(cellMaxCoord);
if (plane.A() >= 0)
{
pVertex.x() = cellMaxCoord.x();
nVertex.x() = cellMinCoord.x();
}
if (plane.B() >= 0)
{
pVertex.y() = cellMaxCoord.y();
nVertex.y() = cellMinCoord.y();
}
if (plane.C() >= 0)
{
pVertex.z() = cellMaxCoord.z();
nVertex.z() = cellMinCoord.z();
}
// Chek if both positive and negative vertex are on same side of plane
if (plane.distanceSquared(pVertex) < 0)
{
if (plane.distanceSquared(nVertex) < 0)
{
return false;
}
else
{
return true;
}
}
else
{
if (plane.distanceSquared(nVertex) >= 0)
{
return false;
}
else
{
return true;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void StructGridCutPlane::setClippingBoundingBox(const BoundingBox& boundingBox)
{
m_clippingBoundingBox = boundingBox;
}
} // namespace cvf

View File

@ -0,0 +1,113 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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 "cvfPlane.h"
#include "cvfBoundingBox.h"
#include <vector>
namespace cvf {
class DrawableGeo;
class StructGridInterface;
class ScalarMapper;
class StructGridScalarDataAccess;
//==================================================================================================
//
//
//
//==================================================================================================
class StructGridCutPlane : public Object
{
public:
StructGridCutPlane(const StructGridInterface* grid);
~StructGridCutPlane();
void setPlane(const Plane& plane);
void setClippingBoundingBox(const BoundingBox& boundingBox);
void setMapScalar(uint scalarSetIndex, const ScalarMapper* mapper, bool nodeAveragedScalars);
ref<DrawableGeo> generateSurface(const cvf::StructGridScalarDataAccess* dataAccessObject);
ref<DrawableGeo> generateMesh(const cvf::StructGridScalarDataAccess* dataAccessObject);
private:
struct GridCell
{
Vec3d p[8]; // Cell's corner coordinates
double s[8]; // Scalar values in cell corners
};
struct Triangles
{
Vec3d vertices[12]; // The vertices, one on each edge in the cell
double scalars[12]; // Interpolated scalar values for the vertices
bool usedVertices[12]; // Flag to indicate which of the vertices (and scalars) are being referenced by the triangle indices
int triangleIndices[15];// Triangle indices (into vertices), max 5 triangles.
};
private:
void computeCutPlane(const cvf::StructGridScalarDataAccess* dataAccessObject);
void addMeshLineIndices(const uint* triangleIndices, uint triangleCount);
static uint polygonise(const Plane& plane, const GridCell& cell, Triangles* triangles);
static Vec3d planeLineIntersection(const Plane& plane, const Vec3d& p1, const Vec3d& p2, const double s1, const double s2, double* s);
static bool isCellIntersectedByPlane(const Plane& plane, const Vec3d& cellMinCoord, const Vec3d& cellMaxCoord);
private:
cref<StructGridInterface> m_grid;
Plane m_plane;
BoundingBox m_clippingBoundingBox;
uint m_mapScalarSetIndex; // Index of scalar set that should be mapped onto the cut plane. -1 for no mapping
cref<ScalarMapper> m_scalarMapper; // Scalar mapper to use when mapping. Both scalar set index and mapper must be set in order to get scalar mapping
bool m_mapNodeAveragedScalars; // If true we'll compute node averaged scalars before mapping them on the cut plane. If false per cell scalars will be mapped.
bool m_mustRecompute; // Flag to indicate that cut plane must be recomputed
std::vector<Vec3f> m_vertices; // Vertices of computed surface
std::vector<double> m_vertexScalars; // Scalar values for vertices
std::vector<uint> m_triangleIndices; // Triangle connectivities
std::vector<uint> m_meshLineIndices; // Mesh line connectivities
static const uint sm_edgeTable[256];
static const int sm_triTable[256][16];
};
}

1817
Fwk/AppFwk/Doxygen/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -163,7 +163,11 @@ int FrameAnimationControl::currentFrame() const
void FrameAnimationControl::setNumFrames(int numFrames)
{
m_numFrames = numFrames < 0 ? 0 : numFrames;
emit frameCountChanged(m_numFrames);
if (m_currentFrame >= numFrames ) m_currentFrame = 0; // Should we emit frameChanged ?
}
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,37 @@
cmake_minimum_required (VERSION 2.8)
project ( cafProjectDataModel_UnitTests )
include_directories (
${CMAKE_SOURCE_DIR}/cafProjectDataModel
${CMAKE_SOURCE_DIR}/cafTests
#Remove when RigStatistics is out
${ResInsight_SOURCE_DIR}/ApplicationCode/ModelVisualization
)
# add the executable
add_executable (${PROJECT_NAME}
cafPdmBasicTest.cpp
cafProjectDataModel_UnitTests.cpp
${CMAKE_SOURCE_DIR}/cafTests/gtest/gtest-all.cpp
)
target_link_libraries ( ${PROJECT_NAME}
cafProjectDataModel
${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)

View File

@ -0,0 +1,744 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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 <iostream>
#include "gtest/gtest.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafPdmDocument.h"
#include "cafAppEnum.h"
#include <memory>
#include <QFile>
/// Demo objects to show the usage of the Pdm system
class SimpleObj: public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
SimpleObj()
{
CAF_PDM_InitObject("Simple Object", "", "", "");
CAF_PDM_InitField(&m_position, "Position", 8765.2, "Position", "", "", "");
CAF_PDM_InitField(&m_dir, "Dir", 123.56, "Direction", "", "", "");
CAF_PDM_InitField(&m_up, "Up", 0.0, "Up value", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_numbers, "Numbers", "Important Numbers", "", "", "");
}
/// Assignment and copying of PDM objects is not focus for the features. This is only a
/// "would it work" test
SimpleObj(const SimpleObj& other)
: PdmObject()
{
CAF_PDM_InitField(&m_position, "Position", 8765.2, "Position", "", "", "");
CAF_PDM_InitField(&m_dir, "Dir", 123.56, "Direction", "", "", "");
CAF_PDM_InitField(&m_up, "Up", 0.0, "Up value", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_numbers, "Numbers", "Important Numbers", "", "", "");
m_position = other.m_position;
m_dir = other.m_dir;
m_up = other.m_up;
m_numbers = other.m_numbers;
}
~SimpleObj() {}
caf::PdmField<double> m_position;
caf::PdmField<double> m_dir;
caf::PdmField<double> m_up;
caf::PdmField<std::vector<double> > m_numbers;
};
CAF_PDM_SOURCE_INIT(SimpleObj, "SimpleObj");
class DemoPdmObject: public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
DemoPdmObject()
{
CAF_PDM_InitObject("Demo Object", "", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework");
CAF_PDM_InitField(&m_doubleField, "BigNumber", 0.0, "Big Number", "",
"Enter a big number here",
"This is a place you can enter a big real value if you want" );
CAF_PDM_InitField(&m_intField, "IntNumber", 0, "Small Number","",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_textField, "TextField", QString("ÆØÅ Test text end"), "", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_simpleObjPtrField, "SimpleObjPtrField", "", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_simpleObjPtrField2, "SimpleObjPtrField2", "", "", "", "");
m_simpleObjPtrField2 = new SimpleObj;
}
~DemoPdmObject()
{
delete m_simpleObjPtrField2();
}
// Fields
caf::PdmField<double> m_doubleField;
caf::PdmField<int> m_intField;
caf::PdmField<QString> m_textField;
caf::PdmField<SimpleObj*> m_simpleObjPtrField;
caf::PdmField<SimpleObj*> m_simpleObjPtrField2;
};
CAF_PDM_SOURCE_INIT(DemoPdmObject, "DemoPdmObject");
class InheritedDemoObj : public DemoPdmObject
{
CAF_PDM_HEADER_INIT;
public:
enum TestEnumType
{
T1, T2, T3
};
InheritedDemoObj()
{
CAF_PDM_InitFieldNoDefault(&m_texts, "Texts", "Some words", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_testEnumField, "TestEnumValue", "An Enum", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_simpleObjectsField, "SimpleObjects", "A child object", "", "", "");
}
caf::PdmField<std::vector<QString> > m_texts;
caf::PdmField< caf::AppEnum<TestEnumType> > m_testEnumField;
caf::PdmPointersField<SimpleObj*> m_simpleObjectsField;
};
CAF_PDM_SOURCE_INIT(InheritedDemoObj, "InheritedDemoObj");
namespace caf
{
template<>
void AppEnum<InheritedDemoObj::TestEnumType>::setUp()
{
addItem(InheritedDemoObj::T1, "T1", "An A letter");
addItem(InheritedDemoObj::T2, "T2", "A B letter");
addItem(InheritedDemoObj::T3, "T3", "A B letter");
setDefault(InheritedDemoObj::T1);
}
}
//--------------------------------------------------------------------------------------------------
/// This is a testbed to try out different aspects, instead of having a main in a prototype program
/// To be disabled when everything gets more mature.
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, Start)
{
DemoPdmObject* a = new DemoPdmObject;
caf::PdmObject* demo = caf::PdmObjectFactory::instance()->create("DemoPdmObject");
EXPECT_TRUE(demo != NULL);
QString xml;
QXmlStreamWriter xmlStream(&xml);
xmlStream.setAutoFormatting(true);
SimpleObj* s2 = new SimpleObj;
caf::PdmPointer<SimpleObj> sp;
sp = s2;
std::cout << sp.p() << std::endl;
{
SimpleObj s;
s.m_dir = 10000;
sp = &s;
a->m_textField = "Hei og hå";
*s2 = s;
a->m_simpleObjPtrField = s2;
s.writeFields(xmlStream);
}
a->writeFields(xmlStream);
caf::PdmObjectGroup og;
og.objects.push_back(a);
og.objects.push_back(s2);
og.writeFields(xmlStream);
std::cout << sp.p() << std::endl,
std::cout << xml.toStdString() << std::endl;
}
//--------------------------------------------------------------------------------------------------
/// Test of PdmField operations
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, NormalPdmField)
{
std::vector<double> testValue;
testValue.push_back(1.1);
testValue.push_back(1.2);
testValue.push_back(1.3);
std::vector<double> testValue2;
testValue2.push_back(2.1);
testValue2.push_back(2.2);
testValue2.push_back(2.3);
// Constructors
caf::PdmField<std::vector<double> > field2(testValue);
EXPECT_EQ(1.3, field2.v()[2]);
caf::PdmField<std::vector<double> > field3(field2);
EXPECT_EQ(1.3, field3.v()[2]);
caf::PdmField<std::vector<double> > field1;
EXPECT_EQ(size_t(0), field1().size());
// Operators
EXPECT_FALSE(field1 == field3);
field1 = field2;
EXPECT_EQ(1.3, field1()[2]);
field1 = testValue2;
EXPECT_EQ(2.3, field1()[2]);
field3 = field1;
EXPECT_TRUE(field1 == field3);
}
//--------------------------------------------------------------------------------------------------
/// Test of PdmField of pointer operations
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, PointerPdmField)
{
SimpleObj* testValue = new SimpleObj;
testValue->m_numbers.v().push_back(1.1);
testValue->m_numbers.v().push_back(1.2);
testValue->m_numbers.v().push_back(1.3);
SimpleObj* testValue2 = new SimpleObj;
testValue->m_numbers.v().push_back(2.1);
testValue->m_numbers.v().push_back(2.2);
testValue->m_numbers.v().push_back(2.3);
// Constructors
caf::PdmField<SimpleObj*> field2(testValue);
EXPECT_EQ(testValue, field2.v());
caf::PdmField<SimpleObj*> field3(field2);
EXPECT_EQ(testValue, field3.v());
caf::PdmField<SimpleObj*> field1;
EXPECT_EQ((SimpleObj*)0, field1.v());
// Operators
EXPECT_FALSE(field1 == field3);
field1 = field2;
EXPECT_EQ(testValue, field1);
field1 = testValue2;
field3 = testValue2;
EXPECT_EQ(testValue2, field1);
EXPECT_TRUE(field1 == field3);
delete testValue;
delete testValue2;
EXPECT_EQ((SimpleObj*)0, field1);
EXPECT_EQ((SimpleObj*)0, field2);
EXPECT_EQ((SimpleObj*)0, field3);
}
//--------------------------------------------------------------------------------------------------
/// Test of PdmPointersField operations
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, PdmPointersField)
{
std::vector<caf::PdmFieldHandle*> parentFields;
InheritedDemoObj* ihd1 = new InheritedDemoObj;
SimpleObj* s1 = new SimpleObj;
SimpleObj* s2 = new SimpleObj;
SimpleObj* s3 = new SimpleObj;
// empty() number 1
EXPECT_TRUE(ihd1->m_simpleObjectsField.empty());
EXPECT_EQ(size_t(0), ihd1->m_simpleObjectsField.size());
// push_back()
ihd1->m_simpleObjectsField.push_back(s1);
ihd1->m_simpleObjectsField.push_back(s2);
ihd1->m_simpleObjectsField.push_back(s3);
s1->parentFields(parentFields);
EXPECT_EQ(size_t(1), parentFields.size());
parentFields.clear();
// size()
EXPECT_EQ(size_t(3), ihd1->m_simpleObjectsField.size());
EXPECT_EQ(size_t(3), ihd1->m_simpleObjectsField.size());
// operator[]
EXPECT_EQ(s2, ihd1->m_simpleObjectsField[1]);
EXPECT_EQ(s3, ihd1->m_simpleObjectsField[2]);
// childObjects
std::vector<caf::PdmObject*> objects;
ihd1->m_simpleObjectsField.childObjects(&objects);
EXPECT_EQ(size_t(3), objects.size());
// Operator ==, Operator =
InheritedDemoObj* ihd2 = new InheritedDemoObj;
EXPECT_FALSE(ihd2->m_simpleObjectsField == ihd1->m_simpleObjectsField);
ihd2->m_simpleObjectsField = ihd1->m_simpleObjectsField;
EXPECT_TRUE(ihd2->m_simpleObjectsField == ihd1->m_simpleObjectsField);
s1->parentFields(parentFields);
EXPECT_EQ(size_t(2), parentFields.size());
parentFields.clear();
// set(), Operator=
ihd2->m_simpleObjectsField.set(1, NULL);
EXPECT_FALSE(ihd2->m_simpleObjectsField == ihd1->m_simpleObjectsField);
EXPECT_TRUE(NULL == ihd2->m_simpleObjectsField[1]);
s2->parentFields(parentFields);
EXPECT_EQ(size_t(1), parentFields.size());
parentFields.clear();
// removeAll(pointer)
ihd2->m_simpleObjectsField.removeChildObject(NULL);
EXPECT_EQ(size_t(2), ihd2->m_simpleObjectsField.size());
EXPECT_EQ(s3, ihd2->m_simpleObjectsField[1]);
EXPECT_EQ(s1, ihd2->m_simpleObjectsField[0]);
// insert()
ihd2->m_simpleObjectsField.insert(1, s2);
EXPECT_TRUE(ihd2->m_simpleObjectsField == ihd1->m_simpleObjectsField);
s2->parentFields(parentFields);
EXPECT_EQ(size_t(2), parentFields.size());
parentFields.clear();
// erase (index)
ihd2->m_simpleObjectsField.erase(1);
EXPECT_EQ(size_t(2), ihd2->m_simpleObjectsField.size());
EXPECT_EQ(s3, ihd2->m_simpleObjectsField[1]);
EXPECT_EQ(s1, ihd2->m_simpleObjectsField[0]);
s2->parentFields(parentFields);
EXPECT_EQ(size_t(1), parentFields.size());
parentFields.clear();
// clear()
ihd2->m_simpleObjectsField.clear();
EXPECT_EQ(size_t(0), ihd2->m_simpleObjectsField.size());
s1->parentFields(parentFields);
EXPECT_EQ(size_t(1), parentFields.size());
parentFields.clear();
}
template <>
inline void GTestStreamToHelper<QString>(std::ostream* os, const QString& val) {
*os << val.toLatin1().data();
}
//--------------------------------------------------------------------------------------------------
/// Tests the roundtrip: Create, write, read, write and checks that the first and second file are identical
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, ReadWrite)
{
QString xmlDocumentContentWithErrors;
{
caf::PdmDocument xmlDoc;
// Create objects
DemoPdmObject* d1 = new DemoPdmObject;
DemoPdmObject* d2 = new DemoPdmObject;
InheritedDemoObj* id1 = new InheritedDemoObj;
InheritedDemoObj* id2 = new InheritedDemoObj;
SimpleObj* s1 = new SimpleObj;
SimpleObj s2;
s1->m_numbers.v().push_back(1.7);
// set some values
s2.m_numbers.v().push_back(2.4);
s2.m_numbers.v().push_back(2.5);
s2.m_numbers.v().push_back(2.6);
s2.m_numbers.v().push_back(2.7);
id1->m_texts.v().push_back("Hei");
id1->m_texts.v().push_back("og");
id1->m_texts.v().push_back("Hå test with whitespace");
d2->m_simpleObjPtrField = &s2;
d2->m_simpleObjPtrField2 = s1;
id1->m_simpleObjectsField.push_back(s1);
id1->m_simpleObjectsField.push_back(&s2);
id1->m_simpleObjectsField.push_back(&s2);
id1->m_simpleObjectsField.push_back(&s2);
// Add to document
xmlDoc.addObject(d1);
xmlDoc.addObject(d2);
xmlDoc.addObject(s1);
xmlDoc.addObject(id1);
xmlDoc.addObject(id2);
// Write file
xmlDoc.fileName = "PdmTestFil.xml";
xmlDoc.writeFile();
{
std::vector<caf::PdmPointer<DemoPdmObject> > demoObjs;
xmlDoc.objectsByType(&demoObjs);
EXPECT_EQ(size_t(4), demoObjs.size());
}
{
std::vector<caf::PdmPointer<InheritedDemoObj> > demoObjs;
xmlDoc.objectsByType(&demoObjs);
EXPECT_EQ(size_t(2), demoObjs.size());
}
{
std::vector<caf::PdmPointer<SimpleObj> > demoObjs;
xmlDoc.objectsByType(&demoObjs);
EXPECT_EQ(size_t(1), demoObjs.size());
}
xmlDoc.deleteObjects();
EXPECT_EQ(size_t(0), xmlDoc.objects().size());
}
{
caf::PdmDocument xmlDoc;
// Read file
xmlDoc.fileName = "PdmTestFil.xml";
xmlDoc.readFile();
// Test sample of that writing actually took place
std::vector<caf::PdmPointer<InheritedDemoObj> > ihDObjs;
xmlDoc.objectsByType(&ihDObjs);
EXPECT_EQ(size_t(2),ihDObjs.size() );
ASSERT_EQ(size_t(4), ihDObjs[0]->m_simpleObjectsField.size());
ASSERT_EQ(size_t(4), ihDObjs[0]->m_simpleObjectsField[1]->m_numbers().size());
EXPECT_EQ(2.7, ihDObjs[0]->m_simpleObjectsField[1]->m_numbers()[3]);
EXPECT_EQ(QString("ÆØÅ Test text end"), ihDObjs[0]->m_textField());
// Write file
QFile xmlFile("PdmTestFil2.xml");
xmlFile.open(QIODevice::WriteOnly);
xmlDoc.writeFile(&xmlFile);
xmlFile.close();
}
// Check that the files are identical
{
QFile f1("PdmTestFil.xml");
QFile f2("PdmTestFil2.xml");
f1.open(QIODevice::ReadOnly);
f2.open(QIODevice::ReadOnly);
QByteArray ba1 = f1.readAll();
QByteArray ba2 = f2.readAll();
bool equal = ba1 == ba2;
EXPECT_TRUE(equal);
// Then test how errors are handled
{
int pos = 0;
int occurenceCount = 0;
while (occurenceCount < 1)
{
pos = ba1.indexOf("<SimpleObj>", pos+1);
occurenceCount++;
}
ba1.insert(pos+1, "Error");
}
{
int pos = 0;
int occurenceCount = 0;
while (occurenceCount < 1)
{
pos = ba1.indexOf("</SimpleObj>", pos +1);
occurenceCount++;
}
ba1.insert(pos+2, "Error");
}
{
int pos = 0;
int occurenceCount = 0;
while (occurenceCount < 6) // Second position in a pointersfield
{
pos = ba1.indexOf("<SimpleObj>", pos +1);
occurenceCount++;
}
ba1.insert(pos+1, "Error");
}
{
int pos = 0;
int occurenceCount = 0;
while (occurenceCount < 6) // Second position in a pointersfield
{
pos = ba1.indexOf("</SimpleObj>", pos +1);
occurenceCount++;
}
ba1.insert(pos+2, "Error");
}
{
int pos = ba1.indexOf("<BigNumber>");
ba1.insert(pos+1, "Error");
pos = ba1.indexOf("</BigNumber>");
ba1.insert(pos+2, "Error");
}
{
int pos = 0;
int occurenceCount = 0;
while (occurenceCount < 4)
{
pos = ba1.indexOf("<Numbers>", pos +1);
occurenceCount++;
}
ba1.insert(pos+1, "Error");
}
{
int pos = 0;
int occurenceCount = 0;
while (occurenceCount < 4)
{
pos = ba1.indexOf("</Numbers>", pos +1);
occurenceCount++;
}
ba1.insert(pos+2, "Error");
}
// Write the edited document
QFile f3("PdmTestFilWithError.xml");
f3.open(QIODevice::WriteOnly);
f3.write(ba1);
f3.close();
// Read the document containing errors
caf::PdmDocument xmlErrorDoc;
xmlErrorDoc.fileName = "PdmTestFilWithError.xml";
xmlErrorDoc.readFile();
// Check the pointersfield
std::vector<caf::PdmPointer<InheritedDemoObj> > ihDObjs;
xmlErrorDoc.objectsByType(&ihDObjs);
EXPECT_EQ(size_t(2), ihDObjs.size() );
ASSERT_EQ(size_t(3), ihDObjs[0]->m_simpleObjectsField.size());
// check single pointer field
std::vector<caf::PdmPointer<DemoPdmObject> > demoObjs;
xmlErrorDoc.objectsByType(&demoObjs);
EXPECT_EQ(size_t(4), demoObjs.size() );
EXPECT_TRUE(demoObjs[0]->m_simpleObjPtrField == NULL );
EXPECT_TRUE(demoObjs[0]->m_simpleObjPtrField2 != NULL );
// check single pointer field
std::vector<caf::PdmPointer<SimpleObj> > simpleObjs;
xmlErrorDoc.objectsByType(&simpleObjs);
EXPECT_EQ(size_t(1), simpleObjs.size() );
EXPECT_EQ(size_t(0), simpleObjs[0]->m_numbers().size());
}
}
//--------------------------------------------------------------------------------------------------
/// Tests the features of PdmPointer
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, PdmPointer)
{
caf::PdmDocument * d = new caf::PdmDocument;
{
caf::PdmPointer<caf::PdmDocument> p;
EXPECT_TRUE(p == NULL);
}
{
caf::PdmPointer<caf::PdmDocument> p(d);
caf::PdmPointer<caf::PdmDocument> p2(p);
EXPECT_TRUE(p == d && p2 == d);
EXPECT_TRUE(p.p() == d);
EXPECT_TRUE((*p).uiName() == (*d).uiName());
EXPECT_TRUE(p->uiName() == "File");
p = 0;
EXPECT_TRUE(p == NULL);
EXPECT_TRUE(p.isNull());
EXPECT_TRUE(p2 == d);
p = p2;
EXPECT_TRUE(p == d );
delete d;
EXPECT_TRUE(p.isNull() && p2.isNull());
}
caf::PdmPointer<DemoPdmObject> p3(new DemoPdmObject());
delete p3;
}
//--------------------------------------------------------------------------------------------------
/// Tests the PdmFactory
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, PdmObjectFactory)
{
{
SimpleObj* s = NULL;
s = dynamic_cast<SimpleObj*> (caf::PdmObjectFactory::instance()->create("SimpleObj"));
EXPECT_TRUE(s != NULL);
}
{
DemoPdmObject* s = NULL;
s = dynamic_cast<DemoPdmObject*> (caf::PdmObjectFactory::instance()->create("DemoPdmObject"));
EXPECT_TRUE(s != NULL);
delete s;
}
{
InheritedDemoObj* s = NULL;
s = dynamic_cast<InheritedDemoObj*> (caf::PdmObjectFactory::instance()->create("InheritedDemoObj"));
EXPECT_TRUE(s != NULL);
}
{
caf::PdmDocument* s = NULL;
s = dynamic_cast<caf::PdmDocument*> (caf::PdmObjectFactory::instance()->create("PdmDocument"));
EXPECT_TRUE(s != NULL);
}
{
caf::PdmObjectGroup* s = NULL;
s = dynamic_cast<caf::PdmObjectGroup*> (caf::PdmObjectFactory::instance()->create("PdmObjectGroup"));
EXPECT_TRUE(s != NULL);
}
}
//--------------------------------------------------------------------------------------------------
/// Validate Xml keywords
//--------------------------------------------------------------------------------------------------
TEST(BaseTest, ValidXmlKeywords)
{
EXPECT_TRUE(caf::PdmObject::isValidXmlElementName("Valid_name"));
EXPECT_FALSE(caf::PdmObject::isValidXmlElementName("2Valid_name"));
EXPECT_FALSE(caf::PdmObject::isValidXmlElementName(".Valid_name"));
EXPECT_FALSE(caf::PdmObject::isValidXmlElementName("xml_Valid_name"));
EXPECT_FALSE(caf::PdmObject::isValidXmlElementName("Valid_name_with_space "));
}
TEST(BaseTest, PdmPointersFieldInsertVector)
{
InheritedDemoObj* ihd1 = new InheritedDemoObj;
SimpleObj* s1 = new SimpleObj;
SimpleObj* s2 = new SimpleObj;
SimpleObj* s3 = new SimpleObj;
caf::PdmObjectGroup pdmGroup;
pdmGroup.addObject(s1);
pdmGroup.addObject(s2);
pdmGroup.addObject(s3);
std::vector<caf::PdmPointer<SimpleObj> > typedObjects;
pdmGroup.objectsByType(&typedObjects);
ihd1->m_simpleObjectsField.insert(ihd1->m_simpleObjectsField.size(), typedObjects);
EXPECT_EQ(size_t(3), ihd1->m_simpleObjectsField.size());
delete ihd1;
}
TEST(BaseTest, PdmObjectGroupCopyOfTypedObjects)
{
SimpleObj* s1 = new SimpleObj;
s1->m_position = 1000;
s1->m_numbers.v().push_back(10);
SimpleObj* s2 = new SimpleObj;
s2->m_position = 2000;
SimpleObj* s3 = new SimpleObj;
s3->m_position = 3000;
InheritedDemoObj* ihd1 = new InheritedDemoObj;
caf::PdmObjectGroup og;
og.objects.push_back(s1);
og.objects.push_back(s2);
og.objects.push_back(s3);
og.objects.push_back(ihd1);
std::vector<caf::PdmPointer<SimpleObj> > simpleObjList;
og.createCopyByType(&simpleObjList);
EXPECT_EQ(size_t(3), simpleObjList.size());
std::vector<caf::PdmPointer<InheritedDemoObj> > inheritObjList;
og.createCopyByType(&inheritObjList);
EXPECT_EQ(size_t(1), inheritObjList.size());
og.deleteObjects();
EXPECT_EQ(size_t(3), simpleObjList.size());
EXPECT_EQ(size_t(1), inheritObjList.size());
}

View File

@ -0,0 +1,56 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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;
}

View File

@ -0,0 +1,56 @@
cmake_minimum_required (VERSION 2.8)
project ( cafTestApplication )
# Qt MOC
set ( QT_MOC_HEADERS
MainWindow.h
WidgetLayoutTest.h
)
qt4_wrap_cpp( MOC_FILES_CPP
${QT_MOC_HEADERS}
)
# Resource file
set( QRC_FILES
textedit.qrc
)
# Runs RCC on specified files
qt4_add_resources( QRC_FILES_CPP
${QRC_FILES}
)
include_directories (
${CMAKE_SOURCE_DIR}/cafProjectDataModel
${CMAKE_SOURCE_DIR}/cafUserInterface
)
# add the executable
add_executable ( ${PROJECT_NAME}
Main.cpp
MainWindow.cpp
WidgetLayoutTest.cpp
${MOC_FILES_CPP}
${QRC_FILES_CPP}
)
target_link_libraries ( ${PROJECT_NAME}
cafUserInterface
cafProjectDataModel
${QT_LIBRARIES}
)
# Copy Qt Dlls
if (MSVC)
set (QTLIBLIST QtCore QtGui QtOpenGl)
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)

View File

@ -0,0 +1,15 @@
#include "MainWindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow window;
window.setWindowTitle("Ceetron Application Framework Test Application");
window.show();
return app.exec();
}

View File

@ -0,0 +1,418 @@
#include "MainWindow.h"
#include "WidgetLayoutTest.h"
#include <QDockWidget>
#include <QTreeView>
#include <QAction>
#include <QMenuBar>
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmDocument.h"
#include "cafAppEnum.h"
#include "cafUiTreeModelPdm.h"
#include "cafPdmUiPropertyView.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiTextEditor.h"
class DemoPdmObjectGroup: public caf::PdmObjectGroup
{
CAF_PDM_HEADER_INIT;
public:
DemoPdmObjectGroup()
{
CAF_PDM_InitObject("Demo Object Group", "", "This group object is a demo of the CAF framework", "This group object is a demo of the CAF framework")
}
};
CAF_PDM_SOURCE_INIT(DemoPdmObjectGroup, "DemoPdmObjectGroup");
class SmallDemoPdmObject: public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
SmallDemoPdmObject()
{
CAF_PDM_InitObject("Small Demo Object", ":/images/win/filenew.png", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework");
CAF_PDM_InitField(&m_doubleField, "BigNumber", 0.0, "Big Number", "", "Enter a big number here", "This is a place you can enter a big real value if you want" );
CAF_PDM_InitField(&m_intField, "IntNumber", 0, "Small Number", "", "Enter some small number here", "This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_textField, "TextField", QString(""), "Text", "", "Text tooltip", "This is a place you can enter a small integer value if you want");
}
caf::PdmField<double> m_doubleField;
caf::PdmField<int> m_intField;
caf::PdmField<QString> m_textField;
};
CAF_PDM_SOURCE_INIT(SmallDemoPdmObject, "SmallDemoPdmObject");
class SmallDemoPdmObjectA: public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
enum TestEnumType
{
T1, T2, T3
};
SmallDemoPdmObjectA()
{
CAF_PDM_InitObject("Small Demo Object A", "", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework");
CAF_PDM_InitField(&m_doubleField, "BigNumber", 0.0, "Big Number", "", "Enter a big number here", "This is a place you can enter a big real value if you want");
CAF_PDM_InitField(&m_intField, "IntNumber", 0, "Small Number", "", "Enter some small number here","This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_textField, "TextField", QString(""), "Small Number", "", "Enter some small number here", "This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_testEnumField, "TestEnumValue", caf::AppEnum<TestEnumType>(T1), "Small Number", "", "Enter some small number here", "This is a place you can enter a small integer value if you want");
m_testEnumField.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
}
caf::PdmField<double> m_doubleField;
caf::PdmField<int> m_intField;
caf::PdmField<QString> m_textField;
caf::PdmField< caf::AppEnum<TestEnumType> > m_testEnumField;
};
CAF_PDM_SOURCE_INIT(SmallDemoPdmObjectA, "SmallDemoPdmObjectA");
namespace caf
{
template<>
void AppEnum<SmallDemoPdmObjectA::TestEnumType>::setUp()
{
addItem(SmallDemoPdmObjectA::T1, "T1", "An A letter");
addItem(SmallDemoPdmObjectA::T2, "T2", "A B letter");
addItem(SmallDemoPdmObjectA::T3, "T3", "A B C letter");
setDefault(SmallDemoPdmObjectA::T1);
}
}
Q_DECLARE_METATYPE(caf::AppEnum<SmallDemoPdmObjectA::TestEnumType>);
class DemoPdmObject: public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
DemoPdmObject()
{
CAF_PDM_InitObject( "Demo Object", "", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework");
CAF_PDM_InitField(&m_doubleField, "BigNumber", 0.0, "Big Number", "", "Enter a big number here", "This is a place you can enter a big real value if you want");
CAF_PDM_InitField(&m_intField, "IntNumber", 0, "Small Number", "", "Enter some small number here", "This is a place you can enter a small integer value if you want" );
CAF_PDM_InitField(&m_boolField, "BooleanValue", false, "Boolean:" , "", "Boolean:Enter some small number here", "Boolean:This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_textField, "TextField", QString(""), "", "", "", "");
CAF_PDM_InitField(&m_filePath, "FilePath", QString(""), "Filename", "", "", "");
CAF_PDM_InitField(&m_longText, "LongText", QString("Test text"), "Long Text", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_multiSelectList, "MultiSelect", "Selection List", "", "List" , "This is a multi selection list" );
CAF_PDM_InitFieldNoDefault(&m_objectList, "ObjectList", "Objects list", "", "List" , "This is a list of PdmObjects" );
m_filePath.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
m_filePath.setUiLabelPosition(caf::PdmUiItemInfo::TOP);
m_longText.setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
m_longText.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_boolField);
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Name1");
group1->add(&m_doubleField);
caf::PdmUiGroup* group2 = uiOrdering.addNewGroup("Name2");
group2->add(&m_intField);
caf::PdmUiGroup* group3 = group2->addNewGroup("Name3");
group3->add(&m_textField);
//uiConfig->add(&f3);
//uiConfig->forgetRemainingFields();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (&m_multiSelectList == fieldNeedingOptions)
{
options.push_back(caf::PdmOptionItemInfo("Choice 1", "Choice1"));
options.push_back(caf::PdmOptionItemInfo("Choice 2", "Choice2"));
options.push_back(caf::PdmOptionItemInfo("Choice 3", "Choice3"));
options.push_back(caf::PdmOptionItemInfo("Choice 4", "Choice4"));
options.push_back(caf::PdmOptionItemInfo("Choice 5", "Choice5"));
options.push_back(caf::PdmOptionItemInfo("Choice 6", "Choice6"));
}
if (useOptionsOnly) *useOptionsOnly = true;
return options;
}
// Fields
caf::PdmField<bool> m_boolField;
caf::PdmField<double> m_doubleField;
caf::PdmField<int> m_intField;
caf::PdmField<QString> m_textField;
caf::PdmField<QString> m_filePath;
caf::PdmField<QString> m_longText;
caf::PdmField<std::vector<QString> > m_multiSelectList;
caf::PdmPointersField< caf::PdmObject* > m_objectList;
};
CAF_PDM_SOURCE_INIT(DemoPdmObject, "DemoPdmObject");
MainWindow* MainWindow::sm_mainWindowInstance = NULL;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
MainWindow::MainWindow()
{
m_treeView = NULL;
m_treeModelPdm = NULL;
createActions();
createDockPanels();
buildTestModel();
setPdmRoot(m_testRoot);
sm_mainWindowInstance = this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::createDockPanels()
{
{
QDockWidget* dockWidget = new QDockWidget("Workspace", this);
dockWidget->setObjectName("dockWidget");
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
m_treeView = new QTreeView(dockWidget);
dockWidget->setWidget(m_treeView);
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
}
/*
{
QDockWidget* dockWidget = new QDockWidget("WidgetLayoutTest", this);
dockWidget->setObjectName("dockWidget");
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
WidgetLayoutTest* widgetLayoutTest = new WidgetLayoutTest(dockWidget);
dockWidget->setWidget(widgetLayoutTest);
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
}
*/
{
QDockWidget* dockWidget = new QDockWidget("cafPropertyView", this);
dockWidget->setObjectName("dockWidget");
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
m_pdmUiPropertyView = new caf::PdmUiPropertyView(dockWidget);
dockWidget->setWidget(m_pdmUiPropertyView);
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::buildTestModel()
{
m_testRoot = new DemoPdmObjectGroup;
DemoPdmObject* demoObject = new DemoPdmObject;
m_testRoot->addObject(demoObject);
SmallDemoPdmObject* smallObj1 = new SmallDemoPdmObject;
m_testRoot->addObject(smallObj1);
SmallDemoPdmObjectA* smallObj2 = new SmallDemoPdmObjectA;
m_testRoot->addObject(smallObj2);
demoObject->m_objectList.push_back(new DemoPdmObject);
demoObject->m_objectList.push_back(new SmallDemoPdmObjectA());
demoObject->m_objectList.push_back(new SmallDemoPdmObject());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::setPdmRoot(caf::PdmObject* pdmRoot)
{
caf::PdmUiTreeItem* treeItemRoot = caf::UiTreeItemBuilderPdm::buildViewItems(NULL, 0, pdmRoot);
if (!m_treeModelPdm)
{
m_treeModelPdm = new caf::UiTreeModelPdm(this);
}
m_treeModelPdm->setTreeItemRoot(treeItemRoot);
assert(m_treeView);
m_treeView->setModel(m_treeModelPdm);
if (treeItemRoot)
{
if (m_treeView->selectionModel())
{
connect(m_treeView->selectionModel(), SIGNAL(selectionChanged( const QItemSelection & , const QItemSelection & )), SLOT(slotSelectionChanged( const QItemSelection & , const QItemSelection & )));
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
MainWindow::~MainWindow()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::releaseTestData()
{
m_treeView->setModel(NULL);
if (m_treeModelPdm)
{
delete m_treeModelPdm;
}
if (m_testRoot)
{
m_testRoot->deleteObjects();
delete m_testRoot;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
MainWindow* MainWindow::instance()
{
return sm_mainWindowInstance;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::createActions()
{
// Create actions
QAction* editInsert = new QAction("&Insert", this);
QAction* editRemove = new QAction("&Remove", this);
QAction* editRemoveAll = new QAction("Remove all", this);
connect(editInsert, SIGNAL(triggered()), SLOT(slotInsert()));
connect(editRemove, SIGNAL(triggered()), SLOT(slotRemove()));
connect(editRemoveAll, SIGNAL(triggered()), SLOT(slotRemoveAll()));
// Create menus
QMenu* editMenu = menuBar()->addMenu("&Edit");
editMenu->addAction(editInsert);
editMenu->addAction(editRemove);
editMenu->addAction(editRemoveAll);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::slotInsert()
{
QModelIndex index = m_treeView->selectionModel()->currentIndex();
QAbstractItemModel *model = m_treeView->model();
if (!model->insertRow(0, index))
return;
QModelIndex child = model->index(0, 0, index);
// (
// for (int column = 0; column < model->columnCount(index); ++column)
// {
// QModelIndex child = model->index(0, column, index);
// model->setData(child, QVariant("[No data]"), Qt::EditRole);
// if (!model->headerData(column, Qt::Horizontal).isValid())
// model->setHeaderData(column, Qt::Horizontal, QVariant("[No header]"),
// Qt::EditRole);
// }
// )
m_treeView->selectionModel()->setCurrentIndex(model->index(0, 0, index), QItemSelectionModel::ClearAndSelect);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::slotRemove()
{
QModelIndex index = m_treeView->selectionModel()->currentIndex();
QAbstractItemModel *model = m_treeView->model();
model->removeRow(index.row(), index.parent());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::slotRemoveAll()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MainWindow::slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected )
{
if (selected.indexes().size() == 1)
{
QModelIndex mi = selected.indexes()[0];
caf::PdmUiTreeItem* treeItem = m_treeModelPdm->getTreeItemFromIndex(mi);
if (treeItem && treeItem->dataObject())
{
m_pdmUiPropertyView->showProperties(treeItem->dataObject());
}
}
else
{
m_pdmUiPropertyView->showProperties(NULL);
}
}

View File

@ -0,0 +1,56 @@
#pragma once
#include <QtGui/QMainWindow>
#include <QAbstractItemModel>
#include <QItemSelection>
class DemoPdmObject;
class QTreeView;
namespace caf
{
class PdmObjectGroup;
class PdmObject;
class UiTreeModelPdm;
class PdmUiPropertyView;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
~MainWindow();
static MainWindow* instance();
void setPdmRoot(caf::PdmObject* pdmRoot);
private:
void createActions();
void createMenus();
void createToolBars();
void createDockPanels();
void buildTestModel();
void releaseTestData();
private slots:
void slotInsert();
void slotRemove();
void slotRemoveAll();
void slotSelectionChanged(const QItemSelection &, const QItemSelection & );
private:
static MainWindow* sm_mainWindowInstance;
private:
QTreeView* m_treeView;
caf::UiTreeModelPdm* m_treeModelPdm;
caf::PdmUiPropertyView* m_pdmUiPropertyView;
caf::PdmObjectGroup* m_testRoot;
};

View File

@ -0,0 +1,108 @@
#include "WidgetLayoutTest.h"
#include <QGridLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QGroupBox>
#include <QLabel>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
WidgetLayoutTest::WidgetLayoutTest(QWidget* parent /*= 0*/, Qt::WindowFlags f /*= 0*/)
: QWidget(parent, f)
{
QVBoxLayout* l = new QVBoxLayout;
setLayout(l);
{
QPushButton* b1 = new QPushButton("Original config", this);
connect(b1, SIGNAL(clicked()), SLOT(setUpInitialConfiguration()));
l->addWidget(b1);
}
{
QPushButton* b1 = new QPushButton("Config A", this);
connect(b1, SIGNAL(clicked()), SLOT(setUpInitialConfigurationA()));
l->addWidget(b1);
}
{
QPushButton* b1 = new QPushButton("Config B", this);
connect(b1, SIGNAL(clicked()), SLOT(setUpInitialConfigurationB()));
l->addWidget(b1);
}
m_mainLayout = new QGridLayout();
l->addLayout(m_mainLayout);
// Create widgets
m_widget1 = new QLineEdit("1", this);
m_widget2 = new QLineEdit("2", this);
m_widget3 = new QLineEdit("3", this);
m_widget4 = new QLineEdit("4", this);
m_widget5 = new QLineEdit("5", this);
m_groupBoxA = new QGroupBox("Groupbox A", this);
m_groupBoxALayout = new QGridLayout();
m_groupBoxA->setLayout(m_groupBoxALayout);
m_groupBoxB = new QGroupBox("Groupbox B", this);
m_groupBoxBLayout = new QGridLayout();
m_groupBoxB->setLayout(m_groupBoxBLayout);
setUpInitialConfiguration();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
WidgetLayoutTest::~WidgetLayoutTest()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void WidgetLayoutTest::setUpInitialConfiguration()
{
m_mainLayout->addWidget(m_widget1);
m_mainLayout->addWidget(m_groupBoxA);
m_groupBoxALayout->addWidget(m_widget2, 0, 0);
if (!m_widget3)
{
m_widget3 = new QLabel("Test label", this);
}
m_groupBoxALayout->addWidget(m_widget3, 1, 0);
m_groupBoxALayout->addWidget(m_groupBoxB, 2, 0);
m_groupBoxBLayout->addWidget(m_widget4);
m_mainLayout->addWidget(m_widget5);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void WidgetLayoutTest::setUpInitialConfigurationA()
{
m_mainLayout->addWidget(m_widget2);
delete m_widget3;
m_widget3 = NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void WidgetLayoutTest::setUpInitialConfigurationB()
{
m_mainLayout->addWidget(m_widget4);
}

View File

@ -0,0 +1,41 @@
#pragma once
#include <QtGui/QWidget>
class QGridLayout;
class QGroupBox;
class WidgetLayoutTest : public QWidget
{
Q_OBJECT
public:
WidgetLayoutTest(QWidget* parent = 0, Qt::WindowFlags f = 0);
~WidgetLayoutTest();
private:
QGridLayout* m_mainLayout;
QGroupBox* m_groupBoxA;
QGridLayout* m_groupBoxALayout;
QGroupBox* m_groupBoxB;
QGridLayout* m_groupBoxBLayout;
QWidget* m_widget1;
QWidget* m_widget2;
QWidget* m_widget3;
QWidget* m_widget4;
QWidget* m_widget5;
private slots:
void setUpInitialConfiguration();
void setUpInitialConfigurationA();
void setUpInitialConfigurationB();
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,43 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>images/logo32.png</file>
<file>images/mac/editcopy.png</file>
<file>images/mac/editcut.png</file>
<file>images/mac/editpaste.png</file>
<file>images/mac/editredo.png</file>
<file>images/mac/editundo.png</file>
<file>images/mac/exportpdf.png</file>
<file>images/mac/filenew.png</file>
<file>images/mac/fileopen.png</file>
<file>images/mac/fileprint.png</file>
<file>images/mac/filesave.png</file>
<file>images/mac/textbold.png</file>
<file>images/mac/textcenter.png</file>
<file>images/mac/textitalic.png</file>
<file>images/mac/textjustify.png</file>
<file>images/mac/textleft.png</file>
<file>images/mac/textright.png</file>
<file>images/mac/textunder.png</file>
<file>images/mac/zoomin.png</file>
<file>images/mac/zoomout.png</file>
<file>images/win/editcopy.png</file>
<file>images/win/editcut.png</file>
<file>images/win/editpaste.png</file>
<file>images/win/editredo.png</file>
<file>images/win/editundo.png</file>
<file>images/win/exportpdf.png</file>
<file>images/win/filenew.png</file>
<file>images/win/fileopen.png</file>
<file>images/win/fileprint.png</file>
<file>images/win/filesave.png</file>
<file>images/win/textbold.png</file>
<file>images/win/textcenter.png</file>
<file>images/win/textitalic.png</file>
<file>images/win/textjustify.png</file>
<file>images/win/textleft.png</file>
<file>images/win/textright.png</file>
<file>images/win/textunder.png</file>
<file>images/win/zoomin.png</file>
<file>images/win/zoomout.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,43 @@
namespace cvftest {
//==================================================================================================
//
//
//==================================================================================================
class Utils
{
public:
static cvf::String getTestDataDir(const cvf::String& unitTestFolder)
{
#ifdef WIN32
std::string exe = std::string(testing::internal::GetArgvs()[0]);
#else
std::string dir = std::string(testing::internal::FilePath::GetCurrentDir().ToString());
std::string exe = dir + std::string("/") + std::string(testing::internal::GetArgvs()[0]);
#endif
std::string testPath = exe.substr(0, exe.find(unitTestFolder.toStdString())) + std::string("TestData/");
return testPath;
}
static cvf::String getGLSLDir(const cvf::String& unitTestFolder)
{
#ifdef WIN32
std::string exe = std::string(testing::internal::GetArgvs()[0]);
#else
std::string dir = std::string(testing::internal::FilePath::GetCurrentDir().ToString());
std::string exe = dir + std::string("/") + std::string(testing::internal::GetArgvs()[0]);
#endif
std::string glslPath = exe.substr(0, exe.find(unitTestFolder.toStdString())) + std::string("../LibRender/glsl/");
return glslPath;
}
};
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,6 @@ include_directories(
# These headers need to go through Qt's MOC compiler
set( QOBJECT_HEADERS
cafBasicAboutDialog.h
cafUiTreeModelPdm.h
cafUiProcess.h
@ -36,8 +35,8 @@ endif()
add_library( ${PROJECT_NAME}
cafBasicAboutDialog.cpp
cafBasicAboutDialog.h
cafAboutDialog.cpp
cafAboutDialog.h
cafPdmUiCheckBoxEditor.cpp
cafPdmUiCheckBoxEditor.h
cafPdmUiColorEditor.cpp

View File

@ -35,12 +35,13 @@
//##################################################################################################
#include "cafBasicAboutDialog.h"
#include "cafAboutDialog.h"
#include <QtCore/QVariant>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtOpenGL/QGLFormat>
#include <assert.h>
namespace caf {
@ -49,8 +50,7 @@ namespace caf {
//==================================================================================================
///
/// \class cvfqt::BasicAboutDialog
/// \ingroup GuiQt
/// \class caf::BasicAboutDialog
///
///
///
@ -59,7 +59,7 @@ namespace caf {
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
BasicAboutDialog::BasicAboutDialog(QWidget* parent)
AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
{
m_isCreated = false;
@ -68,7 +68,6 @@ BasicAboutDialog::BasicAboutDialog(QWidget* parent)
//m_appVersion;
//m_appCopyright;
m_showVizLibraryVersion = true;
m_showQtVersion = true;
m_isDebugBuild = false;
@ -79,7 +78,7 @@ BasicAboutDialog::BasicAboutDialog(QWidget* parent)
//--------------------------------------------------------------------------------------------------
/// Set application name to show in the dialog. Must be specified if any other app info is to be displayed
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::setApplicationName(const QString& appName)
void AboutDialog::setApplicationName(const QString& appName)
{
assert(!m_isCreated);
m_appName = appName;
@ -89,7 +88,7 @@ void BasicAboutDialog::setApplicationName(const QString& appName)
//--------------------------------------------------------------------------------------------------
/// Set application version info to display
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::setApplicationVersion(const QString& ver)
void AboutDialog::setApplicationVersion(const QString& ver)
{
assert(!m_isCreated);
m_appVersion = ver;
@ -99,27 +98,17 @@ void BasicAboutDialog::setApplicationVersion(const QString& ver)
//--------------------------------------------------------------------------------------------------
/// Set copyright info to display
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::setCopyright(const QString& copyright)
void AboutDialog::setCopyright(const QString& copyright)
{
assert(!m_isCreated);
m_appCopyright = copyright;
}
//--------------------------------------------------------------------------------------------------
/// Enable display of visualization library version
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::showVizLibraryVersion(bool show)
{
assert(!m_isCreated);
m_showVizLibraryVersion = show;
}
//--------------------------------------------------------------------------------------------------
/// Enable display of Qt version
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::showQtVersion(bool show)
void AboutDialog::showQtVersion(bool show)
{
assert(!m_isCreated);
m_showQtVersion = show;
@ -129,7 +118,7 @@ void BasicAboutDialog::showQtVersion(bool show)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::addVersionEntry(const QString& verLabel, const QString& verText)
void AboutDialog::addVersionEntry(const QString& verLabel, const QString& verText)
{
assert(!m_isCreated);
@ -143,7 +132,7 @@ void BasicAboutDialog::addVersionEntry(const QString& verLabel, const QString& v
//--------------------------------------------------------------------------------------------------
/// Set to true to show text in dialog to indicate that we're running a debug build of our app
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::setIsDebugBuild(bool isDebugBuild)
void AboutDialog::setIsDebugBuild(bool isDebugBuild)
{
assert(!m_isCreated);
m_isDebugBuild = isDebugBuild;
@ -153,7 +142,7 @@ void BasicAboutDialog::setIsDebugBuild(bool isDebugBuild)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::create()
void AboutDialog::create()
{
// Only allowed to call once
assert(!m_isCreated);
@ -239,8 +228,7 @@ void BasicAboutDialog::create()
// Possibly show extend version info
if (m_showVizLibraryVersion ||
m_showQtVersion ||
if (m_showQtVersion ||
m_verLabels.size() > 0)
{
QGridLayout* verInfoLayout = new QGridLayout;
@ -248,14 +236,6 @@ void BasicAboutDialog::create()
int insertRow = 0;
if (m_showVizLibraryVersion)
{
// QString ver;
// ver.sprintf("%s.%s%s-%s", CVF_MAJOR_VERSION, CVF_MINOR_VERSION, CVF_SPECIAL_BUILD, CVF_BUILD_NUMBER);
//
// addStringPairToVerInfoLayout("Visualization ver.: ", ver, verInfoLayout, insertRow++);
}
// Qt version
if (m_showQtVersion)
{
@ -317,7 +297,7 @@ void BasicAboutDialog::create()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::addStringPairToVerInfoLayout(const QString& labelStr, const QString& infoStr, QGridLayout* verInfoLayout, int insertRow)
void AboutDialog::addStringPairToVerInfoLayout(const QString& labelStr, const QString& infoStr, QGridLayout* verInfoLayout, int insertRow)
{
QLabel* label = new QLabel(this);
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
@ -331,11 +311,39 @@ void BasicAboutDialog::addStringPairToVerInfoLayout(const QString& labelStr, con
}
} // namespace cvfqt
//--------------------------------------------------------------------------------------------------
/// Get an OpenGL version string for the OpenGL context that is current at the moment
//--------------------------------------------------------------------------------------------------
QString AboutDialog::versionStringForcurrentOpenGLContext()
{
QString versionString("OpenGL ");
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if (flags & QGLFormat::OpenGL_Version_4_0 ) versionString += "4.0";
else if (flags & QGLFormat::OpenGL_Version_3_3 ) versionString += "3.3";
else if (flags & QGLFormat::OpenGL_Version_3_2 ) versionString += "3.2";
else if (flags & QGLFormat::OpenGL_Version_3_1 ) versionString += "3.1";
else if (flags & QGLFormat::OpenGL_Version_3_0 ) versionString += "3.0";
else if (flags & QGLFormat::OpenGL_ES_Version_2_0 ) versionString += "ES_Version 2.0";
else if (flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_1) versionString += "ES_CommonLite_Version 1.1";
else if (flags & QGLFormat::OpenGL_ES_Common_Version_1_1 ) versionString += "ES_Common_Version 1.1";
else if (flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_0) versionString += "ES_CommonLite_Version 1.0";
else if (flags & QGLFormat::OpenGL_ES_Common_Version_1_0 ) versionString += "ES_Common_Version 1.0";
else if (flags & QGLFormat::OpenGL_Version_2_1 ) versionString += "2.1";
else if (flags & QGLFormat::OpenGL_Version_2_0 ) versionString += "2.0";
else if (flags & QGLFormat::OpenGL_Version_1_5 ) versionString += "1.5";
else if (flags & QGLFormat::OpenGL_Version_1_4 ) versionString += "1.4";
else if (flags & QGLFormat::OpenGL_Version_1_3 ) versionString += "1.3";
else if (flags & QGLFormat::OpenGL_Version_1_2 ) versionString += "1.2";
else if (flags & QGLFormat::OpenGL_Version_1_1 ) versionString += "1.1";
else if (flags & QGLFormat::OpenGL_Version_None ) versionString += "None";
else versionString += "Unknown";
return versionString;
}
} // namespace caf
//########################################################
//#include "GeneratedFiles/moc_cvfqtBasicAboutDialog.cpp"
//########################################################

View File

@ -49,24 +49,23 @@ namespace caf {
//
//
//==================================================================================================
class BasicAboutDialog : public QDialog
class AboutDialog : public QDialog
{
Q_OBJECT
public:
BasicAboutDialog(QWidget* parent);
AboutDialog(QWidget* parent);
void setApplicationName(const QString& appName);
void setApplicationVersion(const QString& ver);
void setCopyright(const QString& copyright);
void showVizLibraryVersion(bool show);
void showQtVersion(bool show);
void addVersionEntry(const QString& verLabel, const QString& verText);
void setIsDebugBuild(bool isDebugBuild);
void create();
static QString versionStringForcurrentOpenGLContext();
private:
void addStringPairToVerInfoLayout(const QString& labelStr, const QString& infoStr, QGridLayout* verInfoLayout, int insertRow);
@ -77,7 +76,6 @@ private:
QString m_appVersion; // Application version info. Can be empty
QString m_appCopyright; // Application copyright string. Can be empty
bool m_showVizLibraryVersion;
bool m_showQtVersion; // Flags whether Qt version info should be shown
QStringList m_verLabels; // Labels for user specified version entries
QStringList m_verTexts; // The actual version text for user specified version entries

View File

@ -113,7 +113,7 @@ caf::Viewer::Viewer(const QGLFormat& format, QWidget* parent)
m_overlayTextureImage = new cvf::TextureImage;
m_overlayImage = new cvf::OverlayImage(m_overlayTextureImage.p());
m_overlayImage->setBlending(cvf::OverlayImage::TEXTURE_ALPHA);
m_overlayImage->setUnmanagedPosition(cvf::Vec2i(0,0));
m_overlayImage->setLayoutFixedPosition(cvf::Vec2i(0,0));
setupMainRendering();
setupRenderingSequence();
@ -459,7 +459,7 @@ void caf::Viewer::paintEvent(QPaintEvent* event)
m_overlayTextureImage->allocate(this->width(), this->height());
}
cvfqt::Utils::copyFromQImage(m_overlayTextureImage.p(), m_overlayPaintingQImage);
cvfqt::Utils::fromQImage(m_overlayPaintingQImage, m_overlayTextureImage.p());
m_overlayImage->setImage(m_overlayTextureImage.p());
m_overlayImage->setPixelSize(cvf::Vec2ui(this->width(), this->height()));
@ -784,7 +784,7 @@ void caf::Viewer::updateOverlayImagePresence()
{
if (m_isOverlyPaintingEnabled || m_showPerfInfoHud)
{
m_mainRendering->addOverlayItem(m_overlayImage.p(), cvf::OverlayItem::UNMANAGED, cvf::OverlayItem::VERTICAL);
m_mainRendering->addOverlayItem(m_overlayImage.p());
}
else
{

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="NotBuildable|Win32">
<Configuration>NotBuildable</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FB015304-89D5-4093-B01A-0E7F642971DC}</ProjectGuid>
<RootNamespace>CMake</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='NotBuildable|Win32'">
<ConfigurationType>Utility</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemGroup>
<None Include="..\CMakeLists.txt" />
<None Include="..\Tests\CMakeLists.txt" />
<None Include="Utils\ceeDetermineCompilerFlags.cmake" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="..\CMakeLists.txt">
<Filter>for CeeViz</Filter>
</None>
<None Include="..\Tests\CMakeLists.txt">
<Filter>for UnitTests</Filter>
</None>
<None Include="Utils\ceeDetermineCompilerFlags.cmake">
<Filter>Utils</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="for CeeViz">
<UniqueIdentifier>{3e72b0a1-06b6-459f-9607-d9fa896d7f8c}</UniqueIdentifier>
</Filter>
<Filter Include="for UnitTests">
<UniqueIdentifier>{51e511a3-e51f-4744-bff6-f658fccf0863}</UniqueIdentifier>
</Filter>
<Filter Include="Utils">
<UniqueIdentifier>{8764f605-13cc-4037-9f2b-fcae94e99ae9}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@ -0,0 +1,80 @@
# Setup the main platform defines
#-----------------------------------------------------
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-DCVF_LINUX)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions(-DCVF_OSX)
endif()
# Compiler specific defines
#-----------------------------------------------------
# Must add debug define manually on GCC
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ")
endif()
# We alwys want Unicode on Win
if (MSVC)
add_definitions(-DUNICODE -D_UNICODE)
endif()
include(CheckCXXCompilerFlag)
option(CEE_WARNINGS_AS_ERRORS "Make all warnings into errors" ON)
# Compiler flags for GCC
#-----------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCXX)
# Setup our BASE compile flags
set(CEE_BASE_CXX_FLAGS "-Wall -Wextra -pedantic")
if (CEE_WARNINGS_AS_ERRORS)
set(CEE_BASE_CXX_FLAGS "-Werror ${CEE_BASE_CXX_FLAGS}")
endif()
# Setup the our STRICT compile flags
# These are the flags we would like to use on all of our own libraries
set(CEE_STRICT_CXX_FLAGS "${CEE_BASE_CXX_FLAGS} -Wconversion -Woverloaded-virtual -Wformat -Wcast-align")
# Add warning not present on older GCCs
CHECK_CXX_COMPILER_FLAG("-Wlogical-op" HAS_WLOGICAL_OP)
if (HAS_WLOGICAL_OP)
set(CEE_STRICT_CXX_FLAGS "${CEE_STRICT_CXX_FLAGS} -Wlogical-op")
endif()
endif()
# Compiler flags for MSVC
#-----------------------------------------------------
if (MSVC)
# Strip out the /W3 flag that Cmake sets by default
string (REPLACE "/W3" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Setup our BASE compile flags
set(CEE_BASE_CXX_FLAGS "")
if (CEE_WARNINGS_AS_ERRORS)
set(CEE_BASE_CXX_FLAGS "/WX ${CEE_BASE_CXX_FLAGS}")
endif()
# Setup the our STRICT compile flags
# These are the flags we would like to use on all of our own libraries
set(CEE_STRICT_CXX_FLAGS "${CEE_BASE_CXX_FLAGS} /Wall")
# Must add base warning level after setting up strict
set(CEE_BASE_CXX_FLAGS "${CEE_BASE_CXX_FLAGS} /W3")
endif()

67
Fwk/VizFwk/CMakeLists.txt Normal file
View File

@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 2.8)
project(VizFramework)
# Determine if we're being run stand-alone or invoked from some other project
set(CEE_STAND_ALONE ON)
if (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
message("VizFramework project being built stand-alone")
else()
set(CEE_STAND_ALONE OFF)
message("VizFramework project is invoked from other project")
endif()
if (CEE_STAND_ALONE)
# Set a default build type (not relevant for WIN32)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
include(CMake/Utils/ceeDetermineCompilerFlags.cmake)
endif()
add_subdirectory(LibCore)
add_subdirectory(LibIo)
add_subdirectory(LibGeometry)
add_subdirectory(LibRender)
add_subdirectory(LibViewing)
add_subdirectory(LibRegGrid2D)
add_subdirectory(LibStructGrid)
add_subdirectory(LibFreeType)
add_subdirectory(ThirdParty/FreeType)
add_subdirectory(LibUtilities)
option(CEE_BUILD_GUI_QT "Build GUI library for Qt" ON)
if (CEE_BUILD_GUI_QT)
add_subdirectory(LibGuiQt)
endif()
if (CEE_STAND_ALONE)
option(CEE_BUILD_UNIT_TESTS "Build unit tests" ON)
if (CEE_BUILD_UNIT_TESTS)
add_subdirectory(Tests)
endif()
option(CEE_BUILD_TEST_APPS "Build test apps" ON)
if (CEE_BUILD_TEST_APPS)
if (CEE_BUILD_GUI_QT)
# For now, build the snippet libs here
add_subdirectory(Tests/SnippetsBasis)
add_subdirectory(TestApps/Qt/QtMinimal)
add_subdirectory(TestApps/Qt/QtMultiView)
add_subdirectory(TestApps/Qt/QtSnippetRunner)
endif()
endif()
endif()

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Doxygen|Win32">
<Configuration>Doxygen</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F5FA2496-1AD3-4569-8EA1-5B5F01450B03}</ProjectGuid>
<RootNamespace>Doxygen</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Doxygen|Win32'">
<ConfigurationType>Utility</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Doxygen|Win32'">
<OutDir>$(ProjectDir)\html\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Doxygen|Win32'">
<IntDir>$(ProjectDir)\html\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Doxygen|Win32'">
<ExtensionsToDeleteOnClean>*.html;*.css;*.map;*.md5;*.dot;*.png;*.gif;*.js;installdox</ExtensionsToDeleteOnClean>
</PropertyGroup>
<ItemGroup>
<None Include="CeetronDoxygenGuidelines.txt" />
<None Include="html\index.html" />
<CustomBuild Include="RunDoxygen.bat">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Doxygen|Win32'">RunDoxygen.bat</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Doxygen|Win32'">Running Doxygen...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Doxygen|Win32'">html/ToForceRebuildEveryTime.html</Outputs>
</CustomBuild>
<None Include="VizDoxygenSetup" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="CeetronDoxygenGuidelines.txt" />
<None Include="html\index.html" />
<None Include="VizDoxygenSetup" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="RunDoxygen.bat" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,42 @@
Documentation guidelines when writing Doxygen doc for CVC.
-------------------------------------------------------------
Ripped from: http://api.haiku-os.org/apidoc.html
Relevant paragraph commands in decreasing order of importance:
\attention
* Used when the developer is bound to make a mistake, when the API is ambiguous.
The difference between this and a warning is that warnings warn about things
that are the developers fault, and attention blocks warn about things that
might go wrong because of the way the API is structured.
* Used to warn for abuse of the API that might be caused by the way the internals
of the system are structured.
\warning
* Used to warn developers about using the API in a certain way. Warnings apply
especially to new developers that aren't completely familiar with the API and that
might want to abuse it. For example, the thread safety of BString requires a warning.
\note
* Used to place references to other documentation that might not be directly related
to the text. For example, BLooper will have a direct reference to BHandler in the
class description, but BMessenger will be mentioned in a note because it does not
directly influence the use of the class.
* Can also be used for useful hints or notes that somehow need to stand out from the
rest of the text.
\remark
* Remarks are small notes that would interrupt the flow of the text. For example,
if you in a text ignore a certain condition that is so extremely rare and uncommon,
you can put a remark at the end of the text to tell that you have been lying.
* Remarks interact with the text whereas notes add something unmentioned to it.
In newer versions of Doxygen it seems that these gets tagged with a color in the
final documentation.
RED \attention
RED \warning
YELLOW \note
nocolor \remark

View File

@ -0,0 +1,2 @@
..\Tools\Doxygen\doxygen.exe VizDoxygenSetup
pause

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,320 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug MD TBB|Win32">
<Configuration>Debug MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD TBB|x64">
<Configuration>Debug MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|Win32">
<Configuration>Debug MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|x64">
<Configuration>Debug MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|Win32">
<Configuration>Release MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|x64">
<Configuration>Release MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|Win32">
<Configuration>Release MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|x64">
<Configuration>Release MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A9C7A239-B761-A892-BF34-5AECA0D9EE88}</ProjectGuid>
<RootNamespace>LibCore</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="cvfArray.h" />
<ClInclude Include="cvfAssert.h" />
<ClInclude Include="cvfBase.h" />
<ClInclude Include="cvfBase64.h" />
<ClInclude Include="cvfCharArray.h" />
<ClInclude Include="cvfCodeLocation.h" />
<ClInclude Include="cvfCollection.h" />
<ClInclude Include="cvfColor3.h" />
<ClInclude Include="cvfColor4.h" />
<ClInclude Include="cvfConfigCore.h" />
<ClInclude Include="cvfDebugTimer.h" />
<ClInclude Include="cvfFlags.h" />
<ClInclude Include="cvfFunctorRange.h" />
<ClInclude Include="cvfLibCore.h" />
<ClInclude Include="cvfLogDestination.h" />
<ClInclude Include="cvfLogDestinationConsole.h" />
<ClInclude Include="cvfLogDestinationFile.h" />
<ClInclude Include="cvfLogEvent.h" />
<ClInclude Include="cvfLogger.h" />
<ClInclude Include="cvfLogManager.h" />
<ClInclude Include="cvfMath.h" />
<ClInclude Include="cvfMatrix3.h" />
<ClInclude Include="cvfMatrix4.h" />
<ClInclude Include="cvfMutex.h" />
<ClInclude Include="cvfObject.h" />
<ClInclude Include="cvfPlane.h" />
<ClInclude Include="cvfPropertySet.h" />
<ClInclude Include="cvfPropertySetCollection.h" />
<ClInclude Include="cvfQuat.h" />
<ClInclude Include="cvfRect.h" />
<ClInclude Include="cvfString.h" />
<ClInclude Include="cvfSystem.h" />
<ClInclude Include="cvfTBBControl.h" />
<ClInclude Include="cvfTimer.h" />
<ClInclude Include="cvfTrace.h" />
<ClInclude Include="cvfValueArray.h" />
<ClInclude Include="cvfVariant.h" />
<ClInclude Include="cvfVector2.h" />
<ClInclude Include="cvfVector3.h" />
<ClInclude Include="cvfVector4.h" />
<ClInclude Include="cvfVersion.h" />
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
<None Include="cvfArray.inl" />
<None Include="cvfCollection.inl" />
<None Include="cvfFlags.inl" />
<None Include="cvfMath.inl" />
<None Include="cvfMatrix3.inl" />
<None Include="cvfMatrix4.inl" />
<None Include="cvfObject.inl" />
<None Include="cvfQuat.inl" />
<None Include="cvfRect.inl" />
<None Include="cvfVector2.inl" />
<None Include="cvfVector3.inl" />
<None Include="cvfVector4.inl" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfAssert.cpp" />
<ClCompile Include="cvfBase64.cpp" />
<ClCompile Include="cvfCharArray.cpp" />
<ClCompile Include="cvfCodeLocation.cpp" />
<ClCompile Include="cvfColor3.cpp" />
<ClCompile Include="cvfColor4.cpp" />
<ClCompile Include="cvfDebugTimer.cpp" />
<ClCompile Include="cvfLogDestinationConsole.cpp" />
<ClCompile Include="cvfLogDestinationFile.cpp" />
<ClCompile Include="cvfLogEvent.cpp" />
<ClCompile Include="cvfLogger.cpp" />
<ClCompile Include="cvfLogManager.cpp" />
<ClCompile Include="cvfMath.cpp" />
<ClCompile Include="cvfMutex.cpp" />
<ClCompile Include="cvfObject.cpp" />
<ClCompile Include="cvfPlane.cpp" />
<ClCompile Include="cvfPropertySet.cpp" />
<ClCompile Include="cvfPropertySetCollection.cpp" />
<ClCompile Include="cvfString.cpp" />
<ClCompile Include="cvfSystem.cpp" />
<ClCompile Include="cvfTBBControl.cpp" />
<ClCompile Include="cvfTimer.cpp" />
<ClCompile Include="cvfTrace.cpp" />
<ClCompile Include="cvfVariant.cpp" />
<ClCompile Include="cvfVector2.cpp" />
<ClCompile Include="cvfVector3.cpp" />
<ClCompile Include="cvfVector4.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="cvfArray.h" />
<ClInclude Include="cvfVersion.h" />
<ClInclude Include="cvfAssert.h" />
<ClInclude Include="cvfBase.h" />
<ClInclude Include="cvfCharArray.h" />
<ClInclude Include="cvfCollection.h" />
<ClInclude Include="cvfColor3.h" />
<ClInclude Include="cvfColor4.h" />
<ClInclude Include="cvfConfigCore.h" />
<ClInclude Include="cvfDebugTimer.h" />
<ClInclude Include="cvfFlags.h" />
<ClInclude Include="cvfLibCore.h" />
<ClInclude Include="cvfMath.h" />
<ClInclude Include="cvfMatrix3.h" />
<ClInclude Include="cvfMatrix4.h" />
<ClInclude Include="cvfObject.h" />
<ClInclude Include="cvfPlane.h" />
<ClInclude Include="cvfQuat.h" />
<ClInclude Include="cvfRect.h" />
<ClInclude Include="cvfString.h" />
<ClInclude Include="cvfSystem.h" />
<ClInclude Include="cvfTimer.h" />
<ClInclude Include="cvfTrace.h" />
<ClInclude Include="cvfVector2.h" />
<ClInclude Include="cvfVector3.h" />
<ClInclude Include="cvfVector4.h" />
<ClInclude Include="cvfValueArray.h" />
<ClInclude Include="cvfBase64.h" />
<ClInclude Include="cvfTBBControl.h" />
<ClInclude Include="cvfFunctorRange.h" />
<ClInclude Include="cvfLogger.h" />
<ClInclude Include="cvfVariant.h" />
<ClInclude Include="cvfPropertySet.h" />
<ClInclude Include="cvfPropertySetCollection.h" />
<ClInclude Include="cvfLogEvent.h" />
<ClInclude Include="cvfCodeLocation.h" />
<ClInclude Include="cvfMutex.h" />
<ClInclude Include="cvfLogManager.h" />
<ClInclude Include="cvfLogDestination.h" />
<ClInclude Include="cvfLogDestinationConsole.h" />
<ClInclude Include="cvfLogDestinationFile.h" />
</ItemGroup>
<ItemGroup>
<None Include="cvfArray.inl" />
<None Include="cvfCollection.inl" />
<None Include="cvfFlags.inl" />
<None Include="cvfMath.inl" />
<None Include="cvfMatrix3.inl" />
<None Include="cvfMatrix4.inl" />
<None Include="cvfObject.inl" />
<None Include="cvfQuat.inl" />
<None Include="cvfRect.inl" />
<None Include="cvfVector2.inl" />
<None Include="cvfVector3.inl" />
<None Include="cvfVector4.inl" />
<None Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfAssert.cpp" />
<ClCompile Include="cvfVector4.cpp" />
<ClCompile Include="cvfCharArray.cpp" />
<ClCompile Include="cvfColor3.cpp" />
<ClCompile Include="cvfColor4.cpp" />
<ClCompile Include="cvfDebugTimer.cpp" />
<ClCompile Include="cvfMath.cpp" />
<ClCompile Include="cvfObject.cpp" />
<ClCompile Include="cvfPlane.cpp" />
<ClCompile Include="cvfString.cpp" />
<ClCompile Include="cvfSystem.cpp" />
<ClCompile Include="cvfTimer.cpp" />
<ClCompile Include="cvfTrace.cpp" />
<ClCompile Include="cvfVector2.cpp" />
<ClCompile Include="cvfVector3.cpp" />
<ClCompile Include="cvfBase64.cpp" />
<ClCompile Include="cvfTBBControl.cpp" />
<ClCompile Include="cvfLogger.cpp" />
<ClCompile Include="cvfVariant.cpp" />
<ClCompile Include="cvfPropertySet.cpp" />
<ClCompile Include="cvfPropertySetCollection.cpp" />
<ClCompile Include="cvfLogEvent.cpp" />
<ClCompile Include="cvfCodeLocation.cpp" />
<ClCompile Include="cvfMutex.cpp" />
<ClCompile Include="cvfLogManager.cpp" />
<ClCompile Include="cvfLogDestinationConsole.cpp" />
<ClCompile Include="cvfLogDestinationFile.cpp" />
</ItemGroup>
</Project>

View File

@ -114,11 +114,14 @@ Assert::FailAction AssertHandlerConsole::handleAssert(const char* fileName, int
reportToConsole(fileName, lineNumber, expr, msg);
#ifdef WIN32
__debugbreak();
#else
abort();
if (::IsDebuggerPresent())
{
__debugbreak();
}
#endif
abort();
// Shouldn't really matter since we always abort
return Assert::CONTINUE;
}

View File

@ -166,66 +166,6 @@ bool Color3f::operator!=(const Color3f& rhs) const
}
//--------------------------------------------------------------------------------------------------
/// Returns the red color component of this color
//--------------------------------------------------------------------------------------------------
float Color3f::r() const
{
return m_rgb[0];
}
//--------------------------------------------------------------------------------------------------
/// Returns the green color component of this color
//--------------------------------------------------------------------------------------------------
float Color3f::g() const
{
return m_rgb[1];
}
//--------------------------------------------------------------------------------------------------
/// Returns the blue color component of this color
//--------------------------------------------------------------------------------------------------
float Color3f::b() const
{
return m_rgb[2];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the red color component.
///
/// Used for setting the color, e.g. <tt>r() = 0.5f</tt>
//--------------------------------------------------------------------------------------------------
float& Color3f::r()
{
return m_rgb[0];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the green color component.
///
/// Used for setting the color, e.g. <tt>g() = 0.5f</tt>
//--------------------------------------------------------------------------------------------------
float& Color3f::g()
{
return m_rgb[1];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the blue color component.
///
/// Used for setting the color, e.g. <tt>b() = 0.5f</tt>
//--------------------------------------------------------------------------------------------------
float& Color3f::b()
{
return m_rgb[2];
}
//--------------------------------------------------------------------------------------------------
/// Sets all color components
//--------------------------------------------------------------------------------------------------
@ -473,60 +413,6 @@ bool Color3ub::operator!=(const Color3ub& rhs) const
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ubyte Color3ub::r() const
{
return m_rgb[0];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ubyte Color3ub::g() const
{
return m_rgb[1];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ubyte Color3ub::b() const
{
return m_rgb[2];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the red color component.
//--------------------------------------------------------------------------------------------------
ubyte& Color3ub::r()
{
return m_rgb[0];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the green color component.
//--------------------------------------------------------------------------------------------------
ubyte& Color3ub::g()
{
return m_rgb[1];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the blue color component.
//--------------------------------------------------------------------------------------------------
ubyte& Color3ub::b()
{
return m_rgb[2];
}
//--------------------------------------------------------------------------------------------------
/// Sets all color components
//--------------------------------------------------------------------------------------------------

View File

@ -117,12 +117,13 @@ public:
bool operator==(const Color3f& rhs) const;
bool operator!=(const Color3f& rhs) const;
float r() const;
float g() const;
float b() const;
float& r();
float& g();
float& b();
const float& r() const { return m_rgb[0]; } ///< Returns the red color component
const float& g() const { return m_rgb[1]; } ///< Returns the green color component
const float& b() const { return m_rgb[2]; } ///< Returns the blue color component
float& r() { return m_rgb[0]; } ///< Get modifiable reference to the red color component, used for setting the component.
float& g() { return m_rgb[1]; } ///< Get modifiable reference to the green color component, used for setting the component
float& b() { return m_rgb[2]; } ///< Get modifiable reference to the blue color component, used for setting the component
void set(float r, float g, float b);
bool isValid() const;
@ -159,12 +160,13 @@ public:
bool operator==(const Color3ub& rhs) const;
bool operator!=(const Color3ub& rhs) const;
ubyte r() const;
ubyte g() const;
ubyte b() const;
ubyte& r();
ubyte& g();
ubyte& b();
ubyte r() const { return m_rgb[0]; } ///< Returns the red color component
ubyte g() const { return m_rgb[1]; } ///< Returns the green color component
ubyte b() const { return m_rgb[2]; } ///< Returns the blue color component
ubyte& r() { return m_rgb[0]; } ///< Get modifiable reference to the red color component.
ubyte& g() { return m_rgb[1]; } ///< Get modifiable reference to the green color component.
ubyte& b() { return m_rgb[2]; } ///< Get modifiable reference to the blue color component.
void set(ubyte r, ubyte g, ubyte b);
const ubyte* ptr() const;

View File

@ -180,86 +180,6 @@ bool Color4f::operator!=(const Color4f& rhs) const
}
//--------------------------------------------------------------------------------------------------
/// Returns the red color component of this color
//--------------------------------------------------------------------------------------------------
const float& Color4f::r() const
{
return m_rgba[0];
}
//--------------------------------------------------------------------------------------------------
/// Returns the green color component of this color
//--------------------------------------------------------------------------------------------------
const float& Color4f::g() const
{
return m_rgba[1];
}
//--------------------------------------------------------------------------------------------------
/// Returns the blue color component of this color
//--------------------------------------------------------------------------------------------------
const float& Color4f::b() const
{
return m_rgba[2];
}
//--------------------------------------------------------------------------------------------------
/// Returns the alpha color component of this color
//--------------------------------------------------------------------------------------------------
const float& Color4f::a() const
{
return m_rgba[3];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the red color component.
///
/// Used for setting the color, e.g. <tt>r() = 0.5f</tt>
//--------------------------------------------------------------------------------------------------
float& Color4f::r()
{
return m_rgba[0];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the green color component.
///
/// Used for setting the color, e.g. <tt>g() = 0.5f</tt>
//--------------------------------------------------------------------------------------------------
float& Color4f::g()
{
return m_rgba[1];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the blue color component.
///
/// Used for setting the color, e.g. <tt>b() = 0.5f</tt>
//--------------------------------------------------------------------------------------------------
float& Color4f::b()
{
return m_rgba[2];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the alpha component.
///
/// Used for setting the color, e.g. <tt>a() = 0.5f</tt>
//--------------------------------------------------------------------------------------------------
float& Color4f::a()
{
return m_rgba[3];
}
//--------------------------------------------------------------------------------------------------
/// Sets all color components
//--------------------------------------------------------------------------------------------------
@ -464,78 +384,6 @@ bool Color4ub::operator!=(const Color4ub& rhs) const
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ubyte Color4ub::r() const
{
return m_rgba[0];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ubyte Color4ub::g() const
{
return m_rgba[1];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ubyte Color4ub::b() const
{
return m_rgba[2];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ubyte Color4ub::a() const
{
return m_rgba[3];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the red color component.
//--------------------------------------------------------------------------------------------------
ubyte& Color4ub::r()
{
return m_rgba[0];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the green color component.
//--------------------------------------------------------------------------------------------------
ubyte& Color4ub::g()
{
return m_rgba[1];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the blue color component.
//--------------------------------------------------------------------------------------------------
ubyte& Color4ub::b()
{
return m_rgba[2];
}
//--------------------------------------------------------------------------------------------------
/// Get modifiable reference to the alpha color component.
//--------------------------------------------------------------------------------------------------
ubyte& Color4ub::a()
{
return m_rgba[3];
}
//--------------------------------------------------------------------------------------------------
/// Sets all color components
//--------------------------------------------------------------------------------------------------

View File

@ -63,14 +63,14 @@ public:
bool operator==(const Color4f& rhs) const;
bool operator!=(const Color4f& rhs) const;
const float& r() const;
const float& g() const;
const float& b() const;
const float& a() const;
float& r();
float& g();
float& b();
float& a();
const float& r() const { return m_rgba[0]; } ///< Returns the red color component
const float& g() const { return m_rgba[1]; } ///< Returns the green color component
const float& b() const { return m_rgba[2]; } ///< Returns the blue color component
const float& a() const { return m_rgba[3]; } ///< Returns the alpha component
float& r() { return m_rgba[0]; } ///< Get modifiable reference to the red color component, used for setting the component.
float& g() { return m_rgba[1]; } ///< Get modifiable reference to the green color component, used for setting the component
float& b() { return m_rgba[2]; } ///< Get modifiable reference to the blue color component, used for setting the component
float& a() { return m_rgba[3]; } ///< Get modifiable reference to the alpha component, used for setting the component
void set(float r, float g, float b, float alpha);
void set(const Color3f& rgbColor, float alpha);
@ -106,14 +106,15 @@ public:
bool operator==(const Color4ub& rhs) const;
bool operator!=(const Color4ub& rhs) const;
ubyte r() const;
ubyte g() const;
ubyte b() const;
ubyte a() const;
ubyte& r();
ubyte& g();
ubyte& b();
ubyte& a();
ubyte r() const { return m_rgba[0]; } ///< Returns the red color component
ubyte g() const { return m_rgba[1]; } ///< Returns the green color component
ubyte b() const { return m_rgba[2]; } ///< Returns the blue color component
ubyte a() const { return m_rgba[3]; } ///< Returns the alpha component
ubyte& r() { return m_rgba[0]; } ///< Get modifiable reference to the red color component.
ubyte& g() { return m_rgba[1]; } ///< Get modifiable reference to the green color component.
ubyte& b() { return m_rgba[2]; } ///< Get modifiable reference to the blue color component.
ubyte& a() { return m_rgba[3]; } ///< Get modifiable reference to the alpha component.
void set(ubyte r, ubyte g, ubyte b, ubyte a);
const ubyte* ptr() const;

View File

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 2.8)
project(LibFreeType)
# Use our strict compile flags
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CEE_STRICT_CXX_FLAGS}")
include_directories(../LibCore)
include_directories(../LibIo)
include_directories(../LibGeometry)
include_directories(../LibRender)
include_directories(../ThirdParty/FreeType/include)
set(CEE_HEADER_FILES
cvfFreeTypeFont.h
)
set(CEE_SOURCE_FILES
cvfFreeTypeFont.cpp
)
add_library(${PROJECT_NAME} ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})

View File

@ -0,0 +1,244 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug MD TBB|Win32">
<Configuration>Debug MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD TBB|x64">
<Configuration>Debug MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|Win32">
<Configuration>Debug MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|x64">
<Configuration>Debug MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|Win32">
<Configuration>Release MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|x64">
<Configuration>Release MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|Win32">
<Configuration>Release MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|x64">
<Configuration>Release MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2667AC1D-CA80-42F8-8644-DDB58D342FF2}</ProjectGuid>
<RootNamespace>LibFreeType</RootNamespace>
<ProjectName>LibFreeType</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore;../LibIo;../LibRender;../LibUtilities;../ThirdParty/FreeType/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cvfFreeTypeFont.h" />
<ClInclude Include="cvfLibFreeType.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfFreeTypeFont.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cvfLibFreeType.h" />
<ClInclude Include="cvfFreeTypeFont.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfFreeTypeFont.cpp" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,722 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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 "cvfBase.h"
#include "cvfGlyph.h"
#include "cvfTextureImage.h"
#include "cvfFreeTypeFont.h"
#ifdef WIN32
#define CVF_USE_FREETYPE_LIB
#endif
// Todo: Implement and check on Linux and iOS
#ifdef CVF_USE_FREETYPE_LIB
#include "cvfBase64.h"
#include <vector>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_BITMAP_H
#endif // CVF_USE_FREETYPE_LIB
namespace cvf {
//==================================================================================================
//
// Private implementation of the FreeType font interface
//
//==================================================================================================
class FreeTypeFontInterface : public Object
{
#ifdef CVF_USE_FREETYPE_LIB
public:
FT_Library m_ftLib; // FreeType interface library
FT_Face m_ftFace; // FreeType face for currently loaded font
UByteArray m_data; // Locally stored font data. Only used when loading font via FT_New_Memory_Face(..)
uint m_dpiX; // Horizontal DPI
uint m_dpiY; // Vertical DPI
public:
//--------------------------------------------------------------------------------------------------
/// Constructor
//--------------------------------------------------------------------------------------------------
FreeTypeFontInterface(uint dpiX, uint dpiY)
: m_ftLib(NULL),
m_ftFace(NULL),
m_dpiX(dpiX),
m_dpiY(dpiY)
{
// Initialize FreeType library
// Seems that init the reasons for failure here would be memory allocations
// Since we're inside a constructor this will amount to an exception
FT_Error error = FT_Init_FreeType(&m_ftLib);
CVF_ASSERT(!error);
CVF_UNUSED(error);
//if (error)
//{
// m_ftLib = NULL;
// CVF_ERROR(String("Unable to initialize the FreeType library: Error [%1]").arg((int)error));
//}
};
//--------------------------------------------------------------------------------------------------
/// Destructor
//--------------------------------------------------------------------------------------------------
~FreeTypeFontInterface()
{
unload();
// Unload FreeType library
FT_Done_FreeType(m_ftLib);
}
//--------------------------------------------------------------------------------------------------
/// Returns true if the font is set up properly and ready to be used, otherwise returns false.
//--------------------------------------------------------------------------------------------------
bool isEmpty() const
{
return m_ftFace ? false : true;
}
//--------------------------------------------------------------------------------------------------
/// Get the name of the font
//--------------------------------------------------------------------------------------------------
String name()
{
String fontName;
if (!isEmpty())
{
if (m_ftFace->family_name)
{
fontName += m_ftFace->family_name;
if (m_ftFace->style_name)
{
fontName += " ";
fontName += m_ftFace->style_name;
}
}
}
return fontName;
}
//--------------------------------------------------------------------------------------------------
/// Load font from FreeType data format. Note: updateResolution(..) needs to be called after this.
//--------------------------------------------------------------------------------------------------
bool load(const ubyte* data, size_t numBytes)
{
CVF_TIGHT_ASSERT(data);
CVF_TIGHT_ASSERT(numBytes > 0);
CVF_TIGHT_ASSERT(m_ftLib);
// Close currently loaded font, if any
unload();
// Make a copy of the font data to ensure it's alive as long as the font is open as required
// by FT_New_Memory_Face(..). This is, of course, not a requirement for FT_New_Face(<filename>)
m_data.assign(data, numBytes);
// Translate into FreeType data-types
const FT_Byte* file_base = static_cast<const FT_Byte*>(m_data.ptr());
FT_Long file_size = static_cast<FT_Long>(m_data.size());
FT_Error error = FT_New_Memory_Face(m_ftLib, file_base, file_size, 0, &m_ftFace);
return error ? false : true;
}
//--------------------------------------------------------------------------------------------------
/// Load font from file. Note: updateResolution(..) needs to be called after this.
//--------------------------------------------------------------------------------------------------
bool load(const cvf::String& filename)
{
// Close currently loaded font, if any
unload();
FT_Error error = FT_New_Face(m_ftLib, filename.toUtf8().ptr(), 0, &m_ftFace);
return error ? false : true;
}
//--------------------------------------------------------------------------------------------------
/// Load base64 encoded font from memory. Note: updateResolution(..) needs to be called after this.
//--------------------------------------------------------------------------------------------------
bool load(const char** data, size_t numBlocks)
{
std::string encodedFontData;
size_t i;
for (i = 0; i < numBlocks; i++)
{
encodedFontData += data[i];
}
// Todo: Optimize this!
ref<UByteArray> decodedFontData = Base64::decode(encodedFontData);
if (decodedFontData.isNull()) return false;
if (decodedFontData->size() == 0) return false;
const FT_Byte* file_base = static_cast<const FT_Byte*>(static_cast<const void*>(decodedFontData->ptr()));
FT_Long file_size = static_cast<FT_Long>(decodedFontData->size());
return load(file_base, file_size);
}
//--------------------------------------------------------------------------------------------------
/// Update font size
//--------------------------------------------------------------------------------------------------
bool setSize(uint size)
{
CVF_ASSERT(!isEmpty());
FT_Error error = FT_Set_Char_Size(m_ftFace, 0, static_cast<FT_F26Dot6>(size) << 6, m_dpiX, m_dpiY);
if (error)
{
//CVF_ERROR(String("Unable to update FreeType font size: Error [%1]").arg((int)error));
return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
/// Close font if open
//--------------------------------------------------------------------------------------------------
void unload()
{
if (isEmpty()) return;
FT_Done_Face(m_ftFace);
m_ftFace = NULL;
m_data.clear();
}
//--------------------------------------------------------------------------------------------------
/// Create a glyph for the given character
//--------------------------------------------------------------------------------------------------
ref<Glyph> createGlyph(wchar_t character)
{
if (isEmpty()) return NULL;
// Look up the glyph index corresponding to the given character code in the charmap that is currently
// selected for the face. This should really be the UTF-32 representation form of Unicode; for example,
// if you want to load character U+1F028, use value 0x1F028 as the value for character.
//
// Note that FT_Get_Char_Index is one of the rare FreeType functions that do not return an error code.
// However, when a given character code has no glyph image in the face, the value 0 is returned.
// By convention, it always corresponds to a special glyph image called the missing glyph, which
// is commonly displayed as a box or a space.
FT_UInt glyph_index = FT_Get_Char_Index(m_ftFace, character);
// Load a single glyph into the glyph slot of a face object
FT_Error error = FT_Load_Glyph(m_ftFace, glyph_index, FT_LOAD_DEFAULT);
if (error)
{
//CVF_ERROR(String("Unable to load glyph from FreeType font: Error [%1]").arg((int)error));
return NULL;
}
// Convert a given glyph image to a bitmap. It does so by inspecting the glyph image format,
// finding the relevant renderer, and invoking it.
error = FT_Render_Glyph(m_ftFace->glyph, FT_RENDER_MODE_NORMAL);
if (error)
{
//CVF_ERROR(String("Unable to convert FreeType font glyph image to bitmap: Error [%1]").arg((int)error));
return NULL;
}
CVF_ASSERT(m_ftFace->glyph->advance.x == m_ftFace->glyph->metrics.horiAdvance);
//
ref<Glyph> glyph = new Glyph(character);
glyph->setHorizontalBearingX(static_cast<short>(m_ftFace->glyph->metrics.horiBearingX) >> 6); // NB! May be negative
glyph->setHorizontalBearingY(static_cast<short>(m_ftFace->glyph->metrics.horiBearingY) >> 6); // NB! May be negative
glyph->setHorizontalAdvance(m_ftFace->glyph->metrics.horiAdvance >> 6);
// Create from the given FreeType glyph, if valid
if (m_ftFace->glyph && (m_ftFace->glyph->bitmap.width > 0) && (m_ftFace->glyph->bitmap.rows > 0))
{
CVF_ASSERT(static_cast<int>(m_ftFace->glyph->metrics.width >> 6) == static_cast<int>(m_ftFace->glyph->bitmap.width));
CVF_ASSERT(static_cast<int>(m_ftFace->glyph->metrics.height >> 6) == static_cast<int>(m_ftFace->glyph->bitmap.rows));
// Safe to cast
uint bitmapWidth = static_cast<uint>(m_ftFace->glyph->bitmap.width);
uint bitmapHeight = static_cast<uint>(m_ftFace->glyph->bitmap.rows);
// Prepare texture image
TextureImage* textureImage = new TextureImage;
textureImage->allocate(bitmapWidth, bitmapHeight);
ubyte colorComponent;
// Populate m_ftFace->glyph texture image
uint x, y;
for (y = 0; y < bitmapHeight; y++)
{
for (x = 0; x < bitmapWidth; x++)
{
colorComponent = m_ftFace->glyph->bitmap.buffer[((m_ftFace->glyph->bitmap.rows-1-y)*m_ftFace->glyph->bitmap.width)+x];
// Todo: Consider replacing this with a two-channel GL_LUMINANCE_ALPHA
textureImage->setPixel(x, y, Color4ub(255, 255, 255, colorComponent));
}
}
glyph->setTextureImage(textureImage);
glyph->setWidth(textureImage->width());
glyph->setHeight(textureImage->height());
}
// Or create an empty m_ftFace->glyph
else
{
// Make sure we've got an advance.
// This will be used to create a totally transparent textureImage.
if (glyph->horizontalAdvance() == 0)
{
// Load the missing glyph and get advance from there
FT_Error error = FT_Load_Glyph(m_ftFace, 0, FT_LOAD_DEFAULT);
if (error)
{
//CVF_ERROR(String("Unable to load the 'missing-glyph' from FreeType font: Error [%1]").arg((int)error));
// Still unable to get an advance -> hardcode it
glyph->setHorizontalAdvance(10);
}
else
{
glyph->setHorizontalAdvance(m_ftFace->glyph->advance.x >> 6);
}
// Todo: Cach up value
}
CVF_ASSERT(glyph->horizontalAdvance() > 0);
// Prepare texture image
TextureImage* textureImage = new TextureImage;
textureImage->allocate(glyph->horizontalAdvance(), glyph->horizontalAdvance());
textureImage->fill(Color4ub(0, 0, 0, 0)); // Totally transparent!
glyph->setTextureImage(textureImage);
glyph->setWidth(textureImage->width());
glyph->setHeight(textureImage->height());
// Bearing is not needed since we've filled the whole area based on the advance
glyph->setHorizontalBearingX(0);
glyph->setHorizontalBearingY(0);
}
return glyph;
}
//--------------------------------------------------------------------------------------------------
/// Get kerning values for in-between-characters for given string
//--------------------------------------------------------------------------------------------------
bool getKerning(String* str, std::vector<int>* kerningVector)
{
CVF_TIGHT_ASSERT(str);
CVF_TIGHT_ASSERT(kerningVector);
if (isEmpty()) return false;
if (!FT_HAS_KERNING(m_ftFace)) return false;
size_t numCharacters = str->size();
if (numCharacters < 2) return false;
kerningVector->clear();
kerningVector->reserve(numCharacters-1);
// Initialized to 'missing glyph'.
// There is never any kerning distance associated with this glyph.
FT_UInt curr_glyph_index = 0; // Current glyph
FT_UInt prev_glyph_index = 0; // Previous glyph
FT_Vector delta;
size_t i;
for (i = 0; i < numCharacters; i++)
{
const wchar_t character = str->c_str()[i];
curr_glyph_index = FT_Get_Char_Index(m_ftFace, character);
if (i > 0)
{
FT_Get_Kerning(m_ftFace, prev_glyph_index, curr_glyph_index, FT_KERNING_DEFAULT, &delta);
// Note: We do not check the error code returned by FT_Get_Kerning. This is because
// the function always sets the content of delta to (0,0) when an error occurs.
kerningVector->push_back(delta.x >> 6);
}
prev_glyph_index = curr_glyph_index;
}
return true;
}
//--------------------------------------------------------------------------------------------------
/// Get kerning value between two characters
//--------------------------------------------------------------------------------------------------
bool getKerning(wchar_t character, wchar_t nextCharacter, int* kerning)
{
if (isEmpty()) return false;
if (!FT_HAS_KERNING(m_ftFace)) return false;
FT_UInt curr_glyph_index = FT_Get_Char_Index(m_ftFace, character);
FT_UInt next_glyph_index = FT_Get_Char_Index(m_ftFace, nextCharacter);
FT_Vector delta;
FT_Get_Kerning(m_ftFace, curr_glyph_index, next_glyph_index, FT_KERNING_DEFAULT, &delta);
// Note: We do not check the error code returned by FT_Get_Kerning. This is because
// the function always sets the content of delta to (0,0) when an error occurs.
*kerning = delta.x >> 6;
return true;
}
//--------------------------------------------------------------------------------------------------
/// Get FreeType library version
//--------------------------------------------------------------------------------------------------
static bool version(int* major, int* minor, int* patch)
{
FT_Library ftLib;
FT_Error error = FT_Init_FreeType(&ftLib);
if (error) return false;
FT_Library_Version(ftLib, major, minor, patch);
FT_Done_FreeType(ftLib);
return true;
}
//--------------------------------------------------------------------------------------------------
/// Get FreeType library copyright year.
// NB! Must be updated when upgrading the FreeType library!
//--------------------------------------------------------------------------------------------------
static String copyRightYear()
{
return String("1996-2002, 2006");
}
//--------------------------------------------------------------------------------------------------
/// Get FreeType library credit text
//--------------------------------------------------------------------------------------------------
static String credit()
{
int major = 0;
int minor = 0;
int patch = 0;
version(&major, &minor, &patch);
return String("FreeType %1.%2.%3\n"
"Portions of this software are Copyright © %4\n"
"The FreeType Project (www.freetype.org).\n"
"All rights reserved.")
.arg(major).arg(minor).arg(patch).arg(copyRightYear());
}
#endif // CVF_USE_FREETYPE_LIB
}; // FreeTypeFontInterface
//==================================================================================================
///
/// \class cvf::FreeTypeFont
/// \ingroup FreeType
///
/// Loads a given FreeType font to be used when drawing text
//==================================================================================================
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
FreeTypeFont::FreeTypeFont(uint dpiX, uint dpiY)
: m_name(L"")
{
#ifdef CVF_USE_FREETYPE_LIB
m_fontInterface = new FreeTypeFontInterface(dpiX, dpiY);
#endif
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
FreeTypeFont::~FreeTypeFont()
{
unload();
}
//--------------------------------------------------------------------------------------------------
/// Get the name of the currently loaded font. An empty string is returned if no font is loaded.
//--------------------------------------------------------------------------------------------------
const String& FreeTypeFont::name() const
{
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
return m_name;
}
//--------------------------------------------------------------------------------------------------
/// Get glyph for the given character. Will be created if not already present.
//--------------------------------------------------------------------------------------------------
ref<Glyph> FreeTypeFont::getGlyph(wchar_t character)
{
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
ref<Glyph> glyph = NULL;
if (!isEmpty())
{
// Glyph already available?
MapType::iterator it = m_atlasMap.find(character);
if (it != m_atlasMap.end())
{
// Yes, return existing glyph
glyph = it->second;
}
else
{
#ifdef CVF_USE_FREETYPE_LIB
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
glyph = m_fontInterface->createGlyph(character);
m_atlasMap.insert(MapType::value_type(character, glyph));
#endif // CVF_USE_FREETYPE_LIB
}
}
CVF_TIGHT_ASSERT(glyph.notNull());
return glyph;
}
//--------------------------------------------------------------------------------------------------
/// Get advance for character glyph in relation to the next character
//--------------------------------------------------------------------------------------------------
uint FreeTypeFont::advance(wchar_t character, wchar_t nextCharacter)
{
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
int kerning = 0;
#ifdef CVF_USE_FREETYPE_LIB
m_fontInterface->getKerning(character, nextCharacter, &kerning);
#endif
ref<Glyph> characterGlyph = getGlyph(character);
CVF_TIGHT_ASSERT(characterGlyph.notNull());
CVF_TIGHT_ASSERT(characterGlyph->textureImage());
ref<Glyph> nextCharacterGlyph = getGlyph(nextCharacter);
CVF_TIGHT_ASSERT(nextCharacterGlyph.notNull());
CVF_TIGHT_ASSERT(nextCharacterGlyph->textureImage());
uint characterWidth = characterGlyph->horizontalBearingX() + characterGlyph->textureImage()->width() + kerning;
return CVF_MAX(characterWidth, characterGlyph->horizontalAdvance());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool FreeTypeFont::isEmpty()
{
#ifdef CVF_USE_FREETYPE_LIB
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
return m_fontInterface->isEmpty();
#else
return true;
#endif
}
//--------------------------------------------------------------------------------------------------
/// Set font size
//--------------------------------------------------------------------------------------------------
void FreeTypeFont::setSize(uint size)
{
m_atlasMap.clear();
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
#ifdef CVF_USE_FREETYPE_LIB
m_fontInterface->setSize(size);
#endif
}
//--------------------------------------------------------------------------------------------------
/// Load font from file. Note: Any existing font will be removed!
//--------------------------------------------------------------------------------------------------
bool FreeTypeFont::load(const cvf::String& path)
{
unload();
#ifdef CVF_USE_FREETYPE_LIB
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
bool loaded = m_fontInterface->load(path);
m_name = m_fontInterface->name();
return loaded;
#else
CVF_UNUSED(path);
return false;
#endif
}
//--------------------------------------------------------------------------------------------------
/// Load font from memory.
///
/// Note that any existing font will be removed. Also, the the array must
/// exist as long as the font is in use.
//--------------------------------------------------------------------------------------------------
bool FreeTypeFont::load(const UByteArray* data)
{
CVF_TIGHT_ASSERT(data);
CVF_TIGHT_ASSERT(data->size() > 0);
unload();
#ifdef CVF_USE_FREETYPE_LIB
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
bool loaded = m_fontInterface->load(data->ptr(), data->size());
m_name = m_fontInterface->name();
return loaded;
#else
return false;
#endif
}
//--------------------------------------------------------------------------------------------------
/// Load base64 encoded font from memory
///
/// Note that any existing font will be removed. Also, the the array must
/// exist as long as the font is in use.
//--------------------------------------------------------------------------------------------------
bool FreeTypeFont::load(const char** data, size_t numBlocks)
{
CVF_TIGHT_ASSERT(data);
CVF_TIGHT_ASSERT(numBlocks > 0);
unload();
#ifdef CVF_USE_FREETYPE_LIB
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
bool loaded = m_fontInterface->load(data, numBlocks);
m_name = m_fontInterface->name();
return loaded;
#else
return false;
#endif
}
//--------------------------------------------------------------------------------------------------
/// Unload current font
//--------------------------------------------------------------------------------------------------
void FreeTypeFont::unload()
{
m_atlasMap.clear();
m_name = "";
#ifdef CVF_USE_FREETYPE_LIB
CVF_TIGHT_ASSERT(m_fontInterface.notNull());
m_fontInterface->unload();
#endif
}
//--------------------------------------------------------------------------------------------------
/// Get FreeType library version
//--------------------------------------------------------------------------------------------------
bool FreeTypeFont::version(int* major, int* minor, int* patch)
{
CVF_ASSERT(major);
CVF_ASSERT(minor);
CVF_ASSERT(patch);
#ifdef CVF_USE_FREETYPE_LIB
return FreeTypeFontInterface::version(major, minor, patch);
#else
*major = *minor = *patch = -1;
return false;
#endif
}
//--------------------------------------------------------------------------------------------------
/// Get FreeType library credit text
//--------------------------------------------------------------------------------------------------
String FreeTypeFont::credit()
{
#ifdef CVF_USE_FREETYPE_LIB
return FreeTypeFontInterface::credit();
#else
return L"";
#endif
}
} // namespace cvf

View File

@ -0,0 +1,92 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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 "cvfObject.h"
#include "cvfFont.h"
#include "cvfArray.h"
#include "cvfString.h"
#include <map>
namespace cvf {
class Glyph;
class TextureImage;
class FreeTypeFontInterface;
//==================================================================================================
//
// FreeType font class used to generate glyphs for a given character
//
//==================================================================================================
class FreeTypeFont : public Font
{
public:
FreeTypeFont(uint dpiX = 96, uint dpiY = 96);
virtual ~FreeTypeFont();
// Overridden pure virtual functions
virtual const String& name() const;
virtual ref<Glyph> getGlyph(wchar_t character);
virtual uint advance(wchar_t character, wchar_t nextCharacter);
virtual bool isEmpty();
void setSize(uint size);
// Load/unload font
bool load(const String& path);
bool load(const UByteArray* data);
bool load(const char** data, size_t numBlocks);
void unload();
// Library information
static bool version(int* major, int* minor, int* patch);
static String copyRightYear();
static String credit();
private:
typedef std::map<wchar_t, ref<Glyph> > MapType;
ref<FreeTypeFontInterface> m_fontInterface;
MapType m_atlasMap; // Atlas containing cached up Glyphs
String m_name;
};
} // namespace cvf

View File

@ -0,0 +1,45 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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.
//
//##################################################################################################
// Doxygen module definition
/// \ingroup VizFramework
/// @{
/// \defgroup FreeType FreeType module
/// @}
#include "cvfFreeTypeFont.h"

View File

@ -0,0 +1,283 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug MD TBB|Win32">
<Configuration>Debug MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD TBB|x64">
<Configuration>Debug MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|Win32">
<Configuration>Debug MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|x64">
<Configuration>Debug MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|Win32">
<Configuration>Release MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|x64">
<Configuration>Release MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|Win32">
<Configuration>Release MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|x64">
<Configuration>Release MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{EFD5C9AC-8988-F190-AA2C-E36EBE361E90}</ProjectGuid>
<RootNamespace>LibGeometry</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cvfArrowGenerator.h" />
<ClInclude Include="cvfBoundingBox.h" />
<ClInclude Include="cvfBoxGenerator.h" />
<ClInclude Include="cvfEdgeKey.h" />
<ClInclude Include="cvfFrustum.h" />
<ClInclude Include="cvfGeometryBuilder.h" />
<ClInclude Include="cvfGeometryBuilderFaceList.h" />
<ClInclude Include="cvfGeometryBuilderTriangles.h" />
<ClInclude Include="cvfGeometryUtils.h" />
<ClInclude Include="cvfLibGeometry.h" />
<ClInclude Include="cvfMeshEdgeExtractor.h" />
<ClInclude Include="cvfOutlineEdgeExtractor.h" />
<ClInclude Include="cvfPatchGenerator.h" />
<ClInclude Include="cvfRay.h" />
<ClInclude Include="cvfTriangleMeshEdgeExtractor.h" />
<ClInclude Include="cvfTriangleVertexSplitter.h" />
<ClInclude Include="cvfVertexCompactor.h" />
<ClInclude Include="cvfVertexWelder.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfArrowGenerator.cpp" />
<ClCompile Include="cvfBoundingBox.cpp" />
<ClCompile Include="cvfBoxGenerator.cpp" />
<ClCompile Include="cvfEdgeKey.cpp" />
<ClCompile Include="cvfFrustum.cpp" />
<ClCompile Include="cvfGeometryBuilder.cpp" />
<ClCompile Include="cvfGeometryBuilderFaceList.cpp" />
<ClCompile Include="cvfGeometryBuilderTriangles.cpp" />
<ClCompile Include="cvfGeometryUtils.cpp" />
<ClCompile Include="cvfMeshEdgeExtractor.cpp" />
<ClCompile Include="cvfOutlineEdgeExtractor.cpp" />
<ClCompile Include="cvfPatchGenerator.cpp" />
<ClCompile Include="cvfRay.cpp" />
<ClCompile Include="cvfTriangleMeshEdgeExtractor.cpp" />
<ClCompile Include="cvfTriangleVertexSplitter.cpp" />
<ClCompile Include="cvfVertexCompactor.cpp" />
<ClCompile Include="cvfVertexWelder.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="cvfArrowGenerator.h" />
<ClInclude Include="cvfBoundingBox.h" />
<ClInclude Include="cvfBoxGenerator.h" />
<ClInclude Include="cvfEdgeKey.h" />
<ClInclude Include="cvfFrustum.h" />
<ClInclude Include="cvfGeometryBuilder.h" />
<ClInclude Include="cvfGeometryBuilderFaceList.h" />
<ClInclude Include="cvfGeometryBuilderTriangles.h" />
<ClInclude Include="cvfGeometryUtils.h" />
<ClInclude Include="cvfLibGeometry.h" />
<ClInclude Include="cvfMeshEdgeExtractor.h" />
<ClInclude Include="cvfOutlineEdgeExtractor.h" />
<ClInclude Include="cvfPatchGenerator.h" />
<ClInclude Include="cvfRay.h" />
<ClInclude Include="cvfVertexWelder.h" />
<ClInclude Include="cvfTriangleVertexSplitter.h" />
<ClInclude Include="cvfVertexCompactor.h" />
<ClInclude Include="cvfTriangleMeshEdgeExtractor.h" />
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfArrowGenerator.cpp" />
<ClCompile Include="cvfBoundingBox.cpp" />
<ClCompile Include="cvfBoxGenerator.cpp" />
<ClCompile Include="cvfEdgeKey.cpp" />
<ClCompile Include="cvfFrustum.cpp" />
<ClCompile Include="cvfGeometryBuilder.cpp" />
<ClCompile Include="cvfGeometryBuilderFaceList.cpp" />
<ClCompile Include="cvfGeometryBuilderTriangles.cpp" />
<ClCompile Include="cvfGeometryUtils.cpp" />
<ClCompile Include="cvfMeshEdgeExtractor.cpp" />
<ClCompile Include="cvfOutlineEdgeExtractor.cpp" />
<ClCompile Include="cvfPatchGenerator.cpp" />
<ClCompile Include="cvfRay.cpp" />
<ClCompile Include="cvfVertexWelder.cpp" />
<ClCompile Include="cvfTriangleVertexSplitter.cpp" />
<ClCompile Include="cvfVertexCompactor.cpp" />
<ClCompile Include="cvfTriangleMeshEdgeExtractor.cpp" />
</ItemGroup>
</Project>

View File

@ -21,6 +21,16 @@ include_directories(../LibRender)
include_directories(../LibViewing)
set(CEE_HEADER_FILES
cvfqtBasicAboutDialog.h
cvfqtCvfBoundQGLContext.h
cvfqtMouseState.h
cvfqtOpenGLContext.h
cvfqtOpenGLWidget.h
cvfqtPerformanceInfoHud.h
cvfqtUtils.h
)
set(CEE_SOURCE_FILES
cvfqtBasicAboutDialog.cpp
cvfqtCvfBoundQGLContext.cpp
@ -31,5 +41,5 @@ cvfqtPerformanceInfoHud.cpp
cvfqtUtils.cpp
)
add_library(${PROJECT_NAME} ${CEE_SOURCE_FILES})
add_library(${PROJECT_NAME} ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})

View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug MD|Win32">
<Configuration>Debug MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|x64">
<Configuration>Debug MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|Win32">
<Configuration>Release MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|x64">
<Configuration>Release MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FBFAC173-30FE-2C09-3F2E-D54477B433DE}</ProjectGuid>
<RootNamespace>LibGuiQt</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;QT_THREAD_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(QTDIR)/include;$(QTDIR)/include/QtCore;$(QTDIR)/include/QtGui;$(QTDIR)/include/QtOpenGL;../LibCore;../LibGeometry;../LibRender;../LibViewing</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;QT_THREAD_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(QTDIR)/include;$(QTDIR)/include/QtCore;$(QTDIR)/include/QtGui;$(QTDIR)/include/QtOpenGL;../LibCore;../LibGeometry;../LibRender;../LibViewing</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;QT_NO_DEBUG;QT_THREAD_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(QTDIR)/include;$(QTDIR)/include/QtCore;$(QTDIR)/include/QtGui;$(QTDIR)/include/QtOpenGL;../LibCore;../LibGeometry;../LibRender;../LibViewing</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;QT_NO_DEBUG;QT_THREAD_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(QTDIR)/include;$(QTDIR)/include/QtCore;$(QTDIR)/include/QtGui;$(QTDIR)/include/QtOpenGL;../LibCore;../LibGeometry;../LibRender;../LibViewing</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cvfqtBasicAboutDialog.cpp" />
<ClCompile Include="cvfqtCvfBoundQGLContext.cpp" />
<ClCompile Include="cvfqtMouseState.cpp" />
<ClCompile Include="cvfqtOpenGLContext.cpp" />
<ClCompile Include="cvfqtPerformanceInfoHud.cpp" />
<ClCompile Include="cvfqtUtils.cpp" />
<ClCompile Include="cvfqtOpenGLWidget.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cvfqtBasicAboutDialog.h" />
<ClInclude Include="cvfqtCvfBoundQGLContext.h" />
<ClInclude Include="cvfqtMouseState.h" />
<ClInclude Include="cvfqtOpenGLContext.h" />
<ClInclude Include="cvfqtOpenGLWidget.h" />
<ClInclude Include="cvfqtPerformanceInfoHud.h" />
<ClInclude Include="cvfqtUtils.h" />
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="cvfqtBasicAboutDialog.cpp" />
<ClCompile Include="cvfqtPerformanceInfoHud.cpp" />
<ClCompile Include="cvfqtUtils.cpp" />
<ClCompile Include="cvfqtOpenGLWidget.cpp" />
<ClCompile Include="cvfqtCvfBoundQGLContext.cpp" />
<ClCompile Include="cvfqtOpenGLContext.cpp" />
<ClCompile Include="cvfqtMouseState.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cvfqtPerformanceInfoHud.h" />
<ClInclude Include="cvfqtUtils.h" />
<ClInclude Include="cvfqtCvfBoundQGLContext.h" />
<ClInclude Include="cvfqtOpenGLContext.h" />
<ClInclude Include="cvfqtMouseState.h" />
<ClInclude Include="cvfqtBasicAboutDialog.h" />
<ClInclude Include="cvfqtOpenGLWidget.h" />
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
</Project>

View File

@ -44,7 +44,6 @@
#include <QtGui/QVBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtOpenGL/QGLFormat>
namespace cvfqt {
@ -71,7 +70,7 @@ BasicAboutDialog::BasicAboutDialog(QWidget* parent)
//m_appVersion;
//m_appCopyright;
m_showCeeVizVersion = true;
m_showLibraryVersion = true;
m_showQtVersion = true;
m_isDebugBuild = false;
@ -110,21 +109,12 @@ void BasicAboutDialog::setCopyright(const QString& copyright)
//--------------------------------------------------------------------------------------------------
/// Set application icon to display
///
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::setApplicationIcon(const QIcon& icon)
{
m_appIcon = icon;
}
//--------------------------------------------------------------------------------------------------
/// Enable display of CeeViz version
//--------------------------------------------------------------------------------------------------
void BasicAboutDialog::showCeeVizVersion(bool show)
void BasicAboutDialog::showLibraryVersion(bool show)
{
CVF_ASSERT(!m_isCreated);
m_showCeeVizVersion = show;
m_showLibraryVersion = show;
}
@ -202,15 +192,6 @@ void BasicAboutDialog::create()
QVBoxLayout* appInfoLayout = new QVBoxLayout;
appInfoLayout->setSpacing(3);
QHBoxLayout* appNameLayout = new QHBoxLayout;
if (!m_appIcon.isNull())
{
QLabel* iconLabel = new QLabel(this);
iconLabel->setPixmap(m_appIcon.pixmap(QSize(200, 200)));
appNameLayout->addWidget(iconLabel);
}
// Always do app name
CVF_ASSERT(!m_appName.isEmpty());
QLabel* appNameLabel = new QLabel(this);
@ -220,10 +201,7 @@ void BasicAboutDialog::create()
appNameFont.setBold(true);
appNameLabel->setFont(appNameFont);
appNameLabel->setText(m_appName);
appNameLayout->addWidget(appNameLabel);
appInfoLayout->addLayout(appNameLayout);
appInfoLayout->addWidget(appNameLabel);
// Application version if specified
if (!m_appVersion.isEmpty())
@ -264,8 +242,8 @@ void BasicAboutDialog::create()
// Possibly show extend version info
if (m_showCeeVizVersion ||
m_showQtVersion ||
if (m_showLibraryVersion ||
m_showQtVersion ||
m_verLabels.size() > 0)
{
QGridLayout* verInfoLayout = new QGridLayout;
@ -273,20 +251,20 @@ void BasicAboutDialog::create()
int insertRow = 0;
// // CeeViz version
// if (m_showCeeVizVersion)
// {
// QString ver;
// ver.sprintf("%s.%s%s-%s", CVF_MAJOR_VERSION, CVF_MINOR_VERSION, CVF_SPECIAL_BUILD, CVF_BUILD_NUMBER);
//
// addStringPairToVerInfoLayout("CeeViz ver.: ", ver, verInfoLayout, insertRow++);
// }
//
// // Qt version
// if (m_showQtVersion)
// {
// addStringPairToVerInfoLayout("Qt ver.: ", qVersion(), verInfoLayout, insertRow++);
// }
// Library version
if (m_showLibraryVersion)
{
QString ver;
ver.sprintf("%s.%s%s-%s", CVF_MAJOR_VERSION, CVF_MINOR_VERSION, CVF_SPECIAL_BUILD, CVF_BUILD_NUMBER);
addStringPairToVerInfoLayout("Library ver.: ", ver, verInfoLayout, insertRow++);
}
// Qt version
if (m_showQtVersion)
{
addStringPairToVerInfoLayout("Qt ver.: ", qVersion(), verInfoLayout, insertRow++);
}
// Custom specified labels
if (m_verLabels.size() > 0)
@ -356,39 +334,6 @@ void BasicAboutDialog::addStringPairToVerInfoLayout(const QString& labelStr, con
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString BasicAboutDialog::openGLVersionString() const
{
QString versionString("OpenGL ");
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if (flags & QGLFormat::OpenGL_Version_4_0 ) versionString += "4.0";
else if (flags & QGLFormat::OpenGL_Version_3_3 ) versionString += "3.3";
else if (flags & QGLFormat::OpenGL_Version_3_2 ) versionString += "3.2";
else if (flags & QGLFormat::OpenGL_Version_3_1 ) versionString += "3.1";
else if (flags & QGLFormat::OpenGL_Version_3_0 ) versionString += "3.0";
else if (flags & QGLFormat::OpenGL_ES_Version_2_0 ) versionString += "ES_Version 2.0";
else if (flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_1) versionString += "ES_CommonLite_Version 1.1";
else if (flags & QGLFormat::OpenGL_ES_Common_Version_1_1 ) versionString += "ES_Common_Version 1.1";
else if (flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_0) versionString += "ES_CommonLite_Version 1.0";
else if (flags & QGLFormat::OpenGL_ES_Common_Version_1_0 ) versionString += "ES_Common_Version 1.0";
else if (flags & QGLFormat::OpenGL_Version_2_1 ) versionString += "2.1";
else if (flags & QGLFormat::OpenGL_Version_2_0 ) versionString += "2.0";
else if (flags & QGLFormat::OpenGL_Version_1_5 ) versionString += "1.5";
else if (flags & QGLFormat::OpenGL_Version_1_4 ) versionString += "1.4";
else if (flags & QGLFormat::OpenGL_Version_1_3 ) versionString += "1.3";
else if (flags & QGLFormat::OpenGL_Version_1_2 ) versionString += "1.2";
else if (flags & QGLFormat::OpenGL_Version_1_1 ) versionString += "1.1";
else if (flags & QGLFormat::OpenGL_Version_None ) versionString += "None";
else versionString += "Unknown";
return versionString;
}
} // namespace cvfqt

View File

@ -38,7 +38,6 @@
#pragma once
#include <QtGui/QDialog>
#include <QtGui/QIcon>
class QGridLayout;
@ -56,37 +55,35 @@ class BasicAboutDialog : public QDialog
public:
BasicAboutDialog(QWidget* parent);
void setApplicationName(const QString& appName);
void setApplicationVersion(const QString& ver);
void setCopyright(const QString& copyright);
void setApplicationIcon(const QIcon& icon);
void setApplicationName(const QString& appName);
void setApplicationVersion(const QString& ver);
void setCopyright(const QString& copyright);
void showCeeVizVersion(bool show);
void showQtVersion(bool show);
void addVersionEntry(const QString& verLabel, const QString& verText);
void setIsDebugBuild(bool isDebugBuild);
void showLibraryVersion(bool show);
void showQtVersion(bool show);
void addVersionEntry(const QString& verLabel, const QString& verText);
void setIsDebugBuild(bool isDebugBuild);
void create();
void create();
QString openGLVersionString() const;
private:
void addStringPairToVerInfoLayout(const QString& labelStr, const QString& infoStr, QGridLayout* verInfoLayout, int insertRow);
void addStringPairToVerInfoLayout(const QString& labelStr, const QString& infoStr, QGridLayout* verInfoLayout, int insertRow);
private:
bool m_isCreated; // Indicates if the create() function has been called
bool m_isCreated; // Indicates if the create() function has been called
QString m_appName; // Application name, appears in bold at the top of the dialog.
QString m_appVersion; // Application version info. Can be empty
QString m_appCopyright; // Application copyright string. Can be empty
QIcon m_appIcon;
QString m_appName; // Application name, appears in bold at the top of the dialog.
QString m_appVersion; // Application version info. Can be empty
QString m_appCopyright; // Application copyright string. Can be empty
bool m_showCeeVizVersion; // Flags whether CeeViz version info should be shown
bool m_showQtVersion; // Flags whether Qt version info should be shown
QStringList m_verLabels; // Labels for user specified version entries
QStringList m_verTexts; // The actual version text for user specified version entries
bool m_showLibraryVersion; // Flags whether version info should be shown for visualization framework
bool m_showQtVersion; // Flags whether Qt version info should be shown
QStringList m_verLabels; // Labels for user specified version entries
QStringList m_verTexts; // The actual version text for user specified version entries
bool m_isDebugBuild; // If set to true, will show info in dlg to indicate that this is a debug build
bool m_isDebugBuild; // If set to true, will show info in dlg to indicate that this is a debug build
};
}

View File

@ -149,7 +149,12 @@ void OpenGLContext::saveOpenGLState(cvf::OpenGLContext* oglContext)
CVF_CHECK_OGL(oglContext);
glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
CVF_CHECK_OGL(oglContext);
// For now disable pushing of the vertex array related attributes as it gives a mystical
// crash on Redhat5 under VMWare. Not a big issue, but maybe we can do without this push?
//glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
CVF_CHECK_OGL(oglContext);
glPushAttrib(GL_ALL_ATTRIB_BITS);
@ -209,6 +214,9 @@ void OpenGLContext::restoreOpenGLState(cvf::OpenGLContext* oglContext)
glPopAttrib();
CVF_CHECK_OGL(oglContext);
// Currently not pushing vertex attribs, so comment out the pop
//glPopClientAttrib();
glPopClientAttrib();
CVF_CHECK_OGL(oglContext);

View File

@ -36,12 +36,9 @@
#include "cvfBase.h"
#include "cvfTextureImage.h"
#include "cvfVector2.h"
#include "cvfqtUtils.h"
#include <QtCore/QVector>
namespace cvfqt {
@ -58,7 +55,7 @@ namespace cvfqt {
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Utils::toQString(const cvf::String& ceeString)
QString Utils::toQString(const cvf::String& ceeString)
{
if (ceeString.isEmpty())
{
@ -112,67 +109,126 @@ cvf::String Utils::fromQString(const QString& qtString)
return cvf::String();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Utils::copyFromQImage(cvf::TextureImage* textureImage, const QImage& qtImage)
QImage Utils::toQImage(const cvf::TextureImage& textureImage)
{
const int width = static_cast<int>(textureImage.width());
const int height = static_cast<int>(textureImage.height());
if (width <= 0 || height <= 0)
{
return QImage();
}
const cvf::ubyte* rgbData = textureImage.ptr();
QImage qimg(width, height, QImage::Format_ARGB32);
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
const int srcIdx = 4*y*width + 4*x;
qimg.setPixel(x, height - y - 1, qRgba(rgbData[srcIdx], rgbData[srcIdx + 1], rgbData[srcIdx + 2], rgbData[srcIdx + 3]));
}
}
return qimg;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Utils::fromQImage(const QImage& qImage, cvf::TextureImage* textureImage)
{
CVF_ASSERT(textureImage);
if (qtImage.isNull())
const int width = qImage.width();
const int height = qImage.height();
if (width <= 0 || height <= 0)
{
textureImage->clear();
return;
}
if (((int)textureImage->height()) != qtImage.height() || ((int)textureImage->width() != qtImage.width()))
return fromQImageRegion(qImage, cvf::Vec2ui(0, 0), cvf::Vec2ui(static_cast<cvf::uint>(width), static_cast<cvf::uint>(height)), textureImage);
}
//--------------------------------------------------------------------------------------------------
/// Convert a region of a QImage to a TextureImage
///
/// \attention The source position \a srcPos is specified in QImage's coordinate system, where
/// the pixel position (0,0) if the upper left corner.
//--------------------------------------------------------------------------------------------------
void Utils::fromQImageRegion(const QImage& qImage, const cvf::Vec2ui& srcPos, const cvf::Vec2ui& size, cvf::TextureImage* textureImage)
{
CVF_ASSERT(qImage.width() >= 0);
CVF_ASSERT(qImage.height() >= 0);
const cvf::uint qImgWidth = static_cast<cvf::uint>(qImage.width());
const cvf::uint qImgHeight = static_cast<cvf::uint>(qImage.height());
CVF_ASSERT(srcPos.x() < qImgWidth);
CVF_ASSERT(srcPos.y() < qImgHeight);
CVF_ASSERT(srcPos.x() + size.x() <= qImgWidth);
CVF_ASSERT(srcPos.y() + size.y() <= qImgHeight);
CVF_ASSERT(textureImage);
if (size.x() < 1 || size.y() < 1)
{
textureImage->allocate(qtImage.width(), qtImage.height());
textureImage->clear();
return;
}
int height = textureImage->height();
int width = textureImage->width();
// Check if QImage has format QImage::Format_ARGB32, and perform a direct memory copy of image data
if (qtImage.format() == QImage::Format_ARGB32)
if (textureImage->width() != size.x() || textureImage->height() != size.y())
{
cvf::ubyte* dataPtr = const_cast<cvf::ubyte*>(textureImage->ptr());
textureImage->allocate(size.x(), size.y());
}
int negy = 0;
uint idx = 0;
QRgb qtRgbaVal = 0;
// This loop is a candidate for multi-threading. Testing with OpenMP has so far indicated
// quite large variance in performance (Windows Intel i7 with 8 cores).
// When this function is called from the paint event,
// the user experience is considered better when the paint time is consistent.
for (int y = 0 ; y < height; ++y)
const cvf::uint sizeX = size.x();
const cvf::uint sizeY = size.y();
const cvf::uint srcPosX = srcPos.x();
const cvf::uint srcPosY = srcPos.y();
cvf::ubyte* textureImageDataPtr = textureImage->ptr();
// Check if QImage has format QImage::Format_ARGB32, and use a more optimized path
if (qImage.format() == QImage::Format_ARGB32)
{
for (cvf::uint y = 0; y < sizeY; ++y)
{
negy = height - 1 - y;
const uchar* s = qtImage.scanLine(negy);
const cvf::uint scanLineIdx = srcPosY + sizeY - y - 1;
const QRgb* qWholeScanLine = reinterpret_cast<const QRgb*>(qImage.scanLine(scanLineIdx));
const QRgb* qPixels = &qWholeScanLine[srcPosX];
for (int x = 0 ; x < width; ++x)
const cvf::uint dstStartIdx = 4*(y*sizeX);
cvf::ubyte* dstRgba = &textureImageDataPtr[dstStartIdx];
for (cvf::uint x = 0; x < sizeX; ++x)
{
qtRgbaVal = ((QRgb*)s)[x]; // Taken from QImage::pixel(int x, int y)
idx = 4*(y*width + x);
dataPtr[idx] = qRed(qtRgbaVal);
dataPtr[idx + 1] = qGreen(qtRgbaVal);
dataPtr[idx + 2] = qBlue(qtRgbaVal);
dataPtr[idx + 3] = qAlpha(qtRgbaVal);
QRgb qRgbaVal = qPixels[x];
dstRgba[0] = qRed(qRgbaVal);
dstRgba[1] = qGreen(qRgbaVal);
dstRgba[2] = qBlue(qRgbaVal);
dstRgba[3] = qAlpha(qRgbaVal);
dstRgba += 4;
}
}
}
else
{
for (int y = 0 ; y < height; ++y)
cvf::Color4ub cvfRgbVal;
for (cvf::uint y = 0; y < sizeY; ++y)
{
int negy = height - 1 - y;
QRgb qtRgbaVal;
cvf::Color4ub cvfRgbVal;
for (int x = 0 ; x < width; ++x)
const cvf::uint qImageYPos = srcPosY + sizeY - y - 1;
for (cvf::uint x = 0; x < sizeX; ++x)
{
qtRgbaVal = qtImage.pixel(x, negy);
cvfRgbVal.set(qRed(qtRgbaVal), qGreen(qtRgbaVal), qBlue(qtRgbaVal), qAlpha(qtRgbaVal));
const QRgb qRgbaVal = qImage.pixel(srcPosX + x, qImageYPos);
cvfRgbVal.r() = qRed(qRgbaVal);
cvfRgbVal.g() = qGreen(qRgbaVal);
cvfRgbVal.b() = qBlue(qRgbaVal);
cvfRgbVal.a() = qAlpha(qRgbaVal);
textureImage->setPixel(x, y, cvfRgbVal);
}
}
@ -180,6 +236,7 @@ void Utils::copyFromQImage(cvf::TextureImage* textureImage, const QImage& qtImag
}
} // namespace cvfqt

View File

@ -38,13 +38,10 @@
#pragma once
#include "cvfString.h"
#include "cvfTextureImage.h"
#include <QtCore/QString>
#include <QImage>
namespace cvf {
class TextureImage;
}
#include <QtGui/QImage>
namespace cvfqt {
@ -57,10 +54,12 @@ namespace cvfqt {
class Utils
{
public:
static QString toQString(const cvf::String& ceeString);
static cvf::String fromQString(const QString& qtString);
static QString toQString(const cvf::String& ceeString);
static cvf::String fromQString(const QString& qtString);
static void copyFromQImage(cvf::TextureImage* textureImage, const QImage& qtImage);
static QImage toQImage(const cvf::TextureImage& textureImage);
static void fromQImage(const QImage& qImage, cvf::TextureImage* textureImage);
static void fromQImageRegion(const QImage& qImage, const cvf::Vec2ui& srcPos, const cvf::Vec2ui& size, cvf::TextureImage* textureImage);
};
}

View File

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 2.8)
project(LibIo)
# Use our strict compile flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CEE_STRICT_CXX_FLAGS}")
include_directories(../LibCore)
set(CEE_HEADER_FILES
cvfFile.h
cvfLibIo.h
cvfMemoryFile.h
cvfPropertyXmlSerializer.h
cvfTinyXmlFused.hpp
cvfXml.h
)
set(CEE_SOURCE_FILES
cvfFile.cpp
cvfMemoryFile.cpp
cvfPropertyXmlSerializer.cpp
cvfXml.cpp
)
add_library(${PROJECT_NAME} ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})

View File

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug MD TBB|Win32">
<Configuration>Debug MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD TBB|x64">
<Configuration>Debug MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|Win32">
<Configuration>Debug MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug MD|x64">
<Configuration>Debug MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|Win32">
<Configuration>Release MD TBB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD TBB|x64">
<Configuration>Release MD TBB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|Win32">
<Configuration>Release MD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release MD|x64">
<Configuration>Release MD</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{181472EE-4B37-01E8-49D5-6213678FE4F8}</ProjectGuid>
<RootNamespace>LibIo</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<OutDir>$(Platform)_VS2010\$(Configuration)\</OutDir>
<IntDir>$(Platform)_VS2010\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MD TBB|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;_DEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MD TBB|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;CVF_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../LibCore</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cvfFile.h" />
<ClInclude Include="cvfLibIo.h" />
<ClInclude Include="cvfMemoryFile.h" />
<ClInclude Include="cvfPropertyXmlSerializer.h" />
<ClInclude Include="cvfTinyXmlFused.hpp" />
<ClInclude Include="cvfXml.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfFile.cpp" />
<ClCompile Include="cvfMemoryFile.cpp" />
<ClCompile Include="cvfPropertyXmlSerializer.cpp" />
<ClCompile Include="cvfXml.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cvfLibIo.h" />
<ClInclude Include="cvfTinyXmlFused.hpp" />
<ClInclude Include="cvfXml.h" />
<ClInclude Include="cvfMemoryFile.h" />
<ClInclude Include="cvfFile.h" />
<ClInclude Include="cvfPropertyXmlSerializer.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cvfXml.cpp" />
<ClCompile Include="cvfMemoryFile.cpp" />
<ClCompile Include="cvfFile.cpp" />
<ClCompile Include="cvfPropertyXmlSerializer.cpp" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,83 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron 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 "cvfBase.h"
#include "cvfFile.h"
#include "cvfString.h"
namespace cvf {
//==================================================================================================
///
/// \class cvf::File
/// \ingroup Io
///
///
//==================================================================================================
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
FILE* File::fopen(const String& fileName, const String& mode)
{
#ifdef WIN32
FILE* filePtr = NULL;
if (_wfopen_s(&filePtr, fileName.c_str(), mode.c_str()) != 0)
{
return NULL;
}
return filePtr;
#else
FILE* filePtr = ::fopen(fileName.toUtf8().ptr(), mode.toUtf8().ptr());
if (!filePtr)
{
return NULL;
}
return filePtr;
#endif
}
} // namespace cvf

Some files were not shown because too many files have changed in this diff Show More