本文整理汇总了C++中ON_SimpleArray::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_SimpleArray::Count方法的具体用法?C++ ON_SimpleArray::Count怎么用?C++ ON_SimpleArray::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_SimpleArray
的用法示例。
在下文中一共展示了ON_SimpleArray::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RhRegionSelectPointCloudPoints
/*
Description:
Selects point cloud points using a 2D selection region.
Parameters:
view - [in] The view in which the selection region was defined.
cloud - [in] The point cloud to test.
points3d - [in] The 2D (screen) points that define the selection region.
indices - [out] The indices of the points in the point cloud
that lie inside of the selection region.
Returns:
The number of indices added to the output array.
*/
static int RhRegionSelectPointCloudPoints(
CRhinoView* view,
const ON_PointCloud& cloud,
ON_SimpleArray<CPoint>& points2d,
ON_SimpleArray<int>& indices
)
{
if( 0 == view )
return 0;
const int index_count = indices.Count();
CRgn rgn;
if( rgn.CreatePolygonRgn(points2d.Array(), points2d.Count(), WINDING) )
{
ON_Xform w2s;
view->ActiveViewport().VP().GetXform( ON::world_cs, ON::screen_cs, w2s );
int i;
ON_3dPoint point;
for( i = 0; i < cloud.m_P.Count(); i++ )
{
point = cloud.m_P[i];
point.Transform( w2s );
if( rgn.PtInRegion((int)point.x, (int)point.y) )
indices.Append( i );
}
}
return indices.Count() - index_count;
}
示例2:
vtkActor* gfxRhino3D::createActor(const ON_Object *object, double red, double green, double blue){
ON_Brep *brep;
ON_SimpleArray<const ON_Mesh*> cmsh;
int i, j, k, l, npts;
double x1,x2,x3,x4, y1,y2,y3,y4, z1,z2,z3,z4;
// Add Meshes to list
parentObject->points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> list = vtkSmartPointer<vtkCellArray>::New();
brep=0;
brep = (ON_Brep*)ON_Brep::Cast(object);
if (brep){
brep->GetMesh(ON::render_mesh, cmsh);
if (cmsh.Count()>0){
for (l=0;l<cmsh.Count();l++){
npts=parentObject->points->GetNumberOfPoints();
for (j=0;j<cmsh[l]->m_V.Count();j++) parentObject->points->InsertNextPoint(cmsh[l]->m_V[j].x, cmsh[l]->m_V[j].y, cmsh[l]->m_V[j].z);
for (j=0;j<cmsh[l]->m_F.Count();j++){
if (cmsh[l]->m_F[j].IsTriangle()){
vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New();
for (k=0;k<3;k++) triangle->GetPointIds()->SetId(k,cmsh[l]->m_F[j].vi[k]+npts);
list->InsertNextCell(triangle);
}else{
vtkSmartPointer<vtkQuad> quad = vtkSmartPointer<vtkQuad>::New();
for (k=0;k<4;k++) quad->GetPointIds()->SetId(k,cmsh[l]->m_F[j].vi[k]+npts);
list->InsertNextCell(quad);
}
}
}
}
}
//Create a polydata object and add data
vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();
polydata->SetPoints(parentObject->points);
polydata->SetPolys(list);
//Create Mapper
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(polydata);
mapper->SetScalarRange(0.,1.);
//Create Actor
vtkActor *tmpActor = vtkActor::New();
tmpActor->SetMapper(mapper);
tmpActor->GetProperty()->SetInterpolationToGouraud();
// void SetInterpolationToFlat()
// void SetInterpolationToGouraud()
// void SetInterpolationToPhong()
tmpActor->GetProperty()->SetColor(red, green, blue);
return tmpActor;
}
示例3: GetConnectedComponents
int ON_Mesh::GetConnectedComponents( bool bUseVertexConnections,
bool bTopologicalConnections,
ON_SimpleArray<int>& facet_component_labels
) const
{
int i, facecount = m_F.Count(), meshidx = 0;
//This array will act as an associative array to m_F since ON_MeshFace do not have something
//like m_trim_user_i on a ON_BrepTrim. It will have the indice of the final mesh the face
//belongs to.
if (facecount != facet_component_labels.Count())
{
facet_component_labels.Reserve(facecount);
facet_component_labels.SetCount(facecount);
}
//initialize to 0
facet_component_labels.MemSet(0);
ON_SimpleArray<int> DupFaceArray(facecount);
DupFaceArray.SetCount(facecount);
const ON_MeshTopology& Top = Topology();
if (!Top.IsValid())
return 0;
ON_SimpleArray<int> FacesToCheck;
FacesToCheck.Reserve(64);
i = 0;
while (i < facecount)
{
meshidx++;
FacesToCheck.Append(i);
while(0 != FacesToCheck.Count())
{
//Figure out which faces are connected to each other
FindAdjacentFaces(Top, FacesToCheck, facet_component_labels, DupFaceArray, bUseVertexConnections, bTopologicalConnections);
int j;
for (j=0;j<FacesToCheck.Count();j++)
facet_component_labels[FacesToCheck[j]] = meshidx;
}
for(;i<facecount;i++)
{
if (0 == facet_component_labels[i])
break;
}
}
return meshidx;
}
示例4:
int ON_UuidPairList::GetId1s(
ON_SimpleArray<ON_UUID>& uuid_list
) const
{
const int count0 = uuid_list.Count();
int i;
uuid_list.Reserve(uuid_list.Count() + m_count - m_removed_count);
for ( i = 0; i < m_count; i++ )
{
if ( ON_max_uuid == m_a[i].m_uuid[0] && ON_max_uuid == m_a[i].m_uuid[1] )
continue;
uuid_list.Append(m_a[i].m_uuid[0]);
}
return uuid_list.Count() - count0;
}
示例5: GetUuids
int ON_UuidIndexList::GetUuids(
ON_SimpleArray<ON_UUID>& uuid_list
) const
{
const int count0 = uuid_list.Count();
int i;
uuid_list.Reserve(uuid_list.Count() + m_count);
for ( i = 0; i < m_count; i++ )
{
if ( ON_max_uuid == m_a[i].m_id )
continue;
uuid_list.Append(m_a[i].m_id);
}
return uuid_list.Count() - count0;
}
示例6: Write
// virtual ON_Object override
ON_BOOL32 ON__IDefLayerSettingsUserData::Write(ON_BinaryArchive& binary_archive) const
{
bool rc = binary_archive.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,1);
if ( !rc )
return false;
rc = false;
for(;;)
{
if ( !binary_archive.WriteArray(m_layers.Count(),m_layers.Array()) )
break;
// added in version 1.1 chunks
bool bHaveParentLayer = ( 0 != m_idef_layer_table_parent_layer );
if ( !binary_archive.WriteBool(bHaveParentLayer) )
break;
if ( bHaveParentLayer )
{
if ( !binary_archive.WriteObject(m_idef_layer_table_parent_layer) )
break;
}
rc = true;
break;
}
if ( !binary_archive.EndWrite3dmChunk() )
rc = false;
return rc;
}
示例7: DataCRC
// virtual ON_Object override
ON__UINT32 ON__IDefLayerSettingsUserData::DataCRC(ON__UINT32 current_remainder) const
{
ON__UINT32 crc = current_remainder;
for ( int i = 0; i < m_layers.Count(); i++ )
crc = m_layers.DataCRC(crc);
return crc;
}
示例8: DynamicDraw
void CRhGetRegionPoints::DynamicDraw( HDC hdc, CRhinoViewport& vp, const ON_3dPoint& point )
{
if( 0 == ON_UuidCompare(m_viewport_id, vp.ViewportId()) )
{
const int point_count = m_points.Count();
if( point_count > 0 )
{
CRhinoDisplayPipeline* dp = vp.DisplayPipeline();
if( dp )
{
CPen pen( PS_SOLID, 1, RGB(0,0,0) );
int i;
for( i = 0; i < point_count - 1; i++ )
dp->Draw2dLine( m_points[i], m_points[i + 1], pen, true );
if( m_temp_point != CPoint(-1, -1) )
{
dp->Draw2dLine( m_points[point_count - 1], m_temp_point, pen, true );
if( point_count > 1 )
dp->Draw2dLine( m_temp_point, m_points[0], pen, true );
}
else
dp->Draw2dLine( m_points[point_count - 1], m_points[0], pen, true );
}
}
}
CRhinoGetPoint::DynamicDraw(hdc,vp,point);
}
示例9: ON_Hatch_Explode
RH_C_FUNCTION void ON_Hatch_Explode(const ON_Hatch* pConstHatch,
const CRhinoObject* pConstParentRhinoObject,
ON_SimpleArray<ON_Geometry*>* pOutputGeometry)
{
if( pConstHatch && pOutputGeometry )
{
ON_SimpleArray<CRhinoObject*> subobjects;
CRhinoHatch hatchobject;
if( NULL==pConstParentRhinoObject )
{
hatchobject.SetHatch(*pConstHatch);
pConstParentRhinoObject = &hatchobject;
}
pConstParentRhinoObject->GetSubObjects(subobjects);
for( int i=0; i<subobjects.Count(); i++ )
{
CRhinoObject* pRhinoObject = subobjects[i];
if( pRhinoObject )
{
const ON_Geometry* pGeometry = pRhinoObject->Geometry();
if( pGeometry )
pOutputGeometry->Append( pGeometry->Duplicate() );
delete pRhinoObject;
}
}
}
}
示例10: ON_GetBase32Digits
int ON_GetBase32Digits( const ON_SimpleArray<unsigned char>& x, ON_SimpleArray<unsigned char>& base32_digits )
{
int x_count = x.Count();
int bit_count = 8*x_count;
int base32_digit_count = (bit_count/5) + ((bit_count%5)?1:0);
base32_digits.Reserve(base32_digit_count);
base32_digit_count = ON_GetBase32Digits( x.Array(), x_count, base32_digits.Array() );
base32_digits.SetCount(base32_digit_count);
return base32_digit_count;
}
示例11: ON_Base32ToString
bool ON_Base32ToString( const ON_SimpleArray<unsigned char>& base32_digits, ON_String& sBase32 )
{
int digit_count = base32_digits.Count();
sBase32.ReserveArray(digit_count);
sBase32.SetLength(digit_count);
bool rc = ON_Base32ToString( base32_digits, digit_count, sBase32.Array() );
if (!rc)
sBase32.SetLength(0);
return rc;
}
示例12: CreateGroup
void CTestOptionsListCtrlDialog::CreateGroup(
CRhinoUiOptionsListCtrlGroupComboBox& combo,
const wchar_t* lpsItem,
CRhinoUiOptionsListCtrlGroupComboBox* pNestedCombo
)
{
const wchar_t* text[] = { L"A", L"B" };
COLORREF colors[] = { RGB(255,0,0), RGB(0,255,0) };
const int cnt = _countof( text );
ON_SimpleArray<CRhinoUiOptionsListCtrlItem*> items;
items.Reserve( cnt );
items.SetCount( 0 );
int i;
for( i = 0; i < cnt; i++)
{
//CRhinoUiOptionsListCtrlItem* p = new CRhinoUiOptionsListCtrlStaticText();
CRhinoUiOptionsListCtrlColorButton* p = new CRhinoUiOptionsListCtrlColorButton();
if( NULL == p )
continue;
items.Append( p );
p->SetLabel( lpsItem );
p->SetText( text[i] );
p->SetColor( colors[i] );
p->SetIndentLevel( combo.IndentLevel()+1 );
//ctrl.AddItem( p );
}
if( items.Count() < 1 )
return;
if( pNestedCombo)
{
pNestedCombo->SetLabel( L"Nested group combo" );
items.Append( pNestedCombo );
}
combo.AddGroupItem( lpsItem, items );
if( pNestedCombo )
{
pNestedCombo->SetIndentLevel( combo.IndentLevel()+1 );
pNestedCombo->AddGroupItem( L"No controls", NULL, 0 );
CRhinoUiOptionsListCtrlColorButton* pNested = new CRhinoUiOptionsListCtrlColorButton();
if( pNested )
{
pNested->SetLabel(L"Nested group item" );
pNested->SetText( L"" );
pNested->SetColor( 0x00000000 );
pNested->SetIndentLevel( pNestedCombo->IndentLevel()+1 );
CRhinoUiOptionsListCtrlItem* p = static_cast<CRhinoUiOptionsListCtrlItem*>(pNested);
pNestedCombo->AddGroupItem( L"color button", &p, 1 );
}
pNestedCombo->SetCurGroupSel( 0 );
}
}
示例13: Create
bool ON_Hatch::Create( const ON_Plane& plane,
const ON_SimpleArray<const ON_Curve*> loops,
int pattern_index,
double pattern_rotation,
double pattern_scale)
{
if( loops.Count() < 1)
return false;
if( pattern_index < 0)
return false;
SetPlane( plane);
for( int i = 0; i < loops.Count(); i++)
{
ON_HatchLoop* pLoop = new ON_HatchLoop;
pLoop->SetCurve( *loops[i]);
pLoop->SetType( i?ON_HatchLoop::ltInner:ON_HatchLoop::ltOuter);
AddLoop( pLoop);
}
SetPatternIndex( pattern_index);
SetPatternRotation( pattern_rotation);
SetPatternScale( pattern_scale);
return true;
}
示例14: OnMouseDown
void CRhGetRegionPoints::OnMouseDown( CRhinoViewport& vp, UINT flags, const ON_3dPoint& point, const CPoint* pt )
{
if( pt && m_points.Count() == 0 )
{
CRhinoView* view = vp.ParentView();
if( view )
{
m_viewport_id = vp.ViewportId();
m_prev_point = *pt;
m_points.Append( *pt );
}
}
CRhinoGetPoint::OnMouseDown( vp, flags, point, pt );
}
示例15: UpdateVertexColors
void CZAnalysisVAM::UpdateVertexColors(
const CRhinoObject* object,
ON_SimpleArray<const ON_Mesh *>& meshes
) const
{
// Rhino calls this function when it is time for you
// to set the false colors on the analysis mesh vertices.
// For breps, there is one mesh per face. For mesh objects,
// there is a single mesh.
const int count = meshes.Count();
if (count > 0 )
{
// A "mapping tag" is used to determine if the colors
// need to be set.
ON_MappingTag mt = MappingTag();
const ON_Mesh * const * mesh_list = meshes.Array();
for ( int mi = 0; mi < count; mi++ )
{
const ON_Mesh* mesh = mesh_list[mi];
if ( mesh && mt.Compare(mesh->m_Ctag) )
{
// The mesh's mapping tag is different from ours. Either
// the mesh has no false colors, has false colors set by
// another analysis mode, has false colors set using
// different m_z_range[]/m_hue_range[] values, or the
// mesh has been moved. In any case, we need to set
// the false colors to the ones we want.
const int vcount = mesh->m_V.Count();
ON_SimpleArray<ON_Color>& vertex_colors = const_cast<ON_Mesh*>(mesh)->m_C;
vertex_colors.SetCount(0); // in case something else had set the colors
vertex_colors.Reserve(vcount); // for efficiency
for (int vi = 0; vi < vcount; vi++ )
{
double z = mesh->m_V[vi].z;
ON_Color c = FalseColor(z);
vertex_colors.Append(c);
}
// set the mesh's color tag
const_cast<ON_Mesh*>(mesh)->m_Ctag = mt;
}
}
}
}