Changeset 476 in PSPA
- Timestamp:
- Jan 6, 2014, 4:17:29 PM (10 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h
r474 r476 58 58 If needed, it will change the last element of the previous section 59 59 */ 60 void setFirstElement( std::string);60 void setFirstElement(int); 61 61 62 62 private : -
Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc
r474 r476 65 65 66 66 67 void sectionToExecute::setFirstElement(std::string name) { 68 // Possible cases : 67 void sectionToExecute::setFirstElement(int index) { 68 // This will set the beginning of this section to the element with the given name 69 70 // Possible cases : 71 // 72 // | section 1 | section 2 | section 3 | section 4 | section 5 | 73 // | a b c d | e f g h | i j k l | m n o p | q r | Before (example) 69 74 70 // | section 1 | section 2 | 71 // | a b c d | e f g h | i X j k l | m n o p | Before : X is in the 3rd sectionToExcute 72 // | a b c d e f g h i | X j k l || m n o p | Case 1 : X move in the 2nd 73 // | a b c d | e f g h | i | X j k l m n o p | Case 2 : X move in the 4nd 74 75 // Case 1 : Have to change X and 75 // Moved in a previous section : 76 // | a b c d | e f | _g_ h i j k l | m n o p | q r | Case 1 : move beginning of section 3 to "g" 77 // | a b c | | _d_ e f g h i j k l | m n o p | q r | Case 2 : move beginning of section 3 to "d" => section 2 will be removed ! 78 // => all elements from "d"/"g" to "l" will be moved in the 3rd section 79 80 // Moved in the same section : 81 // | a b c d | e f g h i j | _k_ l | m n o p | q r | Case 3 : move beginning of section 3 to "k" 82 // => all elements from "i"(begin of 3rd section) to before "k" will be moved in the 2nd (3-1) section 83 84 // Moved in a next section : 85 // | a b c d | e f g h i j k l m | _n_ | o p | q r | Case 4 : move beginning of section 3 to "n" 86 // | a b c d | e f g h i j k l m n o p | _q_ | | r | Case 5 : move beginning of section 3 to "q" => remove section 4 ! 87 // => all elements from "i"(begin of 3rd section) to before "n"/"q" will be moved in the 2nd (3-1) section 88 // => "n"/"q" element is set to be alone in 3rd section 76 89 77 90 std::vector <sectionToExecute*> sectVect = sector_->getSectionsToExecute(); 78 sectionToExecute* previousSection = NULL; 91 unsigned int sectionNumber = 0; 92 int newBeginSectionNumber = 0; 93 unsigned long indexOfNewBeginSectionNumber = 0; 94 95 // get this section number 96 // get the section number of the new begin element 97 unsigned int n = 0; 98 bool newFound = false; 79 99 80 100 for (unsigned int a=0; a< sectVect.size(); a++) { 81 101 if (sectVect[a] == this) { 82 if (a >= 1) { 83 previousSection = sectVect[a-1]; 102 sectionNumber = a; 103 } 104 n += sectVect[a]->getElements().size(); 105 if ((n >index ) && (!newFound)) { 106 newBeginSectionNumber = a; 107 indexOfNewBeginSectionNumber = index - (n-sectVect[a]->getElements().size()); 108 newFound = true; 109 } 110 } 111 112 if (!newFound ) { 113 return; // Impossible to find this index 114 } 115 116 // Moved in a previous section 117 if ( newBeginSectionNumber < sectionNumber ) { 118 for (int a = sectionNumber-1 ; a >= newBeginSectionNumber; a--) { 119 std::vector< abstractElement* > elemsVect = sectVect[a]->getElements(); 120 long stop = 0; 121 if (a == newBeginSectionNumber) { 122 stop = indexOfNewBeginSectionNumber; 123 } 124 for (long elemIndex = elemsVect.size(); elemIndex > stop; elemIndex--) { 125 insertAtFirst(elemsVect.back()); 126 elemsVect.pop_back(); 127 128 // remove elements 129 sectVect[a]->removeLastElement(); 84 130 } 85 131 } 132 133 // Moved in the same section : 134 } else if ( newBeginSectionNumber == sectionNumber ) { 135 136 137 // Moved in a next section : 138 } else if ( newBeginSectionNumber > sectionNumber ) { 139 140 86 141 } 87 if (previousSection == NULL) { 88 return; 142 143 // Suppress the empty sections 144 for (unsigned int a=0; a< sectVect.size(); a++) { 145 if (sectVect[a]->getElements().size() == 0 ) { 146 sector_->clearSectionToExecute(a); 147 } 89 148 } 90 // FIXME : NOt finished !! 02/201491 149 } -
Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc
r474 r476 128 128 const abstractSoftware* soft = sectionToExecute_.at(a)->getSoftware(); 129 129 if ( soft != NULL ) delete soft; 130 delete sectionToExecute_[a]; 130 131 sectionToExecute_.erase (sectionToExecute_.begin()+a); 131 132 } -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h
r474 r476 36 36 } 37 37 38 void setFirstElementCurrentSelection (Wt::WString);39 void setLastElementCurrentSelection (Wt::WString);40 void setSoftwareElementCurrentSelection (Wt::WString);38 void setFirstElementCurrentSelection_deprecated(Wt::WString); 39 void setLastElementCurrentSelection_deprecated(Wt::WString); 40 void setSoftwareElementCurrentSelection_deprecated(Wt::WString); 41 41 42 42 inline void setWarnings(Wt::WString warn){ -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
r474 r476 99 99 100 100 101 void GWt_sectionToExecute::setFirstElementCurrentSelection (Wt::WString txt){101 void GWt_sectionToExecute::setFirstElementCurrentSelection_deprecated(Wt::WString txt){ 102 102 for (int a=0; a< firstElement_->count(); a++) { 103 103 if (firstElement_->itemText(a) == txt) { … … 108 108 } 109 109 110 void GWt_sectionToExecute::setLastElementCurrentSelection (Wt::WString txt){110 void GWt_sectionToExecute::setLastElementCurrentSelection_deprecated(Wt::WString txt){ 111 111 for (int a=0; a< lastElement_->count(); a++) { 112 112 if (lastElement_->itemText(a) == txt) { … … 117 117 } 118 118 119 void GWt_sectionToExecute::setSoftwareElementCurrentSelection (Wt::WString txt){119 void GWt_sectionToExecute::setSoftwareElementCurrentSelection_deprecated(Wt::WString txt){ 120 120 for (int a=0; a< softElement_->count(); a++) { 121 121 if (softElement_->itemText(a) == txt) { … … 151 151 void GWt_sectionToExecute::changeFirstElement() 152 152 { 153 section_->setFirstElement(firstElement_->currentText().toUTF8()); 153 if (!section_) return; 154 if (!UIsector_) return; 155 156 section_->setFirstElement(firstElement_->currentIndex()); 154 157 UIsector_->getExecuteWidget()->displayFromControler(); 158 UIsector_->getBeamLineWidget()->buildBeamLineWidget(); 155 159 }
Note: See TracChangeset
for help on using the changeset viewer.