// Utility function that returns the complete path for a selection. string getSelectionName(const Selection& selection, CelestiaCore* appCore) { Universe *universe = appCore->getSimulation()->getUniverse(); switch (selection.getType()) { case Selection::Type_Body: return getBodyName(universe, selection.body()); case Selection::Type_Star: return universe->getStarCatalog()->getStarName(*selection.star()); case Selection::Type_DeepSky: return universe->getDSOCatalog()->getDSOName(selection.deepsky()); case Selection::Type_Location: { std::string name = selection.location()->getName(); Body* parentBody = selection.location()->getParentBody(); if (parentBody != NULL) name = getBodyName(universe, parentBody) + ":" + name; return name; } default: return ""; } }
/* * Check the SetMergeMode method works */ void OlaServerServiceImplTest::testSetMergeMode() { UniverseStore store(NULL, NULL); OlaServerServiceImpl impl(&store, NULL, NULL, NULL, NULL, NULL, NULL, m_uid); OlaClientService service(NULL, &impl); unsigned int universe_id = 0; GenericAckCheck<SetMergeModeCheck> ack_check; GenericMissingUniverseCheck<SetMergeModeCheck, ola::proto::Ack> missing_universe_check; // Check we get an error for a missing universe CallSetMergeMode(&service, universe_id, ola::proto::HTP, missing_universe_check); Universe *universe = store.GetUniverse(universe_id); OLA_ASSERT_FALSE(universe); // Check SetUniverseName works universe = store.GetUniverseOrCreate(universe_id); CallSetMergeMode(&service, universe_id, ola::proto::HTP, ack_check); OLA_ASSERT(Universe::MERGE_HTP == universe->MergeMode()); // Run it again CallSetMergeMode(&service, universe_id, ola::proto::LTP, ack_check); OLA_ASSERT(Universe::MERGE_LTP == universe->MergeMode()); }
/* * Check the SetUniverseName method works */ void OlaServerServiceImplTest::testSetUniverseName() { UniverseStore store(NULL, NULL); OlaServerServiceImpl impl(&store, NULL, NULL, NULL, NULL, NULL, NULL, m_uid); OlaClientService service(NULL, &impl); unsigned int universe_id = 0; string universe_name = "test 1"; string universe_name2 = "test 1-2"; GenericAckCheck<SetUniverseNameCheck> ack_check; GenericMissingUniverseCheck<SetUniverseNameCheck, ola::proto::Ack> missing_universe_check; // Check we get an error for a missing universe CallSetUniverseName(&service, universe_id, universe_name, missing_universe_check); Universe *universe = store.GetUniverse(universe_id); OLA_ASSERT_FALSE(universe); // Check SetUniverseName works on an existing univserse universe = store.GetUniverseOrCreate(universe_id); CallSetUniverseName(&service, universe_id, universe_name, ack_check); OLA_ASSERT_EQ(universe_name, universe->Name()); // Run it again with a new name CallSetUniverseName(&service, universe_id, universe_name2, ack_check); OLA_ASSERT_EQ(universe_name2, universe->Name()); }
/* * Update the DMX values for a particular universe */ void OlaServerServiceImpl::UpdateDmxData( RpcController* controller, const DmxData* request, Ack*, ola::rpc::RpcService::CompletionCallback* done, Client *client) { ClosureRunner runner(done); Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return MissingUniverseError(controller); if (client) { DmxBuffer buffer; buffer.Set(request->data()); uint8_t priority = ola::dmx::SOURCE_PRIORITY_DEFAULT; if (request->has_priority()) { priority = request->priority(); priority = std::max(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MIN), priority); priority = std::min(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MAX), priority); } DmxSource source(buffer, *m_wake_up_time, priority); client->DMXReceived(request->universe(), source); universe->SourceClientDataChanged(client); } }
/* * Handle a streaming DMX update, we don't send responses for this */ void OlaServerServiceImpl::StreamDmxData( RpcController*, const ola::proto::DmxData* request, ola::proto::STREAMING_NO_RESPONSE*, ola::rpc::RpcService::CompletionCallback*, Client *client) { Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return; if (client) { DmxBuffer buffer; buffer.Set(request->data()); uint8_t priority = ola::dmx::SOURCE_PRIORITY_DEFAULT; if (request->has_priority()) { priority = request->priority(); priority = std::max(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MIN), priority); priority = std::min(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MAX), priority); } DmxSource source(buffer, *m_wake_up_time, priority); client->DMXReceived(request->universe(), source); universe->SourceClientDataChanged(client); } }
/** * @brief Clones this Universe and all of the Cells within it and returns it * @return a pointer to the Universe clone */ Universe* Universe::clone() { log_printf(DEBUG, "Cloning Universe %d", _id); /* Instantiate new Universe clone */ Universe* clone = new Universe(universe_id()); /* Loop over Cells in Universe and clone each one */ std::map<int, Cell*>::iterator iter1; for (iter1 = _cells.begin(); iter1 != _cells.end(); ++iter1) { /* If the Cell is filled with a Material, clone it */ if ((*iter1).second->getType() == MATERIAL) { /* Clone the Cell */ CellBasic* parent = static_cast<CellBasic*>((*iter1).second); CellBasic* cell_clone = parent->clone(); /* Add Cell clone to the list */ clone->addCell(cell_clone); cell_clone->setUniverse(clone->getId()); } /* Throw error message if Cell is FILL type */ else { log_printf(ERROR, "Unable to clone Universe %d since it contains Cell %d" "which is filled with a Universe rather than a Material"); } } return clone; }
void test_02() { // Create a universe Universe universe; // Add a bunch of objects Object* A = new Object; A->set_velocity(0, 1); for ( int ii = 0; ii < 10; ++ii) { A->set_position(ii, ii); universe.add_object(A); } std::cout << "Initial conditions: \n"; debug_display_world(universe); // Iterate the engine a few times for (int ii = 0; ii < 5; ++ii) { universe.physics_runtime_iteration(); std::cout << "\nIteration " << ii << ":\n"; debug_display_world(universe); } }
/* * Handle a streaming DMX update, we don't send responses for this */ void OlaServerServiceImpl::StreamDmxData( RpcController*, const ::ola::proto::DmxData* request, ::ola::proto::STREAMING_NO_RESPONSE*, ::google::protobuf::Closure*, Client *client) { Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return; if (client) { DmxBuffer buffer; buffer.Set(request->data()); uint8_t priority = DmxSource::PRIORITY_DEFAULT; if (request->has_priority()) { priority = request->priority(); priority = std::max(DmxSource::PRIORITY_MIN, priority); priority = std::min(DmxSource::PRIORITY_MAX, priority); } DmxSource source(buffer, *m_wake_up_time, priority); client->DMXRecieved(request->universe(), source); universe->SourceClientDataChanged(client); } }
void CommandConstellations::process(ExecutionEnvironment& env) { Universe* u = env.getSimulation()->getUniverse(); if (u != NULL) { AsterismList* asterisms = u->getAsterisms(); for (AsterismList::const_iterator iter = asterisms->begin(); iter != asterisms->end(); iter++) { Asterism* ast = *iter; if (none) { ast->setActive(0); } else if (all) { ast->setActive(1); } else { for (int i = 0; i < numConstellations; i++) { if (compareIgnoringCase(constellation[i],ast->getName(false)) == 0) { ast->setActive(active[i] != 0); break; } } } } } }
/* * Update the DMX values for a particular universe */ void OlaServerServiceImpl::UpdateDmxData( RpcController* controller, const DmxData* request, Ack*, google::protobuf::Closure* done, Client *client) { ClosureRunner runner(done); Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return MissingUniverseError(controller); if (client) { DmxBuffer buffer; buffer.Set(request->data()); uint8_t priority = DmxSource::PRIORITY_DEFAULT; if (request->has_priority()) { priority = request->priority(); priority = std::max(DmxSource::PRIORITY_MIN, priority); priority = std::min(DmxSource::PRIORITY_MAX, priority); } DmxSource source(buffer, *m_wake_up_time, priority); client->DMXRecieved(request->universe(), source); universe->SourceClientDataChanged(client); } }
TEST_F(UniverseTest, ObjectsInProximity) { const Position CENTER{ 0, 0, 0 }; Universe universe; auto ship1 = std::make_shared<Common::Game::Object::ShipMock>(); EXPECT_CALL(*ship1, getPosition()).WillOnce(Return(Position(0, 0, 0))); EXPECT_CALL(*ship1, getId()).Times(AtLeast(1)).WillRepeatedly(Return(1)); universe.add(ship1); auto ship2 = std::make_shared<Common::Game::Object::ShipMock>(); EXPECT_CALL(*ship2, getPosition()).WillOnce(Return(Position(0, 100, 0))); EXPECT_CALL(*ship2, getId()).Times(AtLeast(1)).WillRepeatedly(Return(2)); universe.add(ship2); auto ship3 = std::make_shared<Common::Game::Object::ShipMock>(); EXPECT_CALL(*ship3, getPosition()).WillOnce(Return(Position(0, 1000, 0))); EXPECT_CALL(*ship3, getId()).Times(AtLeast(1)).WillRepeatedly(Return(3)); universe.add(ship3); ObjectsVisitorCallbackMock callbackMock; EXPECT_CALL(callbackMock, call(Ref(*ship1))); EXPECT_CALL(callbackMock, call(Ref(*ship2))); universe.objectsInProximity(CENTER, 500, std::ref(callbackMock)); }
void InputOutputMap::setBlackout(bool blackout) { /* Don't do blackout twice */ if (m_blackout == blackout) return; m_blackout = blackout; if (blackout == true) { QByteArray zeros(512, 0); for (quint32 i = 0; i < universes(); i++) { Universe *universe = m_universeArray.at(i); if (universe->outputPatch() != NULL) universe->outputPatch()->dump(universe->id(), zeros); } } else { /* Force writing of values back to the plugins */ m_universeChanged = true; } emit blackoutChanged(m_blackout); }
void ArtNetDevice::HandleNodeList(Request *request, string *response, RpcController *controller) { if (!request->has_node_list()) { controller->SetFailed("Missing NodeListRequest"); return; } unsigned int universe_id = request->node_list().universe(); vector<IPV4Address> node_addresses; vector<OutputPort*> output_ports; OutputPorts(&output_ports); vector<OutputPort*>::const_iterator port_iter = output_ports.begin(); for (; port_iter != output_ports.end(); port_iter++) { Universe *universe = (*port_iter)->GetUniverse(); if (universe && universe->UniverseId() == universe_id) { m_node->GetSubscribedNodes((*port_iter)->PortId(), &node_addresses); break; } } ola::plugin::artnet::Reply reply; reply.set_type(ola::plugin::artnet::Reply::ARTNET_NODE_LIST_REPLY); ola::plugin::artnet::NodeListReply *node_list_reply = reply.mutable_node_list(); vector<IPV4Address>::const_iterator iter = node_addresses.begin(); for (; iter != node_addresses.end(); ++iter) { OutputNode *node = node_list_reply->add_node(); node->set_ip_address(iter->AsInt()); } reply.SerializeToString(response); }
/* * Write data to this port. */ bool E131OutputPort::WriteDMX(const DmxBuffer &buffer, uint8_t priority) { Universe *universe = GetUniverse(); if (!universe) return false; m_last_priority = (GetPriorityMode() == PRIORITY_MODE_STATIC) ? GetPriority() : priority; return m_node->SendDMX(universe->UniverseId(), buffer, m_last_priority, m_preview_on); }
AnimationSceneImpl(IPlugin& anim_system, Engine& engine, Universe& universe, IAllocator& allocator) : m_universe(universe) , m_engine(engine) , m_anim_system(anim_system) , m_animables(allocator) { m_is_game_running = false; m_render_scene = static_cast<RenderScene*>(universe.getScene(crc32("renderer"))); universe.registerComponentTypeScene(ANIMABLE_TYPE, this); ASSERT(m_render_scene); }
/** * @brief Finds the Cell for which a LocalCoords object resides. * @details Finds the Cell that a LocalCoords object is located inside by * checking each of this Universe's Cells. Returns NULL if the * LocalCoords is not in any of the Cells. * @param coords a pointer to the LocalCoords of interest * @param universes a container of all of the Universes passed in by Geometry * @return a pointer the Cell where the LocalCoords is located */ Cell* Universe::findCell(LocalCoords* coords, std::map<int, Universe*> universes) { Cell* return_cell = NULL; std::map<int, Cell*>::iterator iter; /* Sets the LocalCoord type to UNIV at this level */ coords->setType(UNIV); /* Loop over all Cells in this Universe */ for (iter = _cells.begin(); iter != _cells.end(); ++iter) { Cell* cell = iter->second; if (cell->cellContainsCoords(coords)) { /* Set the Cell on this level */ coords->setCell(cell->getId()); /* MATERIAL type Cell - lowest level, terminate search for Cell */ if (cell->getType() == MATERIAL) { coords->setCell(cell->getId()); return_cell = cell; return return_cell; } /* FILL type Cell - Cell contains a Universe at a lower level * Update coords to next level and continue search */ else if (cell->getType() == FILL) { LocalCoords* next_coords; if (coords->getNext() == NULL) next_coords = new LocalCoords(coords->getX(), coords->getY()); else next_coords = coords->getNext(); CellFill* cell_fill = static_cast<CellFill*>(cell); int universe_id = cell_fill->getUniverseFillId(); next_coords->setUniverse(universe_id); Universe* univ = universes.at(universe_id); coords->setCell(cell->getId()); coords->setNext(next_coords); next_coords->setPrev(coords); if (univ->getType() == SIMPLE) return univ->findCell(next_coords, universes); else return static_cast<Lattice*>(univ)->findCell(next_coords, universes); } } } return return_cell; }
void InputOutputMap::flushInputs() { QMutexLocker locker(&m_universeMutex); for (int i = 0; i < m_universeArray.count(); i++) { Universe *universe = m_universeArray.at(i); universe->flushInput(); } }
/* * Sets the name of a universe */ void OlaServerServiceImpl::SetUniverseName( RpcController* controller, const UniverseNameRequest* request, Ack*, google::protobuf::Closure* done) { ClosureRunner runner(done); Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return MissingUniverseError(controller); universe->SetName(request->name()); }
/* * Check that SetDMX/GetDMX works */ void UniverseTest::testSetGetDmx() { Universe *universe = m_store->GetUniverseOrCreate(TEST_UNIVERSE); OLA_ASSERT(universe); // a new universe should be all 0s DmxBuffer empty_buffer; OLA_ASSERT(empty_buffer == universe->GetDMX()); // check that SetDMX works OLA_ASSERT(universe->SetDMX(m_buffer)); OLA_ASSERT(m_buffer == universe->GetDMX()); }
/* * Sets the name of a universe */ void OlaServerServiceImpl::SetUniverseName( RpcController* controller, const UniverseNameRequest* request, Ack*, ola::rpc::RpcService::CompletionCallback* done) { ClosureRunner runner(done); Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return MissingUniverseError(controller); universe->SetName(request->name()); }
bool PortManager::GenericUnPatchPort(PortClass *port) { if (!port) return false; Universe *universe = port->GetUniverse(); m_broker->RemovePort(port); if (universe) { universe->RemovePort(port); port->SetUniverse(NULL); OLA_INFO << "Unpatched " << port->UniqueId() << " from uni " << universe->UniverseId(); } return true; }
/* * Set the merge mode for a universe */ void OlaServerServiceImpl::SetMergeMode( RpcController* controller, const MergeModeRequest* request, Ack*, ola::rpc::RpcService::CompletionCallback* done) { ClosureRunner runner(done); Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return MissingUniverseError(controller); Universe::merge_mode mode = request->merge_mode() == ola::proto::HTP ? Universe::MERGE_HTP : Universe::MERGE_LTP; universe->SetMergeMode(mode); }
/* * Returns the current DMX values for a particular universe */ void OlaServerServiceImpl::GetDmx( RpcController* controller, const UniverseRequest* request, DmxData* response, ola::rpc::RpcService::CompletionCallback* done) { ClosureRunner runner(done); Universe *universe = m_universe_store->GetUniverse(request->universe()); if (!universe) return MissingUniverseError(controller); const DmxBuffer buffer = universe->GetDMX(); response->set_data(buffer.Get()); response->set_universe(request->universe()); }
void taeRuleset::createGame() { Game* game = Game::getGame(); ObjectManager* obm = game->getObjectManager(); ObjectTypeManager* obtm = game->getObjectTypeManager(); //Create ship design category Category* cat = new Category(); cat->setName("Ships"); cat->setDescription("Ship components"); game->getDesignStore()->addCategory(cat); //Create properties createProperties(); //Create components createComponents(); //Create resources setupResources(); uint32_t obT_Universe = obtm->getObjectTypeByName("Universe"); uint32_t obT_Galaxy = obtm->getObjectTypeByName("Galaxy"); //Create the universe IGObject* universe = obm->createNewObject(); obtm->setupObject(universe, obT_Universe); Universe* theUniverse = (Universe*)(universe->getObjectBehaviour()); theUniverse->setSize(1000000000000ll); universe->setName("The Universe"); theUniverse->setPosition(Vector3d(0ll,0ll,0ll)); obm->addObject(universe); //Create the galaxy IGObject* gal = obm->createNewObject(); obtm->setupObject(gal, obT_Galaxy); EmptyObject* galob = (EmptyObject*)(gal->getObjectBehaviour()); galob->setSize(100000000000ll); gal->setName("The Fertile Galaxy"); galob->setPosition(Vector3d(0ll, -6000ll, 0ll)); gal->addToParent(universe->getID()); obm->addObject(gal); string path = string(Settings::getSettings()->get("board_path")); Logger::getLogger()->debug(path.c_str()); createBoard(path, gal->getID()); Logger::getLogger()->info("TaE created"); }
void CelestiaAppWindow::slotAddBookmark() { // Set the default bookmark title to the name of the current selection Selection sel = m_appCore->getSimulation()->getSelection(); QString defaultTitle; if (sel.body() != NULL) { defaultTitle = QString::fromUtf8(sel.body()->getName(true).c_str()); } else if (sel.star() != NULL) { Universe* universe = m_appCore->getSimulation()->getUniverse(); defaultTitle = QString::fromUtf8(ReplaceGreekLetterAbbr(universe->getStarCatalog()->getStarName(*sel.star(), true)).c_str()); } else if (sel.deepsky() != NULL) { Universe* universe = m_appCore->getSimulation()->getUniverse(); defaultTitle = QString::fromUtf8(ReplaceGreekLetterAbbr(universe->getDSOCatalog()->getDSOName(sel.deepsky(), true)).c_str()); } else if (sel.location() != NULL) { defaultTitle = sel.location()->getName().c_str(); } if (defaultTitle.isEmpty()) defaultTitle = _("New bookmark"); CelestiaState appState; appState.captureState(m_appCore); // Capture the current frame buffer to use as a bookmark icon. QImage grabbedImage = glWidget->grabFrameBuffer(); int width = grabbedImage.width(); int height = grabbedImage.height(); // Crop the image to a square. QImage iconImage; if (width > height) iconImage = grabbedImage.copy((width - height) / 2, 0, height, height); else iconImage = grabbedImage.copy(0, (height - width) / 2, width, width); AddBookmarkDialog dialog(m_bookmarkManager, defaultTitle, appState, iconImage); dialog.exec(); populateBookmarkMenu(); m_bookmarkToolBar->rebuild(); }
// NOTE: DOES NOT take ownership of table SimpleFuncGenerator::SimpleFuncGenerator(const FuncTable* ft, const std::vector<Pattern>& pattern, const std::vector<const DomElemContainer*>& vars, const Universe& univ, const std::vector<unsigned int>& firstocc) : _reset(true), _functable(ft), _universe(univ), _vars(vars), _rangevar(vars.back()) { Assert(pattern.back() == Pattern::OUTPUT); Assert(pattern.size()==_vars.size()); auto domainpattern = pattern; domainpattern.pop_back(); std::vector<SortTable*> outtabs; for (unsigned int n = 0; n < domainpattern.size(); ++n) { switch (domainpattern[n]) { case Pattern::OUTPUT: if (firstocc[n] == n) { _outvars.push_back(vars[n]); outtabs.push_back(univ.tables()[n]); _outpos.push_back(n); } break; case Pattern::INPUT: _invars.push_back(vars[n]); _inpos.push_back(n); break; } } _univgen = GeneratorFactory::create(_outvars, outtabs); _currenttuple.resize(domainpattern.size(), NULL); }
/** * @brief Computes the flat source region base indices for each of the * Lattice cells within this Lattice (i.e., the minimum ID for the flat * source regions within each Lattice cell). Returns the number of * FSRs in the Lattice. * @return the number of FSRs */ int Lattice::computeFSRMaps() { /* Initialize a counter */ int count = 0; /* loop over Universes in the Lattice to set the map and update count */ for (int i = 0; i < _num_y; i++) { for (int j = 0; j < _num_x; j++) { Universe *u = _universes.at(i).at(j).second; _region_map[i][j].second = count; count += u->computeFSRMaps(); } } return count; }
/* * Check the RegisterForDmx method works */ void OlaServerServiceImplTest::testRegisterForDmx() { UniverseStore store(NULL, NULL); OlaServerServiceImpl impl(&store, NULL, NULL, NULL, NULL, NULL, NULL, m_uid); OlaClientService service(NULL, &impl); // Register for a universe that doesn't exist unsigned int universe_id = 0; unsigned int second_universe_id = 99; GenericAckCheck<RegisterForDmxCheck> ack_check; CallRegisterForDmx(&service, universe_id, ola::proto::REGISTER, ack_check); // The universe should exist now and the client should be bound Universe *universe = store.GetUniverse(universe_id); OLA_ASSERT(universe); OLA_ASSERT(universe->ContainsSinkClient(NULL)); OLA_ASSERT_EQ((unsigned int) 1, universe->SinkClientCount()); // Try to register again CallRegisterForDmx(&service, universe_id, ola::proto::REGISTER, ack_check); OLA_ASSERT(universe->ContainsSinkClient(NULL)); OLA_ASSERT_EQ((unsigned int) 1, universe->SinkClientCount()); // Register a second universe CallRegisterForDmx(&service, second_universe_id, ola::proto::REGISTER, ack_check); Universe *second_universe = store.GetUniverse(universe_id); OLA_ASSERT(second_universe->ContainsSinkClient(NULL)); OLA_ASSERT_EQ((unsigned int) 1, second_universe->SinkClientCount()); // Unregister the first universe CallRegisterForDmx(&service, universe_id, ola::proto::UNREGISTER, ack_check); OLA_ASSERT_FALSE(universe->ContainsSinkClient(NULL)); OLA_ASSERT_EQ((unsigned int) 0, universe->SinkClientCount()); // Unregister the second universe CallRegisterForDmx(&service, second_universe_id, ola::proto::UNREGISTER, ack_check); OLA_ASSERT_FALSE(second_universe->ContainsSinkClient(NULL)); OLA_ASSERT_EQ((unsigned int) 0, second_universe->SinkClientCount()); // Unregister again CallRegisterForDmx(&service, universe_id, ola::proto::UNREGISTER, ack_check); OLA_ASSERT_FALSE(universe->ContainsSinkClient(NULL)); OLA_ASSERT_EQ((unsigned int) 0, universe->SinkClientCount()); }
void DeepSkyBrowser::slotMarkSelected() { QItemSelectionModel* sm = treeView->selectionModel(); bool labelMarker = labelMarkerBox->checkState() == Qt::Checked; bool convertOK = false; QVariant markerData = markerSymbolBox->itemData(markerSymbolBox->currentIndex()); MarkerRepresentation::Symbol markerSymbol = (MarkerRepresentation::Symbol) markerData.toInt(&convertOK); QVariant markerSize = markerSizeBox->itemData(markerSizeBox->currentIndex()); float size = (float) markerSize.toInt(&convertOK); QColor markerColor = colorSwatch->color(); Color color((float) markerColor.redF(), (float) markerColor.greenF(), (float) markerColor.blueF()); Universe* universe = appCore->getSimulation()->getUniverse(); string label; int nRows = dsoModel->rowCount(QModelIndex()); for (int row = 0; row < nRows; row++) { if (sm->isRowSelected(row, QModelIndex())) { DeepSkyObject* dso = dsoModel->itemAtRow((unsigned int) row); if (dso != NULL) { if (convertOK) { if (labelMarker) { label = universe->getDSOCatalog()->getDSOName(dso, true); label = ReplaceGreekLetterAbbr(label); } universe->markObject(Selection(dso), MarkerRepresentation(markerSymbol, size, color, label), 1); } else { universe->unmarkObject(Selection(dso), 1); } } } // isRowSelected } // for }
void SolarSystemBrowser::slotMarkSelected() { #if 0 QItemSelectionModel* sm = treeView->selectionModel(); QModelIndexList rows = sm->selectedRows(); bool labelMarker = labelMarkerBox->checkState() == Qt::Checked; bool convertOK = false; QVariant markerData = markerSymbolBox->itemData(markerSymbolBox->currentIndex()); Marker::Symbol markerSymbol = (Marker::Symbol) markerData.toInt(&convertOK); QColor markerColor = colorSwatch->color(); Color color((float) markerColor.redF(), (float) markerColor.greenF(), (float) markerColor.blueF()); Universe* universe = appCore->getSimulation()->getUniverse(); string label; for (QModelIndexList::const_iterator iter = rows.begin(); iter != rows.end(); iter++) { Selection sel = solarSystemModel->objectAtIndex(*iter); if (!sel.empty()) { if (convertOK) { #if 0 if (labelMarker) { label = universe->getDSOCatalog()->getDSOName(dso); label = ReplaceGreekLetterAbbr(label); } #endif universe->markObject(sel, 10.0f, color, markerSymbol, 1, label); } else { universe->unmarkObject(sel, 1); } } } #endif }