Skip to content
Snippets Groups Projects
Commit a8f4efdb authored by Karsten Rink's avatar Karsten Rink
Browse files

radius is now correctly calculated upon highlighting a single polyline

parent bebb9a2c
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,9 @@ void VtkCompositeGeoObjectFilter::init()
else if (_type == GEOLIB::POLYLINE)
{
composite = new VtkCompositeLineToTubeFilter(surface);
composite->SetUserProperty("Radius", this->GetInitialRadius());
_outputAlgorithm = composite->GetOutputAlgorithm();
}
else
_outputAlgorithm = surface;
......@@ -75,4 +77,18 @@ void VtkCompositeGeoObjectFilter::init()
void VtkCompositeGeoObjectFilter::SetIndex(size_t idx)
{
_threshold->ThresholdBetween(idx, idx);
}
\ No newline at end of file
}
float VtkCompositeGeoObjectFilter::GetInitialRadius() const
{
double bounding_box[6];
static_cast<vtkPolyData*>(this->_inputAlgorithm->GetOutputDataObject(0))->GetBounds(bounding_box);
double x_diff = abs(bounding_box[0]-bounding_box[1]);
double y_diff = abs(bounding_box[2]-bounding_box[3]);
double z_diff = abs(bounding_box[5]-bounding_box[5]);
double max = (x_diff > y_diff) ? x_diff : y_diff;
max = (max > z_diff) ? max : z_diff;
return max/200.0;
}
......@@ -30,6 +30,8 @@ public:
void SetIndex(size_t idx);
private:
float GetInitialRadius() const;
GEOLIB::GEOTYPE _type;
vtkThreshold* _threshold;
};
......
......@@ -73,5 +73,5 @@ float VtkCompositeLineToTubeFilter::GetInitialRadius() const
double max = (x_diff > y_diff) ? x_diff : y_diff;
max = (max > z_diff) ? max : z_diff;
return max/100.0;
return max/200.0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment