Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <uwsim/VirtualRangeSensor.h>
00014 #include <uwsim/UWSimUtils.h>
00015 #include <iostream>
00016
00017 VirtualRangeSensor::VirtualRangeSensor()
00018 {
00019 }
00020
00021 VirtualRangeSensor::VirtualRangeSensor(std::string name, osg::Node *root, osg::Node *trackNode, double range,
00022 bool visible)
00023 {
00024 init(name, root, trackNode, range, visible);
00025 }
00026
00027 void VirtualRangeSensor::init(std::string name, osg::Node *root, osg::Node *trackNode, double range, bool visible)
00028 {
00029 this->name = name;
00030 this->root = root;
00031
00032 this->trackNode = trackNode;
00033
00034 osg::ref_ptr < osg::Node > axis = UWSimGeometry::createSwitchableFrame();
00035 this->trackNode->asGroup()->addChild(axis);
00036
00037 this->range = range;
00038 this->visible = visible;
00039
00040
00041 node_tracker = new IntersectorUpdateCallback(range, visible, root);
00042 trackNode->setUpdateCallback(node_tracker);
00043 trackNode->asGroup()->addChild(node_tracker->geode);
00044 }
00045