本文整理汇总了C++中ON_SimpleArray::SetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_SimpleArray::SetCount方法的具体用法?C++ ON_SimpleArray::SetCount怎么用?C++ ON_SimpleArray::SetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_SimpleArray
的用法示例。
在下文中一共展示了ON_SimpleArray::SetCount方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCorners
bool ON_Box::GetCorners( ON_SimpleArray<ON_3dPoint>& corners ) const
{
corners.Empty();
corners.Reserve(8);
bool rc = GetCorners(corners.Array());
if (rc)
corners.SetCount(8);
return rc;
}
示例2: GetComponentsWithSetStates
//virtual
unsigned int ON_Object::GetComponentsWithSetStates(
ON_ComponentStatus states_filter,
bool bAllEqualStates,
ON_SimpleArray< ON_COMPONENT_INDEX >& components
) const
{
components.SetCount(0);
return 0U;
}
示例3: 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;
}
示例4: ON_StringToBase32
int ON_StringToBase32(const ON_String& sBase32, ON_SimpleArray<unsigned char>& base32_digits )
{
const char* s = sBase32;
if ( 0 == s || 0 == s[0] )
return 0;
base32_digits.Reserve(sBase32.Length());
int digit_count = ON_StringToBase32(sBase32,base32_digits.Array());
base32_digits.SetCount(digit_count);
return digit_count;
}
示例5: 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 );
}
}
示例6: 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;
}
示例7: GetNormalizedArcLengthPoints
ON_BOOL32 ON_CurveProxy::GetNormalizedArcLengthPoints(
int count,
const double* s,
double* t,
double absolute_tolerance ,
double fractional_tolerance ,
const ON_Interval* sub_domain
) const
{
// 23 July 2004 Dale Lear:
// Fixed a bug so this would work right when m_bReversed = true
int i, j;
if ( !m_real_curve )
return false;
if( count<0)
return false;
ON_Interval scratch_domain = RealCurveInterval( sub_domain );
ON_SimpleArray<double> ss;
if( m_bReversed)
{
ss.Reserve(count);
ss.SetCount(count);
for(i=0, j = count-1; i<count; i++, j--)
{
ss[i] = 1.0-s[j];
}
s = ss.Array();
}
ON_BOOL32 rc = m_real_curve->GetNormalizedArcLengthPoints(count, s, t , absolute_tolerance, fractional_tolerance, &scratch_domain);
if( rc)
{
for(i=0;i<count; i++)
{
t[i] = ThisCurveParameter( t[i]);
}
if ( m_bReversed )
{
double x;
for (i = 0, j = count-1; i < j; i++, j-- )
{
x = t[i];
t[i] = t[j];
t[j] = x;
}
}
}
return rc;
}
示例8: GetPoints
CRhinoGet::result CRhGetRegionPoints::GetPoints()
{
CRhinoGet::result rc = CRhinoGet::cancel;
m_points.Reserve( 2048 );
m_points.SetCount( 0 );
m_prev_point = CPoint( -1, -1 );
AcceptNothing();
ConstrainToTargetPlane();
EnableObjectSnapCursors( false );
PermitObjectSnap( false );
m_2dClamp = true;
for (;;)
{
m_temp_point = CPoint( -1, -1 );
rc = GetPoint( 0, true );
if( rc == CRhinoGet::point )
{
CPoint pt = Point2d();
if( PointIsValid(pt) )
{
m_prev_point = pt;
m_points.Append( pt );
}
continue;
}
if( rc == CRhinoGet::nothing )
{
if( PointIsValid(m_temp_point) )
m_points.Append( m_temp_point );
if( m_points.Count() > 2 )
rc = CRhinoGet::point;
}
break;
}
return rc;
}
示例9: ON_Brep_GetTightIsoCurveBoundingBox_Helper
// Add the isocurves of a BrepFace to the partial boundingbox result.
static void ON_Brep_GetTightIsoCurveBoundingBox_Helper( const TL_Brep& tlbrep, const ON_BrepFace& face, ON_BoundingBox& bbox, const ON_Xform* xform, int dir )
{
ON_Interval domain = face.Domain(1 - dir);
int degree = face.Degree(1 - dir);
int spancount = face.SpanCount(1 - dir);
int spansamples = degree * (degree + 1) - 1;
if( spansamples < 2 )
spansamples = 2;
// pbox delineates the extremes of the face interior.
// We can use it to trivially reject spans and isocurves.
ON_BrepLoop* pOuterLoop = face.OuterLoop();
if( NULL==pOuterLoop )
return;
const ON_BoundingBox& pbox = pOuterLoop->m_pbox;
double t0 = ((dir == 0) ? pbox.Min().y : pbox.Min().x);
double t1 = ((dir == 0) ? pbox.Max().y : pbox.Max().x);
// Get the surface span vector.
ON_SimpleArray<double> spanvector(spancount + 1);
spanvector.SetCount(spancount + 1);
face.GetSpanVector(1 - dir, spanvector.Array());
// Generate a list of all the sampling parameters.
ON_SimpleArray<double> samples(spancount * spansamples);
for( int s = 0; s < spancount; s++)
{
double s0 = spanvector[s];
double s1 = spanvector[s+1];
// Reject span if it does not intersect the pbox.
if( s1 < t0 ) { continue; }
if( s0 > t1 ) { continue; }
ON_Interval span(s0, s1);
for( int i = 1; i < spansamples; i++ )
{
double t = span.ParameterAt((double)i / (double)(spansamples - 1));
// Reject iso if it does not intersect the pbox.
if( t < t0 )
continue;
if( t > t1 )
break;
samples.Append(t);
}
}
//Iterate over samples
int sample_count = samples.Count();
ON_BoundingBox loose_box;
ON_SimpleArray<ON_Interval> intervals;
ON_NurbsCurve isosubcrv;
for( int i = 0; i<sample_count; i++)
{
// Retrieve iso-curve.
ON_Curve* isocrv = face.IsoCurve(dir, samples[i]);
while( NULL!=isocrv )
{
// Transform isocurve if necessary, this is better than transforming downstream boundingboxes.
if( xform )
isocrv->Transform(*xform);
// Compute loose box.
if( !isocrv->GetBoundingBox(loose_box, false))
break;
// Determine whether the loose box is already contained within the partial result.
if( bbox.Includes(loose_box, false) )
break;
// Solve trimming domains for the iso-curve.
intervals.SetCount(0);
if( !tlbrep.GetIsoIntervals(face, dir, samples[i], intervals))
break;
// Iterate over trimmed iso-curves.
int interval_count = intervals.Count();
for( int k=0; k<interval_count; k++ )
{
//this to mask a bug in Rhino4. GetNurbForm does not destroy the Curve Tree. It does now.
isosubcrv.DestroyCurveTree();
isocrv->GetNurbForm(isosubcrv, 0.0, &intervals[k]);
ON_Brep_GetTightCurveBoundingBox_Helper(isosubcrv, bbox, NULL, NULL);
}
break;
}
if( isocrv )
{
delete isocrv;
isocrv = NULL;
}
}
}
示例10: ExecConduit
bool CSampleMeshFaceColorConduit::ExecConduit( CRhinoDisplayPipeline& dp, UINT nChannel, bool& bTerminate )
{
if( (nChannel == CSupportChannels::SC_DRAWOBJECT) )
{
if( m_pChannelAttrs && m_pChannelAttrs->m_pObject )
{
if( m_pChannelAttrs->m_pObject->m_runtime_object_serial_number == m_runtime_object_serial_number )
{
// One time initialization
if( 0 == m_mesh_face_colors.Count() )
{
const CRhinoMeshObject* mesh_obj = CRhinoMeshObject::Cast( m_pChannelAttrs->m_pObject );
if( mesh_obj )
{
const ON_Mesh* mesh = mesh_obj->Mesh();
if( mesh )
{
const int mesh_face_count = mesh->FaceCount();
m_mesh_face_colors.SetCapacity( mesh_face_count );
m_mesh_face_colors.SetCount( mesh_face_count );
for( int i = 0; i < mesh_face_count; i++ )
m_mesh_face_colors[i] = RGB( rand() % 255, rand() % 255, rand() % 255 );
}
}
}
if ( m_mesh_face_colors.Count() )
{
// store current object's color
CColorVec ObjColor( m_pDisplayAttrs->m_ObjectColor );
m_pChannelAttrs->m_bDrawObject = false;
// Start with the current attributes - always a good idea for proper conforming
CDisplayPipelineAttributes da( *m_pDisplayAttrs );
da.m_pMaterial->m_FrontMaterial.SetTransparency( 0.0 );
da.m_pMaterial->m_BackMaterial.SetTransparency( 0.0 );
da.m_pMaterial->m_FrontMaterial.m_bFlatShaded = true;
da.m_pMaterial->m_BackMaterial.m_bFlatShaded = true;
// If we're not drawing surfaces, then we don't want to draw any shaded polygons...
da.m_bShadeSurface = dp.DrawingSurfaces();
// Here's where things can get ugly due the way this conduit is implemented.
// Since the object is always selected (in this example), that means we'll be drawing
// both the shaded polygons and the wires. However, I'm changing this up a little so that
// we don't draw the wires if we're shaded, and instead, I blend the shaded polygons with
// the object's (highlighted) color...
// So, if the object is highlighted AND we're drawing wires AND the original display
// mode is a shaded mode, then we don't want to draw anything. Mesh objects are unique
// in that they can be both drawing wires and surfaces at the same time. Thus, we must
// check for exclusivity on just wires only...
bool bWiresOnly = dp.DrawingWires() && !dp.DrawingSurfaces();
if( da.m_IsHighlighted && bWiresOnly && m_pDisplayAttrs->m_bShadeSurface )
return true; // don't draw anything...
for( int i = 0; i < m_mesh_face_colors.Count(); i++ )
{
CColorVec color( (COLORREF)m_mesh_face_colors[i] );
// If you want the highlight blending, then just uncomment the 2 lines below.
// since this conduit always runs with highlighted objects, then the following
// code will always get hit, and you will not see your true face colors (ever),
// so you might want to get rid of this altogether. It is only here to show how
// this can be done. However, since you're overriding the drawing of this object,
// then something really should be done about object selection, otherwise there
// will be no way for users to know/see whether or not the object is selected.
//if ( da.m_IsHighlighted )
// color = (color + ObjColor) * 0.5f; // blend the object color with the face color 50/50...
da.m_pMaterial->m_FrontMaterial.m_diffuse = color;
da.m_pMaterial->m_BackMaterial.m_diffuse = color;
da.m_ObjectColor = color;
da.m_MeshWireColor = color;
// Here's yet another situation that you might want to handle. If we're drawing
// shaded polygons, then we might not want to draw the wires. Or if we do, then
// we might want those wires some fixed color. However, keep in mind that hiding
// and showing of mesh wires is controlled by the display mode. But, if an object
// is selected, then its "show wires" flag will always be set at this point. And
// since this conduit only works on selected objects, wires will always be on no
// matter what the user sets in the current display mode. So there is really no
// way to tell if wires should be on of off at this point.
if ( da.m_bShadeSurface )
{
// We're here because we're about to draw shaded polygons. For now, I'm always
// going to force the wires to be black...
da.m_MeshWireColor = 0;
da.m_bShowMeshWires = true; // not really needed because of what I said above,
// but here for clarity...
}
dp.DrawFace( m_pChannelAttrs->m_pObject, i, &da );
}
}
//.........这里部分代码省略.........