本文整理汇总了C++中wxVector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ wxVector::size方法的具体用法?C++ wxVector::size怎么用?C++ wxVector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxVector
的用法示例。
在下文中一共展示了wxVector::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChartObjects
wxExcelChartObjects wxExcelWorksheet::ChartObjects(const wxVector<long>& indices)
{
wxExcelChartObjects objects;
wxCHECK(indices.size() > 0, objects);
wxVariant vIndices;
vIndices.NullList();
for (size_t i = 0; i < indices.size(); i++)
vIndices.Append(indices[i]);
WXAUTOEXCEL_CALL_METHOD1_OBJECT("ChartObjects", vIndices, objects);
}
示例2: SetupVAO
void GLPolygons::SetupVAO(wxVector<PMSPolygon> polygons)
{
wxVector<GLfloat> vertices;
GenerateGLBufferVertices(polygons, vertices);
m_polygonsCount = polygons.size();
glGenBuffers(1, &m_vbo);
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);
if (vertices.size() > 0)
{
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
// We initialize all polygons (not only those present in map).
glBufferData(GL_ARRAY_BUFFER, GL_POLYGON_VERTEX_SIZE_BYTES * MAX_POLYGONS_COUNT * GL_POLYGON_VERTICES_COUNT,
&vertices[0], GL_DYNAMIC_DRAW);
}
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, GL_POLYGON_VERTEX_SIZE_BYTES, (GLvoid*)0);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, GL_POLYGON_VERTEX_SIZE_BYTES, (GLvoid*)(3 * sizeof(GLfloat)));
glEnableVertexAttribArray(1);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, GL_POLYGON_VERTEX_SIZE_BYTES, (GLvoid*)(7 * sizeof(GLfloat)));
glEnableVertexAttribArray(2);
glBindVertexArray(0);
}
示例3: GetCumulativeMaxValue
wxDouble wxStackedColumnChart::GetCumulativeMaxValue(const wxVector<wxChartsDoubleDataset::ptr>& datasets)
{
wxDouble result = 0;
size_t i = 0;
while (true)
{
wxDouble sum = 0;
bool stop = true;
for (size_t j = 0; j < datasets.size(); ++j)
{
const wxChartsDoubleDataset& dataset = *datasets[j];
if (i < dataset.GetData().size())
{
sum += dataset.GetData()[i];
stop = false;
}
}
if (sum > result)
{
result = sum;
}
if (stop)
{
break;
}
++i;
}
return result;
}
示例4: GetMaxValue
wxDouble wxPolarAreaChart::GetMaxValue(const wxVector<wxChartSliceData> &slices)
{
wxDouble result = 0;
if (slices.size() > 0)
{
result = slices[0].GetValue();
}
for (size_t i = 1; i < slices.size(); ++i)
{
wxDouble v = slices[i].GetValue();
if (v > result)
{
result = v;
}
}
return result;
}
示例5: AppendItems
wxDataViewItemArray TreeListModel::AppendItems(const wxDataViewItem &parent, const wxVector<wxVector<wxVariant> >& data)
{
wxDataViewItemArray items;
for(size_t i=0; i<data.size(); ++i) {
items.push_back( DoAppendItem(parent, data.at(i), false, NULL) );
}
ItemsAdded(parent, items);
return items;
}
示例6: OnExit
virtual void OnExit()
{
if ( gs_heventShutdown.IsOk() )
{
// stop any threads waiting for the termination of asynchronously
// running processes
if ( !gs_heventShutdown.Set() )
{
wxLogDebug(wxT("Failed to set shutdown event in wxExecuteModule"));
}
gs_heventShutdown.Close();
// now wait until they terminate
if ( !gs_asyncThreads.empty() )
{
const size_t numThreads = gs_asyncThreads.size();
if ( ::WaitForMultipleObjects
(
numThreads,
&gs_asyncThreads[0],
TRUE, // wait for all of them to become signalled
3000 // long but finite value
) == WAIT_TIMEOUT )
{
wxLogDebug(wxT("Failed to stop all wxExecute monitor threads"));
}
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( size_t n = 0; n < numThreads; n++ )
{
::CloseHandle(gs_asyncThreads[n]);
}
gs_asyncThreads.clear();
}
}
if ( gs_classForHiddenWindow )
{
if ( !::UnregisterClass(wxMSWEXEC_WNDCLASSNAME, wxGetInstance()) )
{
wxLogLastError(wxT("UnregisterClass(wxExecClass)"));
}
gs_classForHiddenWindow = NULL;
}
}
示例7:
virtual ~MyClass()
{
for ( size_t i=0; i<gs_myClassInstances.size(); i++ )
{
if ( gs_myClassInstances[i] == this )
{
gs_myClassInstances.erase(gs_myClassInstances.begin()+i);
}
}
}
示例8: ResetPolygons
void GLPolygons::ResetPolygons(wxVector<PMSPolygon> polygons)
{
wxVector<GLfloat> vertices;
GenerateGLBufferVertices(polygons, vertices);
m_polygonsCount = polygons.size();
if (vertices.size() > 0)
{
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
glBufferSubData(GL_ARRAY_BUFFER, 0,
GL_POLYGON_VERTEX_SIZE_BYTES * m_polygonsCount * GL_POLYGON_VERTICES_COUNT, &vertices[0]);
}
}
示例9: OnExit
virtual void OnExit()
{
if ( gs_heventShutdown )
{
// stop any threads waiting for the termination of asynchronously
// running processes
if ( !::SetEvent(gs_heventShutdown) )
{
wxLogDebug(wxT("Failed to set shutdown event in wxExecuteModule"));
}
::CloseHandle(gs_heventShutdown);
gs_heventShutdown = NULL;
// now wait until they terminate
if ( !gs_asyncThreads.empty() )
{
const size_t numThreads = gs_asyncThreads.size();
if ( ::WaitForMultipleObjects
(
numThreads,
&gs_asyncThreads[0],
TRUE, // wait for all of them to become signalled
3000 // long but finite value
) == WAIT_TIMEOUT )
{
wxLogDebug(wxT("Failed to stop all wxExecute monitor threads"));
}
for ( size_t n = 0; n < numThreads; n++ )
{
::CloseHandle(gs_asyncThreads[n]);
}
gs_asyncThreads.clear();
}
}
if ( gs_classForHiddenWindow )
{
if ( !::UnregisterClass(wxMSWEXEC_WNDCLASSNAME, wxGetInstance()) )
{
wxLogLastError(wxT("UnregisterClass(wxExecClass)"));
}
gs_classForHiddenWindow = NULL;
}
}
示例10: FillTree
void wxAxIdentifyView::FillTree(const wxVector<FILLTREEDATA> &data)
{
m_pTreeCtrl->DeleteAllItems();
m_pFeatureDetailsPanel->Clear();
//add root
wxTreeItemId nRootId = m_pTreeCtrl->AddRoot(wxT("Layers"), 0);
m_pTreeCtrl->SetItemBold(nRootId);
//add layers
for(size_t i = 0; i < data.size(); ++i)
{
if(data[i].Cursor.size() == 0)
continue;
wxGISEnumDatasetType eType = data[i].pLayer->GetType();
wxTreeItemId nLayerId = m_pTreeCtrl->AppendItem(nRootId, data[i].pLayer->GetName(), 1);
switch(eType)
{
case enumGISFeatureDataset:
{
wxGISFeatureDataset* pDataset = wxDynamicCast(data[i].pLayer->GetDataset(), wxGISFeatureDataset);
m_pTreeCtrl->SetItemData(nLayerId, new wxIdentifyTreeItemData(pDataset));
//wxTreeItemId nFirstFeatureId = nLayerId;
wxGISSpatialTreeCursor::const_iterator iter;
for(iter = data[i].Cursor.begin(); iter != data[i].Cursor.end(); ++iter)
{
wxGISSpatialTreeData *current = *iter;
if(current)
{
wxTreeItemId nFeatureId = m_pTreeCtrl->AppendItem(nLayerId, wxString::Format(wxT("%ld"), current->GetFID()), 2);
m_pTreeCtrl->SetItemData(nFeatureId, new wxIdentifyTreeItemData(pDataset, current->GetFID(), current->GetGeometry()));
// if(iter == data[i].Cursor.begin())
// nFirstFeatureId = nFeatureId;
}
}
}
break;
default:
break;
};
m_pTreeCtrl->ExpandAllChildren(nLayerId);
}
// m_pTreeCtrl->SelectItem(nFirstFeatureId);
}
示例11: defined
virtual ~MyClass()
{
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( size_t i=0; i<gs_myClassInstances.size(); i++ )
{
if ( gs_myClassInstances[i] == this )
{
gs_myClassInstances.erase(gs_myClassInstances.begin()+i);
}
}
}
示例12: ShowMessageDialog
void ShowMessageDialog(wxWindow* pWnd, const wxVector<MESSAGE>& msgs)
{
wxMessageDialog dlg(pWnd, _("During export there were several warnings."), _("Warning"), wxOK | wxCENTRE | wxICON_WARNING);
wxString extMsg;
for (size_t i = 0; i < msgs.size(); ++i)
{
if (msgs[i].sMessage.IsEmpty())
continue;
if (msgs[i].eType == enumGISMessageErr)
extMsg += _("Error") + wxT(": ");
else if (msgs[i].eType == enumGISMessageWarning)
extMsg += _("Warning") + wxT(": ");
extMsg += msgs[i].sMessage;
extMsg += wxT("\n\n");
}
dlg.SetExtendedMessage(extMsg);
dlg.ShowModal();
wxLogError(extMsg);
}
示例13: glEnd
void wxGLAPI::glEnd()
{
#if wxUSE_OPENGL_EMULATION
bool formerColors = SetState( GL_COLOR_ARRAY, s_colorsUsed );
bool formerNormals = SetState( GL_NORMAL_ARRAY, s_normalsUsed );
bool formerTexCoords = SetState( GL_TEXTURE_COORD_ARRAY, s_texCoordsUsed );
bool formerVertex = glIsEnabled(GL_VERTEX_ARRAY);
if( !formerVertex )
glEnableClientState(GL_VERTEX_ARRAY);
if ( s_colorsUsed )
glColorPointer( 4, GL_FLOAT, 0, &s_colors[0] );
if ( s_normalsUsed )
glNormalPointer( GL_FLOAT, 0, &s_normals[0] );
if ( s_texCoordsUsed )
glTexCoordPointer( 2, GL_FLOAT, 0, &s_texCoords[0] );
glVertexPointer(3, GL_FLOAT, 0, &s_vertices[0]);
glDrawArrays( s_mode, 0, s_vertices.size() / 3 );
if ( s_colorsUsed != formerColors )
RestoreState( GL_COLOR_ARRAY, formerColors );
if ( s_normalsUsed != formerNormals )
RestoreState( GL_NORMAL_ARRAY, formerColors );
if ( s_texCoordsUsed != formerTexCoords )
RestoreState( GL_TEXTURE_COORD_ARRAY, formerColors );
if( !formerVertex )
glDisableClientState(GL_VERTEX_ARRAY);
s_mode = 0xFF;
#else
::glEnd();
#endif
}
示例14: GenerateGLBufferVertices
void GLPolygons::GenerateGLBufferVertices(wxVector<PMSPolygon> &polygons, wxVector<GLfloat> &vertices)
{
unsigned int polygonsCount = polygons.size();
unsigned int i, j;
// Trim down polygons' count.
if (polygonsCount > MAX_POLYGONS_COUNT)
{
polygonsCount = MAX_POLYGONS_COUNT;
}
for (i = 0; i < polygonsCount; ++i)
{
for (j = 0; j < 3; ++j)
{
vertices.push_back((GLfloat)polygons[i].vertices[j].x);
vertices.push_back((GLfloat)polygons[i].vertices[j].y);
vertices.push_back((GLfloat)polygons[i].vertices[j].z);
vertices.push_back((GLfloat)polygons[i].vertices[j].color.red / 255.0);
vertices.push_back((GLfloat)polygons[i].vertices[j].color.green / 255.0);
vertices.push_back((GLfloat)polygons[i].vertices[j].color.blue / 255.0);
vertices.push_back((GLfloat)polygons[i].vertices[j].color.alpha / 255.0);
vertices.push_back((GLfloat)polygons[i].vertices[j].textureS);
vertices.push_back((GLfloat)polygons[i].vertices[j].textureT);
}
}
// Initialization of unused polygons.
for (i = 0; i < MAX_POLYGONS_COUNT - polygonsCount; ++i)
{
for (j = 0; j < 3; ++j)
{
for (unsigned int k = 0; k < GL_POLYGON_VERTEX_SIZE; ++k)
{
vertices.push_back(0.0f);
}
}
}
}
示例15: TestExec
bool TestExec(const wxVector<wxFileName>& programs, long timeout)
{
size_t i;
wxVector<MonitorData*> data;
// run all programs specified as command line parameters
wxArrayLong procID;
for (i=0; i<programs.size(); i++)
{
MonitorData *dt = new MonitorData(programs[i].GetFullPath());
long pid = wxExecute(programs[i].GetFullPath(), wxEXEC_ASYNC, &dt->process);
if (pid == 0)
{
wxLogError("could not run the program '%s'", programs[i].GetFullPath());
}
else
{
wxLogMessage("started program '%s' (pid %d)...",
programs[i].GetFullPath(), pid);
wxASSERT(dt->process.GetPid() == pid);
data.push_back(dt);
}
}
// sleep some moments
wxSleep(timeout);
// check if all processes are still running
bool allok = true;
for (i=0; i<data.size(); i++)
{
MonitoredProcess& proc = data[i]->process;
const wxString& prog = data[i]->program;
if (wxProcess::Exists(proc.GetPid()))
proc.Kill();
else
{
// this typically never happens, at least when running wx-programs
// built with debug builds of wx (see MonitoredProcess::OnTerminate;
// even if an asserts fail the app doesn't automatically close!):
wxLogMessage("program '%s' (pid %d) is NOT running anymore...",
prog, proc.GetPid());
allok = false;
}
if (data[i]->process.Crashed())
{
allok = false;
wxLogMessage("program '%s' (pid %d) crashed...",
prog, proc.GetPid());
}
else
wxLogMessage("program '%s' (pid %d) ended with exit code %d...",
prog, proc.GetPid(), proc.GetExitCode());
}
return allok;
}