void LayersManager::getViewPointList(const std::string& targetID, ActorRefPtrList& viewPointList, int viewPointType) { ActorList childLayerList; dynamic_cast<SingleLayerActor*>(_loadInLayer.get())->getAllChildren(childLayerList, CLASS_VIEWPOINTDEFINE, false, false); for (unsigned int i = 0; i < childLayerList.size(); ++i) { std::string type = childLayerList.at(i)->getProperty(ACTOR_PROPERTY_VIEWPOINTTYPE)->toString(); std::stringstream ss; ss << viewPointType; if (viewPointType < 0 || type == ss.str()) viewPointList.push_back(dynamic_cast<VirtualDataSceneBase::TransformableActor*>(childLayerList.at(i))); } }
void LayersManager::loadInLayer(VirtualDataSceneBase::TransformableActor* layer, StringList loadExclusionList, StringList unLoadExclusionList) { if (_loadInLayer == layer) return; unLoadInLayer(unLoadExclusionList); dynamic_cast<SingleLayerActor*>(layer)->mandatoryLoadNodeAsynchronous(loadExclusionList); _loadInLayer = layer; SystemViewContext* currentcontext = getSystemViewContext(this); if (_loadInLayer->isInstanceOf(CLASS_EARTHLAYER)) { currentcontext->_mainViewer->getCamera()->setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f)); currentcontext->_mainViewer->getCamera()->setNearFarRatio(1e-9); _root->removeChild(_sceneSky); } else { currentcontext->_mainViewer->getCamera()->setClearColor(osg::Vec4(0.004f, 0.0902f, 0.1804f, 1.0f)); currentcontext->_mainViewer->getCamera()->setNearFarRatio(1e-5); if (!_root->containsNode(_sceneSky)) _root->addChild(_sceneSky); //reset dynamic_cast<SingleLayerActor*>(_loadInLayer.get())->resetZeroTransform(); ActorList childLayerList; dynamic_cast<SingleLayerActor*>(_loadInLayer.get())->getAllChildren(childLayerList, CLASS_LAYER, true, false); for (unsigned int i = 0; i < childLayerList.size(); ++i) { dynamic_cast<SingleLayerActor*>(childLayerList.at(i))->resetDefaultTransform(); } } osg::ref_ptr<UserEventData> userData = new UserEventData(); userData->_eventObject = _loadInLayer.get(); userData->_eventType = UserEventData::LAYERCHANGED; currentcontext->_mainViewer->getEventQueue()->userEvent(userData.get()); }
void LayersManager::deleteLayer(VirtualDataSceneBase::ActorBase* layerActor, bool deleteChild) { osg::Node* layerNode = dynamic_cast<osg::Node*>(layerActor); if (layerActor->isInstanceOf(CLASS_ENTERPRISELAYER)) { _root->removeChild(layerNode); _enterpriseList.erase(std::find(_enterpriseList.begin(), _enterpriseList.end(), layerNode)); } else { VirtualDataSceneKernel::SingleLayerActor* ppLayer = dynamic_cast<VirtualDataSceneKernel::SingleLayerActor*>(layerNode->getParent(0)); if (!deleteChild) { ActorList returnValue; VirtualDataSceneKernel::DeviceGroup* parent = dynamic_cast<VirtualDataSceneKernel::DeviceGroup*>(layerActor); parent->getAllChildren(returnValue, CLASS_DEVICE); osg::ref_ptr<osg::Node> everyObj; for (unsigned int i = 0; i < returnValue.size(); ++i) { everyObj = dynamic_cast<osg::Node*>(returnValue.at(i)); parent->removeChild(everyObj); ppLayer->addChild(everyObj); } } dynamic_cast<VirtualDataSceneKernel::SingleLayerActor*>(layerActor)->mandatoryUnLoadNode(); ppLayer->removeChild(dynamic_cast<osg::Node*>(layerActor)); } }