Example #1
0
void recursiveOctreeSphere(octree *a, float cx, float cy, float cz, float side, int depth){
    bool inside=true;
    int i;
    //Too small
    if(depth>SphereDepth){
        if(insideSphere(cx, cy, cz, 0.5))	a->leaf=1;
        else    a->leaf=-1;
        return;
    }
    //Center inside
    if(insideSphere(cx, cy, cz, 0.5)){
        for(i=0;i<8;i++)
            inside = inside && insideSphere(cx+cubeVertices[i][0]*side/2, cy+cubeVertices[i][1]*side/2, cz+cubeVertices[i][2]*side/2, 0.5);
        //All corners inside
        if(inside)	a->leaf=1;
        //Center inside, not all corners
        else {
            addChildren(a, 1, 1, 1, 1, 1, 1, 1, 1);
            for(i=0;i<8;i++)	recursiveOctreeSphere(a->children[i],cx+cubeVertices[i][0]*side/4, cy+cubeVertices[i][1]*side/4, cz+cubeVertices[i][2]*side/4, side/2, depth+1);
        }
    } else {
        inside = false;
        for(i=0;i<8;i++)
            inside = inside || insideSphere(cx+cubeVertices[i][0]*side/2, cy+cubeVertices[i][1]*side/2, cz+cubeVertices[i][2]*side/2, 0.5);
        //Center, all corners outside
        if(!inside)	a->leaf=-1;
        //Center outside, some corners in
        else {
            addChildren(a, 1, 1, 1, 1, 1, 1, 1, 1);
            for(i=0;i<8;i++)    recursiveOctreeSphere(a->children[i],cx+cubeVertices[i][0]*side/4, cy+cubeVertices[i][1]*side/4, cz+cubeVertices[i][2]*side/4, side/2, depth+1);
        }
    }
}
ExpressionSomeBinaryOperatorExpr::ExpressionSomeBinaryOperatorExpr(const char *f,instrumentation_option_t options,long s_line_absolute, long s_line_org, long s_column_org, long s_line_pre, long s_column_pre, long e_line_absolute, long e_line_org, long e_column_org, long e_line_pre, long e_column_pre,long depth,Expression *expression_id1,Expression *expression_id2):
ExpressionNOP(f,options,s_line_absolute, s_line_org, s_column_org, s_line_pre, s_column_pre, e_line_absolute, e_line_org, e_column_org, e_line_pre, e_column_pre,depth)
{
  clear();
  write(INSTRUMENTATION_SOME_BINARY_OPERATOR_EXPR, f,options,s_line_absolute, s_line_org, s_column_org, s_line_pre, s_column_pre, e_line_absolute, e_line_org, e_column_org, e_line_pre, e_column_pre,depth);
  if (expression_id1)
	addChildren(expression_id1);
  if (expression_id2)
	addChildren(expression_id2);
}
Example #3
0
void TOCModelPrivate::addChildren( const QDomNode & parentNode, TOCItem * parentItem )
{
    TOCItem * currentItem = 0;
    QDomNode n = parentNode.firstChild();
    while( !n.isNull() )
    {
        // convert the node to an element (sure it is)
        QDomElement e = n.toElement();

        // insert the entry as top level (listview parented) or 2nd+ level
        currentItem = new TOCItem( parentItem, e );

        // descend recursively and advance to the next node
        if ( e.hasChildNodes() )
            addChildren( n, currentItem );

        // open/keep close the item
        bool isOpen = false;
        if ( e.hasAttribute( "Open" ) )
            isOpen = QVariant( e.attribute( "Open" ) ).toBool();
        if ( isOpen )
            itemsToOpen.append( currentItem );

        n = n.nextSibling();
    }
}
Example #4
0
void TOC::addChildren( const QDomNode & parentNode, KListViewItem * parentItem )
{
    // keep track of the current listViewItem
    TOCItem * currentItem = 0;
    QDomNode n = parentNode.firstChild();
    while( !n.isNull() )
    {
        // convert the node to an element (sure it is)
        QDomElement e = n.toElement();

        // insert the entry as top level (listview parented) or 2nd+ level
        if ( !parentItem )
            currentItem = new TOCItem( this, currentItem, e );
        else
            currentItem = new TOCItem( parentItem, currentItem, e );

        // descend recursively and advance to the next node
        if ( e.hasChildNodes() )
            addChildren( n, currentItem );

        // open/keep close the item
        bool isOpen = false;
        if ( e.hasAttribute( "Open" ) )
            isOpen = QVariant( e.attribute( "Open" ) ).toBool();
        currentItem->setOpen( isOpen );

        n = n.nextSibling();
    }
}
bool CocaSystemTree::moveDown( const coca::INode& node )
{
    wxTreeItemId id = findId( node );
    if ( !id.IsOk() ) { return false; }

    wxTreeItemId parentId = GetItemParent( id );
    if ( !parentId.IsOk() ) { return false; }

    wxTreeItemId nextId = GetNextSibling( id );
    if ( !nextId.IsOk() ) { return false; }

    // ready to move
    bool wasSelected = ( id == GetSelection() );

    Delete( id );
    id = InsertItem( parentId, nextId,
                         EditorTools::getName( node ), EditorTools::getImageIndex( node ),
                         -1, new ItemData( node ) );
    COCA_ASSERT( id.IsOk() );
    SetItemTextColour( id, EditorTools::getTextColour( node ) );

    addChildren( node, id );

    if ( wasSelected ) { SelectItem( id ); }

    return true;
}
Example #6
0
QWidget*
GUIBuilder::addElementGroup(model::gui::ElementGroup *root, QWidget *parent)
{
    QGroupBox* widget = new QGroupBox( parent );
    //widget->setFlat( true );

    const std::string key = root->key();
    if( root->showLabel() && !root->key().empty() ) {
        widget->setTitle( (prettyName( root->key(), m_model ) ).c_str() );
    }

    model::gui::Element* child = root->child();
    if( child != NULL ) {
        if( child->type() == model::gui::GRID ) {
            doGridLayout( static_cast<model::gui::Grid*>( child ), widget );
        }
        else if( child->type() == model::gui::HORIZONTAL_LAYOUT ) {
            doHorizontalLayout( static_cast<model::gui::HorizontalLayout*>( child ), widget );
        }
        else if( child->type() == model::gui::VERTICAL_LAYOUT ) {
            doVerticalLayout( static_cast<model::gui::VerticalLayout*>( child ), widget );
        }
        else {
            QHBoxLayout* layout = new QHBoxLayout( widget );
            widget->setLayout( layout );
            addChildren( static_cast<model::gui::Container0D<model::gui::Element>*>( root ),
                         widget,
                         layout );
        }
    }
    return widget;
}
void AccessibilityScrollView::updateChildrenIfNecessary()
{
    // Always update our children when asked for them so that we don't inadvertently cache them after
    // a new web area has been created for this scroll view (like when moving back and forth through history).
    // Since a ScrollViews children will always be relatively small and limited this should not be a performance problem.
    clearChildren();
    addChildren();
}
AccessibilityObject* AccessibilitySpinButton::decrementButton()
{
    if (!m_haveChildren)
        addChildren();
    
    ASSERT(m_children.size() == 2);
    
    return m_children[1].get();    
}
 ExplorerClusterItem::ExplorerClusterItem(IClusterSPtr cluster, TreeItem* parent)
     : IExplorerTreeItem(parent), cluster_(cluster)
 {
     ICluster::nodes_type nodes = cluster_->nodes();
     for(int i = 0; i < nodes.size(); ++i){
         ExplorerServerItem* ser = new ExplorerServerItem(nodes[i], this);
         addChildren(ser);
     }
 }
Example #10
0
void AXScrollView::updateChildrenIfNecessary()
{
    if (m_childrenDirty)
        clearChildren();

    if (!m_haveChildren)
        addChildren();

    updateScrollbars();
}
Example #11
0
void
GUIBuilder::doVerticalLayout(model::gui::VerticalLayout *root, QWidget *widget)
{
    QVBoxLayout* layout = new QVBoxLayout( widget );
    widget->setLayout( layout );
    widget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
    addChildren( static_cast<model::gui::Container1D<model::gui::Element>*>( root ),
                 widget,
                 layout );
}
Example #12
0
/** \param[in] name Path name of the node to set the current cursor to.
  \param[in] create If true and not found create the node name. If false and node name not found return RET_NOTFOUND.
  \param[in] onlyDatas If true search only in the datas part of the XML tree. If false, search from the root of the XML tree.
  \retval RET_OK No problemo, tag name found.
  \retval RET_STRING2LONG Node name path string is longer than MAX_STRING.
  \retval RET_NOTFOUND Node name not found in the data tree. */
long FevenData::gotoNodeName( char* name, bool create, bool onlyDatas)
{
  char* str;
  long ret = RET_OK;

  str = getSplitted( TREE_SEPARATOR, name);
  if( (long) str == RET_STRING2LONG)
    return RET_STRING2LONG;

  if( onlyDatas)
    current = datas;
  else
    current = root;

  while( str)
  {
    ret = gotoChildren();
    if( ret == RET_NOTEXIST && create)  // If childrens not exist then create it, if create true
    {
      addChildren( str, NULL);
      gotoChildren();
    }
    else if( ret == RET_NOTEXIST && !create)	// if no sub trees and crate false...
      return RET_NOTFOUND;

    ret = Find( str, false);           // Find the tag name ?
    if( ret == RET_NOTFOUND && create)
    {
      gotoParent();
      addChildren( str, NULL);
      gotoChildren();

      Find( str, false);
    }
    else if( ret == RET_NOTFOUND && !create)
      return RET_NOTFOUND;

    str = getSplitted( TREE_SEPARATOR);
  }

  return RET_OK;
}
void KeepassGroupView::addChildren(GroupViewItem* item){
	QList<IGroupHandle*>children=item->GroupHandle->children();
	if(!children.size())
		return;
	for(int i=0; i<children.size(); i++){
		Items.push_back(new GroupViewItem(item));
		Items.back()->setText(0,children[i]->title());
		Items.back()->GroupHandle=children[i];
		addChildren(Items.back());
	}	
}
Example #14
0
File: Ape.cpp Project: sehwan72/Ape
void Ape::addChildren(std::vector<Process **> *tempVector, const unsigned long pid, int level)
{
    int i, j;
    for (i = 0, j = processList.size(); i < j; ++i) {
        if ((*processList[i])->getStatPtr()->ppid == pid) {
            tempVector->push_back(processList[i]);
            (*processList[i])->plevel = level;
            addChildren(tempVector,(*processList[i])->pid, ++level);
        }
    }
}
Example #15
0
File: joiner.c Project: bowhan/kent
static void addChildren(struct joinerSet *js,  struct slRef **pList)
/* Recursively add children to list. */
{
struct slRef *childRef;
for (childRef = js->children; childRef != NULL; childRef = childRef->next)
    {
    struct joinerSet *child = childRef->val;
    refAdd(pList, child);
    addChildren(child, pList);
    }
}
Example #16
0
		void DockWidget::childEvent(QChildEvent *event)
		{
			if (event->added())
			{
				addChildren(event->child());
			}
			else if (event->removed())
			{
				removeChildren(event->child());
			}
		}
