source: trunk/packages/vizservers/vtkvis/RpGroup.cpp @ 3177

Last change on this file since 3177 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

  • Property svn:eol-style set to native
File size: 1.6 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#include "RpGroup.h"
9#include "Trace.h"
10
11using namespace Rappture::VtkVis;
12
13Group::Group()
14{
15}
16
17Group::~Group()
18{
19}
20
21/**
22 * \brief Create and initialize VTK Props to render the Group
23 */
24void Group::initProp()
25{
26    if (_prop == NULL) {
27        _prop = vtkSmartPointer<vtkAssembly>::New();
28    }
29}
30
31void Group::update()
32{
33    initProp();
34}
35
36void Group::addChild(const NodeId& name, VtkGraphicsObject *obj)
37{
38    if (obj == NULL)
39        return;
40    if (obj->getProp3D() != NULL) {
41        getAssembly()->AddPart(obj->getProp3D());
42    }
43    _nodes[name] = obj;
44}
45
46VtkGraphicsObject *Group::getChild(const NodeId& name)
47{
48    NodeHashmap::iterator itr = _nodes.find(name);
49    if (itr == _nodes.end()) {
50        return NULL;
51    } else {
52        return itr->second;
53    }
54}
55
56void Group::removeChild(const NodeId& name)
57{
58    NodeHashmap::iterator itr = _nodes.find(name);
59    if (itr == _nodes.end()) {
60        ERROR("Node not found: '%s'", name.c_str());
61        return;
62    }
63    VtkGraphicsObject *obj = itr->second;
64    if (obj->getProp3D() != NULL) {
65        getAssembly()->RemovePart(obj->getProp3D());
66    }
67    _nodes.erase(itr);
68}
69
70/**
71 * \brief Set a group of world coordinate planes to clip rendering
72 *
73 * Passing NULL for planes will remove all cliping planes
74 */
75void Group::setClippingPlanes(vtkPlaneCollection *planes)
76{
77    for (NodeHashmap::iterator itr = _nodes.begin();
78         itr != _nodes.end(); ++itr) {
79        itr->second->setClippingPlanes(planes);
80    }
81}
Note: See TracBrowser for help on using the repository browser.