This should only be called by the Project constructors. This represents the common part a New Project object once certain initial parts are initialized differently. */
| 1498 | the common part a New Project object once certain initial parts are |
| 1499 | initialized differently. */ |
| 1500 | bool Project::CommonProjectInit() |
| 1501 | { |
| 1502 | wxLogMessage("Project::CommonProjectInit()"); |
| 1503 | OGRDataAdapter& ogr_adapter = OGRDataAdapter::GetInstance(); |
| 1504 | if (!InitFromOgrLayer()) { |
| 1505 | ogr_adapter.Close(); |
| 1506 | return false; |
| 1507 | } |
| 1508 | |
| 1509 | num_records = table_int->GetNumberRows(); |
| 1510 | |
| 1511 | if (!isTableOnly) { |
| 1512 | ogr_adapter.GetHistory("db_host"); |
| 1513 | } |
| 1514 | |
| 1515 | // convert projection to WGS84 by default if there is projection |
| 1516 | sourceSR = GetSpatialReference(); |
| 1517 | if (sourceSR ) { |
| 1518 | project_unit = sourceSR->GetAttrValue(GdaConst::gda_projection_UNIT); |
| 1519 | if (project_unit.CmpNoCase(GdaConst::gda_projection_metre) == 0) { |
| 1520 | project_unit = GdaConst::gda_projection_meter; |
| 1521 | } |
| 1522 | } |
| 1523 | // configurations for save gda project file |
| 1524 | LayerConfiguration* layer_conf = project_conf->GetLayerConfiguration(); |
| 1525 | CustomClassifPtree* cust_classif_ptree = layer_conf->GetCustClassifPtree(); |
| 1526 | WeightsManPtree* spatial_weights = layer_conf->GetWeightsManPtree(); |
| 1527 | DefaultVarsPtree* default_vars = layer_conf->GetDefaultVarsPtree(); |
| 1528 | |
| 1529 | // Initialize various managers |
| 1530 | frames_manager = new FramesManager; |
| 1531 | highlight_state = new HighlightState; |
| 1532 | con_map_hl_state = new HighlightState; |
| 1533 | cat_classif_manager = new CatClassifManager(table_int, GetTableState(), |
| 1534 | cust_classif_ptree); |
| 1535 | highlight_state->SetSize(num_records); |
| 1536 | con_map_hl_state->SetSize(num_records); |
| 1537 | |
| 1538 | maplayer_state = new MapLayerState; |
| 1539 | w_man_state = new WeightsManState; |
| 1540 | w_man_int = new WeightsNewManager(w_man_state, table_int); |
| 1541 | save_manager = new SaveButtonManager(GetTableState(), GetWManState()); |
| 1542 | |
| 1543 | if (spatial_weights) { |
| 1544 | ((WeightsNewManager*) w_man_int)-> |
| 1545 | Init(spatial_weights->GetWeightsMetaInfoList()); |
| 1546 | } |
| 1547 | // For create Variable Selection Dialog, which has maximum 4 variables |
| 1548 | // to select from table |
| 1549 | for (int i=0; i<4; i++) { |
| 1550 | default_var_name[i] = ""; |
| 1551 | default_var_time[i] = 0; |
| 1552 | } |
| 1553 | if (default_vars != NULL) { |
| 1554 | int i=0; |
| 1555 | std::vector<wxString> tm_strs; |
| 1556 | table_int->GetTimeStrings(tm_strs); |
| 1557 | std::map<wxString, int> tm_map; |
nothing calls this directly
no test coverage detected