void Application::OpenProject() { if(IsControllerOpen()) return; if(CloseProject()) { Draw(); main_frame->Refresh(); main_frame->Update(); bool result = project_controller ->OpenProject(main_frame, GetDefaultPath(), status_controller, layer_tree, graphic_factory); wms_request_manager->SetSRS(project_controller->GetSRS()); std::string title = project_controller->GetProjectFullName(); if (title!="") { main_frame->SetTitle (wxString((title + " - Rvzware").c_str(),wxConvUTF8)); } navigator_manager->SetAllNavigatorsToInitialPosition(); navigator_manager->GetFocusedOrFirstNavigator()->ShowHUD(result); main_frame->EnableGUI(result); TestDependencies("WmsLayer"); remote_controller->ConnectAllEntities(); } }
void PrefHandler::SaveDefaultAsText() { BPath path; if (GetDefaultPath(path) == B_OK) SaveAsText(path.Path(), PREFFILE_MIMETYPE); }
int wxLoadFileSelector(wxWindow* parent, wxFileName* fileName, const wxArrayString& extensions) { const wxString filter = wxJoin(extensions, wxT('|'), 0); wxString defaultPath = GetDefaultPath(*fileName); wxString caption = wxGetStockLabelEx(wxID_OPEN, wxSTOCK_PLAINTEXT); wxFileDialog fileDialog(parent, caption, defaultPath, fileName->GetFullName(), filter, wxFD_DEFAULT_STYLE_OPEN | wxFD_CHANGE_DIR); if (fileDialog.ShowModal() != wxID_OK) return wxNOT_FOUND; fileName->Assign(fileDialog.GetPath()); return fileDialog.GetFilterIndex(); }
PrefHandler::PrefHandler() : fContainer('Pref') { _LoadFromDefault(kTermDefaults); BPath path; GetDefaultPath(path); OpenText(path.Path()); _ConfirmFont(PREF_HALF_FONT_FAMILY, be_fixed_font); }
PrefHandler::PrefHandler(bool loadSettings) : fContainer('Pref') { _LoadFromDefault(kTermDefaults); if (loadSettings) { BPath path; GetDefaultPath(path); OpenText(path.Path()); } _ConfirmFont(be_fixed_font); }
const char * GetPath(const std::string & _label) { split_vector_type labels; boost::algorithm::split(labels, _label, boost::algorithm::is_any_of(","), boost::algorithm::token_compress_on); for(split_vector_type::const_iterator itr = labels.begin(); itr != labels.end(); ++itr) { StringStringMap::const_iterator found = m_familynamePath.find(*itr); if (found != m_familynamePath.end()) return found->second.c_str(); found = m_stemPath.find(*itr); if (found != m_stemPath.end()) return found->second.c_str(); } return GetDefaultPath(); }
BOOL CADHelper::SelectFile( CString& fileName, const CString& szFileFilter, const CString& szFileExt ) { CString defaultPath; GetDefaultPath( defaultPath ); CFileDialog dlg( TRUE, szFileExt, defaultPath, OFN_OVERWRITEPROMPT, szFileFilter ); ///TRUE为OPEN对话框,FALSE为SAVE AS对话框 dlg.m_ofn.lpstrFile[0] = NULL; CString selectedPath; if( IDOK == dlg.DoModal() ) { selectedPath = dlg.GetPathName(); } else { return FALSE; } fileName = selectedPath; return TRUE; }
int wxSaveFileSelector(wxWindow* parent, wxFileName* fileName, const wxArrayString& extensions) { const wxString filter = wxJoin(extensions, wxT('|'), 0); const wxString ext = wxString(wxT(".")) + fileName->GetExt(); wxString defaultPath = GetDefaultPath(*fileName); wxString caption = wxGetStockLabelEx(wxID_SAVE, wxSTOCK_PLAINTEXT); wxFileDialog fileDialog(parent, caption, defaultPath, fileName->GetFullName(), filter, wxFD_DEFAULT_STYLE_SAVE | wxFD_CHANGE_DIR); if (!fileName->GetExt().empty()) for (wxArrayString::const_iterator it = extensions.begin(); it != extensions.end(); it++) if (it->EndsWith(ext)) { int index = (int)(it - extensions.begin()); fileDialog.SetFilterIndex(index); break; } if (fileDialog.ShowModal() != wxID_OK) return wxNOT_FOUND; fileName->Assign(fileDialog.GetPath()); return fileDialog.GetFilterIndex(); }
bool Application::InitCpwEntities() { three_dimension_camera_controller = new cpw::AerialCameraController; two_dimension_camera_controller = new cpw::TwoDimensionCameraController; cpw::ApplicationScene *appScene = cpw::ApplicationScene::GetInstance(); appScene->SetScene(graphic_factory->CreateScene()); std::string default_icon = cpw::ApplicationConfiguration::GetInstance()->GetIconDirectory()+"default.png"; cpw::ApplicationScene::GetInstance()->GetScene()->SetDefaultIcon( default_icon ); navigator_manager = graphic_factory->CreateNavigatorManager(); navigator_manager->SetCameraController(three_dimension_camera_controller); appScene->SetNavigatorManager(navigator_manager); wms_request_manager = new cpw::ogc::WmsLayerManager(appScene->GetScene(), 30000, status_controller); wms_request_manager->AddThread(new cpw::ogc::WmsDiskManager(wms_request_manager, 90000)); wms_request_manager->start(); appScene->GetScene()->SetRequestManager(wms_request_manager); cpw::utils::Fire *new_fire = new cpw::utils::Fire(); new_fire->AddCallBack((cpw::ParticleSystemCallBack *) new cpw::utils::GraphicFireCallBack); new_fire->SetPersistentCallBack(new cpw::PersistentFileCallBack); new_fire->SetAnimateCallBack((cpw::ParticleSystemCallBack *) new cpw::utils::GraphicFireCallBack); new_fire->SetName("Fire"); new_fire->SetGraphicFactory(graphic_factory); cpw::EntityFactory::GetInstance()->RegisterBasic(new_fire); cpw::ogc::WmsLayer *wms_layer = new cpw::ogc::WmsLayer; wms_layer->SetPersistentCallBack(new cpw::PersistentFileCallBack); wms_layer->SetName("WmsLayer"); cpw::EntityFactory::GetInstance()->RegisterBasic(wms_layer); bool result = project_controller ->OpenProject(cpw::ApplicationConfiguration::GetInstance()->GetSceneFile(), GetDefaultPath(), status_controller, layer_tree, graphic_factory); std::string title = project_controller->GetProjectFullName(); if (title!="") { main_frame->SetTitle(wxString((title+" - Rvzware").c_str(), wxConvUTF8)); } navigator_manager->SetAllNavigatorsToInitialPosition(); layer_tree.Attach(&video_controller); video_controller.SetLayerTree(&layer_tree); application_time->Attach(&video_controller); wms_request_manager->SetSRS(project_controller->GetSRS()); return result; }
void Application::InitHandlers() { std::string path = GetDefaultPath(); cpw::IScene *scene = cpw::ApplicationScene::GetInstance()->GetScene(); traslation_x_gizmo_id = std::string("tx_giz"); traslation_y_gizmo_id = std::string("ty_giz"); traslation_z_gizmo_id = std::string("tz_giz"); rotate_x_gizmo_id = std::string("rx_giz"); rotate_y_gizmo_id = std::string("ry_giz"); rotate_z_gizmo_id = std::string("rz_giz"); scale_x_gizmo_id = std::string("sx_giz"); two_axis_gizmo_id = std::string("ta_giz"); //create the gizmos cpw::IHandler *traslation_x_handler = new cpw::TraslationGizmo(); cpw::IHandler *traslation_y_handler = new cpw::TraslationGizmo(); cpw::IHandler *traslation_z_handler = new cpw::TraslationGizmo(); cpw::IHandler *rotation_x_handler = new cpw::RotationGizmo(); cpw::IHandler *rotation_y_handler = new cpw::RotationGizmo(); cpw::IHandler *rotation_z_handler = new cpw::RotationGizmo(); cpw::IHandler *scale_x_handler = new cpw::ScaleGizmo(); cpw::IHandler *two_axis_handler = new cpw::TwoAxisTraslationGizmo(); //set the navigator_manager to all of them traslation_x_handler->SetNavigatorManager(navigator_manager); traslation_y_handler->SetNavigatorManager(navigator_manager); traslation_z_handler->SetNavigatorManager(navigator_manager); rotation_x_handler->SetNavigatorManager(navigator_manager); rotation_y_handler->SetNavigatorManager(navigator_manager); rotation_z_handler->SetNavigatorManager(navigator_manager); scale_x_handler->SetNavigatorManager(navigator_manager); two_axis_handler->SetNavigatorManager(navigator_manager); //set the axis ((cpw::Gizmo *)traslation_x_handler) ->SetTransformationAxis( cpw::Gizmo::AXIS_X ); ((cpw::Gizmo *)traslation_y_handler) ->SetTransformationAxis( cpw::Gizmo::AXIS_Y ); ((cpw::Gizmo *)traslation_z_handler) ->SetTransformationAxis( cpw::Gizmo::AXIS_Z ); ((cpw::Gizmo *)rotation_x_handler) ->SetTransformationAxis( cpw::Gizmo::AXIS_X ); ((cpw::Gizmo *)rotation_y_handler) ->SetTransformationAxis( cpw::Gizmo::AXIS_Y ); ((cpw::Gizmo *)rotation_z_handler) ->SetTransformationAxis( cpw::Gizmo::AXIS_Z ); ((cpw::Gizmo *)scale_x_handler) ->SetTransformationAxis( cpw::Gizmo::AXIS_X ); //link the gizmos traslation_x_handler->AddBrother(traslation_y_handler); traslation_x_handler->AddBrother(traslation_z_handler); traslation_x_handler->AddBrother(two_axis_handler); traslation_y_handler->AddBrother(traslation_x_handler); traslation_y_handler->AddBrother(traslation_z_handler); traslation_y_handler->AddBrother(two_axis_handler); traslation_z_handler->AddBrother(traslation_x_handler); traslation_z_handler->AddBrother(traslation_y_handler); traslation_z_handler->AddBrother(two_axis_handler); two_axis_handler->AddBrother(traslation_x_handler); two_axis_handler->AddBrother(traslation_y_handler); two_axis_handler->AddBrother(traslation_z_handler); rotation_x_handler->AddBrother(rotation_y_handler); rotation_x_handler->AddBrother(rotation_z_handler); rotation_y_handler->AddBrother(rotation_x_handler); rotation_y_handler->AddBrother(rotation_z_handler); rotation_z_handler->AddBrother(rotation_x_handler); rotation_z_handler->AddBrother(rotation_y_handler); //set the id´s traslation_x_handler->SetId( traslation_x_gizmo_id ); traslation_y_handler->SetId( traslation_y_gizmo_id ); traslation_z_handler->SetId( traslation_z_gizmo_id ); rotation_x_handler->SetId( rotate_x_gizmo_id ); rotation_y_handler->SetId( rotate_y_gizmo_id ); rotation_z_handler->SetId( rotate_z_gizmo_id ); scale_x_handler->SetId( scale_x_gizmo_id ); two_axis_handler->SetId( two_axis_gizmo_id ); //add them to the scene scene->AddHandler(traslation_x_gizmo_id, path + std::string("gizmos/gizmo_traslate_x.osg")); scene->AddHandler(traslation_y_gizmo_id, path + std::string("gizmos/gizmo_traslate_y.osg")); scene->AddHandler(traslation_z_gizmo_id, path + std::string("gizmos/gizmo_traslate_z.osg")); scene->AddHandler(two_axis_gizmo_id, path + std::string("gizmos/gizmo_ball.osg")); scene->AddHandler(rotate_x_gizmo_id, path + std::string("gizmos/gizmo_rotate_x.osg")); scene->AddHandler(rotate_y_gizmo_id, path + std::string("gizmos/gizmo_rotate_y.osg")); scene->AddHandler(rotate_z_gizmo_id, path + std::string("gizmos/gizmo_rotate_z.osg")); scene->AddHandler(scale_x_gizmo_id, path + std::string("gizmos/gizmo_scale_all.osg")); //add them to the handler controller handler_controller.InsertHandler(traslation_x_handler); handler_controller.InsertHandler(traslation_y_handler); handler_controller.InsertHandler(traslation_z_handler); handler_controller.InsertHandler(rotation_x_handler); handler_controller.InsertHandler(rotation_y_handler); handler_controller.InsertHandler(rotation_z_handler); handler_controller.InsertHandler(scale_x_handler); handler_controller.InsertHandler(two_axis_handler); //default handler handler_controller.SetDefaultHandler(traslation_x_handler); //link the handler controller to the navigators //so it becomes an event receiver cpw::INavigatorManager *nm = cpw::ApplicationScene::GetInstance()->GetNavigatorManager(); nm->GetFocusedOrFirstNavigator()->SetEventReceiver(1, &handler_controller); handler_controller.SetNavigatorManager( nm ); handler_controller.SetScene ( scene = cpw::ApplicationScene::GetInstance()->GetScene() ); handler_controller.SetActiveHandler(traslation_x_gizmo_id); }
static char * GetServerPath(void) { char * pPath = getenv("MQM_DLL_PATH"); if (!pPath) pPath = GetDefaultPath(); return pPath; }
static char * GetClientPath(void) { char * pPath = getenv("MQIC_DLL_PATH"); if (!pPath) pPath = GetDefaultPath(); return pPath; }