source: vtkvis/trunk/Group.h @ 4810

Last change on this file since 4810 was 3683, checked in by ldelgass, 11 years ago

Improvements to 3D shapes in vtkvis. Add preliminary, experimental grouping.

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2004-2012  HUBzero Foundation, LLC
4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
8#ifndef VTKVIS_GROUP_H
9#define VTKVIS_GROUP_H
10
11#include <tr1/unordered_map>
12
13#include <vtkProp3D.h>
14
15#include "GraphicsObject.h"
16
17namespace VtkVis {
18
19/**
20 * \brief Collection of shapes with grouping
21 */
22class Group : public GraphicsObject {
23public:
24    typedef std::string NodeId;
25    typedef std::tr1::unordered_map<NodeId, GraphicsObject *> NodeHashmap;
26
27    Group();
28    virtual ~Group();
29
30    virtual const char *getClassName() const
31    {
32        return "Group";
33    }
34
35    virtual void setDataSet(DataSet *dataSet,
36                            Renderer *renderer)
37    {
38        assert(dataSet == NULL);
39        update();
40    }
41
42    virtual void setClippingPlanes(vtkPlaneCollection *planes);
43
44    void addChild(const NodeId& name, GraphicsObject *obj);
45
46    GraphicsObject *getChild(const NodeId& name);
47
48    void getChildren(std::vector<GraphicsObject *>& children)
49    {
50        for (NodeHashmap::iterator itr = _nodes.begin();
51             itr != _nodes.end(); ++itr) {
52            children.push_back(itr->second);
53        }
54    }
55
56    GraphicsObject *removeChild(const NodeId& name);
57
58private:
59    virtual void initProp();
60
61    virtual void update();
62
63    NodeHashmap _nodes;
64};
65
66}
67
68#endif
Note: See TracBrowser for help on using the repository browser.