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


C++ Contains函数代码示例

本文整理汇总了C++中Contains函数的典型用法代码示例。如果您正苦于以下问题:C++ Contains函数的具体用法?C++ Contains怎么用?C++ Contains使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Intersects

/* Intersects
 * test for a common area between segment and rect.
 * return true if at least a common point is found
 */
bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const
{
    wxPoint point2, point4;

    if( Contains( aPoint1 ) || Contains( aPoint2 ) )
        return true;

    point2.x = GetEnd().x;
    point2.y = GetOrigin().y;
    point4.x = GetOrigin().x;
    point4.y = GetEnd().y;

    //Only need to test 3 sides since a straight line cant enter and exit on same side
    if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin() , point2 ) )
        return true;

    if( SegmentIntersectsSegment( aPoint1, aPoint2, point2      , GetEnd() ) )
        return true;

    if( SegmentIntersectsSegment( aPoint1, aPoint2, GetEnd()    , point4 ) )
        return true;

    return false;
}
开发者ID:OpenEE,项目名称:micad,代码行数:28,代码来源:base_struct.cpp

示例2: if

Widget *Container::GetWidgetAt(const Point &pos)
{
	if (!Contains(pos)) return 0;

	for (RefCountedPtr<Widget> widget : GetWidgets()) {
		const Point relpos = pos - widget->GetPosition() - widget->GetDrawOffset();
		if (widget->IsContainer()) {
			Widget* w = static_cast<Container*>(widget.Get())->GetWidgetAt(relpos);
			if (w) return w;
		} else if (widget->Contains(relpos))
			return widget.Get();
	}

	return this;
}
开发者ID:AmesianX,项目名称:pioneer,代码行数:15,代码来源:Container.cpp

示例3: SystemGc

