File: testMeta8Scene.cxx

package info (click to toggle)
insighttoolkit 3.6.0-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 94,956 kB
  • ctags: 74,981
  • sloc: cpp: 355,621; ansic: 195,070; fortran: 28,713; python: 3,802; tcl: 1,996; sh: 1,175; java: 583; makefile: 415; csh: 184; perl: 175
file content (85 lines) | stat: -rw-r--r-- 1,909 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <stdio.h>
#include <ctype.h>
#include <metaScene.h>
#include <metaGroup.h>
#include <metaEllipse.h>

int main(int argc, char **argv)
{

  METAIO_STREAM::cout << "Creating test scene ..." << METAIO_STREAM::endl;
  MetaScene * s = new MetaScene(3);

  MetaEllipse * e1 = new MetaEllipse(3);
  e1->ID(0);
  e1->Radius(3);

  MetaEllipse * e2 = new MetaEllipse(3);
  e2->ID(1);
  e2->Radius(4);

  MetaGroup * g1 = new MetaGroup(3);
  g1->ID(2);

  e1->ParentID(2);
  e2->ParentID(2);

  s->AddObject(g1);
  s->AddObject(e1);
  s->AddObject(e2);

  METAIO_STREAM::cout << "...[ok]" << METAIO_STREAM::endl;

  METAIO_STREAM::cout << "Writing test file ..." << METAIO_STREAM::endl;

  s->Write("scene.scn");

  METAIO_STREAM::cout << "...[ok]" << METAIO_STREAM::endl;

  METAIO_STREAM::cout << "Clearing the scene..." << METAIO_STREAM::endl;
  s->Clear();
  METAIO_STREAM::cout << "...[ok]" << METAIO_STREAM::endl;

  METAIO_STREAM::cout << "Reading test file ..." << METAIO_STREAM::endl;

  s->Read("scene.scn");

  if(s->NObjects() != 3)
    {
    METAIO_STREAM::cout << "Number of obejcts: " << s->NObjects()
              << " != 3...[FAILED]" << METAIO_STREAM::endl;
    return 0;
    }

  METAIO_STREAM::cout << "...[ok]" << METAIO_STREAM::endl;

  s->Clear();

  METAIO_STREAM::cout << "Writing single object..." << METAIO_STREAM::endl;

  e1 = new MetaEllipse(3);
  e1->ID(0);
  e1->Radius(3);
  e1->Write("ellipse.elp");

  METAIO_STREAM::cout << "[OK]" << METAIO_STREAM::endl;

  s->Clear();

  METAIO_STREAM::cout << "Reading test file ..." << METAIO_STREAM::endl;

  s->Read("ellipse.elp");

  if(s->NObjects() != 1)
    {
    METAIO_STREAM::cout << "Number of obejcts: " << s->NObjects()
              << " != 1...[FAILED]" << METAIO_STREAM::endl;
    return 0;
    }

  METAIO_STREAM::cout << "[OK]" << METAIO_STREAM::endl;

  // (*(s->GetObjectList()->begin()))->PrintInfo();

  return 1;
}