Example #1
0
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
// ---- serialization
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
void Shape::toString( QString& objectAsString )
{
	objectAsString = QString( "%1;%2;%3;%4;%5;%6;%7" );

	objectAsString = objectAsString.arg( getShapeName() );

	objectAsString = objectAsString.arg( getText() );
	objectAsString = objectAsString.arg( QString("%1,%2,%3").arg( getTextColor().red() ).arg( getTextColor().green() ).arg( getTextColor().blue() ) );

	objectAsString = objectAsString.arg( QString("%1,%2,%3").arg( getLineColor().red() ).arg( getLineColor().green() ).arg( getLineColor().blue() ) );
	objectAsString = objectAsString.arg( QString("%1,%2,%3").arg( getFillColor().red() ).arg( getFillColor().green() ).arg( getFillColor().blue() ) );

	objectAsString = objectAsString.arg
	(
		QString("%1,%2")		.arg( getScenePosition().x() )
							.arg( getScenePosition().y() )
	);

	objectAsString = objectAsString.arg
	(
		QString("%1,%2,%3,%4")	.arg( getGeometry().x()		)
							.arg( getGeometry().y() 		)
							.arg( getGeometry().width()		)
							.arg( getGeometry().height()	)
	);
}
Example #2
0
/**
 * @brief SimSpacial::init
 */
void SimSpacial::init(vleVpm *vpm)
{
    mVpm = vpm;

    QString fileName =  vpm->getFilename();

    QString currentDir = QDir::currentPath() += "/";

    fileName.replace(currentDir, "");

    QString pkgName = fileName.split("/").at(0);

    QString shapeName = getShapeName(vpm);

    mShapeFilename = QString("%1/%2/data/%3")
                       .arg(QDir::currentPath())
                       .arg(pkgName)
                       .arg(shapeName);

    try {
        mShapeFile.open(mShapeFilename);

        if ( ! getWidget())
            throw -3;

        mWidgetTab->setVpm(vpm);
        mWidgetTab->setFile(&mShapeFile);
    } catch(...) {
        qDebug() << "Shape init failed !" << fileName << " " << pkgName << "  " << shapeName << " " << mShapeFilename << " " ;
//<< *mCurrPackage->getDataDir().c_str();
    }
}
	// initialize the visualization name w.r.t. the shape name and an index
	string PCPrimitive::getVisualizationNameFromTag( int idx){
		return( getShapeName() + DEFAULT_VISUALIZATION_NAME_SEPARATOR + boost::to_string( idx));
	}