Пример #1
0
void wxSheetCellFloatRendererRefData::SetParameters(const wxString& params)
{
    if ( params.IsEmpty() )
    {
        // reset to defaults
        SetWidth(-1);
        SetPrecision(-1);
    }
    else
    {
        wxString tmp( params.BeforeFirst(_T(',')) );
        if ( !tmp.IsEmpty() )
        {
            long width;
            if ( tmp.ToLong(&width) )
                SetWidth((int)width);
            else
                wxLogDebug(_T("Invalid wxSheetCellFloatRenderer width parameter string '%s ignored"), params.c_str());
        }
        tmp = params.AfterFirst(_T(','));
        if ( !tmp.IsEmpty() )
        {
            long precision;
            if ( tmp.ToLong(&precision) )
                SetPrecision((int)precision);
            else
                wxLogDebug(_T("Invalid wxSheetCellFloatRenderer precision parameter string '%s ignored"), params.c_str());
        }
    }
}
void WorkloadDistributionWidget::setupDistributionTable(){
	const ivector wlvector = this->workloads->getWorkloadVector();
	const int distLb = Lb( wlvector );
	const int distUb = Ub( wlvector );
	const int distCount = distUb - distLb + 1;

	distTable->setRowCount(distCount);

	QStringList rowHeaders;
	for (int i = distLb; i <= distUb; i++) {
		rowHeaders << QString("%1").arg(i);
	}

	distTable->setVerticalHeaderLabels(rowHeaders);

	for (int i = distLb; i <= distUb; i++) {
			stringstream strStr;
			strStr << Scientific << SetPrecision(15,16) << Sup(wlvector[i]) << endl
					<< Scientific << SetPrecision(15,16) << Inf(wlvector[i]);

			QString itemText = QString::fromStdString(strStr.str());
			QTableWidgetItem *newItem =	new QTableWidgetItem(itemText);
			distTable->setItem(i , 0 , newItem);
	}

	distTable->resizeRowsToContents();
}
Пример #3
0
BOOL XsiExp::ReadConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "rb");
	if (!cfgStream)
  {
		return FALSE;
  }

	// First item is a file version
	int fileVersion = _getw(cfgStream);

	if (fileVersion > CFG_VERSION)
  {
		// Unknown version
		fclose(cfgStream);
		return FALSE;
	}

	SetIncludeAnim(fgetc(cfgStream));
  SetIncludeVertexColors(fgetc(cfgStream));

	SetAlwaysSample(fgetc(cfgStream));
	SetMeshFrameStep(_getw(cfgStream));
	SetKeyFrameStep(_getw(cfgStream));

	SetPrecision(_getw(cfgStream));

	fclose(cfgStream);

	return TRUE;
}
Пример #4
0
START_LIBEBML_NAMESPACE

EbmlFloat::EbmlFloat(const EbmlFloat::Precision prec)
  :EbmlElement(0, false)
{
  SetPrecision(prec);
}
void
TimeFormat::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("TimeFormat");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("displayMode")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 3)
                SetDisplayMode(DisplayMode(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            DisplayMode value;
            if(DisplayMode_FromString(node->AsString(), value))
                SetDisplayMode(value);
        }
    }
    if((node = searchNode->GetNode("precision")) != 0)
        SetPrecision(node->AsInt());
}
Пример #6
0
wxGridCellFloatRenderer::wxGridCellFloatRenderer(int width,
                                                 int precision,
                                                 int format)
{
    SetWidth(width);
    SetPrecision(precision);
    SetFormat(format);
}
Пример #7
0
OGRFieldDefn::OGRFieldDefn( OGRFieldDefn *poPrototype )