void QScriptDebuggerLocalsModelPrivate::reallyPopulateIndex(
    const QModelIndex &index,
    const QScriptDebuggerValuePropertyList &props)
{
    if (!index.isValid())
        return;
    QScriptDebuggerLocalsModelNode *node = nodeFromIndex(index);
    Q_ASSERT(node->populationState == QScriptDebuggerLocalsModelNode::Populating);
    node->populationState = QScriptDebuggerLocalsModelNode::Populated;
    addChildren(index, node, props);
}
Example #18
0
//Abstract Octree
void recursiveAbstractOctree(octree *a, int depth){
    int i;
    if(depth>AbstractDepth){
        a->leaf=1;
        return;
    }
    addChildren(a, 1, 0, 0, 1, 0, 1, 1, 0);
    for(i=0;i<8;i++)
        if(a->children[i])
            if(a->children[i]->leaf!=1)
                recursiveAbstractOctree(a->children[i], depth+1);
}
wxTreeItemId CocaSystemTree::add( const coca::INode& node, wxTreeItemId parentId )
{
    if ( !parentId.IsOk() ) { return parentId; }

    wxTreeItemId id = AppendItem( parentId, EditorTools::getName( node ), EditorTools::getImageIndex( node ),
                                  -1, new ItemData( node ) );
    SetItemTextColour( id, EditorTools::getTextColour( node ) );

    addChildren( node, id );

    return id;
}
Example #20
0
void
GUIBuilder::doGridLayout( model::gui::Grid* root, QWidget* widget )
{
    QGridLayout* grid_layout = new QGridLayout;
    //grid_layout->setHorizontalSpacing(0);
    //grid_layout->setVerticalSpacing(0);
    //grid_layout->setContentsMargins( 0, 0, 0, 0 );
    widget->setLayout( grid_layout );
    addChildren( static_cast<model::gui::Container2D<model::gui::Element>*>( root ),
                 widget,
                 grid_layout );

}
Example #21
0
File: joiner.c Project: bowhan/kent
struct slRef *joinerSetInheritanceChain(struct joinerSet *js)
/* Return list of self, children, and parents (but not siblings).
 * slFreeList result when done. */
{
struct slRef *list = NULL;
struct joinerSet *parent;

/* Add self and parents. */
for (parent = js; parent != NULL; parent = parent->parent)
    refAdd(&list, parent);
addChildren(js, &list);
slReverse(&list);
return list;
}
void TensegrityModel::buildStructure(tgStructure& structure, const std::string& structurePath, tgBuildSpec& spec) {
    Yam root = YAML::LoadFile(structurePath);
    // Validate YAML
    std::string rootKeys[] = {"nodes", "pair_groups", "builders", "substructures", "bond_groups"};
    std::vector<std::string> rootKeysVector(rootKeys, rootKeys + sizeof(rootKeys) / sizeof(std::string));
    yamlContainsOnly(root, structurePath, rootKeysVector);
    yamlNoDuplicates(root, structurePath);

    addChildren(structure, structurePath, spec, root["substructures"]);
    addBuilders(spec, root["builders"]);
    addNodes(structure, root["nodes"]);
    addPairGroups(structure, root["pair_groups"]);
    addBondGroups(structure, root["bond_groups"], spec);
}
Example #23
0
ExpressionFor::ExpressionFor(const char *f,instrumentation_option_t options,long s_line_absolute, long s_line_org, long s_column_org, long s_line_pre, long s_column_pre, long e_line_absolute, long e_line_org, long e_column_org, long e_line_pre, long e_column_pre,long depth,
     long s_line_patch1, long s_column_patch1,  long e_line_patch1, long e_column_patch1,
     long s_line_patch2, long s_column_patch2,  long e_line_patch2, long e_column_patch2,
     Expression *expression_id1,
     const Source &source
    ) : _source(source)
{
  clear();
  write(INSTRUMENTATION_FOR, f,options,s_line_absolute, s_line_org, s_column_org, s_line_pre, s_column_pre, e_line_absolute, e_line_org, e_column_org, e_line_pre, e_column_pre,depth);
  writePatchArea(0, s_line_patch1, s_column_patch1, e_line_patch1, e_column_patch1,depth);
  writePatchArea(1, s_line_patch2, s_column_patch2, e_line_patch2, e_column_patch2,depth);
  if (expression_id1)
	addChildren(expression_id1);
}
Example #24
0
LRESULT ModelTreeDialog::doTreeItemExpanding(LPNMTREEVIEW notification)
{
	if (notification->action == TVE_EXPAND)
	{
		LDModelTree *tree = (LDModelTree *)notification->itemNew.lParam;

		if (!tree->getViewPopulated())
		{
			addChildren(notification->itemNew.hItem, tree);
			tree->setViewPopulated(true);
		}
		return 0;
	}
	return 1;
}
Example #25
0
/** \return No return value. */
void FevenData::initDatas()
{
// if it is a base evendata, then start initiating evenData
  if( isA()->equals( &EVENDATA_BASE))
  {
    startNewXml();

    addChildren( XML_DATAS, NULL);

    gotoChildren();
    Find( XML_DATAS, false);
    datas = current;

    setString( TXT_NOVALUES);
  }
}
Example #26
0
File: Ape.cpp Project: sehwan72/Ape
void Ape::sortByParent()
{
    std::vector<Process **> tempVector1;
    std::vector<Process **> tempVector2;

    int i, j;
    for (i = 0, j = processList.size(); i < j; ++i)
        if ((*processList[i])->pid == 1)
            break;

    tempVector1.push_back(processList[i]);
    addChildren(&tempVector1, (*processList[i])->pid);

    tempVector2 = processList;
    processList = tempVector1;
    tempVector2.clear();
}
Example #27
0
FB2_END_KEYHASH

