Exemplo n.º 1
0
SequenceAnnotation* createSequenceAnnotation(Document* doc, const char* uri) {
	if (!doc || !uri || isSBOLObjectURI(doc, uri))
	    return NULL;
	SequenceAnnotation* ann = malloc(sizeof(SequenceAnnotation));
	ann->doc          = doc;
	ann->base         = createSBOLObject(doc, uri);
	ann->genbankStart = createPositionProperty();
	ann->genbankEnd   = createPositionProperty();
	//ann->strand       = 1;
	ann->strand       = createPolarityProperty();
	ann->subComponent = NULL;
	ann->precedes = createPointerArray();
	registerSequenceAnnotation(ann);
	return ann;
}
//-*****************************************************************************
void OCurvesSchema::init( const AbcA::index_t iTsIdx, bool isSparse )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "OCurvesSchema::init()" );

    m_selectiveExport = isSparse;

    m_numSamples = 0;

    m_timeSamplingIndex = iTsIdx;

    if ( m_selectiveExport )
    {
        return;
    }

    createPositionProperty();
    createVertexProperties();

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
//-*****************************************************************************
void OCurvesSchema::selectiveSet( const OCurvesSchema::Sample &iSamp )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "OCurvesSchema::selectiveSet()" );

    Alembic::Util::uint8_t basisAndType[4];
    calcBasisAndType( basisAndType, iSamp );

    if ( iSamp.getPositions() && !m_positionsProperty )
    {
        createPositionProperty();
    }

    if ( m_positionsProperty )
    {
        SetPropUsePrevIfNull( m_positionsProperty, iSamp.getPositions() );

        if ( iSamp.getSelfBounds().hasVolume() )
        {
            m_selfBoundsProperty.set( iSamp.getSelfBounds() );
        }
        else if ( iSamp.getPositions() )
        {
            Abc::Box3d bnds(
                ComputeBoundsFromPositions( iSamp.getPositions() ) );
            m_selfBoundsProperty.set( bnds );
        }
        else
        {
            m_selfBoundsProperty.setFromPrevious();
        }
    }

    if( iSamp.getCurvesNumVertices() && !m_nVerticesProperty )
    {
        createVertexProperties();
    }

    if( m_nVerticesProperty )
    {
        SetPropUsePrevIfNull( m_nVerticesProperty, iSamp.getCurvesNumVertices() );
        m_basisAndTypeProperty.set( basisAndType );
    }

    if ( iSamp.getVelocities() && !m_velocitiesProperty )
    {
        createVelocityProperty();
    }

    if ( m_velocitiesProperty )
    {
        SetPropUsePrevIfNull( m_velocitiesProperty, iSamp.getVelocities() );
    }

    if ( iSamp.getUVs() && !m_uvsParam )
    {
        createUVsProperty( iSamp );
    }

    if ( m_uvsParam )
    {
        m_uvsParam.set( iSamp.getUVs() );
    }

    if ( iSamp.getNormals() && !m_normalsParam )
    {
        createNormalsProperty( iSamp );
    }

    if ( m_normalsParam )
    {
        m_normalsParam.set( iSamp.getNormals() );
    }

    if ( iSamp.getWidths().getVals() && !m_widthsParam )
    {
        createWidthProperty( iSamp );
    }

    if ( m_widthsParam )
    {
        m_widthsParam.set( iSamp.getWidths() );
    }

    if ( iSamp.getPositionWeights() && !m_positionWeightsProperty)
    {
        createPositionWeightsProperty();
    }

    if ( m_positionWeightsProperty )
    {
        SetPropUsePrevIfNull( m_positionWeightsProperty,
                              iSamp.getPositionWeights() );
    }

    if ( iSamp.getOrders() && !m_ordersProperty)
    {
        createOrdersProperty();
    }

    if ( m_ordersProperty )
    {
        SetPropUsePrevIfNull( m_ordersProperty, iSamp.getOrders() );
    }

    if ( iSamp.getKnots() && !m_knotsProperty)
    {
        createKnotsProperty();
    }

    if ( m_knotsProperty )
    {
        SetPropUsePrevIfNull( m_knotsProperty, iSamp.getKnots() );
    }

    m_numSamples++;

    ALEMBIC_ABC_SAFE_CALL_END();
}