当前位置: 首页>>代码示例>>C++>>正文


C++ Bounds::contains方法代码示例

本文整理汇总了C++中Bounds::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ Bounds::contains方法的具体用法?C++ Bounds::contains怎么用?C++ Bounds::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bounds的用法示例。


在下文中一共展示了Bounds::contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: remove

      bool
      remove(const Bounds& area, const Bounds& b)
      {
        if (m_leaf)
          return area.contains(m_data.item);

        int cdel = 0;

        for (int i = 0; i < 4; ++i)
        {
          Node** c = m_data.children + i;

          if (!*c)
            continue;

          Bounds cb = b.quadrant(i);

          if (area.intersects(cb) && (*c)->remove(area, cb))
          {
            delete *c;
            * c = 0;
            ++cdel;
          }
        }
        return cdel == 4;   // true if all sub-nodes were removed
      }
开发者ID:carlos-felipe88,项目名称:dune,代码行数:26,代码来源:QuadTree.cpp

示例2: iterate

 void
 iterate(QuadTree::Iteration& iter, const Bounds& area, const Bounds& b) const
 {
   if (m_leaf && b.contains(m_data.item))
     iter.process(m_data.item);
   else
     for (int i = 0; i < 4; ++i)
     {
       if (m_data.children[i])
       {
         Bounds cb = b.quadrant(i);
         if (area.intersects(cb))
           m_data.children[i]->iterate(iter, area, cb);
       }
     }
 }
开发者ID:carlos-felipe88,项目名称:dune,代码行数:16,代码来源:QuadTree.cpp

示例3: candidates

ChunkReader::QueryRange ChunkReader::candidates(const Bounds& queryBounds) const
{
    if (queryBounds.contains(m_bounds))
    {
        return QueryRange(m_points.begin(), m_points.end());
    }

    const auto& gb(m_metadata.boundsScaledCubic());
    const PointInfo min(Tube::calcTick(queryBounds.min(), gb, m_depth));
    const PointInfo max(Tube::calcTick(queryBounds.max(), gb, m_depth));

    It begin(std::lower_bound(m_points.begin(), m_points.end(), min));
    It end(std::upper_bound(m_points.begin(), m_points.end(), max));

    return QueryRange(begin, end);
}
开发者ID:json87,项目名称:entwine,代码行数:16,代码来源:chunk-reader.cpp

示例4: Bounds

Bounds
Bounds::intersectionWith(const Bounds& rhs) const 
{
    if ( valid() && !rhs.valid() ) return *this;
    if ( !valid() && rhs.valid() ) return rhs;

    if ( this->contains(rhs) ) return rhs;
    if ( rhs.contains(*this) ) return *this;

    if ( !intersects(rhs) ) return Bounds();

    double xmin, xmax, ymin, ymax;

    xmin = ( xMin() > rhs.xMin() && xMin() < rhs.xMax() ) ? xMin() : rhs.xMin();
    xmax = ( xMax() > rhs.xMin() && xMax() < rhs.xMax() ) ? xMax() : rhs.xMax();
    ymin = ( yMin() > rhs.yMin() && yMin() < rhs.yMax() ) ? yMin() : rhs.yMin();
    ymax = ( yMax() > rhs.yMin() && yMax() < rhs.yMax() ) ? yMax() : rhs.yMax();

    return Bounds(xmin, ymin, xmax, ymax);
}
开发者ID:JohnDr,项目名称:osgearth,代码行数:20,代码来源:Bounds.cpp

示例5:

bool
FeatureGridder::cullFeatureListToCell( int i, FeatureList& features ) const
{
    bool success = true;
    int inCount = features.size();

    Bounds b;
    if ( getCellBounds( i, b ) )
    {
        if ( _policy.cullingTechnique() == GriddingPolicy::CULL_BY_CENTROID )
        {
            for( FeatureList::iterator f_i = features.begin(); f_i != features.end();  )
            {
                bool keepFeature = false;

                Feature* feature = f_i->get();
                Symbology::Geometry* featureGeom = feature->getGeometry();
                if ( featureGeom )
                {
                    osg::Vec3d centroid = featureGeom->getBounds().center();
                    if ( b.contains( centroid.x(), centroid.y() ) )
                    {
                        keepFeature = true;
                    }
                }

                if ( keepFeature )
                    ++f_i;
                else
                    f_i = features.erase( f_i );
            }
        }

        else // CULL_BY_CROPPING (requires GEOS)
        {

#ifdef OSGEARTH_HAVE_GEOS

            // create the intersection polygon:
            osg::ref_ptr<Symbology::Polygon> poly = new Symbology::Polygon( 4 );
            poly->push_back( osg::Vec3d( b.xMin(), b.yMin(), 0 ));
            poly->push_back( osg::Vec3d( b.xMax(), b.yMin(), 0 ));
            poly->push_back( osg::Vec3d( b.xMax(), b.yMax(), 0 ));
            poly->push_back( osg::Vec3d( b.xMin(), b.yMax(), 0 ));

            for( FeatureList::iterator f_i = features.begin(); f_i != features.end();  )
            {
                bool keepFeature = false;

                Feature* feature = f_i->get();
                Symbology::Geometry* featureGeom = feature->getGeometry();
                if ( featureGeom )
                {
                    osg::ref_ptr<Symbology::Geometry> croppedGeometry;
                    if ( featureGeom->crop( poly.get(), croppedGeometry ) )
                    {
                        feature->setGeometry( croppedGeometry.get() );
                        keepFeature = true;
                    }                   
                }

                if ( keepFeature )
                    ++f_i;
                else
                    f_i = features.erase( f_i );
            }  

#endif // OSGEARTH_HAVE_GEOS

        }

    }

    OE_INFO << LC
            << "Grid cell " << i << ": bounds="
            << b.xMin() << "," << b.yMin() << " => " << b.xMax() << "," << b.yMax()
            << "; in=" << inCount << "; out=" << features.size()
            << std::endl;

    return success;
}
开发者ID:dgraves,项目名称:osgearth,代码行数:81,代码来源:FeatureGridder.cpp


注:本文中的Bounds::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。