Example #1
0
void ossimQuadTreeWarp::updateLockFlag(ossimQuadTreeWarpVertex* v)
{
   std::vector<ossimQuadTreeWarpNode*> nodeList;
   
   findAllNodes(nodeList,
                v->getPosition());

   if(nodeList.size() != v->theSharedNodeList.size())
   {
      if(isOnEdge(theTree, v->getPosition()))
      {
         v->theLockedFlag = false;
      }
      else
      {
         v->theLockedFlag = true;
      }
   }
   else
   {
      v->theLockedFlag = false;
   }

   // if the original was not locked
   // then we need to make sure we change the delta
   // along the locked edge so to produce no artifacts
   //
   if(v->theLockedFlag)
   {
      updateDelta(v);
   }
}
Example #2
0
static void findAllNodes(DFNode *node, DFArray *result)
{
    if (node->tag == WORD_PPR)
        return;
    for (DFNode *child = node->first; child != NULL; child = child->next) {
        DFArrayAppend(result,child);
        findAllNodes(child,result);
    }
}
Example #3
0
void ossimQuadTreeWarp::findAllNodes(std::vector<const ossimQuadTreeWarpNode*>& result,
                                     const ossimDpt& pt)const
{
   if(!pt.hasNans()&&(!isEmpty()))
   {
      if(theTree->theBoundingRect.pointWithin(pt))
      {
         findAllNodes(result,
                      theTree,
                      pt);
      }
   }
   
}
Example #4
0
void ossimQuadTreeWarp::findAllNodes(std::vector<ossimQuadTreeWarpNode*>& result,
                                     ossimQuadTreeWarpNode* node,
                                     const ossimDpt& pt)
{   
   if(node->isLeaf())
   {
      result.push_back(node);
   }
   else
   {
      for(ossim_uint32 i = 0;
          i < node->theChildren.size();
          ++i)
      {
         if(node->theChildren[i]->theBoundingRect.pointWithin(pt))
         {
            findAllNodes(result,
                         node->theChildren[i],
                         pt);
         }
      }
   }
}
Example #5
0
CaptionParts WordBookmarkGetCaptionParts(WordBookmark *bookmark)
{
    CaptionParts parts;
    parts.beforeNum = 0;
    parts.num = 0;
    parts.afterNum = 0;

    // FIXME: Check if the following line is still relevant with the new bookmarks model
    if (bookmark->element == NULL)
        return parts;

    DFArray *nodes = DFArrayNew(NULL,NULL);
    findAllNodes(bookmark->element,nodes);

    for (size_t i = 0; i < DFArrayCount(nodes); i++) {
        DFNode *node = DFArrayItemAt(nodes,i);
        if (node->tag == WORD_FLDSIMPLE) {
            const char *instr = DFGetAttribute(node,WORD_INSTR);
            if (instr != NULL) {
                const char **args = Word_parseField(instr);
                if ((args[0] != NULL) && !strcmp(args[0],"SEQ"))
                    parts.num = 1;
                free(args);
            }
        }
        else if (node->tag != WORD_BOOKMARK) {
            if (!parts.num)
                parts.beforeNum = 1;
            else
                parts.afterNum = 1;
        }
    }
    DFArrayRelease(nodes);

    return parts;
}
Example #6
0
MemoryMapNode* MemoryMap::existsNode(const Instance& origInst,
                                     const InstanceList &candidates) const
{
    if (!origInst.type())
        return 0;

//    if (origInst.type()->type() & BaseType::trLexical)
//        debugerr(QString("The given instance '%0' has the lexical type '%1' (0x%2)!")
//                 .arg(origInst.fullName())
//                 .arg(origInst.typeName())
//                 .arg((uint)origInst.type()->id()));

    MemMapList nodes(findAllNodes(origInst, candidates));

    // Did we find any node?
    if (nodes.isEmpty())
        return 0;

    bool found = false, done = false;
    int i = 0;
    const MemoryMapNode *n = 0, *funcNode = 0;
    const BaseType* instType;
    quint64 instAddr;

    // Compare all given instances against all nodes found
    while (!found && !done) {
        // Try all candidates from the list first, finally the original instance
        if (i < candidates.size()) {
            instType = candidates[i].type();
            instAddr = candidates[i].address();
            ++i;
        }
        else {
            instType = origInst.type();
            instAddr = origInst.address();
            done = true;
        }

        // Compare the current instance with all nodes found
        for (MemMapList::const_iterator it = nodes.begin(), e = nodes.end();
             !found && it != e; ++it)
        {
            n = *it;
            // Does one node embed the instance?
            ObjectRelation orel = BaseType::embeds(n->type(), n->address(),
                                                   instType, instAddr);
            switch (orel) {
            // Conflict, ignored
            case orOverlap:
            case orCover:
                break;
            // Not found, continue
            case orNoOverlap:
                break;
            // We found the node
            case orEqual:
            case orFirstEmbedsSecond:
                found = true;
                break;
            // New instance embeds node, currently ignored
            case orSecondEmbedsFirst:
                break;
            }

            // Exit loop if node was found
            if (found)
                break;
            // Exit loop if object overlaps with a function
            if (n->type() && n->type()->type() == rtFunction)
                funcNode = n;
        }
    }

    if (found)
        return const_cast<MemoryMapNode*>(n);
    else if (funcNode)
        return const_cast<MemoryMapNode*>(funcNode);
//    else if (!nodes.isEmpty())
//        return const_cast<MemoryMapNode*>(nodes.first());
    else
        return 0;
//    return found ? const_cast<MemoryMapNode*>(n) : 0;
}