00001 #include "RoadmapNode.h" 00002 00003 using namespace PathEngine; 00004 00005 RoadmapNodePtr RoadmapNode::parent(unsigned int index) 00006 { 00007 if (index >= parents_.size()) return RoadmapNodePtr(); 00008 return parents_[index]; 00009 } 00010 00011 RoadmapNodePtr RoadmapNode::child(unsigned int index) 00012 { 00013 if (index >= children_.size()) return RoadmapNodePtr(); 00014 return children_[index]; 00015 } 00016 00017 bool RoadmapNode::removeParent(RoadmapNodePtr node) 00018 { 00019 std::vector<RoadmapNodePtr>::iterator it 00020 = find(parents_.begin(), parents_.end(), node); 00021 if (it != parents_.end()){ 00022 parents_.erase(it); 00023 return true; 00024 }else{ 00025 return false; 00026 } 00027 } 00028 00029 bool RoadmapNode::removeChild(RoadmapNodePtr node) 00030 { 00031 std::vector<RoadmapNodePtr>::iterator it 00032 = find(children_.begin(), children_.end(), node); 00033 if (it != children_.end()){ 00034 children_.erase(it); 00035 return true; 00036 }else{ 00037 return false; 00038 } 00039 } 00040