本文整理汇总了C++中ON_SimpleArray::Search方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_SimpleArray::Search方法的具体用法?C++ ON_SimpleArray::Search怎么用?C++ ON_SimpleArray::Search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_SimpleArray
的用法示例。
在下文中一共展示了ON_SimpleArray::Search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunCommand
CRhinoCommand::result CCommandVRCreateViews::RunCommand( const CRhinoCommandContext& context )
{
AFX_MANAGE_STATE( ::RhinoApp().RhinoModuleState() ); // dunno, from example
ON_wString wStr;
wStr.Format( L"READY SET\n", EnglishCommandName() );
RhinoApp().Print( wStr );
ON_SimpleArray<CRhinoView*> viewList; // don't know what is up with* this*
ON_SimpleArray<ON_UUID> viewportIds;
CRhinoView* lView = 0;
CRhinoView* rView = 0;
ON_SimpleArray<CRhinoView*> lrViews; // will contain our vr views
int i = 0; // also use this in loops
int lr = 0; // use to track 1st and 2nd find
// builds a list of (current) viewport IDs
context.m_doc.GetViewList( viewList, true, false );
for ( i = 0; i < viewList.Count(); i ++)
{
CRhinoView* tempView = viewList[i]; // pull view out -> this is redeclared here, in sample, but not in second loop
if (tempView)
viewportIds.Append( tempView->ActiveViewportID() );
}
viewList.Empty(); // empty bc we are going to re-build later when new views
context.m_doc.NewView( ON_3dmView() );
context.m_doc.NewView( ON_3dmView() ); // we will build two
// find viewport UUID just created
context.m_doc.GetViewList( viewList, true, false);
for (i = 0; i < viewList.Count(); i++)
{
CRhinoView* tempView = viewList[i];
if (tempView)
{
int rc = viewportIds.Search( tempView->ActiveViewportID() ); // returns index of 1st element which satisfies search. returns -1 when no such item found
if (rc < 0 ) // if current tempView did not exist prior to this running
{
if (lr > 0) // and if lr already found 1
{
rView = tempView; // right is 2nd view we find
break;
// so this breaks when we find, and lView is left as the viewList[i] where we found the new viewport, whose ID was not in our list.
// and we are left with lView being = viewList[i] at new view
}
if (lr == 0)
{
lView = tempView; // left is 1st view
lr = 1;
}
}
else
tempView = 0; // reset lView to null and re-loop
}
}
lrViews.Append(lView);
lrViews.Append(rView);
// init points
ON_3dPoint locationL = ON_3dPoint(100.0,100.0,100.0);
ON_3dPoint locationR = ON_3dPoint(100.0,165.1,100.0);
ON_3dPoint targetSetup = ON_3dPoint(0,0,0);
if (lView && rView)
{
for (int i = 0; i < 2; i++)
{
// RhinoApp().ActiveView()->
ON_3dmView onView = lrViews[i]->ActiveViewport().View();
if(i == 0)
onView.m_name = L"lView";
//lrViews[i]->MoveWindow(0,0,VR().resolution.w/2,VR().resolution.h, true);
if(i == 1)
onView.m_name = L"rView";
//lrViews[i]->MoveWindow(960,0,VR().resolution.w/2,VR().resolution.h, true);
lrViews[i]->ActiveViewport().SetView(onView);
lrViews[i]->ActiveViewport().m_v.m_vp.ChangeToPerspectiveProjection(50,true,35);
lrViews[i]->ActiveViewport().m_v.m_vp.SetCameraLocation(locationL);
lrViews[i]->FloatRhinoView(true);
lrViews[i]->Redraw();
}
}
VR().lView = lView;
VR().rView = rView;
ON_wString SYNC;
SYNC.Format(L"SYNCVRBEGIN\n" );
RhinoApp().Print( SYNC );
if (vrConduit.IsEnabled()
&& ::IsWindow( vrConduit.m_hWnd1 )
&& ::IsWindow( vrConduit.m_hWnd2 ) ) // if is already enabled ?
{
vrConduit.m_pView1 = 0;
vrConduit.m_pView2 = 0;
//.........这里部分代码省略.........