Example #1
0
OGRFeatureDefn * OGRJMLLayer::GetLayerDefn()
{
    if (!bHasReadSchema)
        LoadSchema();

    return poFeatureDefn;
}
Example #2
0
OGRFeatureDefn * OGRSVGLayer::GetLayerDefn()
{
    if (poFeatureDefn == NULL)
    {
        LoadSchema();
    }

    return poFeatureDefn;
}
Example #3
0
OGRFeature *OGRJMLLayer::GetNextFeature()
{
    if (!bHasReadSchema)
        LoadSchema();

    if (bStopParsing)
        return nullptr;

    if (nFeatureTabIndex < nFeatureTabLength)
    {
        return ppoFeatureTab[nFeatureTabIndex++];
    }

    if (VSIFEofL(fp))
        return nullptr;

    char aBuf[BUFSIZ];

    nFeatureTabLength = 0;
    nFeatureTabIndex = 0;

    nWithoutEventCounter = 0;

    int nDone = 0;
    do
    {
        nDataHandlerCounter = 0;
        unsigned int nLen =
                (unsigned int)VSIFReadL( aBuf, 1, sizeof(aBuf), fp );
        nDone = VSIFEofL(fp);
        if (XML_Parse(oParser, aBuf, nLen, nDone) == XML_STATUS_ERROR)
        {
            CPLError(CE_Failure, CPLE_AppDefined,
                     "XML parsing of JML file failed : %s "
                     "at line %d, column %d",
                     XML_ErrorString(XML_GetErrorCode(oParser)),
                     (int)XML_GetCurrentLineNumber(oParser),
                     (int)XML_GetCurrentColumnNumber(oParser));
            bStopParsing = true;
        }
        nWithoutEventCounter ++;
    } while (!nDone && !bStopParsing && nFeatureTabLength == 0 &&
             nWithoutEventCounter < 10);

    if (nWithoutEventCounter == 10)
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "Too much data inside one element. File probably corrupted");
        bStopParsing = true;
    }

    return (nFeatureTabLength) ? ppoFeatureTab[nFeatureTabIndex++] : nullptr;
}
void CLuaScriptVarList::Init()
{
	LoadSchema();
	
	CHashString PName = GetParentName();
	SETTABLEVALUEPARAMS stv;
	for( unsigned int i = 0; i < m_Variables.size(); i++ )
	{
		CHashString hsKey(m_Variables[i].GetName());
		CHashString hsValue(m_Variables[i].GetValueAsString());
		CHashString hsType(m_Variables[i].GetType());
		stv.TableKey = &hsKey;
		stv.TableValue = &hsValue;
		stv.TableType = &hsType;
		static DWORD msgHash_SetPropertyTableValue = CHashString("SetPropertyTableValue" ).GetUniqueID();
		m_ToolBox->SendMessage(msgHash_SetPropertyTableValue, sizeof(stv), &stv, &PName );
	}
}
Example #5
0
OGRVFPLayer::OGRVFPLayer( const char* pszFilename,
                          const char* pszLayerName,
                          OGRVFPDataSource* poDS)
{
    this->poDS = poDS;

    pszElementToScan = pszLayerName;

    nFeatures = 0;

    poFeatureDefn = new OGRFeatureDefn( pszLayerName );
    SetDescription( poFeatureDefn->GetName() );
    poFeatureDefn->Reference();

    /* set spatial reference 
       default is S-JTSK (EPSG: 5514) */
    poSRS = new OGRSpatialReference();
    if( poSRS->importFromEPSG(5514) != OGRERR_NONE)
    {
        delete poSRS;
        poSRS = NULL;
    }
    if( poFeatureDefn->GetGeomFieldCount() != 0 )
        poFeatureDefn->GetGeomFieldDefn(0)->SetSpatialRef(poSRS);

     poFeature = NULL;

#ifdef HAVE_EXPAT
    oParser = NULL;
    oSchemaParser = NULL;
#endif

    fpVFP = VSIFOpenL( pszFilename, "r" );
    if( fpVFP == NULL )
        {
            CPLError(CE_Failure, CPLE_AppDefined, "Cannot open %s", pszFilename);
            return;
        }

    LoadSchema();
     
    ResetReading();
}