| 195 | } |
| 196 | |
| 197 | void BackgroundMapLayer::DrawHighlight(wxMemoryDC& dc, MapCanvas* map_canvas) |
| 198 | { |
| 199 | // draw any connected layers |
| 200 | std::map<AssociateLayerInt*, Association>::iterator it; |
| 201 | for (it=associated_layers.begin(); it!=associated_layers.end();it++) { |
| 202 | AssociateLayerInt* associated_layer = it->first; |
| 203 | Association& al = it->second; |
| 204 | wxString primary_key = al.first; |
| 205 | wxString associated_key = al.second; |
| 206 | |
| 207 | std::vector<wxString> pid(shapes.size()); // e.g. 1 2 3 4 5 |
| 208 | if (primary_key.IsEmpty() == false) { |
| 209 | GetKeyColumnData(primary_key, pid); |
| 210 | } else { |
| 211 | for (int i=0; i<shapes.size(); i++) { |
| 212 | pid[i] << i; |
| 213 | } |
| 214 | } |
| 215 | std::vector<wxString> fid; // e.g. 2 2 1 1 3 5 4 4 |
| 216 | associated_layer->GetKeyColumnData(associated_key, fid); |
| 217 | associated_layer->ResetHighlight(); |
| 218 | |
| 219 | std::map<wxString, std::vector<wxInt64> > aid_idx; |
| 220 | for (int i=0; i<fid.size(); i++) { |
| 221 | aid_idx[fid[i]].push_back(i); |
| 222 | } |
| 223 | |
| 224 | for (int i=0; i<highlight_flags.size(); i++) { |
| 225 | if (!highlight_flags[i]) { |
| 226 | continue; |
| 227 | } |
| 228 | wxString aid = pid[i]; |
| 229 | if (aid_idx.find(aid) == aid_idx.end()) { |
| 230 | continue; |
| 231 | } |
| 232 | std::vector<wxInt64>& ids = aid_idx[aid]; |
| 233 | for (int j=0; j<ids.size(); j++) { |
| 234 | associated_layer->SetHighlight( ids[j] ); |
| 235 | } |
| 236 | } |
| 237 | associated_layer->DrawHighlight(dc, map_canvas); |
| 238 | // draw lines to associated layer |
| 239 | wxPen pen(this->GetAssociatePenColour()); |
| 240 | dc.SetPen(pen); |
| 241 | for (int i=0; i<highlight_flags.size(); i++) { |
| 242 | if (!highlight_flags[i]) { |
| 243 | continue; |
| 244 | } |
| 245 | wxString aid = pid[i]; |
| 246 | if (aid_idx.find(aid) == aid_idx.end()) { |
| 247 | continue; |
| 248 | } |
| 249 | std::vector<wxInt64>& ids = aid_idx[aid]; |
| 250 | for (int j=0; j<ids.size(); j++) { |
| 251 | if (associated_lines[associated_layer] && !associated_layer->IsHide()) { |
| 252 | dc.DrawLine(shapes[i]->center, associated_layer->GetShape(ids[j])->center); |
| 253 | } |
| 254 | } |
nothing calls this directly
no test coverage detected