本文整理汇总了C++中ON_SimpleArray::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_SimpleArray::Remove方法的具体用法?C++ ON_SimpleArray::Remove怎么用?C++ ON_SimpleArray::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_SimpleArray
的用法示例。
在下文中一共展示了ON_SimpleArray::Remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunCommand
CRhinoCommand::result CCommandSampleRemovePoints::RunCommand( const CRhinoCommandContext& context )
{
CRhinoGetObject go;
go.SetCommandPrompt( L"Select point cloud" );
go.SetGeometryFilter( CRhinoGetObject::pointset_object );
go.EnableSubObjectSelect( false );
go.GetObjects( 1, 1 );
if( go.CommandResult() != CRhinoCommand::success )
return go.CommandResult();
const CRhinoObjRef& obj_ref = go.Object(0);
const CRhinoPointCloudObject* obj = CRhinoPointCloudObject::Cast( obj_ref.Object() );
if( 0 == obj )
return CRhinoCommand::failure;
const ON_PointCloud& cloud = obj->PointCloud();
obj->Select( false );
context.m_doc.Redraw();
CRhGetRegionPoints gp;
gp.SetCommandPrompt( L"Click and drag, or repeatedly click to lasso point cloud points. Press Enter when done" );
gp.AcceptNothing();
gp.SetGetPointCursor( RhinoApp().m_default_cursor );
gp.GetPoints();
if( gp.Result() == CRhinoGet::point )
return CRhinoCommand::cancel;
ON_SimpleArray<int> indices;
const int index_count = RhRegionSelectPointCloudPoints( gp.View(), cloud, gp.m_points, indices );
if( 0 == index_count )
return CRhinoCommand::nothing;
indices.QuickSort( &ON_CompareIncreasing<int> );
const CRhinoObjectAttributes& atts = obj->Attributes();
bool bColors = cloud.HasPointColors();
bool bNormals = cloud.HasPointNormals();
ON_PointCloud new_cloud;
new_cloud.m_P.SetCapacity( index_count );
new_cloud.m_P.SetCount( index_count );
if( bColors )
{
new_cloud.m_C.SetCapacity( index_count );
new_cloud.m_C.SetCount( index_count );
}
if( bNormals )
{
new_cloud.m_N.SetCapacity( index_count );
new_cloud.m_N.SetCount( index_count );
}
ON_PointCloud dup_cloud( cloud );
dup_cloud.DestroyHiddenPointArray();
const int cloud_count = dup_cloud.PointCount();
int last_point_index = indices[indices.Count() - 1];
for( int i = cloud_count - 1; i >= 0; i-- )
{
if( i == last_point_index )
{
int last_array_index = indices.Count() - 1;
new_cloud.m_P[last_array_index] = dup_cloud.m_P[i];
if( bColors )
new_cloud.m_C[last_array_index] = dup_cloud.m_C[i];
if( bNormals )
new_cloud.m_N[last_array_index] = dup_cloud.m_N[i];
dup_cloud.m_P.Remove( i );
if( bColors )
dup_cloud.m_C.Remove( i );
if( bNormals )
dup_cloud.m_N.Remove( i );
indices.Remove( last_array_index );
if( 0 == indices.Count() )
break;
last_point_index = indices[indices.Count() - 1];
}
}
CRhinoPointCloudObject* new_cloud_obj = new CRhinoPointCloudObject( atts );
new_cloud_obj->SetPointCloud( new_cloud );
new_cloud.Destroy();
if( context.m_doc.AddObject(new_cloud_obj) )
{
new_cloud_obj->Select();
}
else
{
delete new_cloud_obj;
return CRhinoCommand::failure;
}
dup_cloud.m_P.Shrink();
if( bColors )
//.........这里部分代码省略.........