mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3540 Create seperate 2d view with parallel, look down and linked views
This commit is contained in:
@@ -68,7 +68,8 @@ RivWindowEdgeAxesOverlayItem::RivWindowEdgeAxesOverlayItem(Font* font)
|
||||
m_frameColor(Color3::WHITE),
|
||||
m_lineWidth(1),
|
||||
m_font(font),
|
||||
m_isSwitchingYAxisValueSign(true)
|
||||
m_isSwitchingYAxisValueSign(true),
|
||||
m_domainAxes(XZ_AXES)
|
||||
{
|
||||
CVF_ASSERT(font);
|
||||
CVF_ASSERT(!font->isEmpty());
|
||||
@@ -99,7 +100,7 @@ void RivWindowEdgeAxesOverlayItem::setDisplayCoordTransform(const caf::DisplayCo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWindowEdgeAxesOverlayItem::updateGeomerySizes()
|
||||
{
|
||||
String str = String::number(99999.0);
|
||||
String str = String::number(-1.999e-17);
|
||||
m_textSize = m_font->textExtent(str);
|
||||
m_pixelSpacing = 2.0f;
|
||||
m_tickLineLength = m_textSize.y() *0.3f;
|
||||
@@ -137,8 +138,8 @@ void RivWindowEdgeAxesOverlayItem::updateFromCamera(const Camera* camera)
|
||||
double domainMinX = windowOrigoInDomain.x();
|
||||
double domainMaxX = windowMaxInDomain.x();
|
||||
|
||||
double domainMinY = windowOrigoInDomain.z();
|
||||
double domainMaxY = windowMaxInDomain.z();
|
||||
double domainMinY = m_domainAxes == XY_AXES ? windowOrigoInDomain.y() : windowOrigoInDomain.z();
|
||||
double domainMaxY = m_domainAxes == XY_AXES ? windowMaxInDomain.y() : windowMaxInDomain.z();
|
||||
|
||||
int xTickMaxCount = m_windowSize.x()/(2*m_textSize.x());
|
||||
int yTickMaxCount = m_windowSize.y()/(2*m_textSize.x());
|
||||
@@ -156,7 +157,15 @@ void RivWindowEdgeAxesOverlayItem::updateFromCamera(const Camera* camera)
|
||||
Vec3d windowPoint;
|
||||
for (double domainX : m_domainCoordsXValues)
|
||||
{
|
||||
Vec3d displayDomainTick(domainX, 0, domainMinY);
|
||||
Vec3d displayDomainTick;
|
||||
if (m_domainAxes == XY_AXES)
|
||||
{
|
||||
displayDomainTick = Vec3d(domainX, domainMinY, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayDomainTick = Vec3d(domainX, 0, domainMinY);
|
||||
}
|
||||
if ( m_dispalyCoordsTransform.notNull() )
|
||||
{
|
||||
displayDomainTick = m_dispalyCoordsTransform->transformToDisplayCoord(displayDomainTick);
|
||||
@@ -168,7 +177,17 @@ void RivWindowEdgeAxesOverlayItem::updateFromCamera(const Camera* camera)
|
||||
m_windowTickYValues.clear();
|
||||
for (double domainY : m_domainCoordsYValues)
|
||||
{
|
||||
Vec3d displayDomainTick(domainMinX, 0, domainY);
|
||||
Vec3d displayDomainTick;
|
||||
|
||||
if (m_domainAxes == XY_AXES)
|
||||
{
|
||||
displayDomainTick = Vec3d(domainMinX, domainY, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayDomainTick = Vec3d(domainMinX, 0, domainY);
|
||||
}
|
||||
|
||||
if ( m_dispalyCoordsTransform.notNull() )
|
||||
{
|
||||
displayDomainTick = m_dispalyCoordsTransform->transformToDisplayCoord(displayDomainTick);
|
||||
@@ -614,3 +633,19 @@ const Color3f& RivWindowEdgeAxesOverlayItem::lineColor() const
|
||||
return m_lineColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWindowEdgeAxesOverlayItem::setDomainAxes(DomainAxes axes)
|
||||
{
|
||||
m_domainAxes = axes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWindowEdgeAxesOverlayItem::setIsSwitchingYAxisSign(bool switchSign)
|
||||
{
|
||||
m_isSwitchingYAxisValueSign = switchSign;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,13 @@ class RivWindowEdgeAxesOverlayItem : public cvf::OverlayItem
|
||||
using TextDrawer = cvf::TextDrawer;
|
||||
using Camera = cvf::Camera;
|
||||
public:
|
||||
enum DomainAxes
|
||||
{
|
||||
XY_AXES,
|
||||
XZ_AXES
|
||||
};
|
||||
public:
|
||||
|
||||
RivWindowEdgeAxesOverlayItem(Font* font);
|
||||
~RivWindowEdgeAxesOverlayItem() override;
|
||||
|
||||
@@ -93,7 +100,8 @@ public:
|
||||
void setLineColor(const Color3f& lineColor);
|
||||
const Color3f& lineColor() const;
|
||||
void setFrameColor(const Color4f& frameColor);
|
||||
|
||||
void setDomainAxes(DomainAxes axes);
|
||||
void setIsSwitchingYAxisSign(bool switchSign);
|
||||
int frameBorderWidth() { return static_cast<int>( m_frameBorderWidth); }
|
||||
int frameBorderHeight() { return static_cast<int>( m_frameBorderHeight); }
|
||||
|
||||
@@ -127,6 +135,7 @@ private:
|
||||
float m_tickLineLength;
|
||||
float m_pixelSpacing;
|
||||
bool m_isSwitchingYAxisValueSign;
|
||||
DomainAxes m_domainAxes;
|
||||
|
||||
std::vector<double> m_domainCoordsXValues;
|
||||
std::vector<double> m_domainCoordsYValues;
|
||||
|
||||
Reference in New Issue
Block a user