{
    Initialize( poPrototype->GetNameRef(), poPrototype->GetType() );

    SetJustify( poPrototype->GetJustify() );
    SetWidth( poPrototype->GetWidth() );
    SetPrecision( poPrototype->GetPrecision() );
//    SetDefault( poPrototype->GetDefaultRef() );
}
Пример #8
0
void OGRFieldDefn::Set( const char *pszNameIn,
                        OGRFieldType eTypeIn,
                        int nWidthIn, int nPrecisionIn,
                        OGRJustification eJustifyIn )
{
    SetName( pszNameIn );
    SetType( eTypeIn );
    SetWidth( nWidthIn );
    SetPrecision( nPrecisionIn );
    SetJustify( eJustifyIn );
}
Пример #9
0
BOOL CPreStylePag::UpdateTableData(BOOL bSaveAndValidate)
{
    //保存或返回当前表数据
	double dheight;
    if(bSaveAndValidate == TRUE)//保存:将界面数据保存到内存变量
    {
        if(UpdateData(TRUE) == FALSE) return FALSE;
		if(m_dHeight<3)//pfg20050330
		{
			dheight=3;//pfg20050330
		}
		else
		{
			dheight=m_dHeight;//pfg20050330
		}
		SetRegValue(_T("Settings"), _T("标注尺寸-HEIGHT"), dheight);//PFG20050329
        pCurTable->blBackward   = m_blBackward   ;
        pCurTable->blUp2Down    = m_blUp2Down    ;
        pCurTable->blVertical   = m_blVertical   ;

        pCurTable->dHeight      = SetPrecision(m_dHeight, -2)      ;
        pCurTable->dAngle       = SetPrecision(m_dAngle, -2)       ;
        pCurTable->dScaleFactor = SetPrecision(m_dScaleFactor, -2) ;

        m_dHeight               = pCurTable->dHeight      ;
        m_dAngle                = pCurTable->dAngle       ;
        m_dScaleFactor          = pCurTable->dScaleFactor ;

        pCurTable->nBigFonts    = m_nBigFonts    ;
        pCurTable->nShxFonts    = m_nShxFonts    ;
        pCurTable->nStyle       = m_nStyle       ;
        //pCurTable->nTable     只读属性         ;
        pCurTable->nAlign       = m_nAlign       ;

        UpdateData(FALSE);
		return TRUE;
    }
    else // == FALSE,返回:将数据显示到界面上
    {
        m_blBackward   = pCurTable->blBackward   ;
        m_blUp2Down    = pCurTable->blUp2Down    ;
        m_blVertical   = pCurTable->blVertical   ;

        m_dHeight      = SetPrecision(pCurTable->dHeight, -2)      ;
        m_dAngle       = SetPrecision(pCurTable->dAngle, -2)       ;
        m_dScaleFactor = SetPrecision(pCurTable->dScaleFactor, -2) ;

        pCurTable->dHeight      = m_dHeight      ;
        pCurTable->dAngle       = m_dAngle       ;
        pCurTable->dScaleFactor = m_dScaleFactor ;

        m_nBigFonts    = pCurTable->nBigFonts    ;
        m_nShxFonts    = pCurTable->nShxFonts    ;
        m_nStyle       = pCurTable->nStyle       ;
        m_nTable       = pCurTable->nTable       ;
        m_nAlign       = pCurTable->nAlign       ;

        return UpdateData(FALSE);
    }
}
Пример #10
0
ActiveTrack::ActiveTrack()
{
    m_TimerTrack.SetOwner( this, TIMER_TRACK1 );
    m_TimerTrack.Stop();
    m_bRunning = false;

    SetPrecision( g_nTrackPrecision );

    m_prev_time = wxInvalidDateTime;
    m_lastStoredTP = NULL;

    wxDateTime now = wxDateTime::Now();
//    m_ConfigRouteNum = now.GetTicks();        // a unique number....
    trackPointState = firstPoint;
    m_lastStoredTP = NULL;
    m_removeTP = NULL;
    m_fixedTP = NULL;
    m_track_run = 0;
    m_CurrentTrackSeg = 0;
    m_prev_dist = 999.0;
}
Пример #11
0
ProcessFields::ProcessFields(Engine_Interface_Base* eng_if) : Processing(eng_if)
{
	m_DumpType = E_FIELD_DUMP;
	// vtk-file is default
	m_fileType = VTK_FILETYPE;
	m_SampleType = NONE;
	m_Vtk_Dump_File = NULL;
	m_HDF5_Dump_File = NULL;
	SetPrecision(6);
	m_dualTime = false;

	// dump box should be always inside the snapped lines
	m_SnapMethod = 1;

	for (int n=0; n<3; ++n)
	{
		numLines[n]=0;
		posLines[n]=NULL;
		discLines[n]=NULL;
		subSample[n]=1;
		optResolution[n]=0;
	}
}
Пример #12
0
ExponentialNumericControl::ExponentialNumericControl( Control& parent ) : NumericEdit( parent )
{
    SetReal();
    SetPrecision( 8 );
    SetRange( 0.0, 1.0 );

    m_coefficient.label.Hide();
    m_coefficient.slider.SetRange( 0, 180 ); // step size = 0.05
    m_coefficient.slider.SetScaledMinWidth( 250 );
    m_coefficient.SetReal();
    m_coefficient.SetRange( 1.00, 10.00 );
    m_coefficient.SetPrecision( 2 );
    m_coefficient.SetToolTip( "<p>Coefficient value in the range [1.0,9.99]</p>" );
    m_coefficient.OnValueUpdated( (NumericEdit::value_event_handler)&ExponentialNumericControl::__CoefficientValueUpdated, *this );

    m_exponent.SetRange( -8, 0 );
    m_exponent.SetToolTip( "<p>Exponent in the range [-8,0]</p>" );
    m_exponent.OnValueUpdated( (SpinBox::value_event_handler)&ExponentialNumericControl::__ExponentValueUpdated, *this );

    sizer.Add( m_coefficient, 100 );
    sizer.Add( m_exponent );

    AdjustToContents();
}
Пример #13
0
BOOL AscOut::ReadConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "rb");
	if (!cfgStream)
		return FALSE;

	// First item is a file version
	int fileVersion = _getw(cfgStream);

	if (fileVersion > CFG_VERSION) {
		// Unknown version
		fclose(cfgStream);
		return FALSE;
	}

	SetPrecision(_getw(cfgStream));

	fclose(cfgStream);

	return TRUE;
}
Пример #14
0
const PreciseDecimal& PreciseDecimal::operator=(PreciseDecimal& Dest) {
	SetPrecision(Dest.DecimalState);

	if (DecimalState == StringExact) {
		char** StringBuffer = &NumberData.StringPrecision.Integer;
		long BufferLength = strlen(Dest.NumberData.StringPrecision.Integer) + 1;
		delete [] *StringBuffer;
		(*StringBuffer) = new char[BufferLength];
		(*StringBuffer)[BufferLength - 1] = '\0';
		strncpy_s(*StringBuffer, BufferLength, Dest.NumberData.StringPrecision.Integer, BufferLength);


		StringBuffer = &NumberData.StringPrecision.Mantissa;
		BufferLength = strlen(Dest.NumberData.StringPrecision.Mantissa) + 1;
		delete [] *StringBuffer;
		(*StringBuffer) = new char[BufferLength];
		(*StringBuffer)[BufferLength - 1] = '\0';
		strcpy_s(*StringBuffer, BufferLength, Dest.NumberData.StringPrecision.Mantissa);
	}
	else {
		NumberData.RealPrecision = Dest.NumberData.RealPrecision;
	}
	return *this;
}
Пример #15
0
void wxGridCellFloatRenderer::SetParameters(const wxString& params)
{
    if ( !params )
    {
        // reset to defaults
        SetWidth(-1);
        SetPrecision(-1);
        SetFormat(wxGRID_FLOAT_FORMAT_DEFAULT);
    }
    else
    {
        wxString rest;
        wxString tmp = params.BeforeFirst(wxT(','), &rest);
        if ( !tmp.empty() )
        {
            long width;
            if ( tmp.ToLong(&width) )
            {
                SetWidth((int)width);
            }
            else
            {
                wxLogDebug(wxT("Invalid wxGridCellFloatRenderer width parameter string '%s ignored"), params.c_str());
            }
        }

        tmp = rest.BeforeFirst(wxT(','));
        if ( !tmp.empty() )
        {
            long precision;
            if ( tmp.ToLong(&precision) )
            {
                SetPrecision((int)precision);
            }
            else
            {
                wxLogDebug(wxT("Invalid wxGridCellFloatRenderer precision parameter string '%s ignored"), params.c_str());
            }
        }

        tmp = rest.AfterFirst(wxT(','));
        if ( !tmp.empty() )
        {
            if ( tmp[0] == wxT('f') )
            {
                SetFormat(wxGRID_FLOAT_FORMAT_FIXED);
            }
            else if ( tmp[0] == wxT('e') )
            {
                SetFormat(wxGRID_FLOAT_FORMAT_SCIENTIFIC);
            }
            else if ( tmp[0] == wxT('g') )
            {
                SetFormat(wxGRID_FLOAT_FORMAT_COMPACT);
            }
            else if ( tmp[0] == wxT('E') )
            {
                SetFormat(wxGRID_FLOAT_FORMAT_SCIENTIFIC |
                          wxGRID_FLOAT_FORMAT_UPPER);
            }
            else if ( tmp[0] == wxT('F') )
            {
                SetFormat(wxGRID_FLOAT_FORMAT_FIXED |
                          wxGRID_FLOAT_FORMAT_UPPER);
            }
            else if ( tmp[0] == wxT('G') )
            {
                SetFormat(wxGRID_FLOAT_FORMAT_COMPACT |
                          wxGRID_FLOAT_FORMAT_UPPER);
            }
            else
            {
                wxLogDebug("Invalid wxGridCellFloatRenderer format "
                           "parameter string '%s ignored", params);
            }
        }
    }
}
Пример #16
0
wxGridCellFloatRenderer::wxGridCellFloatRenderer(int width, int precision)
{
    SetWidth(width);
    SetPrecision(precision);
}
Пример #17
0
BaseFormat& BaseFormat::operator<<(const fmt::Precision& Manipulator)
{
    return SetPrecision(Manipulator.GetValue());
}
Пример #18
0
EbmlFloat::EbmlFloat(const double aDefaultValue, const EbmlFloat::Precision prec)
  :EbmlElement(0, true), Value(aDefaultValue), DefaultValue(aDefaultValue)
{
  SetDefaultIsSet();
  SetPrecision(prec);
}
Пример #19
0
// ----------------------------------------------------------------------------
// wxSheetCellFloatRendererRefData
// ----------------------------------------------------------------------------
bool wxSheetCellFloatRendererRefData::Copy(const wxSheetCellFloatRendererRefData &other)
{
    SetWidth(other.GetWidth());
    SetPrecision(other.GetPrecision());
    return wxSheetCellStringRendererRefData::Copy(other);
}