Skip to content

Commit e9d1ceb

Browse files
author
tpat
committed
Added Geometry Composite class which lets you send multiple geometry handles through one port(similar to composite widget). Dipole module can now use input data which only fetches upstream when new data received, can show lines, and disable last vector.
1 parent 375c641 commit e9d1ceb

File tree

7 files changed

+290
-153
lines changed

7 files changed

+290
-153
lines changed

src/Graphics/Datatypes/GeometryImpl.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <Graphics/Datatypes/GeometryImpl.h>
3030

3131
using namespace SCIRun::Core;
32+
using namespace SCIRun::Core::Datatypes;
3233
using namespace SCIRun::Graphics::Datatypes;
3334

3435
GeometryObjectSpire::GeometryObjectSpire(const GeometryIDGenerator& idGenerator, const std::string& tag, bool isClippable) :
@@ -37,3 +38,15 @@ isClippable_(isClippable)
3738
{
3839

3940
}
41+
42+
Composite::~Composite()
43+
{
44+
}
45+
46+
void Composite::addToList(GeometryBaseHandle handle, GeomList& list)
47+
{
48+
if (handle.get() == this)
49+
{
50+
list.insert(geoms_.begin(), geoms_.end());
51+
}
52+
}

src/Graphics/Datatypes/GeometryImpl.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,24 @@ namespace SCIRun {
287287

288288
typedef boost::shared_ptr<GeometryObjectSpire> GeometryHandle;
289289

290+
class SCISHARE Composite : public GeometryObjectSpire
291+
{
292+
public:
293+
template <typename GeomIter>
294+
Composite(const Core::GeometryIDGenerator& idGenerator, const std::string& tag, GeomIter begin, GeomIter end)
295+
: GeometryObjectSpire(idGenerator, tag, true), geoms_(begin, end)
296+
{}
297+
~Composite();
298+
void addToList(Core::Datatypes::GeometryBaseHandle handle, Core::Datatypes::GeomList& list) override;
299+
private:
300+
std::vector<GeometryHandle> geoms_;
301+
};
290302

303+
template <typename GeomIter>
304+
static GeometryHandle createGeomComposite(const Core::GeometryIDGenerator& idGenerator, const std::string& tag, GeomIter begin, GeomIter end)
305+
{
306+
return boost::make_shared<Composite>(idGenerator, tag, begin, end);
307+
}
291308
}
292309
}
293310
}

src/Graphics/Widgets/SphereWidget.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ SphereWidget::SphereWidget(const Core::GeometryIDGenerator& idGenerator,
4343
const Point& point, const BBox& bbox)
4444
: WidgetBase(idGenerator, "SphereWidget::" + name, true, point)
4545
{
46-
//std::cout << "SphereWidget() point: " << point.get_string() << std::endl;
4746
int resolution = 10;
4847
if (radius < 0) radius = 1.;
4948
if (resolution < 0) resolution = 10.;

src/Graphics/Widgets/Widget.cc

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ WidgetHandle WidgetFactory::createDisk(const Core::GeometryIDGenerator& idGenera
112112
return boost::make_shared<DiskWidget>(idGenerator, name, scale, defaultColor, p1, p2, bbox);
113113
}
114114

115-
CompositeWidget::~CompositeWidget()
116-
{
117-
}
118-
119115
void CompositeWidget::addToList(GeometryBaseHandle handle, GeomList& list)
120116
{
121117
if (handle.get() == this)
@@ -124,15 +120,6 @@ void CompositeWidget::addToList(GeometryBaseHandle handle, GeomList& list)
124120
}
125121
}
126122

127-
128-
LinkedCompositeWidget::~LinkedCompositeWidget()
129-
{
130-
}
131-
132-
void LinkedCompositeWidget::addToList(GeometryBaseHandle handle, GeomList& list)
123+
CompositeWidget::~CompositeWidget()
133124
{
134-
if (handle.get() == this)
135-
{
136-
list.insert(widgets_.begin(), widgets_.end());
137-
}
138125
}

src/Graphics/Widgets/Widget.h

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@ namespace SCIRun
7878
std::vector<WidgetHandle> widgets_;
7979
};
8080

81-
class SCISHARE LinkedCompositeWidget : public WidgetBase
82-
{
83-
public:
84-
template <typename WidgetIter>
85-
LinkedCompositeWidget(const Core::GeometryIDGenerator& idGenerator, const std::string& tag, WidgetIter begin, WidgetIter end)
86-
: WidgetBase(idGenerator, tag, true), widgets_(begin, end)
87-
{}
88-
~LinkedCompositeWidget();
89-
void addToList(Core::Datatypes::GeometryBaseHandle handle, Core::Datatypes::GeomList& list) override;
90-
private:
91-
std::vector<WidgetHandle> widgets_;
92-
};
93-
9481
class SCISHARE WidgetFactory
9582
{
9683
public:
@@ -122,17 +109,12 @@ namespace SCIRun
122109
const Core::Geometry::Point& p1,
123110
const Core::Geometry::Point& p2,
124111
const Core::Geometry::BBox& bbox);
125-
template <typename WidgetIter>
112+
113+
template <typename WidgetIter>
126114
static WidgetHandle createComposite(const Core::GeometryIDGenerator& idGenerator, const std::string& tag, WidgetIter begin, WidgetIter end)
127115
{
128116
return boost::make_shared<CompositeWidget>(idGenerator, tag, begin, end);
129117
}
130-
131-
template <typename WidgetIter>
132-
static WidgetHandle createLinkedComposite(const Core::GeometryIDGenerator& idGenerator, const std::string& tag, WidgetIter begin, WidgetIter end)
133-
{
134-
return boost::make_shared<LinkedCompositeWidget>(idGenerator, tag, begin, end);
135-
}
136118
};
137119
}
138120
}

0 commit comments

Comments
 (0)