本文整理汇总了C++中CModel类的典型用法代码示例。如果您正苦于以下问题:C++ CModel类的具体用法?C++ CModel怎么用?C++ CModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TRACE
CModel* CModelManager::AddModel(CString URI)
{
TRACE("CModelManager::AddModel");
CModel *model = FindModel(URI);
if (model == NULL)
{
if (URI.Right(3) == "ifc" || URI.Right(3) == "IFC" || URI.Right(3) == "Ifc" ||
URI.Right(6) == "ifcxml" || URI.Right(6) == "ifcXML" || URI.Right(6) == "ifcXml"||
URI.Right(6) == "IFCxml" || URI.Right(6) == "IFCXML" || URI.Right(6) == "IFCXml"||
URI.Right(6) == "Ifcxml" || URI.Right(6) == "IfcXML" || URI.Right(6) == "IfcXml")
{
model = new CIfcModel;
((CIfcModel*)model)->m_schemaFile = m_SchemaFile;
}
else
model = new CGmlModel;
model->m_URI = new char[URI.GetLength() + 1];
model->m_filePath = new char[URI.ReverseFind('\\') + 2];
model->m_fileName = new char[URI.GetLength() - URI.ReverseFind('\\') + 2];
strcpy(model->m_URI, URI.GetBuffer());
strcpy(model->m_filePath, URI.Mid(0, URI.ReverseFind('\\') + 1).GetBuffer());
strcpy(model->m_fileName, URI.Mid(URI.ReverseFind('\\') + 1, URI.GetLength()).GetBuffer());
m_models.push_back(model);
model->OpenModel();
}
return model;
}
示例2: getModel
// virtual
void CModelParameterSpecies::setValue(const C_FLOAT64 & value, const Framework & framework)
{
CModel * pModel = getModel();
if (framework == Concentration)
{
mConcentration = value;
if (mpCompartment != NULL && pModel != NULL)
{
mValue = mConcentration * mpCompartment->getValue(ParticleNumbers) * pModel->getQuantity2NumberFactor();
}
else
{
mValue = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
}
}
else
{
mValue = value;
if (mpCompartment != NULL && pModel != NULL)
{
mConcentration = mValue / mpCompartment->getValue(ParticleNumbers) * pModel->getNumber2QuantityFactor();
}
else
{
mConcentration = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
}
}
}
示例3: assert
bool TaskWidget::commonAfterRunTask()
{
if (!mpTask) return false;
if (mProgressBar != NULL)
{
mProgressBar->finish();
mProgressBar->deleteLater();
mProgressBar = NULL;
}
mpTask->setCallBack(NULL);
CCopasiMessage::clearDeque();
assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
(*CCopasiRootContainer::getDatamodelList())[0]->finish();
// Update all values shown in the GUI
CModel * pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
pModel->updateSimulatedValues(true);
pModel->updateNonSimulatedValues();
protectedNotify(ListViews::STATE, ListViews::CHANGE, (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
unsetCursor();
CopasiUI3Window::getMainWindow()->suspendAutoSave(false);
return loadTask();
}
示例4: QModelIndex
void insertReactionRowsCommand::redo()
{
mpReactionDM->insertNewReactionRow(mPosition, mRows, QModelIndex());
assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
assert(pDataModel != NULL);
CModel * pModel = pDataModel->getModel();
assert(pModel != NULL);
mpReaction = pModel->getReactions()[mPosition];
std::string sName = mpReaction->getObjectName();
if (mpReactionData != NULL)
mpReactionData->setName(sName);
CReactionInterface* ri = new CReactionInterface((*CCopasiRootContainer::getDatamodelList())[0]->getModel());
ri->initFromReaction(mpReaction);
if (mpReactionData != NULL)
mpReactionData->setRi(ri);
setUndoState(true);
setAction("Add to list");
if (mpReactionData != NULL)
setName(mpReactionData->getName());
else setName(sName);
}
示例5: CCopasiUndoCommand
RemoveGlobalQuantityRowsCommand::RemoveGlobalQuantityRowsCommand(
QModelIndexList rows, CQGlobalQuantityDM * pGlobalQuantityDM, const QModelIndex&)
: CCopasiUndoCommand("Global Quantity", GLOBALQUANTITY_REMOVE)
, mpGlobalQuantityDM(pGlobalQuantityDM)
, mRows(rows)
, mpGlobalQuantityData()
, mFirstTime(true)
{
CCopasiDataModel * pDataModel = pGlobalQuantityDM->getDataModel();
assert(pDataModel != NULL);
CModel * pModel = pDataModel->getModel();
assert(pModel != NULL);
QModelIndexList::const_iterator i;
for (i = rows.begin(); i != rows.end(); ++i)
{
CModelValue* pModelValue = &pModel->getModelValues()[i->row()];
if (pGlobalQuantityDM->isDefaultRow(*i) || pModelValue == NULL)
continue;
UndoGlobalQuantityData *data = new UndoGlobalQuantityData(pModelValue);
mpGlobalQuantityData.append(data);
}
setText(QObject::tr(": Removed Global Quantity"));
}
示例6: beginRemoveRows
bool CQSpecieDM::removeRows(int position, int rows, const QModelIndex&)
{
if (rows <= 0)
return true;
beginRemoveRows(QModelIndex(), position, position + rows - 1);
CModel * pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
std::vector< std::string > DeletedKeys;
DeletedKeys.resize(rows);
std::vector< std::string >::iterator itDeletedKey;
std::vector< std::string >::iterator endDeletedKey = DeletedKeys.end();
CCopasiVector< CMetab >::const_iterator itRow = pModel->getMetabolites().begin() + position;
for (itDeletedKey = DeletedKeys.begin(); itDeletedKey != endDeletedKey; ++itDeletedKey, ++itRow)
{
*itDeletedKey = (*itRow)->getKey();
}
for (itDeletedKey = DeletedKeys.begin(); itDeletedKey != endDeletedKey; ++itDeletedKey)
{
pModel->removeMetabolite(*itDeletedKey);
emit notifyGUI(ListViews::METABOLITE, ListViews::DELETE, *itDeletedKey);
emit notifyGUI(ListViews::METABOLITE, ListViews::DELETE, ""); //Refresh all as there may be dependencies.
}
endRemoveRows();
return true;
}
示例7: loadReactionTable
void CQSpeciesDetail::loadReactionTable()
{
if (mpMetab == NULL) return;
CModel * pModel = const_cast< CModel * >(mpMetab->getModel());
if (pModel == NULL) return;
std::set< const CCopasiObject * > Reactions;
pModel->appendDependentReactions(mpMetab->getDeletedObjects(), Reactions);
mpReactionTable->setRowCount((int) Reactions.size());
std::set< const CCopasiObject * >::const_iterator it = Reactions.begin();
std::set< const CCopasiObject * >::const_iterator end = Reactions.end();
int i = 0;
const CReaction * pReaction;
for (; it != end; ++it, ++i)
{
pReaction = static_cast< const CReaction * >(*it);
mpReactionTable->setItem(i, 0, new QTableWidgetItem(FROM_UTF8(pReaction->getObjectName()) + ":"));
mpReactionTable->setItem(i, 1, new QTableWidgetItem(FROM_UTF8(CChemEqInterface::getChemEqString(pModel, *pReaction, false))));
}
if (i == 0)
mpReactionTable->setItem(i, 0, new QTableWidgetItem("none"));
// Provide count of reactions, in label.
mpLblReactions->setText("Involved in \n" + QString::number(mpReactionTable->rowCount()) + " Reactions");
return;
}
示例8: assert
RemoveAllReactionRowsCommand::RemoveAllReactionRowsCommand(CQReactionDM * pReaDM, const QModelIndex&)
{
mpReactionDM = pReaDM;
assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
assert(pDataModel != NULL);
CModel * pModel = pDataModel->getModel();
assert(pModel != NULL);
for (int i = 0; i != pReaDM->rowCount() - 1; ++i)
{
UndoReactionData *data = new UndoReactionData();
CReactionInterface* ri = new CReactionInterface((*CCopasiRootContainer::getDatamodelList())[0]->getModel());
if (pModel->getReactions()[i])
{
data->setName(pModel->getReactions()[i]->getObjectName());
ri->initFromReaction(pModel->getReactions()[i]->getKey());
data->setRi(ri);
mpReaData.append(data);
}
}
mType = REACTIONREMOVEALL;
setEntityType("Reaction");
this->setText(removeAllReactionRowsText());
}
示例9: OnSkinListBox
void CEditAnimationDialog::OnSkinListBox( wxCommandEvent& event )
{
TString strFileName = event.GetString();
wxString logMessage;
m_pSkin = CResourceManager::GetInstance()->GetResource<CSkin>(strFileName, false);
if (m_pSkin)
{
CModel* pModel = m_pAnimationGLWindow->GetModel();
if (pModel)
{
pModel->SetSkin(m_pSkin);
m_pSkinCheckBox->SetValue(true);
logMessage = strFileName + _T(" load success");
SharePtr<CTexture> pTestTexture = CResourceManager::GetInstance()->GetResource<CTexture>(_T("TestTexture.tga"), false);
pModel->AddTexture(pTestTexture);
m_bSkin = true;
ShowAnima();
}
else
{
logMessage = "No model is selected!";
}
}
else
{
m_pSkinCheckBox->SetValue(false);
logMessage = WARNING + strFileName + _T(" load failed");
}
wxLogMessage(logMessage);
}
示例10: PrepareModels
void SortModelRenderer::PrepareModels()
{
CMatrix3D worldToCam;
if (m->models.size() == 0)
return;
g_Renderer.GetViewCamera().m_Orientation.GetInverse(worldToCam);
for(std::vector<SModel*>::iterator it = m->models.begin(); it != m->models.end(); ++it)
{
SModel* smdl = *it;
CModel* model = smdl->GetModel();
ENSURE(model->GetRenderData() == smdl);
m->vertexRenderer->UpdateModelData(model, smdl->m_Data, smdl->m_UpdateFlags);
smdl->m_UpdateFlags = 0;
CVector3D modelpos = model->GetTransform().GetTranslation();
modelpos = worldToCam.Transform(modelpos);
smdl->m_Distance = modelpos.Z;
}
PROFILE_START( "sorting transparent" );
std::sort(m->models.begin(), m->models.end(), SortModelsByDist());
PROFILE_END( "sorting transparent" );
}
示例11: QModelIndex
void InsertCompartmentRowsCommand::redo()
{
if (firstTime)
{
mpCompartmentDM->insertNewCompartmentRow(mPosition, mRows, QModelIndex());
assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
assert(pDataModel != NULL);
CModel * pModel = pDataModel->getModel();
assert(pModel != NULL);
CCompartment *pCompartment = pModel->getCompartments()[mPosition];
mpCompartmentData->setName(pCompartment->getObjectName());
mpCompartmentData->setStatus(pCompartment->getStatus());
mpCompartmentData->setInitialValue(pCompartment->getInitialValue());
firstTime = false;
}
else
{
mpCompartmentDM->addCompartmentRow(mpCompartmentData);
}
setUndoState(true);
setAction("Add to list");
setName(mpCompartmentData->getName());
}
示例12: CNMRException
LIB3MFMETHODIMP CCOMModelTexture2D::ReadFromBuffer(_In_ BYTE * pBuffer, _In_ ULONG64 cbBufferSize)
{
try {
if (pBuffer == nullptr)
throw CNMRException(NMR_ERROR_INVALIDPOINTER);
CModelTexture2DResource * pTextureResource = getTexture2D();
__NMRASSERT(pTextureResource);
PImportStream pImportStream = std::make_shared<CImportStream_Memory>(pBuffer, cbBufferSize);
CModel * pModel = pTextureResource->getModel();
__NMRASSERT(pModel);
pModel->removeTextureStream(pTextureResource->getPath());
pModel->addTextureStream(pTextureResource->getPath(), pImportStream);
return handleSuccess();
}
catch (CNMRException & Exception) {
return handleNMRException(&Exception);
}
catch (...) {
return handleGenericException();
}
}
示例13: FROM_UTF8
void CQCompartment::deleteCompartment()
{
if (mpCompartment == NULL) return;
QMessageBox::StandardButton choice =
CQMessageBox::confirmDelete(this, "compartment",
FROM_UTF8(mpCompartment->getObjectName()),
mpCompartment->getDeletedObjects());
switch (choice)
{
case QMessageBox::Ok:
{
CModel * pModel = mpCompartment->getModel();
assert(pModel != NULL);
pModel->removeCompartment(mKey);
protectedNotify(ListViews::COMPARTMENT, ListViews::DELETE, mKey);
protectedNotify(ListViews::COMPARTMENT, ListViews::DELETE, ""); //Refresh all as there may be dependencies.
break;
}
default:
break;
}
switchToWidget(CCopasiUndoCommand::COMPARTMENTS);
}
示例14: Render
// Renders the scene.
void CSceneManager::Render()
{
m_pRenderDevice->ClearScreen( m_ClearColour );
CVector3 camPos = m_pCamera->GetPosition();
m_pRender->RenderStart( &camPos );// place holder only.
CTemplate* temp = 0;
for(TUInt32 i = 0; i < m_TemplateList.size(); i++)
{
temp = m_TemplateList[i];
temp->Render( m_pRenderDevice->GetDevice() );
ID3D10ShaderResourceView* tex = temp->GetTexture();
for(TUInt32 model=0; model < temp->ModelCount(); model++)
{
CModel* current = temp->GetModelByIndex( model );
m_pRender->RenderModel( current->GetWorldMatrix(), tex );
m_pRenderDevice->DrawIndexed( temp->IndexCount() );
}
}
m_pRenderDevice->Present();
}
示例15: Save
void CToySource::Build() const
{
Save();
CGeppetto g(true, FindAbsolutePath(GetDirectory(m_sFilename)));
bool bSuccess = g.BuildFromInputScript(FindAbsolutePath(m_sFilename));
if (bSuccess)
{
if (CModelLibrary::FindModel(m_sToyFile) != ~0)
{
CModel* pModel = CModelLibrary::GetModel(CModelLibrary::FindModel(m_sToyFile));
TAssert(pModel);
if (pModel)
{
for (size_t i = 0; i < GameServer()->GetMaxEntities(); i++)
{
CBaseEntity* pEntity = CBaseEntity::GetEntity(i);
if (!pEntity)
continue;
if (pEntity->GetModel() == pModel)
pEntity->RemoveFromPhysics();
}
pModel->Reload();
}
}
else
CModelLibrary::AddModel(m_sToyFile);
}
}