示例#1
0
void InternalModule::prepare()
{
    InternalIlwisObjectFactory *ifactory = new InternalIlwisObjectFactory();
    kernel()->addFactory(ifactory);

    ConnectorFactory *factory = kernel()->factory<ConnectorFactory>("ilwis::ConnectorFactory");
    if (!factory)
        return ;
    factory->addCreator(itCATALOG,"internal",CatalogConnector::create);
    factory->addCreator(itRASTER,"internal", InternalRasterCoverageConnector::create);
    factory->addCreator(itTABLE,"internal", InternalTableConnector::create);
    factory->addCreator(itFEATURE,"internal", InternalFeatureCoverageConnector::create);
    factory->addCreator(itGEOREF,"internal", InternalGeoReferenceConnector::create);
    factory->addCreator(itDOMAIN,"internal", InternalDomainConnector::create);
    factory->addCreator(itCOORDSYSTEM,"internal", InternalCoordinatesystemConnector::create);
    factory->addCreator(itREPRESENTATION,"internal", InternalRepresentationConnector::create);

    FactoryInterface *projfactory = new ProjectionImplFactory();
    projfactory->prepare();
    kernel()->addFactory(projfactory );

    QSqlQuery db(kernel()->database());

    bool ok = createItems(db,"projection", itPROJECTION);
    ok &= createItems(db,"ellipsoid", itELLIPSOID);
    ok &= createItems(db,"datum", itGEODETICDATUM);
    ok &= createItems(db,"numericdomain", itNUMERICDOMAIN, "domain");
    ok &= createItems(db,"representation", itREPRESENTATION);
    ok &= createPcs(db);
    ok &= createSpecialDomains();

    QString url = QString("ilwis://system/unknown");
    Resource resource(url, itBOUNDSONLYCSY);
    resource.code("unknown");
    resource.name("unknown", false);
    resource.addContainer(QUrl("ilwis://system"));
    resource.prepare();
    mastercatalog()->addItems({resource});

    url = QString("ilwis://system/undetermined");
    resource = Resource(url, itGEOREF);
    resource.code("undetermined");
    resource.name("undetermined", false);
    resource.addContainer(QUrl("ilwis://system"));
    resource.prepare();
    mastercatalog()->addItems({resource});

    url = QString("file:///%1/resources/country_boundaries.ilwis").arg(context()->ilwisFolder().absoluteFilePath());
    resource = Resource(QUrl("ilwis://system/country_boundaries.ilwis"), QUrl(url),itFEATURE);
    resource.code("catalogcountryboundaries");
    resource.name("countryboundaries", false);
    resource.addContainer(QUrl("ilwis://system"));
    resource.prepare();
    mastercatalog()->addItems({resource});


    IlwisObject::addTypeFunction(InternalModule::ilwisType);

    kernel()->issues()->log("Loaded internal objects module",IssueObject::itMessage);

}
void Ilwis::ProjectionModule::prepare()
{
    FactoryInterface *factory = new ProjectionImplFactoryProj4();
    factory->prepare();
    kernel()->addFactory(factory );
}