mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Janitor: Several code hygiene adjustments (#9981)
* Include all libraries in APP_FWK_LIBRARIES * Several fixes detected by Static Code Analysis * Remove unused code * Add .clang.tidy * Use QElapsedTimer * Use horizontalAdvance * Avoid | between enum of different classes * Avoid illegal character * Renaming and reorder of constructor initialization
This commit is contained in:
parent
2abfd08bd9
commit
d23c6b4bb6
@ -610,10 +610,7 @@ add_subdirectory(Fwk/AppFwk/cafVizExtensions)
|
|||||||
|
|
||||||
option(CAF_CVF_SCRIPTING "" ON)
|
option(CAF_CVF_SCRIPTING "" ON)
|
||||||
add_subdirectory(Fwk/AppFwk/cafPdmScripting)
|
add_subdirectory(Fwk/AppFwk/cafPdmScripting)
|
||||||
set_property(TARGET cafPdmScripting PROPERTY FOLDER "AppFwk")
|
|
||||||
|
|
||||||
add_subdirectory(Fwk/AppFwk/cafCommandFeatures)
|
add_subdirectory(Fwk/AppFwk/cafCommandFeatures)
|
||||||
set_property(TARGET cafCommandFeatures PROPERTY FOLDER "AppFwk")
|
|
||||||
|
|
||||||
add_subdirectory(Fwk/AppFwk/cafTensor)
|
add_subdirectory(Fwk/AppFwk/cafTensor)
|
||||||
add_subdirectory(Fwk/AppFwk/cafHexInterpolator)
|
add_subdirectory(Fwk/AppFwk/cafHexInterpolator)
|
||||||
@ -665,6 +662,7 @@ list(
|
|||||||
CommonCode
|
CommonCode
|
||||||
cafVizExtensions
|
cafVizExtensions
|
||||||
cafPdmScripting
|
cafPdmScripting
|
||||||
|
cafCommandFeatures
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(TARGET ${APP_FWK_LIBRARIES} PROPERTY FOLDER "AppFwk")
|
set_property(TARGET ${APP_FWK_LIBRARIES} PROPERTY FOLDER "AppFwk")
|
||||||
@ -675,30 +673,31 @@ mark_as_advanced(FORCE RESINSIGHT_INCLUDE_APPFWK_TESTS)
|
|||||||
if(RESINSIGHT_INCLUDE_APPFWK_TESTS)
|
if(RESINSIGHT_INCLUDE_APPFWK_TESTS)
|
||||||
# Unit Tests
|
# Unit Tests
|
||||||
add_subdirectory(Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests)
|
add_subdirectory(Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests)
|
||||||
set_property(
|
|
||||||
TARGET cafProjectDataModel_UnitTests PROPERTY FOLDER "AppFwkTests"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(
|
add_subdirectory(
|
||||||
Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests
|
Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests
|
||||||
)
|
)
|
||||||
set_property(TARGET cafPdmCore_UnitTests PROPERTY FOLDER "AppFwkTests")
|
|
||||||
|
|
||||||
add_subdirectory(Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests)
|
add_subdirectory(Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests)
|
||||||
set_property(TARGET cafPdmXml_UnitTests PROPERTY FOLDER "AppFwkTests")
|
|
||||||
|
|
||||||
add_subdirectory(Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests)
|
add_subdirectory(Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests)
|
||||||
set_property(TARGET cafPdmScripting_UnitTests PROPERTY FOLDER "AppFwkTests")
|
|
||||||
|
|
||||||
add_subdirectory(Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests)
|
add_subdirectory(Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests)
|
||||||
set_property(TARGET cafUserInterface_UnitTests PROPERTY FOLDER "AppFwkTests")
|
|
||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
add_subdirectory(Fwk/AppFwk/cafTests/cafTestApplication)
|
add_subdirectory(Fwk/AppFwk/cafTests/cafTestApplication)
|
||||||
set_property(TARGET cafTestApplication PROPERTY FOLDER "AppFwkTests")
|
|
||||||
|
|
||||||
add_subdirectory(Fwk/AppFwk/cafTests/cafTestCvfApplication)
|
add_subdirectory(Fwk/AppFwk/cafTests/cafTestCvfApplication)
|
||||||
set_property(TARGET cafTestCvfApplication PROPERTY FOLDER "AppFwkTests")
|
|
||||||
|
list(
|
||||||
|
APPEND
|
||||||
|
APP_FWK_TEST_PROJECTS
|
||||||
|
cafProjectDataModel_UnitTests
|
||||||
|
cafPdmCore_UnitTests
|
||||||
|
cafPdmXml_UnitTests
|
||||||
|
cafPdmScripting_UnitTests
|
||||||
|
cafUserInterface_UnitTests
|
||||||
|
cafTestApplication
|
||||||
|
cafTestCvfApplication
|
||||||
|
)
|
||||||
|
|
||||||
|
set_property(TARGET ${APP_FWK_TEST_PROJECTS} PROPERTY FOLDER "AppFwkTests")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ##############################################################################
|
# ##############################################################################
|
||||||
@ -802,8 +801,8 @@ if(MSVC AND RESINSIGHT_ENABLE_STATIC_ANALYSIS)
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(TARGETS_FOR_STATIC_ANALYSIS
|
set(TARGETS_FOR_STATIC_ANALYSIS
|
||||||
${APP_FWK_LIBRARIES} ApplicationLibCode Commands ResultStatisticsCache
|
${APP_FWK_LIBRARIES} ${APP_FWK_TEST_PROJECTS} ApplicationLibCode Commands
|
||||||
RigGeoMechDataModel
|
ResultStatisticsCache RigGeoMechDataModel
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(TARGET_PROJECT ${TARGETS_FOR_STATIC_ANALYSIS})
|
foreach(TARGET_PROJECT ${TARGETS_FOR_STATIC_ANALYSIS})
|
||||||
|
4
Fwk/AppFwk/.clang-tidy
Normal file
4
Fwk/AppFwk/.clang-tidy
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
Checks: '-*,modernize-use-override,modernize-use-nullptr,modernize-deprecated-headers,bugprone-bool-pointer-implicit-conversion,bugprone-parent-virtual-call,bugprone-redundant-branch-condition,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare'
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
FormatStyle: 'file'
|
@ -249,11 +249,10 @@ void CmdFieldChangeExec::readFieldValueFromValidXmlDocument( QXmlStreamReader& x
|
|||||||
{
|
{
|
||||||
// See PdmObject::readFields and friends to match token count for reading field values
|
// See PdmObject::readFields and friends to match token count for reading field values
|
||||||
// The stream is supposed to be pointing at the first token of field content when calling readFieldData()
|
// The stream is supposed to be pointing at the first token of field content when calling readFieldData()
|
||||||
QXmlStreamReader::TokenType tt;
|
int tokenCount = 3;
|
||||||
int tokenCount = 3;
|
|
||||||
for ( int i = 0; i < tokenCount; i++ )
|
for ( int i = 0; i < tokenCount; i++ )
|
||||||
{
|
{
|
||||||
tt = xmlStream.readNext();
|
xmlStream.readNext();
|
||||||
}
|
}
|
||||||
xmlFieldHandle->readFieldData( xmlStream, PdmDefaultObjectFactory::instance() );
|
xmlFieldHandle->readFieldData( xmlStream, PdmDefaultObjectFactory::instance() );
|
||||||
xmlFieldHandle->resolveReferences();
|
xmlFieldHandle->resolveReferences();
|
||||||
|
@ -329,7 +329,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
EnumMapper()
|
EnumMapper()
|
||||||
: m_defaultValueIsSet( false )
|
: m_defaultValue( T() )
|
||||||
|
, m_defaultValueIsSet( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef DataType FieldDataType;
|
typedef DataType FieldDataType;
|
||||||
PdmDataValueField() {}
|
PdmDataValueField()
|
||||||
|
: m_fieldValue( DataType() )
|
||||||
|
, m_defaultFieldValue( DataType() )
|
||||||
|
{
|
||||||
|
}
|
||||||
PdmDataValueField( const PdmDataValueField& other ) { m_fieldValue = other.m_fieldValue; }
|
PdmDataValueField( const PdmDataValueField& other ) { m_fieldValue = other.m_fieldValue; }
|
||||||
explicit PdmDataValueField( const DataType& fieldValue ) { m_fieldValue = fieldValue; }
|
explicit PdmDataValueField( const DataType& fieldValue ) { m_fieldValue = fieldValue; }
|
||||||
~PdmDataValueField() override {}
|
~PdmDataValueField() override {}
|
||||||
|
@ -66,8 +66,8 @@ IconProvider::IconProvider( const QString& iconResourceString, const QSize& pref
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
caf::IconProvider::IconProvider( const QPixmap& pixmap )
|
caf::IconProvider::IconProvider( const QPixmap& pixmap )
|
||||||
: m_active( true )
|
: m_active( true )
|
||||||
, m_pixmap( new QPixmap( pixmap ) )
|
|
||||||
, m_preferredSize( pixmap.size() )
|
, m_preferredSize( pixmap.size() )
|
||||||
|
, m_pixmap( new QPixmap( pixmap ) )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ namespace caf
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
PdmUi3dObjectEditorHandle::PdmUi3dObjectEditorHandle()
|
PdmUi3dObjectEditorHandle::PdmUi3dObjectEditorHandle()
|
||||||
|
: m_isInComparisonView( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,9 @@ void PdmUiFieldHandle::notifyFieldChanged( const QVariant& oldFieldValue, const
|
|||||||
{
|
{
|
||||||
PdmUiEditorHandle* editorContainingThisField = editorForThisField->topMostContainingEditor();
|
PdmUiEditorHandle* editorContainingThisField = editorForThisField->topMostContainingEditor();
|
||||||
|
|
||||||
bool editorContainingThisFieldIsNotUpdated = !uiObjHandle->hasEditor( editorContainingThisField );
|
bool editorContainingThisFieldIsNotUpdated = false;
|
||||||
|
if ( uiObjHandle )
|
||||||
|
editorContainingThisFieldIsNotUpdated = !uiObjHandle->hasEditor( editorContainingThisField );
|
||||||
|
|
||||||
if ( noOwnerObject || editorContainingThisFieldIsNotUpdated )
|
if ( noOwnerObject || editorContainingThisFieldIsNotUpdated )
|
||||||
{
|
{
|
||||||
|
@ -61,6 +61,7 @@ PdmUiItemInfo::PdmUiItemInfo( const QString& uiName,
|
|||||||
, m_isReadOnly( false )
|
, m_isReadOnly( false )
|
||||||
, m_labelAlignment( LEFT )
|
, m_labelAlignment( LEFT )
|
||||||
, m_isCustomContextMenuEnabled( false )
|
, m_isCustomContextMenuEnabled( false )
|
||||||
|
, m_notifyAllFieldsInMultiFieldChangedEvents( -1 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ PdmUiItemInfo::PdmUiItemInfo( const QString& uiName,
|
|||||||
, m_isReadOnly( false )
|
, m_isReadOnly( false )
|
||||||
, m_labelAlignment( LEFT )
|
, m_labelAlignment( LEFT )
|
||||||
, m_isCustomContextMenuEnabled( false )
|
, m_isCustomContextMenuEnabled( false )
|
||||||
|
, m_notifyAllFieldsInMultiFieldChangedEvents( -1 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,10 +9,9 @@ namespace caf
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmFieldIOHelper::skipCharactersAndComments( QXmlStreamReader& xmlStream )
|
void PdmFieldIOHelper::skipCharactersAndComments( QXmlStreamReader& xmlStream )
|
||||||
{
|
{
|
||||||
QXmlStreamReader::TokenType type;
|
while ( !xmlStream.atEnd() && ( xmlStream.isCharacters() || xmlStream.isComment() ) )
|
||||||
while ( !xmlStream.atEnd() && xmlStream.isCharacters() || xmlStream.isComment() )
|
|
||||||
{
|
{
|
||||||
type = xmlStream.readNext();
|
xmlStream.readNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,10 +20,9 @@ void PdmFieldIOHelper::skipCharactersAndComments( QXmlStreamReader& xmlStream )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmFieldIOHelper::skipComments( QXmlStreamReader& xmlStream )
|
void PdmFieldIOHelper::skipComments( QXmlStreamReader& xmlStream )
|
||||||
{
|
{
|
||||||
QXmlStreamReader::TokenType type;
|
|
||||||
while ( !xmlStream.atEnd() && xmlStream.isComment() )
|
while ( !xmlStream.atEnd() && xmlStream.isComment() )
|
||||||
{
|
{
|
||||||
type = xmlStream.readNext();
|
xmlStream.readNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,8 +290,11 @@ void caf::PdmFieldXmlCap<caf::PdmChildField<DataType*>>::readFieldData( QXmlStre
|
|||||||
std::cout << "Line " << xmlStream.lineNumber()
|
std::cout << "Line " << xmlStream.lineNumber()
|
||||||
<< ": Warning: Unknown object type with class name: " << className.toLatin1().data()
|
<< ": Warning: Unknown object type with class name: " << className.toLatin1().data()
|
||||||
<< " found while reading the field : " << m_field->keyword().toLatin1().data() << std::endl;
|
<< " found while reading the field : " << m_field->keyword().toLatin1().data() << std::endl;
|
||||||
std::cout << " Expected class name: " << xmlObject->classKeyword().toLatin1().data()
|
if ( xmlObject )
|
||||||
<< std::endl;
|
{
|
||||||
|
std::cout << " Expected class name: " << xmlObject->classKeyword().toLatin1().data();
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
|
||||||
xmlStream.skipCurrentElement(); // Skip to the endelement of the object we was supposed to read
|
xmlStream.skipCurrentElement(); // Skip to the endelement of the object we was supposed to read
|
||||||
xmlStream.skipCurrentElement(); // Skip to the endelement of this field
|
xmlStream.skipCurrentElement(); // Skip to the endelement of this field
|
||||||
|
@ -16,8 +16,7 @@ void PdmFieldReader<QString>::readFieldData( QString& field, QXmlStreamReader& x
|
|||||||
field = xmlStream.text().toString();
|
field = xmlStream.text().toString();
|
||||||
|
|
||||||
// Make stream point to end of element
|
// Make stream point to end of element
|
||||||
QXmlStreamReader::TokenType type;
|
xmlStream.readNext();
|
||||||
type = xmlStream.readNext();
|
|
||||||
PdmFieldIOHelper::skipCharactersAndComments( xmlStream );
|
PdmFieldIOHelper::skipCharactersAndComments( xmlStream );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,8 +84,7 @@ void PdmXmlObjectHandle::readFields( QXmlStreamReader& xmlStream, PdmObjectFacto
|
|||||||
// readFieldData assumes that the xmlStream points to first token of field content.
|
// readFieldData assumes that the xmlStream points to first token of field content.
|
||||||
// After reading, the xmlStream is supposed to point to the first token after the field
|
// After reading, the xmlStream is supposed to point to the first token after the field
|
||||||
// content. (typically an "endElement")
|
// content. (typically an "endElement")
|
||||||
QXmlStreamReader::TokenType tt;
|
xmlStream.readNext();
|
||||||
tt = xmlStream.readNext();
|
|
||||||
xmlFieldHandle->readFieldData( xmlStream, objectFactory );
|
xmlFieldHandle->readFieldData( xmlStream, objectFactory );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -179,9 +178,8 @@ void PdmXmlObjectHandle::readObjectFromXmlString( const QString& xmlString, PdmO
|
|||||||
|
|
||||||
QXmlStreamReader inputStream( xmlString );
|
QXmlStreamReader inputStream( xmlString );
|
||||||
|
|
||||||
QXmlStreamReader::TokenType tt;
|
inputStream.readNext(); // Start of document
|
||||||
tt = inputStream.readNext(); // Start of document
|
inputStream.readNext();
|
||||||
tt = inputStream.readNext();
|
|
||||||
QString classKeyword = inputStream.name().toString();
|
QString classKeyword = inputStream.name().toString();
|
||||||
CAF_ASSERT( classKeyword == this->classKeyword() );
|
CAF_ASSERT( classKeyword == this->classKeyword() );
|
||||||
|
|
||||||
@ -197,9 +195,8 @@ PdmObjectHandle* PdmXmlObjectHandle::readUnknownObjectFromXmlString( const QStri
|
|||||||
{
|
{
|
||||||
QXmlStreamReader inputStream( xmlString );
|
QXmlStreamReader inputStream( xmlString );
|
||||||
|
|
||||||
QXmlStreamReader::TokenType tt;
|
inputStream.readNext(); // Start of document
|
||||||
tt = inputStream.readNext(); // Start of document
|
inputStream.readNext();
|
||||||
tt = inputStream.readNext();
|
|
||||||
QString classKeyword = inputStream.name().toString();
|
QString classKeyword = inputStream.name().toString();
|
||||||
PdmObjectHandle* newObject = objectFactory->create( classKeyword );
|
PdmObjectHandle* newObject = objectFactory->create( classKeyword );
|
||||||
|
|
||||||
@ -243,9 +240,8 @@ caf::PdmObjectHandle* PdmXmlObjectHandle::copyAndCastByXmlSerialization( const Q
|
|||||||
|
|
||||||
QXmlStreamReader inputStream( xmlString );
|
QXmlStreamReader inputStream( xmlString );
|
||||||
|
|
||||||
QXmlStreamReader::TokenType tt;
|
inputStream.readNext(); // Start of document
|
||||||
tt = inputStream.readNext(); // Start of document
|
inputStream.readNext();
|
||||||
tt = inputStream.readNext();
|
|
||||||
QString classKeyword = inputStream.name().toString();
|
QString classKeyword = inputStream.name().toString();
|
||||||
CAF_ASSERT( classKeyword == sourceClassKeyword );
|
CAF_ASSERT( classKeyword == sourceClassKeyword );
|
||||||
|
|
||||||
|
@ -66,8 +66,9 @@ namespace caf
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
CustomObjectEditor::CustomObjectEditor()
|
CustomObjectEditor::CustomObjectEditor()
|
||||||
{
|
{
|
||||||
m_columnCount = 3;
|
m_columnCount = 3;
|
||||||
m_rowCount = 2;
|
m_rowCount = 2;
|
||||||
|
m_currentCellId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -155,8 +156,6 @@ void CustomObjectEditor::recursivelyConfigureAndUpdateTopLevelUiOrdering(const P
|
|||||||
{
|
{
|
||||||
resetCellId();
|
resetCellId();
|
||||||
|
|
||||||
QWidget* previousTabOrderWidget = nullptr;
|
|
||||||
|
|
||||||
const std::vector<PdmUiOrdering::FieldAndLayout>& topLevelUiItems = topLevelUiOrdering.uiItemsWithLayout();
|
const std::vector<PdmUiOrdering::FieldAndLayout>& topLevelUiItems = topLevelUiOrdering.uiItemsWithLayout();
|
||||||
|
|
||||||
for (size_t i = 0; i < topLevelUiItems.size(); ++i)
|
for (size_t i = 0; i < topLevelUiItems.size(); ++i)
|
||||||
|
@ -993,8 +993,6 @@ public:
|
|||||||
group1->add(&m_doubleField);
|
group1->add(&m_doubleField);
|
||||||
caf::PdmUiGroup* group2 = uiOrdering.addNewGroup("Name2");
|
caf::PdmUiGroup* group2 = uiOrdering.addNewGroup("Name2");
|
||||||
group2->add(&m_intField);
|
group2->add(&m_intField);
|
||||||
caf::PdmUiGroup* group3 = group2->addNewGroup("Name3");
|
|
||||||
// group3->add(&m_textField);
|
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields();
|
uiOrdering.skipRemainingFields();
|
||||||
}
|
}
|
||||||
@ -1557,8 +1555,7 @@ void MainWindow::slotSimpleSelectionChanged()
|
|||||||
{
|
{
|
||||||
std::vector<caf::PdmUiItem*> selection;
|
std::vector<caf::PdmUiItem*> selection;
|
||||||
m_pdmUiTreeView->selectedUiItems(selection);
|
m_pdmUiTreeView->selectedUiItems(selection);
|
||||||
caf::PdmObjectHandle* obj = nullptr;
|
caf::PdmObjectHandle* obj = nullptr;
|
||||||
caf::PdmChildArrayFieldHandle* listField = nullptr;
|
|
||||||
|
|
||||||
if (selection.size())
|
if (selection.size())
|
||||||
{
|
{
|
||||||
@ -1576,7 +1573,6 @@ void MainWindow::slotShowTableView()
|
|||||||
{
|
{
|
||||||
std::vector<caf::PdmUiItem*> selection;
|
std::vector<caf::PdmUiItem*> selection;
|
||||||
m_pdmUiTreeView2->selectedUiItems(selection);
|
m_pdmUiTreeView2->selectedUiItems(selection);
|
||||||
caf::PdmObjectHandle* obj = nullptr;
|
|
||||||
caf::PdmUiFieldHandle* uiFieldHandle = nullptr;
|
caf::PdmUiFieldHandle* uiFieldHandle = nullptr;
|
||||||
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = nullptr;
|
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = nullptr;
|
||||||
|
|
||||||
|
@ -46,7 +46,10 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
MenuItemProducer::MenuItemProducer() {}
|
MenuItemProducer::MenuItemProducer()
|
||||||
|
: m_textPosition(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
@ -208,7 +208,7 @@ void QMinimizePanel::enableFrame( bool showFrame )
|
|||||||
{
|
{
|
||||||
if ( showFrame )
|
if ( showFrame )
|
||||||
{
|
{
|
||||||
this->setFrameStyle( QFrame::StyledPanel | QFrame::Plain );
|
this->setFrameStyle( static_cast<int>( QFrame::StyledPanel ) | static_cast<int>( QFrame::Plain ) );
|
||||||
m_titleFrame->show();
|
m_titleFrame->show();
|
||||||
m_titleLabel->show();
|
m_titleLabel->show();
|
||||||
m_collapseButton->show();
|
m_collapseButton->show();
|
||||||
@ -384,7 +384,7 @@ void QMinimizePanel::toggleExpanded()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void QMinimizePanel::initialize( const QString& title )
|
void QMinimizePanel::initialize( const QString& title )
|
||||||
{
|
{
|
||||||
this->setFrameStyle( QFrame::StyledPanel | QFrame::Plain );
|
this->setFrameStyle( static_cast<int>( QFrame::StyledPanel ) | static_cast<int>( QFrame::Plain ) );
|
||||||
QVBoxLayout* fullLayout = new QVBoxLayout( this );
|
QVBoxLayout* fullLayout = new QVBoxLayout( this );
|
||||||
|
|
||||||
fullLayout->setContentsMargins( 0, 0, 0, 0 );
|
fullLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||||
@ -403,7 +403,7 @@ void QMinimizePanel::initialize( const QString& title )
|
|||||||
{
|
{
|
||||||
m_titleLabel = new QLabel( title );
|
m_titleLabel = new QLabel( title );
|
||||||
QPalette titleLabelPalette = m_titleLabel->palette();
|
QPalette titleLabelPalette = m_titleLabel->palette();
|
||||||
titleLabelPalette.setBrush( QPalette::Foreground, titleLabelPalette.windowText() );
|
titleLabelPalette.setBrush( QPalette::WindowText, titleLabelPalette.windowText() );
|
||||||
m_titleLabel->setPalette( titleLabelPalette );
|
m_titleLabel->setPalette( titleLabelPalette );
|
||||||
titleLayout->addWidget( m_titleLabel, 1, Qt::AlignLeft );
|
titleLayout->addWidget( m_titleLabel, 1, Qt::AlignLeft );
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,8 @@ void PdmUiActionPushButtonEditor::configureAndUpdateUi( const QString& uiConfigN
|
|||||||
{
|
{
|
||||||
m_pushButton->setText( uiField()->uiName( uiConfigName ) );
|
m_pushButton->setText( uiField()->uiName( uiConfigName ) );
|
||||||
QFontMetrics fontMetr = m_pushButton->fontMetrics();
|
QFontMetrics fontMetr = m_pushButton->fontMetrics();
|
||||||
m_pushButton->setMaximumWidth( fontMetr.width( m_pushButton->text() ) + 2 * fontMetr.width( "M" ) );
|
m_pushButton->setMaximumWidth( fontMetr.horizontalAdvance( m_pushButton->text() ) +
|
||||||
|
2 * fontMetr.horizontalAdvance( "M" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant variantFieldValue = uiField()->uiValue();
|
QVariant variantFieldValue = uiField()->uiValue();
|
||||||
|
@ -204,7 +204,7 @@ QWidget* PdmUiTreeViewEditor::createWidget( QWidget* parent )
|
|||||||
m_treeView->setModel( m_filterModel );
|
m_treeView->setModel( m_filterModel );
|
||||||
m_treeView->installEventFilter( this );
|
m_treeView->installEventFilter( this );
|
||||||
|
|
||||||
m_delegate = new PdmUiTreeViewItemDelegate( this, m_filterModel );
|
m_delegate = new PdmUiTreeViewItemDelegate( this );
|
||||||
|
|
||||||
m_treeView->setItemDelegate( m_delegate );
|
m_treeView->setItemDelegate( m_delegate );
|
||||||
|
|
||||||
|
@ -62,10 +62,9 @@ namespace caf
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
PdmUiTreeViewItemDelegate::PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent, QAbstractItemModel* model )
|
PdmUiTreeViewItemDelegate::PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent )
|
||||||
: QStyledItemDelegate( parent->treeView() )
|
: QStyledItemDelegate( parent->treeView() )
|
||||||
, m_treeView( parent )
|
, m_treeView( parent )
|
||||||
, m_model( model )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class PdmUiTreeViewEditor;
|
|||||||
class PdmUiTreeViewItemDelegate : public QStyledItemDelegate
|
class PdmUiTreeViewItemDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent, QAbstractItemModel* model );
|
PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent );
|
||||||
void clearTags( QModelIndex index );
|
void clearTags( QModelIndex index );
|
||||||
void clearAllTags();
|
void clearAllTags();
|
||||||
void addTag( QModelIndex index, std::unique_ptr<PdmUiTreeViewItemAttribute::Tag> tag );
|
void addTag( QModelIndex index, std::unique_ptr<PdmUiTreeViewItemAttribute::Tag> tag );
|
||||||
@ -77,7 +77,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PdmUiTreeViewEditor* m_treeView;
|
PdmUiTreeViewEditor* m_treeView;
|
||||||
QAbstractItemModel* m_model;
|
|
||||||
|
|
||||||
std::map<QModelIndex, std::vector<std::unique_ptr<PdmUiTreeViewItemAttribute::Tag>>> m_tags;
|
std::map<QModelIndex, std::vector<std::unique_ptr<PdmUiTreeViewItemAttribute::Tag>>> m_tags;
|
||||||
};
|
};
|
||||||
|
@ -375,12 +375,11 @@ void openDebugWindow()
|
|||||||
#pragma warning( disable : 4996 )
|
#pragma warning( disable : 4996 )
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
|
|
||||||
FILE* consoleFilePointer;
|
FILE* consoleFilePointer;
|
||||||
errno_t err;
|
|
||||||
|
|
||||||
err = freopen_s( &consoleFilePointer, "conin$", "r", stdin );
|
freopen_s( &consoleFilePointer, "conin$", "r", stdin );
|
||||||
err = freopen_s( &consoleFilePointer, "conout$", "w", stdout );
|
freopen_s( &consoleFilePointer, "conout$", "w", stdout );
|
||||||
err = freopen_s( &consoleFilePointer, "conout$", "w", stderr );
|
freopen_s( &consoleFilePointer, "conout$", "w", stderr );
|
||||||
|
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
@ -54,7 +55,7 @@ class UiProcess : public QProcess
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTime m_timer;
|
QElapsedTimer m_timer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit UiProcess( QObject* pParent = nullptr );
|
explicit UiProcess( QObject* pParent = nullptr );
|
||||||
|
@ -60,9 +60,10 @@ caf::TrackBallBasedNavigation::TrackBallBasedNavigation()
|
|||||||
, m_isZooming( false )
|
, m_isZooming( false )
|
||||||
, m_lastPosX( 0 )
|
, m_lastPosX( 0 )
|
||||||
, m_lastPosY( 0 )
|
, m_lastPosY( 0 )
|
||||||
|
, m_consumeEvents( false )
|
||||||
|
, m_isRotationEnabled( false )
|
||||||
, m_lastWheelZoomPosX( -1 )
|
, m_lastWheelZoomPosX( -1 )
|
||||||
, m_lastWheelZoomPosY( -1 )
|
, m_lastWheelZoomPosY( -1 )
|
||||||
, m_consumeEvents( false )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +53,10 @@ class RotationSensitivityCalculator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RotationSensitivityCalculator()
|
RotationSensitivityCalculator()
|
||||||
: m_lastPosX( 0 )
|
: m_isEnabled( false )
|
||||||
|
, m_lastPosX( 0 )
|
||||||
, m_lastPosY( 0 )
|
, m_lastPosY( 0 )
|
||||||
, m_lastMouseVelocityLenght( 200 )
|
, m_lastMouseVelocityLenght( 200 )
|
||||||
, m_isEnabled( false )
|
|
||||||
, m_fixedSensitivity( std::numeric_limits<double>::infinity() )
|
, m_fixedSensitivity( std::numeric_limits<double>::infinity() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ private:
|
|||||||
bool m_isEnabled;
|
bool m_isEnabled;
|
||||||
int m_lastPosX; /// Previous mouse position
|
int m_lastPosX; /// Previous mouse position
|
||||||
int m_lastPosY;
|
int m_lastPosY;
|
||||||
unsigned long m_lastTime;
|
unsigned long m_lastTime{};
|
||||||
double m_lastMouseVelocityLenght;
|
double m_lastMouseVelocityLenght;
|
||||||
double m_fixedSensitivity;
|
double m_fixedSensitivity;
|
||||||
};
|
};
|
||||||
|
@ -121,17 +121,18 @@ caf::Viewer::Viewer( const QGLFormat& format, QWidget* parent )
|
|||||||
, m_defaultPerspectiveNearPlaneDistance( 0.05 )
|
, m_defaultPerspectiveNearPlaneDistance( 0.05 )
|
||||||
, m_maxClipPlaneDistance( cvf::UNDEFINED_DOUBLE )
|
, m_maxClipPlaneDistance( cvf::UNDEFINED_DOUBLE )
|
||||||
, m_cameraFieldOfViewYDeg( 40.0 )
|
, m_cameraFieldOfViewYDeg( 40.0 )
|
||||||
|
, m_showPerfInfoHud( false )
|
||||||
, m_paintCounter( 0 )
|
, m_paintCounter( 0 )
|
||||||
, m_releaseOGLResourcesEachFrame( false )
|
, m_releaseOGLResourcesEachFrame( false )
|
||||||
, m_isOverlayPaintingEnabled( true )
|
, m_isOverlayPaintingEnabled( true )
|
||||||
, m_offscreenViewportWidth( 0 )
|
, m_animationControl( nullptr )
|
||||||
, m_offscreenViewportHeight( 0 )
|
|
||||||
, m_parallelProjectionLightDirection( 0, 0, -1 )
|
|
||||||
, // Light directly from behind
|
|
||||||
m_comparisonViewOffset( 0, 0, 0 )
|
|
||||||
, m_comparisonWindowNormalizedRect( 0.5f, 0.0f, 0.5f, 1.0f )
|
|
||||||
, m_isComparisonFollowingAnimation( true )
|
, m_isComparisonFollowingAnimation( true )
|
||||||
, m_isComparisonViewActiveFlag( false )
|
, m_isComparisonViewActiveFlag( false )
|
||||||
|
, m_comparisonViewOffset( 0, 0, 0 )
|
||||||
|
, m_comparisonWindowNormalizedRect( 0.5f, 0.0f, 0.5f, 1.0f )
|
||||||
|
, m_parallelProjectionLightDirection( 0, 0, -1 )
|
||||||
|
, m_offscreenViewportWidth( 0 )
|
||||||
|
, m_offscreenViewportHeight( 0 )
|
||||||
{
|
{
|
||||||
m_layoutWidget = new QWidget( parent );
|
m_layoutWidget = new QWidget( parent );
|
||||||
|
|
||||||
@ -1588,8 +1589,7 @@ void caf::Viewer::enableParallelProjection( bool enableOrtho )
|
|||||||
Vec3d eye, vrp, up;
|
Vec3d eye, vrp, up;
|
||||||
m_mainCamera->toLookAt( &eye, &vrp, &up );
|
m_mainCamera->toLookAt( &eye, &vrp, &up );
|
||||||
|
|
||||||
Vec3d eyeToFocus = pointOfInterest - eye;
|
Vec3d camDir = vrp - eye;
|
||||||
Vec3d camDir = vrp - eye;
|
|
||||||
camDir.normalize();
|
camDir.normalize();
|
||||||
|
|
||||||
double distToFocusPlane = 0.5 * ( m_mainCamera->farPlane() - m_mainCamera->nearPlane() );
|
double distToFocusPlane = 0.5 * ( m_mainCamera->farPlane() - m_mainCamera->nearPlane() );
|
||||||
|
@ -12,7 +12,7 @@ static const char TranspWB_CombinationFrag_inl[] =
|
|||||||
"// Weighted Blended Order-Independent Transparency \n"
|
"// Weighted Blended Order-Independent Transparency \n"
|
||||||
"// Morgan McGuire and Louis Bavoil NVIDIA \n"
|
"// Morgan McGuire and Louis Bavoil NVIDIA \n"
|
||||||
"// Journal of Computer Graphics Techniques Vol. 2, No. 2, 2013 \n"
|
"// Journal of Computer Graphics Techniques Vol. 2, No. 2, 2013 \n"
|
||||||
"// Adapted by Jacob Støren to fit with a pure combination pass with no blending \n"
|
"// Adapted by Jacob Storen to fit with a pure combination pass with no blending \n"
|
||||||
"//-------------------------------------------------------------------------------------- \n"
|
"//-------------------------------------------------------------------------------------- \n"
|
||||||
" \n"
|
" \n"
|
||||||
"#extension GL_ARB_texture_rectangle : enable \n"
|
"#extension GL_ARB_texture_rectangle : enable \n"
|
||||||
|
@ -41,8 +41,8 @@ namespace caf
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
CategoryLegend::CategoryLegend( Font* font, const CategoryMapper* categoryMapper )
|
CategoryLegend::CategoryLegend( Font* font, const CategoryMapper* categoryMapper )
|
||||||
: TitledOverlayFrame( font, 200, 200 )
|
: TitledOverlayFrame( font, 200, 200 )
|
||||||
|
, m_layout( Vec2ui( 200u, 200u ) )
|
||||||
, m_categoryMapper( categoryMapper )
|
, m_categoryMapper( categoryMapper )
|
||||||
, m_Layout( Vec2ui( 200u, 200u ) )
|
|
||||||
{
|
{
|
||||||
CVF_ASSERT( font );
|
CVF_ASSERT( font );
|
||||||
CVF_ASSERT( !font->isEmpty() );
|
CVF_ASSERT( !font->isEmpty() );
|
||||||
@ -129,13 +129,12 @@ void CategoryLegend::renderGeneric( OpenGLContext* oglContext, const Vec2i& posi
|
|||||||
camera.applyOpenGL();
|
camera.applyOpenGL();
|
||||||
camera.viewport()->applyOpenGL( oglContext, Viewport::CLEAR_DEPTH );
|
camera.viewport()->applyOpenGL( oglContext, Viewport::CLEAR_DEPTH );
|
||||||
|
|
||||||
m_Layout = OverlayColorLegendLayoutInfo( size );
|
m_layout = OverlayColorLegendLayoutInfo( size );
|
||||||
layoutInfo( &m_Layout );
|
layoutInfo( &m_layout );
|
||||||
m_textDrawer = new TextDrawer( this->font() );
|
m_textDrawer = new TextDrawer( this->font() );
|
||||||
|
|
||||||
// Set up text drawer
|
// Set up text drawer
|
||||||
float maxLegendRightPos = 0;
|
setupTextDrawer( m_textDrawer.p(), &m_layout );
|
||||||
setupTextDrawer( m_textDrawer.p(), &m_Layout );
|
|
||||||
|
|
||||||
Vec2f backgroundSize( size );
|
Vec2f backgroundSize( size );
|
||||||
|
|
||||||
@ -147,7 +146,7 @@ void CategoryLegend::renderGeneric( OpenGLContext* oglContext, const Vec2i& posi
|
|||||||
backgroundSize,
|
backgroundSize,
|
||||||
this->backgroundColor(),
|
this->backgroundColor(),
|
||||||
this->backgroundFrameColor() );
|
this->backgroundFrameColor() );
|
||||||
renderLegendImmediateMode( oglContext, &m_Layout );
|
renderLegendImmediateMode( oglContext, &m_layout );
|
||||||
m_textDrawer->renderSoftware( oglContext, camera );
|
m_textDrawer->renderSoftware( oglContext, camera );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -159,7 +158,7 @@ void CategoryLegend::renderGeneric( OpenGLContext* oglContext, const Vec2i& posi
|
|||||||
backgroundSize,
|
backgroundSize,
|
||||||
this->backgroundColor(),
|
this->backgroundColor(),
|
||||||
this->backgroundFrameColor() );
|
this->backgroundFrameColor() );
|
||||||
renderLegendUsingShaders( oglContext, &m_Layout, matrixState );
|
renderLegendUsingShaders( oglContext, &m_layout, matrixState );
|
||||||
m_textDrawer->render( oglContext, camera );
|
m_textDrawer->render( oglContext, camera );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<bool> m_visibleCategoryLabels; // Skip labels ending up on top of previous visible label
|
std::vector<bool> m_visibleCategoryLabels; // Skip labels ending up on top of previous visible label
|
||||||
OverlayColorLegendLayoutInfo m_Layout;
|
OverlayColorLegendLayoutInfo m_layout;
|
||||||
cvf::ref<cvf::TextDrawer> m_textDrawer;
|
cvf::ref<cvf::TextDrawer> m_textDrawer;
|
||||||
cvf::cref<CategoryMapper> m_categoryMapper;
|
cvf::cref<CategoryMapper> m_categoryMapper;
|
||||||
};
|
};
|
||||||
|
@ -186,33 +186,30 @@ bool HexGridIntersectionTools::planeTriangleIntersection( const cvf::Plane& plan
|
|||||||
CVF_ASSERT( false );
|
CVF_ASSERT( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok1 = false;
|
|
||||||
bool ok2 = false;
|
|
||||||
|
|
||||||
if ( topVx == 1 )
|
if ( topVx == 1 )
|
||||||
{
|
{
|
||||||
ok1 = planeLineIntersect( plane, p1, p2, &( ( *newVx1 ).vx ), &( ( *newVx1 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
planeLineIntersect( plane, p1, p2, &( ( *newVx1 ).vx ), &( ( *newVx1 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
||||||
( *newVx1 ).clippedEdgeVx1Id = p1Id;
|
( *newVx1 ).clippedEdgeVx1Id = p1Id;
|
||||||
( *newVx1 ).clippedEdgeVx2Id = p2Id;
|
( *newVx1 ).clippedEdgeVx2Id = p2Id;
|
||||||
ok2 = planeLineIntersect( plane, p1, p3, &( ( *newVx2 ).vx ), &( ( *newVx2 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
planeLineIntersect( plane, p1, p3, &( ( *newVx2 ).vx ), &( ( *newVx2 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
||||||
( *newVx2 ).clippedEdgeVx1Id = p1Id;
|
( *newVx2 ).clippedEdgeVx1Id = p1Id;
|
||||||
( *newVx2 ).clippedEdgeVx2Id = p3Id;
|
( *newVx2 ).clippedEdgeVx2Id = p3Id;
|
||||||
}
|
}
|
||||||
else if ( topVx == 2 )
|
else if ( topVx == 2 )
|
||||||
{
|
{
|
||||||
ok1 = planeLineIntersect( plane, p2, p3, &( ( *newVx1 ).vx ), &( ( *newVx1 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
planeLineIntersect( plane, p2, p3, &( ( *newVx1 ).vx ), &( ( *newVx1 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
||||||
( *newVx1 ).clippedEdgeVx1Id = p2Id;
|
( *newVx1 ).clippedEdgeVx1Id = p2Id;
|
||||||
( *newVx1 ).clippedEdgeVx2Id = p3Id;
|
( *newVx1 ).clippedEdgeVx2Id = p3Id;
|
||||||
ok2 = planeLineIntersect( plane, p2, p1, &( ( *newVx2 ).vx ), &( ( *newVx2 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
planeLineIntersect( plane, p2, p1, &( ( *newVx2 ).vx ), &( ( *newVx2 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
||||||
( *newVx2 ).clippedEdgeVx1Id = p2Id;
|
( *newVx2 ).clippedEdgeVx1Id = p2Id;
|
||||||
( *newVx2 ).clippedEdgeVx2Id = p1Id;
|
( *newVx2 ).clippedEdgeVx2Id = p1Id;
|
||||||
}
|
}
|
||||||
else if ( topVx == 3 )
|
else if ( topVx == 3 )
|
||||||
{
|
{
|
||||||
ok1 = planeLineIntersect( plane, p3, p1, &( ( *newVx1 ).vx ), &( ( *newVx1 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
planeLineIntersect( plane, p3, p1, &( ( *newVx1 ).vx ), &( ( *newVx1 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
||||||
( *newVx1 ).clippedEdgeVx1Id = p3Id;
|
( *newVx1 ).clippedEdgeVx1Id = p3Id;
|
||||||
( *newVx1 ).clippedEdgeVx2Id = p1Id;
|
( *newVx1 ).clippedEdgeVx2Id = p1Id;
|
||||||
ok2 = planeLineIntersect( plane, p3, p2, &( ( *newVx2 ).vx ), &( ( *newVx2 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
planeLineIntersect( plane, p3, p2, &( ( *newVx2 ).vx ), &( ( *newVx2 ).normDistFromEdgeVx1 ), nonDimensionalTolerance );
|
||||||
( *newVx2 ).clippedEdgeVx1Id = p3Id;
|
( *newVx2 ).clippedEdgeVx1Id = p3Id;
|
||||||
( *newVx2 ).clippedEdgeVx2Id = p2Id;
|
( *newVx2 ).clippedEdgeVx2Id = p2Id;
|
||||||
}
|
}
|
||||||
@ -221,8 +218,6 @@ bool HexGridIntersectionTools::planeTriangleIntersection( const cvf::Plane& plan
|
|||||||
CVF_ASSERT( false );
|
CVF_ASSERT( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// CVF_TIGHT_ASSERT(ok1 && ok2);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,6 @@ void OverlayScalarMapperLegend::renderGeneric( OpenGLContext* oglContext, const
|
|||||||
m_textDrawer = new TextDrawer( this->font() );
|
m_textDrawer = new TextDrawer( this->font() );
|
||||||
|
|
||||||
// Set up text drawer
|
// Set up text drawer
|
||||||
float maxLegendRightPos = 0;
|
|
||||||
setupTextDrawer( m_textDrawer.p(), &m_Layout );
|
setupTextDrawer( m_textDrawer.p(), &m_Layout );
|
||||||
|
|
||||||
Vec2f backgroundSize( size );
|
Vec2f backgroundSize( size );
|
||||||
|
@ -88,9 +88,9 @@ OverlayScaleLegend::OverlayScaleLegend( Font* font )
|
|||||||
: TitledOverlayFrame( font, 200, 200 )
|
: TitledOverlayFrame( font, 200, 200 )
|
||||||
, m_tickNumberPrecision( 4 )
|
, m_tickNumberPrecision( 4 )
|
||||||
, m_numberFormat( AUTO )
|
, m_numberFormat( AUTO )
|
||||||
, m_Layout( Vec2ui( 200u, 200u ) )
|
|
||||||
, m_font( font )
|
|
||||||
, m_orientation( HORIZONTAL )
|
, m_orientation( HORIZONTAL )
|
||||||
|
, m_layout( Vec2ui( 200u, 200u ) )
|
||||||
|
, m_font( font )
|
||||||
, m_currentScale( 1.0 )
|
, m_currentScale( 1.0 )
|
||||||
{
|
{
|
||||||
CVF_ASSERT( font );
|
CVF_ASSERT( font );
|
||||||
@ -138,16 +138,15 @@ void OverlayScaleLegend::renderGeneric( OpenGLContext* oglContext, const Vec2i&
|
|||||||
camera.applyOpenGL();
|
camera.applyOpenGL();
|
||||||
camera.viewport()->applyOpenGL( oglContext, Viewport::CLEAR_DEPTH );
|
camera.viewport()->applyOpenGL( oglContext, Viewport::CLEAR_DEPTH );
|
||||||
|
|
||||||
m_Layout = LayoutInfo( size );
|
m_layout = LayoutInfo( size );
|
||||||
layoutInfo( &m_Layout );
|
layoutInfo( &m_layout );
|
||||||
m_textDrawer = new TextDrawer( this->font() );
|
m_textDrawer = new TextDrawer( this->font() );
|
||||||
|
|
||||||
// Set up text drawer
|
// Set up text drawer
|
||||||
float maxLegendRightPos = 0;
|
|
||||||
if ( m_orientation == HORIZONTAL )
|
if ( m_orientation == HORIZONTAL )
|
||||||
setupHorizontalTextDrawer( m_textDrawer.p(), &m_Layout );
|
setupHorizontalTextDrawer( m_textDrawer.p(), &m_layout );
|
||||||
else
|
else
|
||||||
setupVerticalTextDrawer( m_textDrawer.p(), &m_Layout );
|
setupVerticalTextDrawer( m_textDrawer.p(), &m_layout );
|
||||||
|
|
||||||
Vec2f backgroundSize( size );
|
Vec2f backgroundSize( size );
|
||||||
|
|
||||||
@ -161,7 +160,7 @@ void OverlayScaleLegend::renderGeneric( OpenGLContext* oglContext, const Vec2i&
|
|||||||
this->backgroundColor(),
|
this->backgroundColor(),
|
||||||
this->backgroundFrameColor() );
|
this->backgroundFrameColor() );
|
||||||
}
|
}
|
||||||
renderLegendImmediateMode( oglContext, &m_Layout );
|
renderLegendImmediateMode( oglContext, &m_layout );
|
||||||
m_textDrawer->renderSoftware( oglContext, camera );
|
m_textDrawer->renderSoftware( oglContext, camera );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -175,7 +174,7 @@ void OverlayScaleLegend::renderGeneric( OpenGLContext* oglContext, const Vec2i&
|
|||||||
this->backgroundColor(),
|
this->backgroundColor(),
|
||||||
this->backgroundFrameColor() );
|
this->backgroundFrameColor() );
|
||||||
}
|
}
|
||||||
renderLegendUsingShaders( oglContext, &m_Layout, matrixState );
|
renderLegendUsingShaders( oglContext, &m_layout, matrixState );
|
||||||
m_textDrawer->render( oglContext, camera );
|
m_textDrawer->render( oglContext, camera );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,8 +200,6 @@ void OverlayScaleLegend::setupHorizontalTextDrawer( TextDrawer* textDrawer, cons
|
|||||||
float lastVisibleTextX = 0.0;
|
float lastVisibleTextX = 0.0;
|
||||||
|
|
||||||
size_t numTicks = layout->ticks.size();
|
size_t numTicks = layout->ticks.size();
|
||||||
size_t numMajorTicks =
|
|
||||||
std::count_if( layout->ticks.begin(), layout->ticks.end(), []( const LayoutInfo::Tick& t ) { return t.isMajor; } );
|
|
||||||
size_t it;
|
size_t it;
|
||||||
for ( it = 0; it < numTicks; it++ )
|
for ( it = 0; it < numTicks; it++ )
|
||||||
{
|
{
|
||||||
@ -344,12 +341,6 @@ void OverlayScaleLegend::renderLegendUsingShaders( OpenGLContext* oglContext, La
|
|||||||
// Per vector convenience pointers
|
// Per vector convenience pointers
|
||||||
float* v0 = &vertexArray[0];
|
float* v0 = &vertexArray[0];
|
||||||
float* v1 = &vertexArray[3];
|
float* v1 = &vertexArray[3];
|
||||||
float* v2 = &vertexArray[6];
|
|
||||||
float* v3 = &vertexArray[9];
|
|
||||||
float* v4 = &vertexArray[12];
|
|
||||||
|
|
||||||
// Connects
|
|
||||||
static const ushort trianglesConnects[] = { 0, 1, 4, 0, 4, 3 };
|
|
||||||
|
|
||||||
ref<ShaderProgram> shaderProgram = oglContext->resourceManager()->getLinkedUnlitColorShaderProgram( oglContext );
|
ref<ShaderProgram> shaderProgram = oglContext->resourceManager()->getLinkedUnlitColorShaderProgram( oglContext );
|
||||||
CVF_TIGHT_ASSERT( shaderProgram.notNull() );
|
CVF_TIGHT_ASSERT( shaderProgram.notNull() );
|
||||||
|
@ -167,7 +167,7 @@ protected:
|
|||||||
NumberFormat m_numberFormat;
|
NumberFormat m_numberFormat;
|
||||||
|
|
||||||
Orientation m_orientation;
|
Orientation m_orientation;
|
||||||
LayoutInfo m_Layout;
|
LayoutInfo m_layout;
|
||||||
cvf::ref<TextDrawer> m_textDrawer;
|
cvf::ref<TextDrawer> m_textDrawer;
|
||||||
|
|
||||||
cvf::ref<Font> m_font;
|
cvf::ref<Font> m_font;
|
||||||
|
@ -48,14 +48,14 @@ namespace caf
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
TitledOverlayFrame::TitledOverlayFrame( Font* font, unsigned int width, unsigned int height )
|
TitledOverlayFrame::TitledOverlayFrame( Font* font, unsigned int width, unsigned int height )
|
||||||
: m_font( font )
|
: m_renderSize( width, height )
|
||||||
, m_renderSize( width, height )
|
|
||||||
, m_textColor( Color3::BLACK )
|
, m_textColor( Color3::BLACK )
|
||||||
, m_lineColor( Color3::BLACK )
|
, m_lineColor( Color3::BLACK )
|
||||||
, m_lineWidth( 1 )
|
, m_lineWidth( 1 )
|
||||||
, m_isBackgroundEnabled( true )
|
, m_isBackgroundEnabled( true )
|
||||||
, m_backgroundColor( 1.0f, 1.0f, 1.0f, 0.8f )
|
, m_backgroundColor( 1.0f, 1.0f, 1.0f, 0.8f )
|
||||||
, m_backgroundFrameColor( 0.0f, 0.0f, 0.0f, 0.5f )
|
, m_backgroundFrameColor( 0.0f, 0.0f, 0.0f, 0.5f )
|
||||||
|
, m_font( font )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user