X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Fkernel_ManagerContour_NDimensions%2FOutlineModelManager.cxx;h=9dbb1dbf9d80a13bd8f35373c1f829dbd666ff0b;hb=ffd5933600d8bad1de6ee62c305cc26a046166dd;hp=6b2e68b25495332d6d6e275389abe33c2432d2aa;hpb=3e974430e1298c1086c64260db838023d8a72744;p=creaContours.git diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx b/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx index 6b2e68b..9dbb1db 100644 --- a/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx +++ b/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx @@ -24,11 +24,11 @@ outlinesEnvironment = contourEnv; workSpace = new ContourWorkspace(this);//implies a shared workSpace - keyGenerator = * new PrefixMaxKeyGenerator(); + keyGenerator = * new PrefixMaxKeyGenerator(); counterIdKey = 0; actualInstantWrapping = new InstantMembersNameList(); - changeSourceImage = true; + changeSourceImage = true; bool allOK = keyGenerator.addKeyThing("Axes", "Axe"); allOK &= keyGenerator.addKeyThing("Image Sources", "Image source"); @@ -45,11 +45,11 @@ clean(); delete actualInstant; delete workSpace; - delete actualInstantWrapping; + delete actualInstantWrapping; } //------------------------------------------------------------------------------------------------------------ -// Methods +// Methods //------------------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ /* * Sets the workSpace object - * @param aWorkSpace The workSpace to set + * @param aWorkSpace The workSpace to set */ void OutlineModelManager :: setWorkSpace( ContourWorkspace * aWorkSpace ) { @@ -117,7 +117,7 @@ { bool executedComs = executionQueue.size()>0 ? true : false; while( executionQueue.size()>0 ) - { + { CommandObject * aCmmand = executionQueue.front(); executedComs &= executeCommand(aCmmand, fromRegistration); executionQueue.pop_front(); @@ -125,9 +125,9 @@ return executedComs; } - + /* - * Sets the concepts of the environments and includes the concepts managed by the program + * Sets the concepts of the environments and includes the concepts managed by the program * @conceptsScript Is the script for with the concepts descrition * @return Returns true if successful insert of the given concepts, false otherwise */ @@ -137,45 +137,45 @@ int endSub; std::string::size_type equalIndex = conceptsScript.find("=", 0); std::string::size_type nextIndex = 0; - while( equalIndex != std::string::npos && allOK) - { + while( equalIndex != std::string::npos && allOK) + { endSub = equalIndex; - std::string concept = conceptsScript.substr( 0, endSub ); - conceptsScript.erase( 0, endSub+1 ); - std::cout << "C: " << concept <0 ) allOK &= addUserConcept(concept, intReturn); else allOK = false; - } + } return allOK; } /* - * Add a concept to all the environments + * Add a concept to all the environments * @param theConceptName Is the name of the new concept - * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances + * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances * @return Returns true if successful insert of concept, false otherwise - */ + */ bool OutlineModelManager :: addUserConcept(std::string theConceptName, int conceptSize) - { + { bool allOK = axesEnvironment->addConcept(theConceptName, conceptSize); allOK &= imagesSectionEnvironment->addConcept(theConceptName, conceptSize); allOK &= imageSourceEnvironment->addConcept(theConceptName, conceptSize); @@ -204,7 +204,7 @@ this->outlinesEnvironment->removeThingFromInstant(keyName, instant); } else { ContourThing **contourthing = staticContourLst[ispartofstaticlist]; - this->outlinesEnvironment->addInstantToThing ( keyName , instant ); + this->outlinesEnvironment->addInstantToThing ( keyName , instant ); staticContourLst.erase( staticContourLst.begin()+ispartofstaticlist ); } } @@ -256,7 +256,7 @@ std::vector kNamesVector; std::vector outlinesVector; //= new std::vector(); std::vector lstInstants = getOutlineInstants(); - int i,sizeLstInstants = lstInstants.size(); + int i,sizeLstInstants = lstInstants.size(); Instant *instant; for ( i=0 ; i OutlineModelManager :: getOutlinesFromGroup(std::string aGroupName) { std::vector outlinesVector; std::map< std::string,OutlineGroup * >::iterator iterP = outlineGroups.find(aGroupName); if ( iterP != outlineGroups.end() ) - { - std::vector kNamesVector = iterP->second->getGroupOutlinesNames(); + { + std::vector kNamesVector = iterP->second->getGroupOutlinesNames(); for(int i=0; i ( theOutlineName, theGroup )); + outlineGroups.insert(std::pair ( theOutlineName, theGroup )); // std::map :: iterator iter = NULL; std::map :: iterator iter; iter = outlineGroups.find( theOutlineName ); @@ -341,8 +341,8 @@ std::string OutlineModelManager :: createOutline(manualBaseModel * model, std::vector theInstantData, std::string aName) { ContourThing * theOutline = new ContourThing ( model ); - theOutline->setName(aName); - return addOutline( theOutline, new Instant( &theInstantData ) ); + theOutline->setName(aName); + return addOutline( theOutline, new Instant( &theInstantData ) ); } /* @@ -354,8 +354,8 @@ bool OutlineModelManager :: createAxe(std::string aDescription, Instant * theInstantData) { AxeThing * theAxe = new AxeThing (); - theAxe->setDescription(aDescription); - return addAxe(theAxe, theInstantData); + theAxe->setDescription(aDescription); + return addAxe(theAxe, theInstantData); } /* @@ -366,8 +366,8 @@ //bool OutlineModelManager :: createImageSource(std::string aSource, ImageSourceThing * &imageSource) bool OutlineModelManager :: createImageSource(std::string aSource, Instant * theInstantData) { -// imageSource = new ImageSourceThing(aSource); - //return addImageSource(new ImageSourceThing(aSource), theInstantData); +// imageSource = new ImageSourceThing(aSource); + //return addImageSource(new ImageSourceThing(aSource), theInstantData); return NULL;//*********************************************************************************************** } @@ -379,22 +379,22 @@ //bool OutlineModelManager :: createImageSection(std::string aSecImageData, ImageSectionThing * &imageSection) bool OutlineModelManager :: createImageSection(std::string aSecImageData, Instant * theInstantData) { - //imageSection = new ImageSectionThing(aSecImageData); -// return addImageSection(new ImageSectionThing(aSecImageData), theInstantData); + //imageSection = new ImageSectionThing(aSecImageData); +// return addImageSection(new ImageSectionThing(aSecImageData), theInstantData); return NULL; } /* - * Adds an outlineThing + * Adds an outlineThing * @param theOutline The outline/contour (thing) * @param theInstantData Is the instant for the outline to add * @return Returns true if the addition of the outline was successful */ std::string OutlineModelManager :: addOutline( ContourThing * theOutline, Instant * theInstantData) - { + { std::string kName; -// EED +// EED // bool added = keyGenerator.generateKeyOf("Outlines", outlinesEnvironment->getNumberOfThings(),kName); counterIdKey++; @@ -408,7 +408,7 @@ if( added ) return kName; else - return ""; + return ""; } @@ -429,11 +429,11 @@ /* - * Remove an outlineThing + * Remove an outlineThing * @param theOutline The outline/contour (thing) */ void OutlineModelManager :: removeOutline( std::string ss ) - { + { outlinesEnvironment->removeThing( ss ); } @@ -447,7 +447,7 @@ std::vector< ContourThing **> thingsVector; outlinesEnvironment->getThingsOfEnvironment( &thingsVector ); int i,sizeThingVector = thingsVector.size(); - for(i=0;igetName() ); @@ -456,7 +456,7 @@ /* - * Adds an axeThing + * Adds an axeThing * @param thaAxe The axe (thing) * @param theInstantData Is the instant for the axe to add * @return Returns true if the addition of the axe was successful @@ -464,13 +464,13 @@ bool OutlineModelManager :: addAxe( AxeThing * theAxe , Instant * theInstantData) { std::string kName; - bool added = keyGenerator.generateKeyOf("Axes", axesEnvironment->getNumberOfThings(),kName); + bool added = keyGenerator.generateKeyOf("Axes", axesEnvironment->getNumberOfThings(),kName); added &= axesEnvironment->addThingWithInstant(kName,theAxe, theInstantData); return added; } /* - * Adds an imageSourceThing + * Adds an imageSourceThing * @param imgageSource The image source (thing) * @param theInstantData Is the instant for the source to add * @return Returns true if the addition of the imageSource was successful @@ -490,7 +490,7 @@ * @return Returns true if the addition of the imageSection was successful */ bool OutlineModelManager :: addImageSection(ImageSectionThing * imageSection, Instant * theInstantData) - { + { std::string kName; bool added = keyGenerator.generateKeyOf("Image Sections", imagesSectionEnvironment->getNumberOfThings(),kName); added &= imagesSectionEnvironment->addThingWithInstant(kName, imageSection, theInstantData); @@ -521,7 +521,7 @@ actualInstantWrapping -> addOutlineName( kNamesVector[i], anOutline->getName() ); } } - + /* * Annotates the actual outline keyName-real name wrapping at the actual instant * @param actualKeyOutline The key name to annotate @@ -550,17 +550,17 @@ void OutlineModelManager :: annotateActualSectionImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR... { actualInstantWrapping -> setActualSectionImageNamesWrapp(actualKeyImage, theRealName); - } + } /* * Annotate the annotateActualSource image keyName-real name wrapping at the actual instant * @param actualKeyImage The key name to annotate - * @param theRealName The real name asigned to the annotateActualSource + * @param theRealName The real name asigned to the annotateActualSource */ void OutlineModelManager :: annotateActualSourceImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR... { actualInstantWrapping -> setActualSourceImageNamesWrapp(actualKeyImage, theRealName); - } + } /* @@ -591,20 +591,20 @@ /* * Gets the instants of a specific outline * @param thekName Is the name of the outline - * @return The instants set + * @return The instants set */ std::vector OutlineModelManager :: getOutlineInstantsByName(std::string thekName) - { - return *outlinesEnvironment->getInstantsOfThing(thekName); + { + return *outlinesEnvironment->getInstantsOfThing(thekName); } /* * Gets all instants outlines - * @return The instants set + * @return The instants set */ std::vector OutlineModelManager :: getOutlineInstants() - { - return *outlinesEnvironment->getExistingInstants(); + { + return *outlinesEnvironment->getExistingInstants(); } @@ -652,7 +652,7 @@ { return imageSourceEnvironment->addInstantToThing( imaKName,anInstantData ); } - + /* * Method that retorns the name of each concept and the size of it. * @param conceptNameVect, Vector in which is disposed to be setted the name for each of the included concepts @@ -664,12 +664,12 @@ { //if (outlinesEnvironment->getNumberOfThings()>0) outlinesEnvironment->getConceptsInformation(conceptNameVect, conceptSizeVect); - } + } } /* - * Gets the contourWorspace + * Gets the contourWorspace * @return Returns the workspace */ ContourWorkspace * OutlineModelManager :: getContourWorkspace() @@ -697,10 +697,10 @@ * Update the registered objects in the InstantMemebersNameList, is the one that really changes the instant in the model */ void OutlineModelManager :: updateToActualInstant() - { + { Instant * longInstant = actualInstant; /*Instant * mediumInstant = new Instant(); - Instant * shortInstant = new Instant(); + Instant * shortInstant = new Instant(); std::vector* theInstant = longInstant->getInstant(); for(int i=1; isize(); i++) { @@ -708,14 +708,14 @@ shortInstant->addConcept( (*theInstant)[i] ); mediumInstant->addConcept( (*theInstant)[i] ); } - + //getting the sourceAtInstant std::vector kSourceVector; std::vector imSourceVector; imageSourceEnvironment->getThings(kSourceVector, imSourceVector, shortInstant); annotateActualSourceImageWrap(kSourceVector[0], (**imSourceVector[0]).getSourceImage()); - //getting the aAxeAtInstant + //getting the aAxeAtInstant std::vector kAxeVector; std::vector axesVector; axesEnvironment->getThings(kAxeVector, axesVector, mediumInstant); @@ -728,15 +728,15 @@ imagesSectionEnvironment->getThings(kSectionVector, imSectionVector, longInstant); if ( !kSectionVector.empty() ) //annotateActualSectionImageWrap(kSectionVector[0], (**imSectionVector[0]).getImageData()); */ - - //getting the outlines + + //getting the outlines std::vector vect = getOutlinesAtInstant( longInstant ); } - + /* - * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments. + * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments. * @return Returns true if successful insert of the automatic concepts, false otherwise */ bool OutlineModelManager :: setAutomaticConcepts() @@ -749,7 +749,7 @@ bool allOK = axesEnvironment->addConcept(axeConcept, axeC_size); allOK &= imagesSectionEnvironment->addConcept(axeConcept, axeC_size); allOK &= outlinesEnvironment->addConcept(axeConcept, axeC_size); - + allOK &= imagesSectionEnvironment->addConcept(axeDepthConcept, axeDepthC_size); allOK &= outlinesEnvironment->addConcept(axeDepthConcept, axeDepthC_size); /* @@ -771,9 +771,7 @@ void OutlineModelManager::SaveThingName( FILE *pFile, FILE *pFileData, std::string nameThing ) { std::vector< Instant * > *lstInstants; -printf("EED OutlineModelManager::SaveThingName %s\n",nameThing.c_str() ); lstInstants = outlinesEnvironment->getInstantsOfThing( nameThing ); -printf("EED OutlineModelManager::SaveThingName %d\n", (*lstInstants).size() ); Instant *instant = (*lstInstants)[0]; std::vector *vecInst =instant->getInstant(); int i,sizeVecInst = vecInst->size();