mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3343 Holo Lens : Add VdeExportPart
This commit is contained in:
parent
92e7ea9947
commit
a40853dba5
@ -3,12 +3,14 @@ set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHoloLensExportToFolderFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHoloLensExportToFolderUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHoloLensExportImpl.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/VdeExportPart.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHoloLensExportToFolderFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHoloLensExportImpl.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHoloLensExportToFolderUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/VdeExportPart.cpp
|
||||
)
|
||||
|
||||
|
||||
|
@ -61,6 +61,44 @@ void RicHoloLensExportImpl::partsForExport(const RimGridView* view, cvf::Collect
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport(const RimGridView* view)
|
||||
{
|
||||
std::vector<VdeExportPart> exportParts;
|
||||
|
||||
if (view->viewer())
|
||||
{
|
||||
cvf::Scene* scene = view->viewer()->mainScene();
|
||||
if (scene)
|
||||
{
|
||||
cvf::Collection<cvf::Part> sceneParts;
|
||||
scene->allParts(&sceneParts);
|
||||
|
||||
for (auto& scenePart : sceneParts)
|
||||
{
|
||||
if (RicHoloLensExportImpl::isGrid(scenePart.p()))
|
||||
{
|
||||
VdeExportPart part(scenePart.p());
|
||||
part.setSourceObjectType(VdeExportPart::OBJ_TYPE_GRID);
|
||||
|
||||
exportParts.push_back(part);
|
||||
}
|
||||
else if (RicHoloLensExportImpl::isPipe(scenePart.p()))
|
||||
{
|
||||
VdeExportPart part(scenePart.p());
|
||||
part.setSourceObjectType(VdeExportPart::OBJ_TYPE_PIPE);
|
||||
|
||||
exportParts.push_back(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return exportParts;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfCollection.h"
|
||||
#include "VdeExportPart.h"
|
||||
|
||||
class QString;
|
||||
class RimGridView;
|
||||
@ -37,6 +38,8 @@ class RicHoloLensExportImpl
|
||||
public:
|
||||
static void partsForExport(const RimGridView* view, cvf::Collection<cvf::Part>* partCollection);
|
||||
|
||||
static std::vector<VdeExportPart> partsForExport(const RimGridView* view);
|
||||
|
||||
static QString nameFromPart(const cvf::Part* part);
|
||||
|
||||
static bool isGrid(const cvf::Part* part);
|
||||
|
91
ApplicationCode/Commands/HoloLensCommands/VdeExportPart.cpp
Normal file
91
ApplicationCode/Commands/HoloLensCommands/VdeExportPart.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "VdeExportPart.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
VdeExportPart::VdeExportPart(cvf::Part* part)
|
||||
: m_part(part)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setSourceObjectType(SourceObjectType sourceObjectType)
|
||||
{
|
||||
m_sourceObjectType = sourceObjectType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setSourceObjectName(const QString& sourceObjectName)
|
||||
{
|
||||
m_sourceObjectName = sourceObjectName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setColor(cvf::Color3ub color)
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setWinding(Winding winding)
|
||||
{
|
||||
m_winding = winding;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString VdeExportPart::sourceObjectName() const
|
||||
{
|
||||
return m_sourceObjectName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
VdeExportPart::SourceObjectType VdeExportPart::sourceObjectType() const
|
||||
{
|
||||
return m_sourceObjectType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Part* VdeExportPart::part()
|
||||
{
|
||||
return m_part.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3ub VdeExportPart::color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
67
ApplicationCode/Commands/HoloLensCommands/VdeExportPart.h
Normal file
67
ApplicationCode/Commands/HoloLensCommands/VdeExportPart.h
Normal file
@ -0,0 +1,67 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfPart.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class VdeExportPart
|
||||
{
|
||||
public:
|
||||
enum SourceObjectType
|
||||
{
|
||||
OBJ_TYPE_GRID,
|
||||
OBJ_TYPE_PIPE,
|
||||
OBJ_TYPE_GRID_MESH,
|
||||
OBJ_TYPE_UNKNOWN
|
||||
};
|
||||
|
||||
enum Winding
|
||||
{
|
||||
CLOCKWISE,
|
||||
COUNTERCLOCKWISE
|
||||
};
|
||||
|
||||
public:
|
||||
VdeExportPart(cvf::Part* part);
|
||||
|
||||
void setSourceObjectType(SourceObjectType sourceObjectType);
|
||||
void setSourceObjectName(const QString& sourceObjectName);
|
||||
void setColor(cvf::Color3ub color);
|
||||
void setWinding(Winding winding);
|
||||
|
||||
QString sourceObjectName() const;
|
||||
SourceObjectType sourceObjectType() const;
|
||||
cvf::Part* part();
|
||||
cvf::Color3ub color() const;
|
||||
Winding winding() const;
|
||||
|
||||
private:
|
||||
QString m_sourceObjectName;
|
||||
SourceObjectType m_sourceObjectType;
|
||||
cvf::Color3ub m_color;
|
||||
cvf::ref<cvf::Part> m_part;
|
||||
Winding m_winding;
|
||||
};
|
Loading…
Reference in New Issue
Block a user