logplus/logPlus/LogmudResultItem.cpp

177 lines
3.3 KiB
C++

#include "LogmudResultItem.h"
#include <QtGlobal>
LogmudResultItem::LogmudResultItem()
:Order(0)
,depth(0)
,Number(0)
,type(1)
,BH(0)
,WH(0)
,DH(0)
,A(0)
,B(0)
,C(0)
,D(0)
,LABEL_X(0)
,LABEL_Y(0)
{
m_BeginDotPos=-1,m_EndDotPos=-1;
memset(&CoreValues,0,sizeof(CoreValues));
memset(RATION_Y,0,sizeof(RATION_Y));
for (int i=0;i<30;i++)
{
m_time[i]=-1;
m_tVvalue[i]=-1;
}
}
void LogmudResultItem::SetOrder(int order)
{
Order=order;
}
int LogmudResultItem::GetOrder()
{
return Order;
}
void LogmudResultItem::SetNumber(double dep)
{
Number=dep;
// SetDepthRange(dep,dep);
// if(m_discreteLog) m_discreteLog->SaveToSLF();
}
double LogmudResultItem::GetNumber()
{
return Number;
}
void LogmudResultItem::SetCoreValue(float v)
{
// CoreValue=v;
}
float LogmudResultItem::GetCoreValue()
{
return 0;//CoreValue;
}
LogmudResultItem::LogmudResultItem( double topDepth, double bottomDepth )
:Order(0)
,depth(0)
,Number(topDepth)
,type(1)
,BH(0)
,WH(0)
,DH(0)
,A(0)
,B(0)
,C(0)
,D(0)
,LABEL_X(0)
,LABEL_Y(0)
{
m_topDepth=topDepth;
m_bottomDepth=bottomDepth;
m_BeginDotPos=-1,m_EndDotPos=-1;
memset(&CoreValues,0,sizeof(CoreValues));
memset(RATION_Y,0,sizeof(RATION_Y));
for (int i=0;i<30;i++)
{
m_time[i]=-1;
m_tVvalue[i]=-1;
}
}
LogmudResultItem::~LogmudResultItem()
{
}
bool LogmudResultItem::ContainTextItem( double depth,double sideWidth,double boundingWidth)
{
return (depth >=m_topDepth-CoreHeight/2) && (m_bottomDepth+CoreHeight/2 )>= depth;
}
bool LogmudResultItem::operator< (const LogmudResultItem& other)
{
float top = (int)(other.m_topDepth * 1000 + 0.5) / 1000.;
float bottom = (int)(m_bottomDepth * 1000 + 0.5) / 1000.;
float top0 = (int)(m_topDepth * 1000 + 0.5) / 1000.;
return (top - m_bottomDepth) > 0.05 ||
(qAbs(bottom - top) < 0.05 && (top - top0) > 0.05);
}
bool LogmudResultItem::operator> (const LogmudResultItem& other)
{ //TODO check this
float top = (int)(other.m_topDepth * 1000 + 0.5) / 1000.;
float bottom = (int)(other.m_bottomDepth * 1000 + 0.5) / 1000.;
float top1 = (int)(m_topDepth * 1000 + 0.5) / 1000.;
float bottom1 = (int)(m_bottomDepth * 1000 + 0.5) / 1000.;
return (top1 - top) > 0.05 ||
(qAbs(top1 - bottom) < 0.05 && (top1 - top) > 0.05);
}
bool LogmudResultItem::operator== (const LogmudResultItem& other)
{
return fabs(other.Number-Number)<1e-10;
}
bool LogmudResultItem::Contains(double depth) const
{
depth = (int)(depth * 1000 + 0.5) / 1000.0;
if (m_topDepth == m_bottomDepth)
{
return qAbs(m_topDepth - depth) < 0.001;
}
if (qAbs(m_topDepth - depth) < 0.05 || qAbs(m_bottomDepth - depth) < 0.05) return false;
return depth > m_topDepth && m_bottomDepth > depth;
}
void LogmudResultItem::SetDepth( double _depth )
{
depth=_depth;
// if(m_discreteLog) m_discreteLog->SaveToSLF();
// emit signalCorePropertyChanged();
}
double LogmudResultItem::GetDepth()
{
return depth;
}
int ViewInfoLogmud::GetLogarithmic()
{
return m_nLogarithmic;
}
int ViewInfoLogmud::GetTLogarithmic()
{
return m_nTLogarithmic;
}
int ViewInfoLogmud::GetxGrid()
{
return m_xGrid;
}
int ViewInfoLogmud::GetyGrid()
{
return m_yGrid;
}
QColor ViewInfoLogmud::GetColor()
{
return m_Color;
}
void ViewInfoLogmud::SetLogarithmic(int nAxis)
{
m_nLogarithmic = nAxis;
}
void ViewInfoLogmud::SetTLogarithmic(int nAxis)
{
m_nTLogarithmic = nAxis;
}