void CPositionDisplay::Draw(const TRect& aRect) const
{
   CWindowGc& gc = SystemGc();
   gc.SetClippingRect(aRect);
   gc.SetBrushColor(iBgClr);
   gc.SetBrushStyle(CGraphicsContext::ESolidBrush);

   //gc.Clear(aRect); //paint background color.

   gc.SetPenStyle(CGraphicsContext::ESolidPen);
   gc.SetPenColor(iOutlineClr);
   gc.SetBrushColor(iFldClr);

   if(Contains(iLatControl->Rect(), aRect) || 
      Contains(iLonControl->Rect(), aRect)){
      return;
   }
   TRect bubbles[] = {BoundingRect(iLatControl->Rect(), iLonControl->Rect())};
   const TInt num = sizeof(bubbles)/sizeof(*bubbles);
   for(TInt i = 0; i < num; ++i){
      bubbles[i].Shrink(-2,-2);
      gc.DrawRoundRect(bubbles[i], TSize(8,8));
   }
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:24,代码来源:PositionDisplay.cpp

示例4: Contains

bool PolygonItem::ProcessLeftUp(Point p, dword keyflags)
{
	bool sel = Contains(p);

	p = GetTopRender()->ViewToScene(p);

	if (sel && !IsNull(_click))
	{
		if (abs(_click.x - p.x) < 5 && abs(_click.y - p.y) < 5)
			WhenClick(this);
	}

	_click = Null;
	return IMapItem::ProcessLeftUp(p, keyflags);
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:15,代码来源:PolygonItemEvents.cpp

示例5: MakeHitTest

  int GraphicsBase::MakeHitTest(const glm::vec2& point)
  {
    if (selected_) {
      for (int i = 1; i <= HandleCount(); ++i)
      {
        if (GetHandleRect(i).Contains(point))
          return i;
      }
    }

    if (Contains(point))
      return 0;

    return -1;
  }
开发者ID:yesterdail,项目名称:deformable-mesh,代码行数:15,代码来源:GraphicsBase.cpp

示例6: assert

Window *
WindowList::FindPreviousChildControl(Window *reference)
{
    assert(reference != nullptr);
    assert(Contains(*reference));

    std::list<Window*>::const_reverse_iterator i =
        std::find(list.rbegin(), list.rend(), reference);
#ifndef ANDROID
    /* Android's NDK r5b ships a cxx-stl which does not allow comparing
       two const_reverse_iterator objects for inequality */
    assert(i != list.rend());
#endif

    return FindControl(++i, list.rend());
}
开发者ID:LK8000,项目名称:LK8000,代码行数:16,代码来源:WList.cpp

示例7: FacePlane

bool Polyhedron::Intersects(const LineSegment &lineSegment) const
{
	if (Contains(lineSegment))
		return true;
	for(int i = 0; i < NumFaces(); ++i)
	{
		float t;
		Plane plane = FacePlane(i);
		bool intersects = Plane::IntersectLinePlane(plane.normal, plane.d, lineSegment.a, lineSegment.b - lineSegment.a, t);
		if (intersects && t >= 0.f && t <= 1.f)
			if (FaceContains(i, lineSegment.GetPoint(t)))
				return true;
	}

	return false;
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:16,代码来源:Polyhedron.cpp

示例8: if

Widget *Container::GetWidgetAt(const Point &pos)
{
	if (!Contains(pos)) return 0;

	for (WidgetIterator i = WidgetsBegin(); i != WidgetsEnd(); ++i) {
		Widget *widget = (*i).Get();
		const Point relpos = pos - widget->GetPosition() - widget->GetDrawOffset();
		if (widget->IsContainer()) {
			Widget* w = static_cast<Container*>(widget)->GetWidgetAt(relpos);
			if (w) return w;
		} else if (widget->Contains(relpos))
			return widget;
	}

	return this;
}
开发者ID:RevOliver,项目名称:pioneer,代码行数:16,代码来源:Container.cpp

示例9: CheckMultiple

//______________________________________________________________________________
void CheckMultiple(const TList& list, const char* title, const char* what)
{
  // check whether the list contains each pad only once
  
  TIter next(&list);
  AliMpPad* pad;
  while ( ( pad = (AliMpPad*)next() ) )
  {
    if ( Contains(list,*pad) != 1 )
    {
      cout << title << " " << what << " pad found more than once : " << endl;
      pad->Print();
    }
  }
      
}
开发者ID:alisw,项目名称:AliRoot,代码行数:17,代码来源:testSt345Pads.C

示例10: Contains

bool AABB::Intersects(const LineSegment &lineSegment) const
{
	vec dir = lineSegment.b - lineSegment.a;
	float len = dir.Length();
	if (len <= 1e-4f) // Degenerate line segment? Fall back to point-in-AABB test.
		return Contains(lineSegment.a);

	float invLen = 1.f / len;
	dir *= invLen;
	float tNear = 0.f, tFar = len;
#ifdef MATH_SIMD
	return IntersectLineAABB_SSE(lineSegment.a, dir, tNear, tFar);
#else
	return IntersectLineAABB_CPP(lineSegment.a, dir, tNear, tFar);
#endif
}
开发者ID:ChunHungLiu,项目名称:MathGeoLib,代码行数:16,代码来源:AABB.cpp

示例11: Contains

/*!	\brief Returns whether this directory or any of its subdirectories
	at any level contain the entry referred to by the supplied path name.
	Only entries that match the node flavor specified by \a nodeFlags are
	considered.
	If the BDirectory is not properly initialized, the method returns \c false.
	A non-absolute path is considered relative to the current directory.

	\note R5's implementation always returns \c true given an absolute path or 
	an unitialized directory. This implementation is not compatible with that
	behavior. Instead it converts the path into a BEntry and passes it to the
	other version of Contains().

	\param path the entry's path name. May be relative to this directory or
		   absolute.
	\param nodeFlags Any of the following:
		   - \c B_FILE_NODE: The entry must be a file.
		   - \c B_DIRECTORY_NODE: The entry must be a directory.
		   - \c B_SYMLINK_NODE: The entry must be a symbolic link.
		   - \c B_ANY_NODE: The entry may be of any kind.
	\return
	- \c true, if the entry exists, its kind does match \nodeFlags and the
	  BDirectory is properly initialized and does contain the entry at any
	  level,
	- \c false, otherwise
*/
bool
BDirectory::Contains(const char *path, int32 nodeFlags) const
{
	// check initialization and parameters
	if (InitCheck() != B_OK)
		return false;
	if (!path)
		return true;	// mimic R5 behavior
	// turn the path into a BEntry and let the other version do the work
	BEntry entry;
	if (BPrivate::Storage::is_absolute_path(path))
		entry.SetTo(path);
	else
		entry.SetTo(this, path);
	return Contains(&entry, nodeFlags);
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:41,代码来源:Directory.cpp

示例12: FilterMatches

    /**
     * Method FilterMatches
     *
     * Checks if the filter matches the given hotkey
     *
     * @return true on match (or if filter is disabled)
     */
    bool FilterMatches( const EDA_HOTKEY& aHotkey ) const
    {
        if( !m_valid )
            return true;

        // Match in the (translated) filter string
        const auto normedInfo = wxGetTranslation( aHotkey.m_InfoMsg ).Upper();
        if( normedInfo.Contains( m_normalised_filter_str ) )
            return true;

        const wxString keyName = KeyNameFromKeyCode( aHotkey.m_KeyCode );
        if( keyName.Upper().Contains( m_normalised_filter_str ) )
            return true;

        return false;
    }
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:23,代码来源:widget_hotkey_list.cpp

示例13: UnionPosition

BOOL CPolygon::UnionPosition(SFloat3* psPosition)
{
	CArrayInt	cIndices;
	int			iInsertionIndex;
	int			i;
	int			iIndex;
	
	if (mbConvex)
	{
		if (On(psPosition))
		{
			if (!Contains(psPosition))
			{
				if (HasPositionPtr(psPosition))
				{
					return TRUE;
				}

				cIndices.Init(4);
				FindIndicesOfVisibleHalfSpaces(psPosition, &cIndices);
				if (cIndices.NumElements() == 0)
				{
					//Something went wrong.
					return FALSE;
				}

				iInsertionIndex = cIndices.GetValue(1);  //End index of the first visible line.

				for (i = 2; i < cIndices.NumElements(); i+= 2)
				{
					iIndex = cIndices.GetValue(i);
					mapsPositions.RemoveAt(iIndex);
					if (iIndex < iInsertionIndex)
					{
						iInsertionIndex--;
					}
				}

				mapsPositions.InsertAt(&psPosition, iInsertionIndex);
				cIndices.Kill();
			}
			return TRUE;
		}
		return FALSE;
	}
	return FALSE;
}
开发者ID:chrisjaquet,项目名称:Codaphela.Library,代码行数:47,代码来源:Polygon.cpp

示例14: if

vector<Node*>* Container::AdjacentRemainingNodes(Node* node)
{
	vector<Node*>* adjacentNodes = new vector<Node*>();
	for (unsigned int i = 0; i < edges.size(); ++i) {
		Edge* edge = edges.at(i);
		Node* adjacent = NULL;
		
		if (edge->node1 == node)
			adjacent = edge->node2;
		else if (edge->node2 == node)
			adjacent = edge->node1;
		
		if (adjacent && Contains(nodes, adjacent))
			adjacentNodes->push_back(adjacent);
	}
	return adjacentNodes;
}
开发者ID:Mikulas,项目名称:Ada,代码行数:17,代码来源:Dijkstras.cpp

示例15: FastRandomPointInside

float3 Frustum::UniformRandomPointInside(LCG &rng) const
{
	if (type == OrthographicFrustum)
		return FastRandomPointInside(rng);
	else
	{
		OBB o = MinimalEnclosingOBB();
		for(int numTries = 0; numTries < 1000; ++numTries)
		{
			float3 pt = o.RandomPointInside(rng);
			if (Contains(pt))
				return pt;
		}
		LOGW("Rejection sampling failed in Frustum::UniformRandomPointInside! Producing a non-uniformly distributed point inside the frustum!");
		return FastRandomPointInside(rng);
	}
}
开发者ID:chengzg,项目名称:MathGeoLib,代码行数:17,代码来源:Frustum.cpp


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