| 1017 | } |
| 1018 | |
| 1019 | void Project::AddNeighborsToSelection(boost::uuids::uuid weights_id) |
| 1020 | { |
| 1021 | wxLogMessage("Entering Project::AddNeighborsToSelection"); |
| 1022 | if (!GetWManInt()) return; |
| 1023 | GalWeight* gal_weights = GetWManInt()->GetGal(weights_id); |
| 1024 | if (!gal_weights || !gal_weights->gal) { |
| 1025 | wxLogMessage("Warning: no current weight matrix found"); |
| 1026 | return; |
| 1027 | } |
| 1028 | |
| 1029 | // go through the list of all objects in current selection |
| 1030 | // for each selected object and add each of its neighbor to |
| 1031 | // the list so long as it isn't already selected. |
| 1032 | |
| 1033 | HighlightState& hs = *highlight_state; |
| 1034 | std::vector<bool>& h = hs.GetHighlight(); |
| 1035 | int nh_cnt = 0; |
| 1036 | std::vector<bool> add_elem(gal_weights->num_obs, false); |
| 1037 | |
| 1038 | std::vector<int> new_highlight_ids; |
| 1039 | |
| 1040 | for (int i=0; i<gal_weights->num_obs; i++) { |
| 1041 | if (h[i]) { |
| 1042 | GalElement& e = gal_weights->gal[i]; |
| 1043 | for (int j=0, jend=e.Size(); j<jend; j++) { |
| 1044 | int obs = e[j]; |
| 1045 | if (!h[obs] && !add_elem[obs]) { |
| 1046 | add_elem[obs] = true; |
| 1047 | new_highlight_ids.push_back(obs); |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | } |
| 1052 | |
| 1053 | for (int i=0; i<(int)new_highlight_ids.size(); i++) { |
| 1054 | h[ new_highlight_ids[i] ] = true; |
| 1055 | nh_cnt ++; |
| 1056 | } |
| 1057 | |
| 1058 | if (nh_cnt > 0) { |
| 1059 | hs.SetEventType(HLStateInt::delta); |
| 1060 | hs.notifyObservers(); |
| 1061 | } |
| 1062 | wxLogMessage("Exiting Project::AddNeighborsToSelection"); |
| 1063 | } |
| 1064 | |
| 1065 | void Project::AddMeanCenters() |
| 1066 | { |
no test coverage detected