Ejemplo n.º 1
0
FdoByteArray* SpatialContextTest::SerializeExtent( double minX, double minY, double maxX, double maxY )
{
    // Create a byte array 
  	FdoPtr<FdoFgfGeometryFactory>  gf = FdoFgfGeometryFactory::GetInstance();
    FdoPtr<FdoIEnvelope>            env = gf->CreateEnvelopeXY(minX, minY, maxX, maxY );  
    FdoPtr<FdoIGeometry>            geom = gf->CreateGeometry(env); 

    return( gf->GetFgf(geom) );
}
bool FdoXmlSpatialContextReader::ReadNext()
{
    FdoXmlSaxContextP context = FdoXmlSaxContext::Create( mXmlReader );

    // Clear out extents for previously read spatial context
    mExtent = NULL;

    // Re-initialze the read handler so the next spatial context can be read.
    mSCHandler->Setup( mXmlFlags );

    // Read the next spatial context from XML.
    mXmlReader->Parse( this, context, true );

    context->ThrowErrors();

    if ( mSCHandler->mSCName.GetLength() > 0 ) {
        // A spatial context was found. Convert extents to byte array.
 	    FdoPtr<FdoFgfGeometryFactory>  gf = FdoFgfGeometryFactory::GetInstance();
        FdoPtr<FdoIEnvelope>            env = gf->CreateEnvelopeXY(
                                                mSCHandler->mMinX, 
                                                mSCHandler->mMinY, 
                                                mSCHandler->mMaxX, 
                                                mSCHandler->mMaxY 
                                              ); 

        FdoPtr<FdoIGeometry>            geom = gf->CreateGeometry(env); 

        mExtent =  gf->GetFgf(geom);
        mSCHandler->mFirst = false;

        return true;
    }
    else {
        // No spatial context found. We're done reading.
        return false;
    }
}