示例#1
0
DDLNode *OpenDDLParser::popNode() {
    if( m_stack.empty() ) {
        return ddl_nullptr;
    }

    DDLNode *topNode( top() );
    m_stack.pop_back();
    return topNode;
}
示例#2
0
void HTMLElementStack::popCommon()
{
    if (isHTMLTElement(topNode())) {
        ASSERT(m_preserveWhiteSpaceCount);
        --m_preserveWhiteSpaceCount;
    }
    m_top = m_top->releaseNext();
    m_stackDepth--;
}
示例#3
0
void HTMLElementStack::popAll()
{
    m_rootNode = nullptr;
    m_stackDepth = 0;
    while (m_top) {
        Node& node = *topNode();
        if (node.isElementNode())
            toElement(node).finishParsingChildren();
        m_top = m_top->releaseNext();
    }
}
//protected
//pure-virtual from FlightPlanner
void GreedyFlightPlanner::doStart()
{
    _frontier.clear();

    QSharedPointer<GreedyPlanningNode> topNode(new GreedyPlanningNode(this->problem()->startingPosition(),
                                                                      this->problem()->startingOrientation(),
                                                                      0,
                                                                      GREED_DEPTH));
    //_frontier.insert(0, topNode);
    _frontier.enqueue(topNode);
}
示例#5
0
//--------------------------------------------------------------------------------------------------
/// Create a cone oriented along the z-axis
///
/// \param	bottomRadius    Bottom radius of cone
/// \param	height          Height of cone
/// \param	numSlices       Number of slices
/// \param	normalsOutwards true to generate polygons with outward facing normals. 
/// \param	closedBot       true to close the bottom of the cone with a disc
/// \param	singleTopNode   Specify if a single top node should be used, or if each side triangle 
///                         should have its own top node.
/// \param  builder         Geometry builder to use when creating geometry
///
//--------------------------------------------------------------------------------------------------
void GeometryUtils::createCone(float bottomRadius, float height, uint numSlices, bool normalsOutwards, bool closedBot, bool singleTopNode, GeometryBuilder* builder)
{
    Vec3fArray verts;

    if (singleTopNode)
    {
        verts.reserve(numSlices + 1);
    }
    else
    {
        verts.reserve(numSlices*2);
    }

    Vec3f point = Vec3f::ZERO;

    double da = 2*PI_D/numSlices;
    uint i;
    for (i = 0; i < numSlices; i++) 
    {
        // Precompute this one (A = i*da;)
        double sinA = Math::sin(i*da);
        double cosA = Math::cos(i*da);

        point.x() = static_cast<float>(-sinA*bottomRadius);
        point.y() = static_cast<float>( cosA*bottomRadius);

        verts.add(point);
    }

    if (singleTopNode)
    {
        verts.add(Vec3f(0, 0, height));
    }
    else
    {
        // Unique sourceNodes at apex of cone
        Vec3f topNode(0, 0, height);

        uint i;
        for (i = 0; i < numSlices; i++)
        {
            verts.add(topNode);
        }
    }

    uint baseNodeIdx = builder->addVertices(verts);

    uint piConn[3] = { 0, 0, 0 };

    // Normals facing outwards
    if (normalsOutwards)
    {
        uint i;
        for (i = 0; i < numSlices; i++) 
        {
            piConn[0] = baseNodeIdx + i;
            piConn[1] = baseNodeIdx + i + 1;
            piConn[2] = singleTopNode ? baseNodeIdx + numSlices : baseNodeIdx + i + numSlices; 

            if (i == numSlices - 1) 
            {
                piConn[1] = baseNodeIdx;
            }
            
            if (normalsOutwards)
            {
                builder->addTriangle(piConn[0], piConn[1], piConn[2]);
            }
            else
            {
                builder->addTriangle(piConn[1], piConn[0], piConn[2]);
            }
        }
    }

    if (closedBot)
    {
        createDisc(bottomRadius, numSlices, builder);
    }
}
示例#6
0
void TunerBody::openSetting(std::string fileName)
{
  /* open file strage */
  cv::FileStorage cvfs(fileName, CV_STORAGE_READ);

  /* read data from file */
  cv::FileNode topNode(cvfs.fs, NULL);
  {
    cv::FileNode nd_red = topNode[std::string("RED")];
    {
      cv::FileNode nd_hue = nd_red["Hue"];
      Red_set.hue.center  = nd_hue["center"];
      Red_set.hue.range   = nd_hue["range"];
    }

    {
      cv::FileNode nd_sat = nd_red["Saturation"];
      Red_set.sat.center  = nd_sat["center"];
      Red_set.sat.range   = nd_sat["range"];
    }

    {
      cv::FileNode nd_val = nd_red["Value"];
      Red_set.val.center  = nd_val["center"];
      Red_set.val.range   = nd_val["range"];
    }

    Red_set.isUpdated = true;
  }

  {
    cv::FileNode nd_yellow = topNode[std::string("YELLOW")];
    {
      cv::FileNode nd_hue   = nd_yellow["Hue"];
      Yellow_set.hue.center = nd_hue["center"];
      Yellow_set.hue.range  = nd_hue["range"];
    }

    {
      cv::FileNode nd_sat   = nd_yellow["Saturation"];
      Yellow_set.sat.center = nd_sat["center"];
      Yellow_set.sat.range  = nd_sat["range"];
    }

    {
      cv::FileNode nd_val   = nd_yellow["Value"];
      Yellow_set.val.center = nd_val["center"];
      Yellow_set.val.range  = nd_val["range"];
    }

    Yellow_set.isUpdated = true;
  }

  {
    cv::FileNode nd_green = topNode[std::string("GREEN")];
    {
      cv::FileNode nd_hue  = nd_green["Hue"];
      Green_set.hue.center = nd_hue["center"];
      Green_set.hue.range  = nd_hue["range"];
    }

    {
      cv::FileNode nd_sat  = nd_green["Saturation"];
      Green_set.sat.center = nd_sat["center"];
      Green_set.sat.range  = nd_sat["range"];
    }

    {
      cv::FileNode nd_val  = nd_green["Value"];
      Green_set.val.center = nd_val["center"];
      Green_set.val.range  = nd_val["range"];
    }

    Green_set.isUpdated = true;
  }

  /* set trackbar position to current status */
  cv::setTrackbarPos("H", windowName, Selected_set->hue.range);
  cv::setTrackbarPos("S", windowName, Selected_set->sat.range);
  cv::setTrackbarPos("V", windowName, Selected_set->val.range);

  /* sat mask image to current status */
  cv::Mat hsv_img;
  cv::cvtColor(src_img, hsv_img, cv::COLOR_BGR2HSV);
  colorTrack(hsv_img,
             Selected_set->hue.center,
             Selected_set->sat.center,
             Selected_set->val.center,
             Selected_set->hue.range,
             Selected_set->sat.range,
             Selected_set->val.range,
             &mask);

} /* void TunerBody::openSetting() */