FbHeadItem::FbHeadItem(QWebElement &element, FbHeadItem *parent)
    : QObject(parent)
    , m_element(element)
    , m_parent(parent)
{
    m_name = element.tagName().toLower();
    if (m_name.left(3) == "fb:") {
        m_name = m_name.mid(3);
        if (m_name == "annotation") return;
        if (m_name == "history") return;
    } else if (m_name == "img") {
        m_name = "image";
    }
    addChildren(element);
}
Example #28
0
void GLC_OctreeNode::addInstance(GLC_3DViewInstance* pInstance, int depth)
{
    m_Empty= false;
    const GLC_BoundingBox instanceBox= pInstance->boundingBox();
    // Check if the instance's bounding box intersect this node bounding box
    if (!instanceBox.isEmpty() && intersect(instanceBox))
    {
        if (0 == depth)
        {
            m_3DViewInstanceSet.insert(pInstance);
        }
        else
        {
            if (m_Children.isEmpty())
            {
                // Create children
                addChildren();
            }
            QVector<bool> childIntersect(8);
            bool allIntersect= true;
            bool currentIntersect= false;
            for (int i= 0; i < 8; ++i)
            {
                currentIntersect= m_Children.at(i)->intersect(instanceBox);
                allIntersect= allIntersect && currentIntersect;
                childIntersect[i]= currentIntersect;
            }
            if (allIntersect)
            {
                m_3DViewInstanceSet.insert(pInstance);
            }
            else
            {
                for (int i= 0; i < 8; ++i)
                {
                    if (childIntersect[i])
                    {
                        m_Children[i]->addInstance(pInstance, depth - 1);
                    }
                }
            }
        }

    }
}
  // add children to correct maps
  void RobotStatePublisher::addChildren(const KDL::SegmentMap::const_iterator segment)
  {
    const std::string& root = segment->second.segment.getName();

    const std::vector<KDL::SegmentMap::const_iterator>& children = segment->second.children;
    for (unsigned int i=0; i<children.size(); i++){
      const KDL::Segment& child = children[i]->second.segment;
      SegmentPair s(children[i]->second.segment, root, child.getName());
      if (child.getJoint().getType() == KDL::Joint::None){
        segments_fixed_.insert(make_pair(child.getJoint().getName(), s));
        ROS_DEBUG("Adding fixed segment from %s to %s", root.c_str(), child.getName().c_str());
      }
      else{
        segments_.insert(make_pair(child.getJoint().getName(), s));
        ROS_DEBUG("Adding moving segment from %s to %s", root.c_str(), child.getName().c_str());
      }
      addChildren(children[i]);
    }
  }
Example #30
0
void JointStateConverter::addChildren(const KDL::SegmentMap::const_iterator segment)
{
  const std::string& root = GetTreeElementSegment(segment->second).getName();

  const std::vector<KDL::SegmentMap::const_iterator>& children = GetTreeElementChildren(segment->second);
  for (unsigned int i=0; i<children.size(); i++){
    const KDL::Segment& child = GetTreeElementSegment(children[i]->second);
    robot_state_publisher::SegmentPair s(GetTreeElementSegment(children[i]->second), root, child.getName());
    if (child.getJoint().getType() == KDL::Joint::None){
      segments_fixed_.insert(std::make_pair(child.getJoint().getName(), s));
      ROS_DEBUG("Adding fixed segment from %s to %s", root.c_str(), child.getName().c_str());
    }
    else{
      segments_.insert(std::make_pair(child.getJoint().getName(), s));
      ROS_DEBUG("Adding moving segment from %s to %s", root.c_str(), child.getName().c_str());
    }
    addChildren(children[i]);
  }
}