本文整理汇总了C++中ModelCreator类的典型用法代码示例。如果您正苦于以下问题:C++ ModelCreator类的具体用法?C++ ModelCreator怎么用?C++ ModelCreator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelCreator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: START_TEST
END_TEST
START_TEST ( test_ModelHistory_copyConstructor )
{
ModelHistory * mh = new ModelHistory();
ModelCreator *mc = new ModelCreator();
mc->setFamilyName("Keating");
mc->setGivenName("Sarah");
mc->setEmail("[email protected]");
mh->addCreator(mc);
delete mc;
Date * date = new Date(2005, 12, 30, 12, 15, 45, 1, 2, 0);
mh->setCreatedDate(date);
delete date;
fail_unless(mh->getCreatedDate()->getMonth() == 12);
fail_unless(mh->getCreatedDate()->getSecond() == 45);
fail_unless(static_cast <ModelCreator*>
(mh->getListCreators()->get(0))->getFamilyName() == "Keating");
ModelHistory* mh2=new ModelHistory(*mh);
fail_unless(mh2->getCreatedDate()->getMonth() == 12);
fail_unless(mh2->getCreatedDate()->getSecond() == 45);
fail_unless(static_cast <ModelCreator*>(mh2->getListCreators()->get(0))->getFamilyName() == "Keating");
delete mh2;
delete mh;
}
示例2: START_TEST
END_TEST
START_TEST (test_Validation_ModelHistory3)
{
ModelHistory * mh = new ModelHistory();
fail_unless(mh != NULL);
fail_unless (!(mh->hasRequiredAttributes()));
Date * date = new Date(2007, 12, 30, 12, 15, 45, 1, 2, 0);
mh->setCreatedDate(date);
fail_unless (!(mh->hasRequiredAttributes()));
mh->setModifiedDate(date);
fail_unless (!(mh->hasRequiredAttributes()));
ModelCreator * mc = new ModelCreator();
mc->setFamilyName("Keating");
mh->addCreator(mc);
fail_unless (!(mh->hasRequiredAttributes()));
delete mh;
}
示例3: main
int
main (int argc, char *argv[])
{
SBMLDocument* d;
unsigned int errors;
if (argc != 3)
{
cout << endl
<< " usage: addModelHistory <input-filename> <output-filename>" << endl
<< endl;
return 2;
}
d = readSBML(argv[1]);
errors = d->getNumErrors();
if (errors > 0)
{
cout << "Read Error(s):" << endl;
d->printErrors(cout);
cout << "Correct the above and re-run." << endl;
}
else
{
ModelHistory * h = new ModelHistory();
ModelCreator *c = new ModelCreator();
c->setFamilyName("Keating");
c->setGivenName("Sarah");
c->setEmail("[email protected]");
c->setOrganization("University of Hertfordshire");
int status = h->addCreator(c);
printStatus("Status for addCreator: ", status);
Date * date = new Date("1999-11-13T06:54:32");
Date * date2 = new Date("2007-11-30T06:54:00-02:00");
status = h->setCreatedDate(date);
printStatus("Set created date: ", status);
status = h->setModifiedDate(date2);
printStatus("Set modified date: ", status);
status = d->getModel()->setModelHistory(h);
printStatus("Set model history: ", status);
writeSBML(d, argv[2]);
}
delete d;
return errors;
}
示例4: START_TEST
END_TEST
START_TEST (test_RDFAnnotation2_modelWithHistoryAndMultipleModifiedDates)
{
ModelHistory * h = new ModelHistory();
ModelCreator *c = new ModelCreator();
c->setFamilyName("Keating");
c->setGivenName("Sarah");
h->addCreator(c);
Date * d = new Date(2005, 2, 2, 14, 56, 11);
h->setCreatedDate(d);
h->addModifiedDate(d);
h->addModifiedDate(d);
m2->unsetModelHistory();
m2->setModelHistory(h);
XMLNode *ann = RDFAnnotationParser::parseModelHistory(m2);
const char * expected =
"<annotation>\n"
" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n"
" <rdf:Description rdf:about=\"#_000001\">\n"
" <dc:creator rdf:parseType=\"Resource\">\n"
" <rdf:Bag>\n"
" <rdf:li rdf:parseType=\"Resource\">\n"
" <vCard:N rdf:parseType=\"Resource\">\n"
" <vCard:Family>Keating</vCard:Family>\n"
" <vCard:Given>Sarah</vCard:Given>\n"
" </vCard:N>\n"
" </rdf:li>\n"
" </rdf:Bag>\n"
" </dc:creator>\n"
" <dcterms:created rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n"
" </dcterms:created>\n"
" <dcterms:modified rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n"
" </dcterms:modified>\n"
" <dcterms:modified rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n"
" </dcterms:modified>\n"
" </rdf:Description>\n"
" </rdf:RDF>\n"
"</annotation>";
fail_unless( equals(expected, ann->toXMLString().c_str()) );
delete c;
delete d;
delete h;
delete ann;
}
示例5: Vector3
void Billboard_Test::Init(Scene * scene)
{
BillboardPtr ptr = scene->AddBillboard();
Billboard * b = ptr.Get();
b->SetSize(20.0f, 20.0f);
b->UseDiffuseTexture(true);
b->SetDiffuseTexture("assets/fire.png");
StaticVert verts[4];
verts[0].pos = Vector3(-1.0f, -1.0f, 0.0f);
verts[1].pos = Vector3(-1.0f, 1.0f, 0.0f);
verts[2].pos = Vector3(1.0f, 1.0f, 0.0f);
verts[3].pos = Vector3(1.0f, -1.0f, 0.0f);
verts[0].u = 0.0f;
verts[0].v = 1.0f;
verts[1].u = 0.0f;
verts[1].v = 0.0f;
verts[2].u = 1.0f;
verts[2].v = 0.0f;
verts[3].u = 1.0f;
verts[3].v = 1.0f;
unsigned int ind[] = { 0, 1, 3, 1, 3, 2 };
ModelCreator<StaticVert> creator;
creator.StartMesh();
creator.SetTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
creator.SetDrawMethod(DM_DRAW_INDEXED);
creator.SetVertexBuffer(verts, sizeof(verts), sizeof(StaticVert));
creator.SetIndexBuffer(ind, 6);
creator.EndMesh();
StaticEntityPtr triPtr = scene->AddStaticEntity(creator, "tri");
StaticEntity * tri = triPtr.Get();
tri->Illuminate(false);
tri->SetPosition(50.0f, 0.0f, 0.0f);
tri->SetScale(20.0f, 20.0f, 2.0f);
Material * mat = tri->GetMaterial(0);
mat->UseDiffuseMap(true);
mat->SetDiffuseMap("assets/fire.png");
mat->SetEmmisivePower(1);
}
示例6: CreateLine
void Object_Picking_Test::CreateLine(Vector3 begin, Vector3 end)
{
StaticVert verts[2];
verts[0].pos = begin;
verts[1].pos = end;
ModelCreator<StaticVert> modelCreator;
modelCreator.StartMesh();
modelCreator.SetDrawMethod(DM_DRAW);
modelCreator.SetTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);
modelCreator.SetVertexBuffer(verts, sizeof(verts), sizeof(StaticVert));
modelCreator.EndMesh();
StaticEntityPtr linePtr = scene->AddStaticEntity(modelCreator, "line " + std::to_string(currentBox));
StaticEntity * line = linePtr.Get();
line->Illuminate(false);
Material * mat = line->GetMaterial(0);
mat->UseDiffuseMap(false);
mat->SetDiffuseColor(Color::Red());
currentBox++;
}
示例7: createRDFDescription
//.........这里部分代码省略.........
XMLToken W3CDTF2_token = XMLToken(W3CDTF_triple, blank_att);
XMLToken empty_token = XMLToken("");
/* nodes */
XMLNode bag = XMLNode(bag_token);
XMLNode created = XMLNode(created_token);
XMLNode modified= XMLNode(modified_token);
XMLNode W3CDTF1 = XMLNode(W3CDTF1_token);
XMLNode W3CDTF2 = XMLNode(W3CDTF2_token);
//
// The following XMLNode objects are used only
// in the for loop below (for each ModelCreator object
// in ModelHistory object) and reset in each step.
// Thus, they are defined only in the block in which
// they are used to avoid a memory leak.
//
// XMLNode * N
// XMLNode * Email
// XMLNode * Org
// XMLNode Family;
// XMLNode Given
// XMLNode Orgname
// XMLNode li
//
/* now add the data from the ModelHistory */
for (unsigned int n = 0; n < history->getNumCreators(); n++)
{
XMLNode * N = 0;
XMLNode * Email = 0;
XMLNode * Org = 0;
ModelCreator* c = history->getCreator(n);
if (c->isSetFamilyName())
{
XMLNode empty(empty_token);
empty.append(c->getFamilyName());
XMLNode Family(Family_token);
Family.addChild(empty);
N = new XMLNode(N_token);
N->addChild(Family);
}
if (c->isSetGivenName())
{
XMLNode empty(empty_token);
empty.append(c->getGivenName());
XMLNode Given(Given_token);
Given.addChild(empty);
if (!N)
{
N = new XMLNode(N_token);
}
N->addChild(Given);
}
if (c->isSetEmail())
{
XMLNode empty(empty_token);
empty.append(c->getEmail());
示例8: START_TEST
END_TEST
START_TEST (test_RDFAnnotation2_modelWithHistoryAndCVTerms)
{
ModelHistory * h = new ModelHistory();
ModelCreator *c = new ModelCreator();
c->setFamilyName("Keating");
c->setGivenName("Sarah");
h->addCreator(c);
Date *d = new Date(2008, 11, 17, 18, 37, 0, 0, 0, 0);
h->setCreatedDate(d);
h->setModifiedDate(d);
m2->unsetModelHistory();
m2->setModelHistory(h);
CVTerm *cv = new CVTerm();
cv->setQualifierType(BIOLOGICAL_QUALIFIER);
cv->setBiologicalQualifierType(BQB_IS_VERSION_OF);
cv->addResource("http://www.geneontology.org/#GO:0005892");
m2->addCVTerm(cv);
XMLNode *ann = RDFAnnotationParser::parseModelHistory(m2);
const char * expected =
"<annotation>\n"
" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n"
" <rdf:Description rdf:about=\"#_000001\">\n"
" <dc:creator rdf:parseType=\"Resource\">\n"
" <rdf:Bag>\n"
" <rdf:li rdf:parseType=\"Resource\">\n"
" <vCard:N rdf:parseType=\"Resource\">\n"
" <vCard:Family>Keating</vCard:Family>\n"
" <vCard:Given>Sarah</vCard:Given>\n"
" </vCard:N>\n"
" </rdf:li>\n"
" </rdf:Bag>\n"
" </dc:creator>\n"
" <dcterms:created rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2008-11-17T18:37:00Z</dcterms:W3CDTF>\n"
" </dcterms:created>\n"
" <dcterms:modified rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2008-11-17T18:37:00Z</dcterms:W3CDTF>\n"
" </dcterms:modified>\n"
" <bqbiol:isVersionOf>\n"
" <rdf:Bag>\n"
" <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0005892\"/>\n"
" </rdf:Bag>\n"
" </bqbiol:isVersionOf>\n"
" </rdf:Description>\n"
" </rdf:RDF>\n"
"</annotation>";
if (ann != NULL)
{
fail_unless( equals(expected, ann->toXMLString().c_str()) );
}
else
{
fail("parseModelHistory failed");
}
}
示例9: Vector3
StaticEntityPtr Object_Picking_Test::CreateBBox(StaticEntityPtr ptr)
{
AABB bbox = ptr.Get()->GetAABB();
Vector3 min = bbox.min;
Vector3 max = bbox.max;
StaticVert box[32];
box[0].pos = Vector3(min.x, max.y, min.z);
box[1].pos = Vector3(max.x, max.y, min.z);
box[2].pos = Vector3(max.x, max.y, min.z);
box[3].pos = Vector3(max.x, min.y, min.z);
box[4].pos = Vector3(max.x, min.y, min.z);
box[5].pos = Vector3(min.x,min.y,min.z);
box[6].pos = Vector3(min.x, min.y, min.z);
box[7].pos = Vector3(min.x, max.y, min.z);
box[8].pos = Vector3(min.x, max.y, max.z);
box[9].pos = Vector3(max.x, max.y, max.z);
box[10].pos = Vector3(max.x, max.y, max.z);
box[11].pos = Vector3(max.x, min.y, max.z);
box[12].pos = Vector3(max.x, min.y, max.z);
box[13].pos = Vector3(min.x, min.y, max.z);
box[14].pos = Vector3(min.x, min.y, max.z);
box[15].pos = Vector3(min.x, max.y, max.z);
box[16].pos = Vector3(max.x, max.y, min.z);
box[17].pos = Vector3(max.x, max.y, max.z);
box[18].pos = Vector3(max.x, max.y, max.z);
box[19].pos = Vector3(max.x, min.y, max.z);
box[20].pos = Vector3(max.x, min.y, max.z);
box[21].pos = Vector3(max.x, min.y, min.z);
box[22].pos = Vector3(max.x, min.y, min.z);
box[23].pos = Vector3(max.x, max.y, min.z);
box[24].pos = Vector3(min.x, max.y, min.z);
box[25].pos = Vector3(min.x, max.y, max.z);
box[26].pos = Vector3(min.x, max.y, max.z);
box[27].pos = Vector3(min.x, min.y, max.z);
box[28].pos = Vector3(min.x, min.y, max.z);
box[29].pos = Vector3(min.x, min.y, min.z);
box[30].pos = Vector3(min.x, min.y, min.z);
box[31].pos = Vector3(min.x, max.y, min.z);
ModelCreator<StaticVert> cr;
cr.StartMesh();
cr.SetTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
cr.SetDrawMethod(DM_DRAW);
cr.SetVertexBuffer(box, sizeof(box), sizeof(StaticVert));
cr.EndMesh();
StaticEntityPtr boxPtr = scene->AddStaticEntity(cr, "box" + std::to_string(currentBox));
StaticEntity * ent = boxPtr.Get();
Material * mat = ent->GetMaterial(0);
mat->SetDiffuseColor(Color::Blue());
currentBox++;
return boxPtr;
}