| 95 | } |
| 96 | |
| 97 | void SetAssociationDlg::Init() |
| 98 | { |
| 99 | int nrows = all_layers.size(); |
| 100 | for (int i=0; i<nrows; i++) { |
| 101 | wxString layer_id = LAYER_LIST_ID; |
| 102 | layer_id << i; |
| 103 | int ctrl_id = XRCID(layer_id); |
| 104 | layer_list[i]->Clear(); |
| 105 | layer_list[i]->Append(""); |
| 106 | for (int j=0; j<all_layers.size(); j++) { |
| 107 | wxString name = all_layers[j]->GetName(); |
| 108 | layer_list[i]->Append(name); |
| 109 | } |
| 110 | |
| 111 | wxCommandEvent e; |
| 112 | e.SetId(ctrl_id); |
| 113 | OnLayerSelect(e); |
| 114 | |
| 115 | my_field_list[i]->Clear(); |
| 116 | my_field_list[i]->Append(""); |
| 117 | my_field_list[i]->Append(_("(Use Sequences)")); |
| 118 | std::vector<wxString> my_fieldnames = current_ml->GetKeyNames(); |
| 119 | for (int j=0; j<my_fieldnames.size(); j++) { |
| 120 | my_field_list[i]->Append(my_fieldnames[j]); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | int i = 0; |
| 125 | std::map<AssociateLayerInt*, Association>& asso = current_ml->associated_layers; |
| 126 | std::map<AssociateLayerInt*, Association>::iterator it; |
| 127 | for (it = asso.begin(); it!=asso.end(); it++) { |
| 128 | AssociateLayerInt* layer = it->first; |
| 129 | Association& lyr = it->second; |
| 130 | wxString my_key = lyr.first; |
| 131 | wxString key = lyr.second; |
| 132 | |
| 133 | wxString layer_name; |
| 134 | for (int j=0; j<all_layers.size(); j++) { |
| 135 | wxString name = all_layers[j]->GetName(); |
| 136 | if (layer->GetName() == name) { |
| 137 | layer_name = name; |
| 138 | layer_list[i]->SetSelection(j+1); |
| 139 | |
| 140 | wxString layer_id = LAYER_LIST_ID; |
| 141 | layer_id << i; |
| 142 | int ctrl_id = XRCID(layer_id); |
| 143 | wxCommandEvent e; |
| 144 | e.SetId(ctrl_id); |
| 145 | OnLayerSelect(e); |
| 146 | |
| 147 | AssociateLayerInt* ml = GetMapLayer(layer_name); |
| 148 | if (ml) { |
| 149 | if (key.IsEmpty()) { |
| 150 | field_list[i]->SetSelection(1); |
| 151 | } else { |
| 152 | std::vector<wxString> names = ml->GetKeyNames(); |
| 153 | for (int j=0; j<names.size(); j++) { |
| 154 | if (key == names[j]) { |
no test coverage detected