Beispiel #1
0
//---------------------------------------------------------
CSG_String CSG_Matrix::asString(int Width, int Precision, bool bScientific)	const
{
	CSG_String	s;

	for(int y=0, n=SG_Get_Digit_Count(m_ny + 1); y<m_ny; y++)
	{
		s	+= CSG_String::Format(SG_T("%0*d:"), n, y + 1);

		for(int x=0; x<m_nx; x++)
		{
			s	+= "\t" + SG_Get_Double_asString(m_z[y][x], Width, Precision, bScientific);
		}

		s	+= "\n";
	}

	return( s );
}
Beispiel #2
0
//---------------------------------------------------------
bool CCMD_Module::_Save_Output(CSG_Parameters *pParameters)
{
    for(int j=0; j<pParameters->Get_Count(); j++)
    {
        wxString		FileName;

        CSG_Parameter	*pParameter	= pParameters->Get_Parameter(j);

        //-------------------------------------------------
        if( pParameter->is_Input() )
        {
            if( pParameter->is_DataObject() )
            {
                CSG_Data_Object	*pObject	= pParameter->asDataObject();

                if( pObject && pObject->is_Modified() && SG_File_Exists(pObject->Get_File_Name()) )
                {
                    pObject->Save(pObject->Get_File_Name());
                }
            }

            else if( pParameter->is_DataObject_List() )
            {
                for(int i=0; i<pParameter->asList()->Get_Count(); i++)
                {
                    CSG_Data_Object	*pObject	= pParameter->asList()->asDataObject(i);

                    if( pObject->is_Modified() && SG_File_Exists(pObject->Get_File_Name()) )
                    {
                        pObject->Save(pObject->Get_File_Name());
                    }
                }
            }
        }

        //-------------------------------------------------
        else if( pParameter->is_Output() &&  m_CMD.Found(_Get_ID(pParameter), &FileName) && FileName.Length() > 0 )
        {
            if( pParameter->is_DataObject() )
            {
                if( pParameter->asDataObject() )
                {
                    pParameter->asDataObject()->Save(&FileName);
                }
            }

            else if( pParameter->is_DataObject_List() )
            {
                CSG_Strings	FileNames;

                while( FileName.Length() > 0 )
                {
                    CSG_String	s(&FileName);
                    s = s.BeforeFirst(';');

                    if( s.Length() > 0 )
                    {
                        FileNames	+= s;
                        FileName	 = FileName.AfterFirst(';');
                    }
                    else
                    {
                        FileNames	+= &FileName;
                        FileName	.Clear();
                    }
                }

                int	nFileNames	= pParameter->asList()->Get_Count() <= FileNames.Get_Count() ? FileNames.Get_Count() : FileNames.Get_Count() - 1;

                for(int i=0; i<pParameter->asList()->Get_Count(); i++)
                {
                    if( i < nFileNames )
                    {
                        pParameter->asList()->asDataObject(i)->Save(FileNames[i]);
                    }
                    else
                    {
                        pParameter->asList()->asDataObject(i)->Save(CSG_String::Format(SG_T("%s_%0*d"),
                                FileNames[FileNames.Get_Count() - 1].c_str(),
                                SG_Get_Digit_Count(pParameter->asList()->Get_Count()),
                                1 + i - nFileNames
                                                                                      ));
                    }
                }
            }
        }
    }

    return( true );
}