Beispiel #1
0
int main(int argc, const char *argv[])
{
    int flag=0;
    while(1)
    {
        info();
        scanf("%d",&flag);
        getchar();
        if(flag==1)
        {
            print_b();    
            continu();
        }
        if(flag==2)
        {
            mul();
            continu();
        }
        if(flag==3)
        {
            flag=0;
            exchange_s();
            continu();
        }
        if(flag==4)
        {
            encryption();
            continu();
        }
        if(flag==5)
        {
            break;
        }
    }
    return 0;
}
bool GLC_WorldTo3dxml::exportTo3dxml(const QString& filename, GLC_WorldTo3dxml::ExportType exportType, bool exportMaterial)
{
	m_3dxmlFileSet.clear();
	m_ListOfOverLoadedOccurence.clear();
	m_FileNameIncrement= 0;
	m_ExportMaterial= exportMaterial;
	m_FileName= filename;
	m_ExportType= exportType;
	bool isExported= false;
	if (m_ExportType == Compressed3dxml)
	{
		m_p3dxmlArchive= new QuaZip(m_FileName);
		isExported= m_p3dxmlArchive->open(QuaZip::mdCreate);
		// Add the manifest
		addManifest();

	}
	else
	{
		m_AbsolutePath= QFileInfo(m_FileName).absolutePath() + QDir::separator();
		QFile exportFile(m_FileName);
		isExported= exportFile.open(QIODevice::WriteOnly);
		exportFile.close();
	}
	if (isExported)
	{
		if (m_ExportMaterial && (m_ExportType != StructureOnly))
		{
			writeAllMaterialRelatedFilesIn3dxml();
		}

		// Export the assembly structure from the list of structure reference
		exportAssemblyStructure();

		if (m_ExportType != StructureOnly)
		{
			int previousQuantumValue= 0;
			int currentQuantumValue= 0;
			emit currentQuantum(currentQuantumValue);

			int currentRepIndex= 0;
			const int size= m_ReferenceRepTo3dxmlFileName.size();
			// Export the representation
			QHash<const GLC_3DRep*, QString>::const_iterator iRep= m_ReferenceRepTo3dxmlFileName.constBegin();
			while ((m_ReferenceRepTo3dxmlFileName.constEnd() != iRep) && continu())
			{
				write3DRep(iRep.key(), iRep.value());
				++iRep;

				// Progrees bar indicator
				++currentRepIndex;
				currentQuantumValue = static_cast<int>((static_cast<double>(currentRepIndex) / size) * 100);
				if (currentQuantumValue > previousQuantumValue)
				{
					emit currentQuantum(currentQuantumValue);
				}
				previousQuantumValue= currentQuantumValue;
				if (!m_IsThreaded)
				{
					QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
				}
			}
		}
	}

	emit currentQuantum(100);
	return isExported;
}