]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.cxx
a8c436605ec64a14aa763188584bcb1cb7643e2e
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / OutlineModelBuilder.cxx
1
2 //----------------------------------------------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------------------------------------------
5 #include "OutlineModelBuilder.h"
6
7 //----------------------------------------------------------------------------------------------------------------
8 // Class implementation
9 //----------------------------------------------------------------------------------------------------------------
10 /** @file OutlineModelBuilder.cxx */
11
12 //------------------------------------------------------------------------------------------------------------
13 // Constructors & Destructors
14 //------------------------------------------------------------------------------------------------------------
15
16         /**
17         * Creates an OutlineModelBuilder
18         * @ param filesNames Paired set of files with the names of the files to read ConceptsFile, ImageSourcesFile, ImageSectionsFile, AxeThingsFile, ContoursFile
19         * @ param sources Paired set of sourceKeyName-ImageSourceThing
20         * @ param sections Paired set of sectionKeyName-ImageSectionThing
21         * @ param axes Paired set of axeKeyName-AxeThing
22         * @ param outlines Paired set of contoKeyName-ContourThing
23         */
24 OutlineModelBuilder ::  OutlineModelBuilder(std::string  theConceptsFile, std::string datadir)//std::map<std::string, std::string> filesNames, std::map<std::string, ImageSourceThing *> * sources, std::map<std::string, ImageSectionThing *>* sections, std::map<std::string, AxeThing *>* axes, std::map<std::string, ContourThing *>* outlines)
25         {
26                 conceptsFile = theConceptsFile; 
27                 imagesSectionEnvOtherConceptsFN = datadir + "/imageSectionOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/imageSectionOtherConceptsFile.cf";
28                 outlinesEnvOtherConceptsFN = datadir + "/outlinesOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/outlinesOtherConceptsFile.cf";
29                 axesEnvOtherConceptsFN = datadir + "/axesOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/axesOtherConceptsFile.cf";
30                 axesEnv_Reader = NULL;
31                 imagesSectionEnv_Reader = NULL;
32                 imageSourceEnv_Reader = NULL;
33                 outlinesEnv_Reader = NULL;
34         }
35
36         /**
37         * Destroys an AxeThing
38         */
39         OutlineModelBuilder ::  ~OutlineModelBuilder()
40         {
41                 delete axesEnv_Reader;
42                 delete imagesSectionEnv_Reader;
43                 delete imageSourceEnv_Reader;
44                 delete outlinesEnv_Reader;
45         }
46 //------------------------------------------------------------------------------------------------------------
47 // Methods
48 //------------------------------------------------------------------------------------------------------------
49
50         /**
51         * Gets the ImageSourceThing environment
52         *@param  ImSourceEnv 
53         */
54     SomeEnvironment<ImageSourceThing *> * OutlineModelBuilder ::  getImSourceEnv()
55         {
56                 return ( imageSourceEnv_Reader!= NULL ) ? imageSourceEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSourceThing *>();
57         }
58         /**
59         * Gets the ImageSectionThing environment
60         *@param  imSectionEnv 
61         */
62         SomeEnvironment<ImageSectionThing *> * OutlineModelBuilder ::  getImSectionEnv()
63         {
64                 return ( imagesSectionEnv_Reader!= NULL ) ? imagesSectionEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSectionThing *>();
65         }
66         /*
67         * Gets the AxeThing environment
68         *@param  AxesEnv
69         */
70         SomeEnvironment<AxeThing *> * OutlineModelBuilder ::  getAxesEnv()
71         {
72                 return ( axesEnv_Reader!= NULL ) ? axesEnv_Reader->getEnvironment() : new SomeEnvironment<AxeThing *>();
73         }
74         /**
75         * Gets the ContourThing environment
76         *@param  ContourEnv 
77         */
78         SomeEnvironment<ContourThing *> * OutlineModelBuilder ::  getContourEnv()
79         {
80                 return ( outlinesEnv_Reader!= NULL ) ? outlinesEnv_Reader->getEnvironment() : new SomeEnvironment<ContourThing *>();
81         }
82
83
84         /**
85         * Builds the ImageSourceThing * environment
86         * @param sourcesFile File path with the object key names and specific instants for each one
87         * @param sources The sources to include in the enivorment
88         */
89         void OutlineModelBuilder :: buildImageSource_Envornment( std::string sourcesFile, std::map<std::string, ImageSourceThing *> * sources )
90         {
91                 if( !conceptsFile.empty() )
92                         imageSourceEnv_Reader = new ReaderEnvironment<ImageSourceThing *> (conceptsFile, sourcesFile, sources);
93                         //imageSourceEnv_Reader = new ReaderEnvironment<ImageSourceThing *> ("data/holaConceptsFile.cf", sourcesFile, sources);
94         }
95
96         /**
97         * Builds the ImageSectionThing * environment
98         * @param sectionsFile File path with the object key names and specific instants for each one
99         * @param sections The sections to include in the enivorment
100         */
101         void OutlineModelBuilder :: buildImageSection_Envornment( std::string sectionsFile, std::map<std::string, ImageSectionThing *>* sections )
102         {
103                 if( !conceptsFile.empty() )
104                         imagesSectionEnv_Reader = new ReaderEnvironment<ImageSectionThing *> ( imagesSectionEnvOtherConceptsFN, conceptsFile, sectionsFile, sections);
105         }
106
107
108         /**
109         * Builds the AxeThing * environment
110         * @param axesFile File path with the object key names and specific instants for each one
111         * @param axes The axes to include in the enivorment
112         */
113         void OutlineModelBuilder :: buildAxe_Envornment( std::string axesFile, std::map<std::string, AxeThing *>* axes )
114         {
115                 if( !conceptsFile.empty() )
116                         axesEnv_Reader = new ReaderEnvironment<AxeThing *> ( axesEnvOtherConceptsFN, conceptsFile, axesFile, axes);
117         }
118
119         /**
120         * Builds the CountourThing * environment
121         * @param outlinesFile File path with the object key names and specific instants for each one
122         * @param outlines The outlines to include in the enivorment
123         */
124         void OutlineModelBuilder :: buildCountour_Envornment( std::string outlinesFile, std::map<std::string, ContourThing *>* outlines )
125         {
126                 if( !conceptsFile.empty() )
127                         outlinesEnv_Reader = new ReaderEnvironment< ContourThing *> ( outlinesEnvOtherConceptsFN, conceptsFile, outlinesFile, outlines);
128         }
129