Skip to content

Commit

Permalink
Merge pull request #2246 from SCIInstitute/2239-arrows
Browse files Browse the repository at this point in the history
Fix #2239 - arrows and colors for group diff
  • Loading branch information
akenmorris committed May 5, 2024
2 parents b4e39ce + 826d3ac commit 4e2dab7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
61 changes: 31 additions & 30 deletions Studio/Visualization/Viewer.cpp
Expand Up @@ -234,7 +234,6 @@ void Viewer::display_vector_field() {
// restore things to normal
glyphs_->ScalingOn();
glyphs_->ClampingOff();
glyphs_->SetScaleModeToDataScalingOff();
glyph_mapper_->SetLookupTable(glyph_lut_);

glyph_points_->SetDataTypeToDouble();
Expand Down Expand Up @@ -942,45 +941,47 @@ void Viewer::update_points() {
if (domain_visibility.size() != correspondence_points.size()) {
domain_visibility.resize(correspondence_points.size(), true);
}
if (num_points > 0) {
viewer_ready_ = true;
glyphs_->SetRange(0.0, (double)num_points + 1);
glyph_mapper_->SetScalarRange(0.0, (double)num_points + 1.0);

glyph_points_->Reset();
scalars->Reset();

int point_index = 0;
for (int d = 0; d < correspondence_points.size(); d++) {
int num_points_this_domain = correspondence_points[d].size() / 3;

int d_index = 0;
for (int j = 0; j < num_points_this_domain; j++) {
double x = correspondence_points[d][d_index++];
double y = correspondence_points[d][d_index++];
double z = correspondence_points[d][d_index++];

if (slice_view_.should_point_show(x, y, z) && domain_visibility[d]) {
if (scalar_values.size() > point_index) {
scalars->InsertNextValue(scalar_values[point_index]);
} else {
scalars->InsertNextValue(point_index);

if (!arrows_visible_) {
if (num_points > 0) {
viewer_ready_ = true;
glyphs_->SetRange(0.0, (double)num_points + 1);
glyph_mapper_->SetScalarRange(0.0, (double)num_points + 1.0);

glyph_points_->Reset();
scalars->Reset();

int point_index = 0;
for (int d = 0; d < correspondence_points.size(); d++) {
int num_points_this_domain = correspondence_points[d].size() / 3;

int d_index = 0;
for (int j = 0; j < num_points_this_domain; j++) {
double x = correspondence_points[d][d_index++];
double y = correspondence_points[d][d_index++];
double z = correspondence_points[d][d_index++];

if (slice_view_.should_point_show(x, y, z) && domain_visibility[d]) {
if (scalar_values.size() > point_index) {
scalars->InsertNextValue(scalar_values[point_index]);
} else {
scalars->InsertNextValue(point_index);
}
glyph_points_->InsertNextPoint(x, y, z);
}
glyph_points_->InsertNextPoint(x, y, z);
point_index++;
}
point_index++;
}
} else {
glyph_points_->Reset();
scalars->Reset();
}
} else {
glyph_points_->Reset();
scalars->Reset();
}

if (showing_feature_map()) {
glyph_mapper_->SetScalarRange(surface_lut_->GetRange());
glyph_point_set_->GetPointData()->SetScalars(scalars);
glyphs_->SetColorModeToColorByScalar();
glyphs_->SetScaleModeToDataScalingOff();
glyph_mapper_->SetColorModeToMapScalars();
glyph_mapper_->ScalarVisibilityOn();
glyph_mapper_->SetLookupTable(surface_lut_);
Expand Down
3 changes: 3 additions & 0 deletions Studio/Visualization/Visualizer.cpp
Expand Up @@ -428,6 +428,9 @@ const std::string& Visualizer::get_feature_map() const { return feature_map_; }

//-----------------------------------------------------------------------------
void Visualizer::set_feature_map(const std::string& feature_map) {
if (feature_map_ == feature_map) {
return;
}
feature_map_ = feature_map;
reset_feature_range();
}
Expand Down

0 comments on commit 4e2dab7

Please sign in to comment.