(#266) Added geometry for grid box faces

Added legend lines and text
This commit is contained in:
Magne Sjaastad
2015-11-17 13:11:54 +01:00
parent 83d1c0c411
commit 7ff7f42adc
12 changed files with 955 additions and 19 deletions
@@ -0,0 +1,118 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "cvfCollection.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfScalarMapperDiscreteLinear.h"
namespace cvf
{
class Camera;
}
//==================================================================================================
//
//
//==================================================================================================
class RivGridBoxGenerator
{
public:
RivGridBoxGenerator();
void setTransform(cvf::Transform* scaleTransform);
void setBoundingBox(const cvf::BoundingBox& boundingBox);
void createGridBoxParts();
void updateFromCamera(const cvf::Camera* camera);
cvf::Model* model();
private:
enum AxisType
{
X_AXIS,
Y_AXIS,
Z_AXIS
};
enum FaceType
{
POS_X,
NEG_X,
POS_Y,
NEG_Y,
POS_Z,
NEG_Z
};
enum EdgeType
{
POS_Z_POS_X,
POS_Z_NEG_X,
POS_Z_POS_Y,
POS_Z_NEG_Y,
NEG_Z_POS_X,
NEG_Z_NEG_X,
NEG_Z_POS_Y,
NEG_Z_NEG_Y,
POS_X_POS_Y,
POS_X_NEG_Y,
NEG_X_POS_Y,
NEG_X_NEG_Y
};
private:
void createGridBoxSideParts();
void createGridBoxLegendParts();
void createLegend(EdgeType edge, cvf::Collection<cvf::Part>* parts);
cvf::Vec3f sideNormalOutwards(FaceType face);
cvf::Vec3d pointOnSide(FaceType face);
cvf::Vec3f cornerDirection(FaceType face1, FaceType face2);
private:
cvf::Collection<cvf::Part> m_gridBoxSideParts;
cvf::Collection<cvf::Part> m_gridBoxLegendParts;
cvf::ref<cvf::ModelBasicList> m_gridBoxModel;
cvf::ref<cvf::Transform> m_scaleTransform;
cvf::BoundingBox m_boundingBox;
cvf::ref<cvf::ScalarMapperDiscreteLinear> m_linDiscreteScalarMapper;
std::vector<double> m_xValues;
std::vector<double> m_yValues;
std::vector<double> m_zValues;
};