Beispiel #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);

}
Beispiel #2
0
void Stage1::loadingsStep(float dt)
{
	static int progress = 0;

	//工廠模式
	FactoryInterface *factory;
	//FactoryInterface *enemyFactory = new EnemyFactory();

	std::string arrFile[] =
	{
		"up.png",
		"left.png",
		"right.png"
	};
	Vec2 arrPos[] =
	{
		Vec2(48 + 96, 48 + 96),
		Vec2(48, 48),
		Vec2(48 + 96 * 2, 48),
		Vec2(800, 48 + 96)
	};

	Weapon* weapon;
	Vec2 map1Pos;
	Vec2 treesPos;
	ParticleSystemQuad* mSystem;
	EventListenerTouchOneByOne *touchListener;
	switch (progress)
	{
	case p10:
		map = MapLayer::create();
		bulletLayer = BulletLayer::create();
		main = (MainFly*)MainFly::myCreate("main.png");

		//利用工廠生產主角
		factory = new WarriorFactory();
		warrior = (Warrior*)factory->ctrateObject();

		warrior->setName("Warrior");
		weapon = (Weapon*)Weapon::create("weapon1.png");
		warrior->setWeapon(weapon);
		this->addChild(map, 2);
		this->addChild(bulletLayer, 1);
		map->addChild(weapon, 5);
		map->addChild(warrior, 5);
		this->addChild(main, 10);

		
		//map->setPosition(Vec2(map->getPositionX()-960/2, map->getPositionY()-540/2));

		break;
	case p20:
		for (int i = 0; i < 4; i++){
			
			auto arr = Input::create("arr.png", Rect(i * 96, 0, 96, 96));
			arr->setTag(i);
			arr->setPosition(arrPos[i]);
			arr->setControllee(warrior);
			inputs.push_back(arr);
			this->addChild(arr, 20);
		}
		warrior->setPosition(Vec2(oriX, oriY+200));
		//warrior->setWorldPosition(Vec2(oriX, oriY));
		//warrior->setEffect(_effect, "warrior_n.png");

		for (int i = 2; i < 10+21; i++)
		{
			factory = new EnemyFactory();
			auto skull = factory->ctrateObject();
			skull->setPosition(Vec2(oriX*(i), oriY+400));
			skull->setName("skull");
			//skull->setEffect(_effect, "warrior_n.png");
		
			map->addChild(skull, 5);

		}
		mainPos = Vec2(100, 100);
		main->setPosition(mainPos);
		break;

		// ...

	case p30:
		map1 = Sprite::create("stage1Back.png");
		map1Pos = Vec2(0 + map1->getContentSize().width / 2, 0 + map1->getContentSize().height / 10);
		map1->setPosition(map1Pos);
		this->addChild(map1, 0);

		trees = Sprite::create("trees.png");
		treesPos = Vec2(0 + trees->getContentSize().width / 2, 0 + trees->getContentSize().height - 200);
		trees->setPosition(treesPos);
		this->addChild(trees, 1);

		mSystem = ParticleSystemQuad::create("test.plist");
		mSystem->setTextureWithRect(TextureCache::sharedTextureCache()->addImage("8.png"), Rect(0, 0, 64, 64));
		mSystem->setBlendAdditive(true);
		mSystem->setPosition(ccp(0, 540));
		this->addChild(mSystem, 50);
		
		
		break;

	case p40:
		
		CocosDenshion::SimpleAudioEngine::getInstance()->preloadBackgroundMusic("bgm/01.mp3");
		CocosDenshion::SimpleAudioEngine::getInstance()->setBackgroundMusicVolume(0.1f);
		CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("bgm/01.mp3", true);
		//CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect("SE/se_maoudamashii_battle17.mp3");
		CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect("SE/se_maoudamashii_se_fall02.mp3");
		CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("SE/se_maoudamashii_battle17.mp3");
		
		break;

	case p50:
		touchListener = EventListenerTouchOneByOne::create();
		touchListener->onTouchBegan = CC_CALLBACK_2(Stage1::onTouchBegan, this);
		touchListener->onTouchEnded = CC_CALLBACK_2(Stage1::onTouchEnded, this);
		touchListener->onTouchMoved = CC_CALLBACK_2(Stage1::onTouchMoved, this);
		_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
		break;

	case p60:
		warrior->scheduleUpdate();
		map->scheduleUpdate();
		this->scheduleUpdate();

		this->unschedule(schedule_selector(Stage1::loadingsStep));
		this->removeChildByName("loadingAnimation");


		auto label = Label::createWithTTF("Loading OK!", "TTF/pixelart.ttf", 24);
		label->setPosition(warrior->getPosition());
		this->addChild(label);

		break;


	}

	progress++;

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