XMLElem ComplexXMLParser10x::convertSCPCOAToXML(
    const SCPCOA* scpcoa, XMLElem parent) const
{
    XMLElem scpcoaXML = ComplexXMLParser::convertSCPCOAToXML(scpcoa, parent);

    //! Added in 1.0.0
    createDouble("AzimAng", scpcoa->azimAngle, scpcoaXML);
    createDouble("LayoverAng", scpcoa->layoverAngle, scpcoaXML);
    return scpcoaXML;
}
XMLElem ComplexXMLParser040::convertRMATToXML(
    const RMAT* rmat,
    XMLElem rmaXML) const
{
    createString("ImageType", "RMAT", rmaXML);

    XMLElem rmatXML = newElement("RMAT", rmaXML);

    createDouble("RMRefTime", rmat->refTime, rmatXML);
    common().createVector3D("RMPosRef", rmat->refPos, rmatXML);
    common().createVector3D("RMVelRef", rmat->refVel, rmatXML);
    common().createPoly2D("CosDCACOAPoly", rmat->cosDCACOAPoly, rmatXML);
    createDouble("Kx1", rmat->kx1, rmatXML);
    createDouble("Kx2", rmat->kx2, rmatXML);
    createDouble("Ky1", rmat->ky1, rmatXML);
    createDouble("Ky2", rmat->ky2, rmatXML);

    return rmatXML;
}
XMLElem ComplexXMLParser10x::convertRMATToXML(
    const RMAT* rmat, 
    XMLElem rmaXML) const
{
    createString("ImageType", "RMAT", rmaXML);

    XMLElem rmatXML = newElement("RMAT", rmaXML);

    common().createVector3D("PosRef", rmat->refPos, rmatXML);
    common().createVector3D("VelRef", rmat->refVel, rmatXML);
    createDouble("DopConeAngRef", rmat->dopConeAngleRef, rmatXML);

    return rmatXML;
}
XMLElem ComplexXMLParser10x::convertImageFormationToXML(
    const ImageFormation* imageFormation, 
    XMLElem parent) const
{
    //! this segment was recreated completely because the ordering of
    //! a lot of the variables has been updated
    XMLElem imageFormationXML = newElement("ImageFormation", parent);

    convertRcvChanProcToXML("1.0", imageFormation->rcvChannelProcessed.get(), 
                            imageFormationXML);

    createString("TxRcvPolarizationProc",
                 six::toString(imageFormation->txRcvPolarizationProc),
                 imageFormationXML);

    createDouble("TStartProc", imageFormation->tStartProc, imageFormationXML);
    createDouble("TEndProc", imageFormation->tEndProc, imageFormationXML);

    XMLElem txFreqXML = newElement("TxFrequencyProc", imageFormationXML);
    createDouble("MinProc", imageFormation->txFrequencyProcMin, txFreqXML);
    createDouble("MaxProc", imageFormation->txFrequencyProcMax, txFreqXML);

    //! updated location in 1.0.0
    if (!imageFormation->segmentIdentifier.empty())
        createString("SegmentIdentifier", imageFormation->segmentIdentifier,
                     imageFormationXML);

    createString("ImageFormAlgo",
                 six::toString(imageFormation->imageFormationAlgorithm),
                 imageFormationXML);

    createString("STBeamComp",
                 six::toString(imageFormation->slowTimeBeamCompensation),
                 imageFormationXML);
    createString("ImageBeamComp",
                 six::toString(imageFormation->imageBeamCompensation),
                 imageFormationXML);
    createString("AzAutofocus",
                 six::toString(imageFormation->azimuthAutofocus),
                 imageFormationXML);
    createString("RgAutofocus", six::toString(imageFormation->rangeAutofocus),
                 imageFormationXML);

    for (unsigned int i = 0; i < imageFormation->processing.size(); ++i)
    {
        const Processing* proc = &imageFormation->processing[i];

        XMLElem procXML = newElement("Processing", imageFormationXML);

        createString("Type", proc->type, procXML);
        require(createBooleanType("Applied", proc->applied, procXML), "Applied");
        common().addParameters("Parameter", proc->parameters, procXML);
    }

    if (imageFormation->polarizationCalibration.get())
    {
        XMLElem pcXML =
                newElement("PolarizationCalibration", imageFormationXML);

        require(createBooleanType("DistortCorrectionApplied",
                                  imageFormation ->polarizationCalibration->
                                  distortionCorrectionApplied,
                                  pcXML), "DistortCorrectionApplied");

        convertDistortionToXML("1.0", 
            imageFormation->polarizationCalibration->distortion.get(),
            pcXML);
    }
    return imageFormationXML;
}
Example #5
0
void XMLizer::writeFilter( QDomDocument &document, QDomNode &parent, bool audio, QSharedPointer<Filter> f )
{
	QString s = audio ? "AudioFilter" : "VideoFilter";
	QDomElement n1 = document.createElement( s );
	parent.appendChild( n1 );

	createText( document, n1, "Name", f->getIdentifier() );
	createDouble( document, n1, "PosInTrack", f->getPosition() );
	if ( f->getPositionOffset() > 0 )
		createDouble( document, n1, "PosOffset", f->getPositionOffset() );
	createDouble( document, n1, "Length", f->getLength() );
	createInt( document, n1, "SnapMode", f->getSnap() );
	
	QList<Parameter*> params = f->getParameters();
	for ( int i = 0; i < params.count(); ++i ) {
		Parameter *p = params[i];
		QDomElement pel = document.createElement( "Parameter" );
		n1.appendChild( pel );
		pel.setAttribute( "name", p->id );
		switch ( p->type ) {
			case Parameter::PDOUBLE: {
				pel.setAttribute( "type", "double" );
				pel.setAttribute( "value", QString::number( p->value.toDouble(), 'e', 17 ) );
				break;
			}
			case Parameter::PINPUTDOUBLE: {
				pel.setAttribute( "type", "inputdouble" );
				pel.setAttribute( "value", QString::number( p->value.toDouble(), 'e', 17 ) );
				break;
			}
			case Parameter::PINT: {
				pel.setAttribute( "type", "int" );
				pel.setAttribute( "value", QString::number( p->value.toInt() ) );
				break;
			}
			case Parameter::PBOOL: {
				pel.setAttribute( "type", "bool" );
				pel.setAttribute( "value", QString::number( p->value.toInt() ) );
				break;
			}
			case Parameter::PRGBCOLOR: {
				pel.setAttribute( "type", "rgb" );
				pel.setAttribute( "value", p->value.value<QColor>().name() );
				break;
			}
			case Parameter::PRGBACOLOR: {
				QColor col = p->value.value<QColor>();
				pel.setAttribute( "type", "rgba" );
				pel.setAttribute( "value", col.name() + "." + QString::number( col.alpha() ) );
				break;
			}
			case Parameter::PCOLORWHEEL: {
				QColor col = p->value.value<QColor>();
				pel.setAttribute( "type", "colorwheel" );
				pel.setAttribute( "value", QString::number( col.blueF(), 'e', 17 ) );
				pel.setAttribute( "hue", QString::number( col.redF(), 'e', 17 ) );
				pel.setAttribute( "saturation", QString::number( col.greenF(), 'e', 17 ) );
				break;
			}
			case Parameter::PSTRING: {
				pel.setAttribute( "type", "string" );
				pel.setAttribute( "value", p->value.toString().replace( "\n", QString::fromUtf8("ΒΆ") ) );
				break;
			}
			case Parameter::PSHADEREDIT: {
				pel.setAttribute( "type", "shader" );
				pel.setAttribute( "value", Parameter::getShaderName( p->value.toString() ) );
				break;
			}
			case Parameter::PSTATUS: {
				pel.setAttribute( "type", "status" );
				pel.setAttribute( "value", "" );
				break;
			}
		}
		
		for ( int i = 0; i < p->graph.keys.count(); ++i ) {
			QDomElement ke = document.createElement( "Key" );
			pel.appendChild( ke );
			QString type;
			switch ( p->graph.keys[i].keyType ) {
				case AnimationKey::CONSTANT: type = "constant"; break;
				case AnimationKey::CURVE: type = "curve"; break;
				default: type = "linear";
			}
			ke.setAttribute( "type", type );
			ke.setAttribute( "position", QString::number( p->graph.keys[i].x, 'e', 17 ) );
			ke.setAttribute( "value", QString::number( p->getUnnormalizedKeyValue( i ), 'e', 17 ) );
		}
	}
}