Changeset 558 for trunk/zoo-project/zoo-kernel
- Timestamp:
- Feb 9, 2015, 3:36:46 PM (10 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_otb.c
r555 r558 21 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 22 * THE SOFTWARE. 23 * 24 * See Ref: http://hg.orfeo-toolbox.org/OTB/ Copyright 25 * Some parts of this code are derived from ITK. See ITKCopyright.txt for 26 * details. 23 27 */ 24 28 25 29 #include "service_internal_otb.h" 26 #include <vector>27 #include <string>28 30 29 31 using namespace otb::Wrapper; 32 33 class MyCommand : public itk::Command 34 { 35 public: 36 itkNewMacro( MyCommand ); 37 public: 38 39 void Execute(itk::Object *caller, const itk::EventObject & event) 40 { 41 Execute( (const itk::Object *)caller, event); 42 } 43 44 void Execute(const itk::Object * object, const itk::EventObject & event) 45 { 46 const AddProcessToWatchEvent* eventToWatch = dynamic_cast< const AddProcessToWatchEvent*> ( &event ); 47 std::string m_CurrentDescription = eventToWatch->GetProcessDescription(); 48 std::cerr << "err_service_zooo start ccalled." << m_CurrentDescription << std::endl; 49 ZooWatcher * watch = new ZooWatcher(eventToWatch->GetProcess(), 50 eventToWatch->GetProcessDescription()); 51 watch->SetConf(&m_Conf); 52 m_WatcherList.push_back(watch); 53 } 54 55 56 57 }; 58 30 59 31 60 std::string ReplaceAll(std::string str, const std::string& from, const std::string& to) { … … 42 71 maps* inputs=*real_inputs; 43 72 maps* outputs=*real_outputs; 73 map* tmp0=getMapFromMaps(*main_conf,"lenv","cwd"); 74 char *ntmp=tmp0->value; 44 75 map* tmp=NULL; 45 76 int res=-1; … … 68 99 res=-1; 69 100 }else{ 101 // Create Observer on AddProcessToWatchEvent 102 m_Conf=m; 103 MyCommand::Pointer myCommand = MyCommand::New(); 104 m_Application->AddObserver(AddProcessToWatchEvent(), myCommand); 70 105 char tmpS[1024]; 71 sprintf(tmpS, "The OTB Application %s was loaded correctly.", (*it).c_str());72 106 const std::vector<std::string> appKeyList = m_Application->GetParametersKeys(true); 73 107 for (unsigned int i = 0; i < appKeyList.size(); i++){ … … 80 114 if(test==NULL){ 81 115 test=getMapFromMaps(inputs,paramKey.c_str(),"inRequest"); 116 map* tmpPath=getMapFromMaps(m,"main","tmpPath"); 117 map* tmpSid=getMapFromMaps(m,"lenv","usid"); 118 char tmp[1024]; 119 map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType"); 82 120 if(test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){ 83 121 test=getMapFromMaps(inputs,paramKey.c_str(),"value"); … … 96 134 else if (strncasecmp(test->value,"double",6)==0) 97 135 outPixType = ImagePixelType_double; 98 map* tmpPath=getMapFromMaps(m,"main","tmpPath");99 map* tmpSid=getMapFromMaps(m,"lenv","sid");100 char tmp[1024];101 map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");102 136 char* ext="tiff"; 103 137 if(tmpVal!=NULL){ … … 122 156 }else{ 123 157 if(type == ParameterType_OutputVectorData){ 124 map* tmpPath=getMapFromMaps(m,"main","tmpPath");125 map* tmpSid=getMapFromMaps(m,"lenv","sid");126 char tmp[1024];127 map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");128 158 char* ext="json"; 129 159 if(tmpVal!=NULL){ … … 146 176 else 147 177 if(type == ParameterType_OutputFilename){ 148 map* tmpPath=getMapFromMaps(m,"main","tmpPath");149 map* tmpSid=getMapFromMaps(m,"lenv","sid");150 char tmp[1024];151 map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");152 178 char* ext="txt"; 153 179 if(tmpVal!=NULL){ … … 355 381 } 356 382 } 383 384 for (unsigned int i = 0; i < m_WatcherList.size(); i++){ 385 m_WatcherList[i]->FreeConf(); 386 delete m_WatcherList[i]; 387 m_WatcherList[i] = NULL; 388 } 389 m_WatcherList.clear(); 390 357 391 return res; 358 392 } -
trunk/zoo-project/zoo-kernel/service_internal_otb.h
r555 r558 31 31 #include "otbWrapperApplicationRegistry.h" 32 32 #include "otbWrapperInputImageListParameter.h" 33 #include "otbWrapperAddProcessToWatchEvent.h" 34 #include "otbZooWatcher.h" 33 35 #include "service_internal.h" 34 36 #include "service.h" … … 38 40 #include <direct.h> 39 41 #endif 42 #include <vector> 43 #include <string> 40 44 45 typedef std::vector<ZooWatcher *> WatcherListType; 46 WatcherListType m_WatcherList; 47 maps* m_Conf; 41 48 int zoo_otb_support(maps**,map*,service*,maps**,maps**); 42 49
Note: See TracChangeset
for help on using the changeset viewer.