コード例 #1
0
TEST(LuaUIOperationsTest, Rotate) {
	QApplication app(argc, argv);
	LuaInterface luaInterface;
	auto L = luaInterface.luaState();

	luaInterface.hideUI(true);
	luaInterface.initLua();

	auto mdiArea = LuaIntf::Lua::getGlobal<QMdiArea*>(L, "mdiArea");

	if(mdiArea->subWindowList().count() == 0) {
		LuaIntf::LuaRef(L, "new_file")();
	}

	mdiArea->setActiveSubWindow(mdiArea->subWindowList().at(0));

	auto mdiChild = dynamic_cast<CadMdiChild*>(mdiArea->activeSubWindow()->widget());
	auto storageManager = mdiChild->storageManager();
	auto documentCanvas = mdiChild->viewer()->documentCanvas();

	lc::entity::Line_CSPtr createdEntity;
	std::vector<lc::entity::CADEntity_CSPtr> entities;

	entities = storageManager->entityContainer().asVector();

	for(auto entity : entities) {
		storageManager->removeEntity(entity);
	}

	EXPECT_EQ(0, storageManager->entityContainer().asVector().size());



	LuaIntf::LuaRef(L, "create_line")();
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 0));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(100, 100));

	EXPECT_EQ(1, storageManager->entityContainer().asVector().size()) << "Line was not created";



	documentCanvas->makeSelection(0, 0, 100, 100, false, false);
	documentCanvas->closeSelection();

	EXPECT_EQ(1, mdiChild->selection().size()) << "Entity not selected";



	LuaIntf::LuaRef(L, "rotate_selected_entities")();
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 0));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 100));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(100, 0));

	entities = storageManager->entityContainer().asVector();
	createdEntity = std::dynamic_pointer_cast<const lc::entity::Line>(entities.at(0));

	EXPECT_EQ(lc::geo::Coordinate(0, 0), createdEntity->start());
	EXPECT_EQ(lc::geo::Coordinate(100, -100), createdEntity->end());
}
コード例 #2
0
void ThreadedDyscoColumn<DataType>::Prepare(DyscoDistribution distribution, DyscoNormalization normalization, double studentsTNu, double distributionTruncation)
{
	stopThreads();
	casacore::Table &table = storageManager().table();
	_ant1Col.reset( new casacore::ScalarColumn<int>(table, casacore::MeasurementSet::columnName(casacore::MSMainEnums::ANTENNA1)) );
	_ant2Col.reset( new casacore::ScalarColumn<int>(table, casacore::MeasurementSet::columnName(casacore::MSMainEnums::ANTENNA2)) ); 
	_fieldCol.reset( new casacore::ScalarColumn<int>(table, casacore::MeasurementSet::columnName(casacore::MSMainEnums::FIELD_ID)) );
	_dataDescIdCol.reset( new casacore::ScalarColumn<int>(table, casacore::MeasurementSet::columnName(casacore::MSMainEnums::DATA_DESC_ID)) );
	_timeCol.reset( new casacore::ScalarColumn<double>(table, casacore::MeasurementSet::columnName(casacore::MSMainEnums::TIME)) );
	
	size_t nPolarizations = _shape[0], nChannels = _shape[1];
	_timeBlockBuffer.reset(new TimeBlockBuffer<data_t>(nPolarizations, nChannels));
	if(_antennaCount != 0)
	{
		//TODO _timeBlockEncoder->SetNAntennae(_antennaCount);
	}
	_currentBlock = std::numeric_limits<size_t>::max();
}