OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimImageChain.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: LGPL
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: Garrett Potts
9 //
10 //*************************************************************************
11 // $Id: ossimImageChain.cpp 21850 2012-10-21 20:09:55Z dburken $
12 
14 #include <ossim/base/ossimCommon.h>
16 #include <ossim/base/ossimDrect.h>
20 #include <ossim/base/ossimTrace.h>
27 #include <algorithm>
28 #include <iostream>
29 #include <iterator>
30 
31 static ossimTrace traceDebug("ossimImageChain");
32 
33 
34 RTTI_DEF3(ossimImageChain, "ossimImageChain", ossimImageSource,
36 
38 {
41 
43  {
44  if(event.isPropagatingToOutputs())
45  {
47  ossim_uint32 idx = 0;
48  for(idx = 0; idx < outputList.size();++idx)
49  {
50  if(outputList[idx].valid())
51  {
52  outputList[idx]->fireEvent(event);
53  outputList[idx]->propagateEventToOutputs(event);
54  }
55  }
56  }
57  }
58 }
59 
62  0, // number of inputs
63  0, // number of outputs
64  false, // input's fixed
65  false), // outputs are not fixed
67  theBlankTile(NULL),
68  theLoadStateFlag(false)
69 {
71  //thePropagateEventFlag = false;
73 }
74 
76 {
78  deleteList();
79 }
80 
82 {
83  ossimConnectableObject* rightOfThisObj =
85 
86  return insertRight(obj, rightOfThisObj);
87 }
88 
90 {
91  if(imageChainList().size() > 0)
92  {
93  ossimConnectableObject* lastSource = imageChainList()[ imageChainList().size() -1].get();
94 // if(dynamic_cast<ossimImageSource*>(obj)&&lastSource)
95  if(lastSource)
96  {
97 // obj->disconnect();
99  lastSource->disconnectAllInputs();
100  lastSource->connectMyInputTo(obj);
101  obj->changeOwner(this);
102  obj->connectInputList(tempIn);
103 
104  tempIn = obj->getInputList();
107  imageChainList().push_back(obj);
108 
110  // Send an event to any listeners.
111  ossimContainerEvent event((ossimObject*)this,
113  event.setObjectList(obj);
114  fireEvent(event);
115  return true;
116  }
117  }
118  else
119  {
120  return add(obj);
121  }
122 
123  return false;;
124 }
125 
127 {
128  if(imageChainList().size()>0)
129  {
130  return dynamic_cast<ossimImageSource*>(imageChainList()[0].get());
131  }
132 
133  return 0;
134 }
135 
137 {
138  if(imageChainList().size()>0)
139  return dynamic_cast<const ossimImageSource*>(imageChainList()[0].get());
140 
141  return 0;
142 }
143 
145 {
146  if(imageChainList().size()>0)
147  {
148  return dynamic_cast<ossimImageSource*>(imageChainList()[0].get());
149  }
150 
151  return 0;
152 }
153 
155 {
156  if(imageChainList().size()>0)
157  {
158  return dynamic_cast<ossimImageSource*>((*(imageChainList().end()-1)).get());
159  }
160 
161  return NULL;
162 }
163 
165 {
166  if(imageChainList().size()>0)
167  return dynamic_cast<const ossimImageSource*>((*(imageChainList().end()-1)).get());
168 
169  return NULL;
170 }
171 
173 {
174  if(imageChainList().size()>0)
175  {
176  return dynamic_cast<ossimImageSource*>((*(imageChainList().end()-1)).get());
177  }
178 
179  return 0;
180 }
181 
183  bool /* recurse */)
184 {
185  std::vector<ossimRefPtr<ossimConnectableObject> >::iterator current = imageChainList().begin();
186 
187  while(current != imageChainList().end())
188  {
189  if((*current).get())
190  {
191  if(id == (*current)->getId())
192  {
193  return (*current).get();
194  }
195  }
196 
197  ++current;
198  }
199 
200  current = imageChainList().begin();
201 
202  while(current != imageChainList().end())
203  {
205  (*current).get());
206 
207  if(child)
208  {
209  ossimConnectableObject* object = child->findObject(id, true);
210 
211  if(object) return object;
212  }
213  ++current;
214  }
215 
216  return NULL;
217 }
218 
220  bool /* recurse */)
221 {
222  std::vector<ossimRefPtr<ossimConnectableObject> >::iterator current = imageChainList().begin();
223 
224  while(current != imageChainList().end())
225  {
226  if((*current).valid())
227  {
228  if(obj == (*current).get())
229  {
230  return (*current).get();
231  }
232  }
233 
234  ++current;
235  }
236 
237  current = imageChainList().begin();
238 
239  while(current != imageChainList().end())
240  {
242 
243  if(child)
244  {
245  ossimConnectableObject* object = child->findObject(obj, true);
246 
247  if(object) return object;
248  }
249  ++current;
250  }
251 
252  return 0;
253 }
254 
256  bool recurse)
257 {
258  vector<ossimRefPtr<ossimConnectableObject> >::iterator current = imageChainList().begin();
259 
260  while(current != imageChainList().end())
261  {
262  if((*current).valid()&&
263  (*current)->canCastTo(typeInfo))
264  {
265  return (*current).get();
266  }
267  ++current;
268  }
269 
270  if(recurse)
271  {
272  current = imageChainList().begin();
273  while(current != imageChainList().end())
274  {
276  (*current).get());
277 
278  if(child)
279  {
280  ossimConnectableObject* temp = child->findFirstObjectOfType(typeInfo, recurse);
281  if(temp)
282  {
283  return temp;
284  }
285  }
286  ++current;
287  }
288  }
289 
290  return (ossimConnectableObject*)NULL;
291 }
292 
294  bool recurse)
295 {
296  vector<ossimRefPtr<ossimConnectableObject> >::iterator current = imageChainList().begin();
297 
298  while(current != imageChainList().end())
299  {
300  if((*current).valid()&&
301  (*current)->canCastTo(className) )
302  {
303  return (*current).get();
304  }
305  ++current;
306  }
307 
308  if(recurse)
309  {
310  current = imageChainList().begin();
311  while(current != imageChainList().end())
312  {
314 
315  if(child)
316  {
317  ossimConnectableObject* temp = child->findFirstObjectOfType(className, recurse);
318  if(temp)
319  {
320  return temp;
321  }
322  }
323  ++current;
324  }
325  }
326 
327  return (ossimConnectableObject*)0;
328 }
329 
331  bool recurse)
332 {
334  ossimConnectableObject::ConnectableObjectList::iterator current = imageChainList().begin();
335 
336  while(current != imageChainList().end())
337  {
338  if((*current).valid()&&
339  (*current)->canCastTo(typeInfo))
340  {
341  ossimConnectableObject::ConnectableObjectList::iterator iter = std::find(result.begin(),
342  result.end(),
343  (*current).get());
344  if(iter == result.end())
345  {
346  result.push_back((*current).get());
347  }
348  }
349  ++current;
350  }
351 
352  if(recurse)
353  {
354  current = imageChainList().begin();
355  while(current != imageChainList().end())
356  {
358 
359  if(child)
360  {
362  temp = child->findAllObjectsOfType(typeInfo, recurse);
363  for(long index=0; index < (long)temp.size();++index)
364  {
365  ossimConnectableObject::ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), temp[index]);
366  if(iter == result.end())
367  {
368  result.push_back(temp[index]);
369  }
370  }
371  }
372  ++current;
373  }
374  }
375 
376  return result;
377 
378 }
379 
381  bool recurse)
382 {
384  ossimConnectableObject::ConnectableObjectList::iterator current = imageChainList().begin();
385 
386  while(current != imageChainList().end())
387  {
388  if((*current).valid()&&
389  (*current)->canCastTo(className))
390  {
391  ossimConnectableObject::ConnectableObjectList::iterator iter = std::find(result.begin(),
392  result.end(),
393  (*current).get());
394  if(iter == result.end())
395  {
396  result.push_back((*current).get());
397  }
398  }
399  ++current;
400  }
401 
402  if(recurse)
403  {
404  current = imageChainList().begin();
405  while(current != imageChainList().end())
406  {
408 
409  if(child)
410  {
412  temp = child->findAllObjectsOfType(className, recurse);
413  for(long index=0; index < (long)temp.size();++index)
414  {
415  ossimConnectableObject::ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), temp[index]);
416  if(iter == result.end())
417  {
418  result.push_back(temp[index]);
419  }
420  }
421  }
422  ++current;
423  }
424  }
425 
426  return result;
427 
428 }
429 
431 {
432  setId(ossimIdManager::instance()->generateId());
433  for(long index = 0; index < (long)imageChainList().size(); ++index)
434  {
436  imageChainList()[index].get());
437  if(container)
438  {
439  container->makeUniqueIds();
440  }
441  else
442  {
443  if(imageChainList()[index].valid())
444  {
445  imageChainList()[index]->setId(ossimIdManager::instance()->generateId());
446  }
447  }
448  }
449 }
450 
452 {
453  ossim_uint32 result = (ossim_uint32)imageChainList().size();
454 
455  if(recurse)
456  {
457  for(ossim_uint32 i = 0; i < imageChainList().size(); ++i)
458  {
460  if(child)
461  {
462  result += child->getNumberOfObjects(true);
463  }
464  }
465  }
466 
467  return result;
468 }
469 
471 {
473  << "ossimImageChain::getNumberOfSources is deprecated!"
474  << "\nUse: ossimImageChain::getNumberOfObjects(false)"
475  << std::endl;
476  return getNumberOfObjects(false);
477 }
478 
480 {
481  return add(object);
482 }
483 
485 {
486  bool result = false;
487  vector<ossimRefPtr<ossimConnectableObject> >::iterator current = std::find(imageChainList().begin(), imageChainList().end(), object);
488 
489 
490  if(current!=imageChainList().end())
491  {
492  result = true;
493  object->removeListener((ossimConnectableObjectListener*)this);
494  if(current == imageChainList().begin())
495  {
496  object->removeListener((ossimConnectableObjectListener*)this);
497  }
498  if(imageChainList().size() == 1)
499  {
500  object->changeOwner(0);
501  current = imageChainList().erase(current);
502  }
503  else
504  {
505  ossimConnectableObject::ConnectableObjectList input = object->getInputList();
506  ossimConnectableObject::ConnectableObjectList output = object->getOutputList();
507  object->changeOwner(0);// set the owner to 0
508  bool erasingBeginning = (current == imageChainList().begin());
509  // bool erasingEnd = (current+1) == imageChainList().end();
510  current = imageChainList().erase(current);
511  object->disconnect();
512 
513  if(!imageChainList().empty())
514  {
515  if(erasingBeginning) // the one that receives the first getTile
516  {
517  (*imageChainList().begin())->addListener(this);
518  }
519 
520  else if(current==imageChainList().end()) // one that receives the last getTIle
521  {
522  current = imageChainList().begin()+(imageChainList().size()-1);
523  (*current)->connectInputList(input);
524  theInputObjectList = (*current)->getInputList();
525  theInputListIsFixedFlag = (*current)->getInputListIsFixedFlag();
526  }
527  else
528  {
529  // prepare interior setup and removal and connect surrounding nodes
530  // take the outputs of the node we are removing and connect them to the old inputs
531  ossim_uint32 outIndex = 0;
532  for(outIndex = 0; outIndex < output.size();++outIndex)
533  {
534  output[outIndex]->connectInputList(input);
535  }
536  }
537  }
538  }
539 
540  // Send an event to any listeners.
541  ossimContainerEvent event((ossimObject*)this,
543  event.setObjectList(object);
544  fireEvent(event);
545  }
546 
547  return result;
548 }
549 
551 {
552  ossimIdVisitor visitor( id,
554  accept( visitor );
555  ossimConnectableObject* obj = visitor.getObject();
556  if ( obj )
557  {
558  removeChild(obj);
559  }
560  return obj;
561 }
562 
563 void ossimImageChain::getChildren(vector<ossimConnectableObject*>& children,
564  bool immediateChildrenOnlyFlag)
565 {
566  ossim_uint32 i = 0;
567 
568  vector<ossimConnectableObject*> temp;
569  for(i = 0; i < imageChainList().size();++i)
570  {
571  temp.push_back(imageChainList()[i].get());
572  }
573 
574  for(i = 0; i < temp.size();++i)
575  {
577  temp[i]);
578  if(immediateChildrenOnlyFlag)
579  {
580  children.push_back(temp[i]);
581  }
582  else if(!interface)
583  {
584  children.push_back(temp[i]);
585  }
586  }
587 
588  if(!immediateChildrenOnlyFlag)
589  {
590  for(i = 0; i < temp.size();++i)
591  {
593  temp[i]);
594  if(interface)
595  {
596  interface->getChildren(children, false);
597  }
598  }
599  }
600 }
601 
603 {
604  bool result = false;
605 // if(PTR_CAST(ossimImageSource, source))
606  {
607  source->changeOwner(this);
608  if(imageChainList().size() > 0)
609  {
610  source->disconnectAllOutputs();
612  imageChainList()[0]->removeListener(this);
613  imageChainList().insert(imageChainList().begin(), source);
614  imageChainList()[0]->addListener(this);
616  imageChainList()[0]->connectMyInputTo(imageChainList()[1].get());
617  result = true;
618  }
619  else
620  {
621  theInputListIsFixedFlag = false;
622  theOutputListIsFixedFlag = false;
623 
624  if(!theInputObjectList.empty())
625  {
626  source->connectInputList(getInputList());
627  }
628  theInputObjectList = source->getInputList();
630  // theOutputObjectList = source->getOutputList();
631  // theOutputListIsFixedFlag= source->getOutputListIsFixedFlag();
632  imageChainList().push_back(source);
634  source->addListener(this);
635  result = true;
636  }
637  }
638 
639  if (result && source)
640  {
642  event.setObjectList(source);
643  fireEvent(event);
644  }
645 
646  return result;
647 }
648 
650  ossimConnectableObject* rightOfThisObj)
651 {
652  if(!newObj&&!rightOfThisObj) return false;
653  if(!imageChainList().size())
654  {
655  return add(newObj);
656  }
657  std::vector<ossimRefPtr<ossimConnectableObject> >::iterator iter = std::find(imageChainList().begin(), imageChainList().end(), rightOfThisObj);
658 
659  if(iter!=imageChainList().end())
660  {
661  if(iter == imageChainList().begin())
662  {
663  return add(newObj);
664  }
665  else //if(PTR_CAST(ossimImageSource, newObj))
666  {
667  ossimConnectableObject::ConnectableObjectList outputList = rightOfThisObj->getOutputList();
668  rightOfThisObj->disconnectAllOutputs();
669 
670  // Core dump fix. Connect input prior to outputs. (drb)
671  newObj->connectMyInputTo(rightOfThisObj);
672  newObj->connectOutputList(outputList);
673  newObj->changeOwner(this);
675  imageChainList().insert(iter, newObj);
676  // Send event to any listeners.
678  event.setObjectList(newObj);
679  fireEvent(event);
680  return true;
681  }
682  }
683 
684  return false;
685 }
686 
688  const ossimId& id)
689 {
690 
691 #if 1
693  accept( visitor );
694  ossimConnectableObject* obj = visitor.getObject();
695  if ( obj )
696  {
697  return insertRight(newObj, obj);
698  }
699  return false;
700 #else
701  ossimConnectableObject* obj = findObject(id, false);
702  if(obj)
703  {
704  return insertRight(newObj, obj);
705  }
706 
707  return false;
708 #endif
709 }
710 
712  ossimConnectableObject* leftOfThisObj)
713 {
714  if(!newObj&&!leftOfThisObj) return false;
715  if(!imageChainList().size())
716  {
717  return add(newObj);
718  }
719  std::vector<ossimRefPtr<ossimConnectableObject> >::iterator iter = std::find(imageChainList().begin(), imageChainList().end(), leftOfThisObj);
720  if(iter!=imageChainList().end())
721  {
722  if((iter+1)==imageChainList().end())
723  {
724  return addLast(newObj);
725  }
726  else
727  {
728  ossimConnectableObject::ConnectableObjectList inputList = leftOfThisObj->getInputList();
729 
730  newObj->connectInputList(inputList);
731 
732  leftOfThisObj->disconnectAllInputs();
733  leftOfThisObj->connectMyInputTo(newObj);
734  newObj->changeOwner(this);
736  imageChainList().insert(iter+1, newObj);
737  // Send an event to any listeners.
739  event.setObjectList(newObj);
740  fireEvent(event);
741  return true;
742  }
743  }
744 
745  return false;
746 }
747 
749  const ossimId& id)
750 {
751 #if 1
752  ossimIdVisitor visitor( id,
754  accept( visitor );
755  ossimConnectableObject* obj = visitor.getObject();
756  if ( obj )
757  {
758  return insertLeft(newObj, obj);
759  }
760  return false;
761 #else
762  ossimConnectableObject* obj = findObject(id, false);
763  if(obj)
764  {
765  return insertLeft(newObj, obj);
766  }
767  return false;
768 #endif
769 }
770 
772  ossimConnectableObject* oldObj)
773 {
774  ossim_int32 idx = indexOf(oldObj);
775  if(idx >= 0)
776  {
780  oldObj->removeListener(this);
781  oldObj->changeOwner(0);
782  imageChainList()[idx] = newObj;
783  newObj->connectInputList(inputList);
784  newObj->connectOutputList(outputList);
785  newObj->changeOwner(this);
787  if(idx == 0)
788  {
789  newObj->addListener(this);
790  }
791  }
792 
793  return (idx >= 0);
794 }
795 
797  const ossimIrect& tileRect,
798  ossim_uint32 resLevel)
799 {
800  if((imageChainList().size() > 0)&&(isSourceEnabled()))
801  {
803  imageChainList()[0].get());
804 
805  if(inputSource)
806  {
807  // make sure we initialize in reverse order.
808  // some source may depend on the initialization of
809  // its inputs
810  return inputSource->getTile(tileRect, resLevel);
811  }
812  }
813  else
814  {
815  if(getInput(0))
816  {
818  if(inputSource)
819  {
820  ossimRefPtr<ossimImageData> inputTile = inputSource->getTile(tileRect, resLevel);
821 // if(inputTile.valid())
822 // {
823 // std::cout << *(inputTile.get()) << std::endl;
824 // }
825  return inputTile.get();
826  }
827  }
828  }
829 // std::cout << "RETURNING A BLANK TILE!!!!" << std::endl;
830 /*
831  if(theBlankTile.get())
832  {
833  theBlankTile->setImageRectangle(tileRect);
834  }
835  return theBlankTile;
836  */
837  return 0;
838 }
839 
841 {
842  if((imageChainList().size() > 0)&&(isSourceEnabled()))
843  {
845  imageChainList()[0].get());
846  if(interface)
847  {
848  return interface->getNumberOfOutputBands();
849  }
850  }
851  else
852  {
853  if(getInput(0))
854  {
856  getInput(0));
857  if(interface)
858  {
859  return interface->getNumberOfOutputBands();
860  }
861  }
862  }
863 
864  return 0;
865 }
866 
868 {
869  if((imageChainList().size() > 0)&&(isSourceEnabled()))
870  {
872  imageChainList()[0].get());
873  if(interface)
874  {
875  return interface->getNullPixelValue(band);
876  }
877  }
878  else
879  {
880  if(getInput(0))
881  {
883  getInput(0));
884  if(interface)
885  {
886  return interface->getNullPixelValue(band);
887  }
888  }
889  }
890 
892 }
893 
895 {
896  if((imageChainList().size() > 0)&&(isSourceEnabled()))
897  {
899  imageChainList()[0].get());
900  if(interface)
901  {
902  return interface->getMinPixelValue(band);
903  }
904  }
905  else
906  {
907  if(getInput(0))
908  {
910  getInput(0));
911  if(interface)
912  {
913  return interface->getMinPixelValue(band);
914  }
915  }
916  }
917 
919 }
920 
922 {
923  if((imageChainList().size() > 0)&&(isSourceEnabled()))
924  {
926  imageChainList()[0].get());
927  if(inter)
928  {
929  return inter->getMaxPixelValue(band);
930  }
931  }
932  else
933  {
934  if(getInput(0))
935  {
937  getInput(0));
938  if(interface)
939  {
940  return interface->getMaxPixelValue(band);
941  }
942  }
943  }
944 
946 }
947 
948 void ossimImageChain::getOutputBandList(std::vector<ossim_uint32>& bandList) const
949 {
950  if( (imageChainList().size() > 0) && isSourceEnabled() )
951  {
953  dynamic_cast<const ossimImageSource*>( imageChainList()[0].get() );
954  if( inter.valid() )
955  {
956  // cout << "cn: " << inter->getClassName() << endl;
957  inter->getOutputBandList(bandList);
958  }
959  }
960 }
961 
963 {
964  if((imageChainList().size() > 0)&&(isSourceEnabled()))
965  {
967  imageChainList()[0].get());
968  if(interface)
969  {
970  return interface->getOutputScalarType();
971  }
972  }
973  else
974  {
975  if(getInput(0))
976  {
978  getInput(0));
979  if(interface)
980  {
981  return interface->getOutputScalarType();
982  }
983  }
984  }
985 
986  return OSSIM_SCALAR_UNKNOWN;
987 }
988 
990 {
991  if((imageChainList().size() > 0)&&(isSourceEnabled()))
992  {
994  imageChainList()[0].get());
995  if(interface)
996  {
997  return interface->getTileWidth();;
998  }
999  }
1000  else
1001  {
1002  if(getInput(0))
1003  {
1005  getInput(0));
1006  if(interface)
1007  {
1008  return interface->getTileWidth();
1009  }
1010  }
1011  }
1012 
1013  return 0;
1014 }
1015 
1017 {
1018  if((imageChainList().size() > 0)&&(isSourceEnabled()))
1019  {
1021  imageChainList()[0].get());
1022  if(interface)
1023  {
1024  return interface->getTileHeight();
1025  }
1026  }
1027  else
1028  {
1029  if(getInput(0))
1030  {
1032  getInput(0));
1033  if(interface)
1034  {
1035  return interface->getTileHeight();
1036  }
1037  }
1038  }
1039 
1040  return 0;
1041 }
1042 
1044 {
1045  if((imageChainList().size() > 0)&&(isSourceEnabled()))
1046  {
1047 
1049  imageChainList()[0].get());
1050 
1051  if(interface)
1052  {
1053  return interface->getBoundingRect(resLevel);
1054  }
1055  }
1056  else
1057  {
1058  if(getInput(0))
1059  {
1061  getInput(0));
1062  if(interface)
1063  {
1064  return interface->getBoundingRect();
1065  }
1066  }
1067  }
1068  ossimDrect rect;
1069  rect.makeNan();
1070 
1071  return rect;
1072 
1073 }
1074 
1075 void ossimImageChain::getValidImageVertices(vector<ossimIpt>& validVertices,
1076  ossimVertexOrdering ordering,
1077  ossim_uint32 resLevel)const
1078 {
1079  if((imageChainList().size() > 0)&&(isSourceEnabled()))
1080  {
1082  imageChainList()[0].get());
1083 
1084  if(interface)
1085  {
1086  interface->getValidImageVertices(validVertices,
1087  ordering,
1088  resLevel);
1089  }
1090  }
1091  else
1092  {
1093  if(getInput(0))
1094  {
1096  getInput(0));
1097  if(interface)
1098  {
1099  interface->getValidImageVertices(validVertices,
1100  ordering,
1101  resLevel);
1102  }
1103  }
1104  }
1105 }
1106 
1108 {
1109  if((imageChainList().size() > 0)&&(isSourceEnabled()))
1110  {
1111  ossimImageSource* interface = PTR_CAST(ossimImageSource, imageChainList()[0].get());
1112  if( interface )
1113  {
1114  return interface->getImageGeometry();
1115  }
1116  }
1117  else
1118  {
1119  if(getInput(0))
1120  {
1122  if(interface)
1123  {
1124  return interface->getImageGeometry();
1125  }
1126  }
1127  }
1129 }
1130 
1132  ossimDpt& result) const
1133 {
1134  if((imageChainList().size() > 0)&&(isSourceEnabled()))
1135  {
1137  imageChainList()[0].get());
1138  if(interface)
1139  {
1140  interface->getDecimationFactor(resLevel,
1141  result);
1142  return;
1143  }
1144  }
1145  else
1146  {
1147  if(getInput(0))
1148  {
1150  getInput(0));
1151  if(interface)
1152  {
1153  interface->getDecimationFactor(resLevel, result);
1154  return;
1155  }
1156  }
1157  }
1158 
1159  result.makeNan();
1160 }
1161 
1162 void ossimImageChain::getDecimationFactors(vector<ossimDpt>& decimations) const
1163 {
1164  if((imageChainList().size() > 0)&&(isSourceEnabled()))
1165  {
1167  imageChainList()[0].get());
1168  if(interface)
1169  {
1170  interface->getDecimationFactors(decimations);
1171  }
1172  }
1173  else
1174  {
1175  if(getInput(0))
1176  {
1178  getInput(0));
1179  if(interface)
1180  {
1181  interface->getDecimationFactors(decimations);
1182  return;
1183  }
1184  }
1185  }
1186 }
1187 
1189 {
1190  if((imageChainList().size() > 0)&&(isSourceEnabled()))
1191  {
1193  imageChainList()[0].get());
1194 
1195  if(interface)
1196  {
1197  return interface->getNumberOfDecimationLevels();
1198  }
1199  }
1200  else
1201  {
1202  if(getInput(0))
1203  {
1205  getInput(0));
1206  if(interface)
1207  {
1208  return interface->getNumberOfDecimationLevels();
1209  }
1210  }
1211  }
1212 
1213  return 1;
1214 }
1215 
1216 bool ossimImageChain::addAllSources(map<ossimId, vector<ossimId> >& idMapping,
1217  const ossimKeywordlist& kwl,
1218  const char* prefix)
1219 {
1220  static const char* MODULE = "ossimImageChain::addAllSources";
1221  ossimString copyPrefix = prefix;
1222  bool result = ossimImageSource::loadState(kwl, copyPrefix.c_str());
1223 
1224  if(!result)
1225  {
1226  return result;
1227  }
1228  long index = 0;
1229 
1230 // ossimSource* source = NULL;
1231 
1232  vector<ossimId> inputConnectionIds;
1233  ossimString regExpression = ossimString("^(") + copyPrefix + "object[0-9]+.)";
1234  vector<ossimString> keys =
1235  kwl.getSubstringKeyList( regExpression );
1236  long numberOfSources = (long)keys.size();//kwl.getNumberOfSubstringKeys(regExpression);
1237 
1238  int offset = (int)(copyPrefix+"object").size();
1239  int idx = 0;
1240  std::vector<int> theNumberList(numberOfSources);
1241  for(idx = 0; idx < (int)theNumberList.size();++idx)
1242  {
1243  ossimString numberStr(keys[idx].begin() + offset,
1244  keys[idx].end());
1245  theNumberList[idx] = numberStr.toInt();
1246  }
1247  std::sort(theNumberList.begin(), theNumberList.end());
1248  for(idx=0;idx < (int)theNumberList.size();++idx)
1249  {
1250  ossimString newPrefix = copyPrefix;
1251  newPrefix += ossimString("object");
1252  newPrefix += ossimString::toString(theNumberList[idx]);
1253  newPrefix += ossimString(".");
1254 
1255  if(traceDebug())
1256  {
1257  CLOG << "trying to create source with prefix: " << newPrefix
1258  << std::endl;
1259  }
1261  newPrefix.c_str());
1262  ossimConnectableObject* source = PTR_CAST(ossimConnectableObject, object.get());
1263 
1264  if(source)
1265  {
1266  // we did find a source so include it in the count
1267  if(traceDebug())
1268  {
1269  CLOG << "Created source with prefix: " << newPrefix << std::endl;
1270  }
1271  //if(PTR_CAST(ossimImageSource, source))
1272  {
1273  ossimId id = source->getId();
1274  inputConnectionIds.clear();
1275 
1276  findInputConnectionIds(inputConnectionIds,
1277  kwl,
1278  newPrefix);
1279  if(inputConnectionIds.size() == 0)
1280  {
1281  // we will try to do a default connection
1282  //
1283 
1284  if(imageChainList().size())
1285  {
1286  if(traceDebug())
1287  {
1288  CLOG << "connecting " << source->getClassName() << " to "
1289  << imageChainList()[0]->getClassName() << std::endl;
1290  }
1291  source->connectMyInputTo(0, imageChainList()[0].get());
1292  }
1293  }
1294  else
1295  {
1296  // we remember the connection id's so we can connect this later.
1297  // this way we make sure all sources were actually
1298  // allocated.
1299  //
1300  idMapping.insert(std::make_pair(id, inputConnectionIds));
1301  }
1302  add(source);
1303  }
1304  // else
1305  // {
1306  source = 0;
1307  // }
1308  }
1309  else
1310  {
1311  object = 0;
1312  source = 0;
1313  }
1314 
1315  ++index;
1316  }
1317  if(imageChainList().size())
1318  {
1320  if(obj)
1321  {
1323  }
1324  }
1325 
1326  return result;
1327 }
1328 
1329 void ossimImageChain::findInputConnectionIds(vector<ossimId>& result,
1330  const ossimKeywordlist& kwl,
1331  const char* prefix)
1332 {
1333  ossimString copyPrefix = prefix;
1334  ossim_uint32 idx = 0;
1335 
1336  ossimString regExpression = ossimString("^") + ossimString(prefix) + "input_connection[0-9]+";
1337  vector<ossimString> keys =
1338  kwl.getSubstringKeyList( regExpression );
1339 
1340  ossim_int32 offset = (ossim_int32)(copyPrefix+"input_connection").size();
1341  ossim_uint32 numberOfKeys = (ossim_uint32)keys.size();
1342  std::vector<int> theNumberList(numberOfKeys);
1343  for(idx = 0; idx < theNumberList.size();++idx)
1344  {
1345  ossimString numberStr(keys[idx].begin() + offset,
1346  keys[idx].end());
1347  theNumberList[idx] = numberStr.toInt();
1348  }
1349  std::sort(theNumberList.begin(), theNumberList.end());
1350  copyPrefix += ossimString("input_connection");
1351  for(idx=0;idx < theNumberList.size();++idx)
1352  {
1353  const char* lookup = kwl.find(copyPrefix,ossimString::toString(theNumberList[idx]));
1354  if(lookup)
1355  {
1356  long id = ossimString(lookup).toLong();
1357  result.push_back(ossimId(id));
1358  }
1359  }
1360 }
1361 
1362 
1363 bool ossimImageChain::connectAllSources(const map<ossimId, vector<ossimId> >& idMapping)
1364 {
1365  // cout << "this->getId(): " << this->getId() << endl;
1366 
1367  if(idMapping.size())
1368  {
1369  map<ossimId, vector<ossimId> >::const_iterator iter = idMapping.begin();
1370 
1371 
1372  while(iter != idMapping.end())
1373  {
1374  // cout << "(*iter).first): " << (*iter).first << endl;
1375 #if 0
1376  ossimConnectableObject* currentSource = findObject((*iter).first);
1377 #else
1378  ossimIdVisitor visitor( (*iter).first,
1380  // ossimVisitor::VISIT_INPUTS ) );
1381  accept( visitor );
1382  ossimConnectableObject* currentSource = visitor.getObject();
1383 #endif
1384 
1385  if(currentSource)
1386  {
1387  // cout << "currentSource->getClassName: " << currentSource->getClassName() << endl;
1388  long upperBound = (long)(*iter).second.size();
1389  for(long index = 0; index < upperBound; ++index)
1390  {
1391  //cout << "(*iter).second[index]: " << (*iter).second[index] << endl;
1392 
1393  if((*iter).second[index].getId() > -1)
1394  {
1395 #if 0
1396  ossimConnectableObject* inputSource =
1397  PTR_CAST(ossimConnectableObject, findObject((*iter).second[index]));
1398 #else
1399  visitor.reset();
1400  visitor.setId( (*iter).second[index] );
1401  accept( visitor );
1402  ossimConnectableObject* inputSource = visitor.getObject();
1403 #endif
1404  // cout << "inputSource is " << (inputSource?"good...":"null...") << endl;
1405  if ( inputSource )
1406  {
1407  // cout << "inputSource->getClassName(): " << inputSource->getClassName() << endl;
1408 
1409  // Check for connection to self.
1410  if ( this != inputSource )
1411  {
1412  currentSource->connectMyInputTo(index, inputSource);
1413  }
1414  // else warning???
1415  }
1416  }
1417  else // -1 id
1418  {
1419  currentSource->disconnectMyInput((ossim_int32)index);
1420  }
1421  }
1422  }
1423  else
1424  {
1425  cerr << "Could not find " << (*iter).first << " for source: ";
1426  return false;
1427  }
1428  ++iter;
1429  }
1430  }
1431 
1432  // abort();
1433  return true;
1434 }
1435 
1437  const char* prefix)const
1438 {
1439  bool result = true;
1440 
1441  result = ossimImageSource::saveState(kwl, prefix);
1442 
1443  if(!result)
1444  {
1445  return result;
1446  }
1447  ossim_uint32 upper = (ossim_uint32)imageChainList().size();
1448  ossim_uint32 counter = 1;
1449 
1450  if (upper)
1451  {
1452  ossim_int32 idx = upper-1;
1453  // start with the tail and go to the head fo the list.
1454  for(;((idx >= 0)&&result);--idx, ++counter)
1455  {
1456  ossimString newPrefix = prefix;
1457 
1458  newPrefix += (ossimString("object") +
1459  ossimString::toString(counter) +
1460  ossimString("."));
1461  result = imageChainList()[idx]->saveState(kwl, newPrefix.c_str());
1462  }
1463  }
1464 
1465  return result;
1466 }
1467 
1469  const char* prefix)
1470 {
1471  static const char* MODULE = "ossimImageChain::loadState(kwl, prefix)";
1472  deleteList();
1473 
1474  ossimImageSource::loadState(kwl, prefix);
1475 
1476 
1477  theLoadStateFlag = true;
1478  bool result = true;
1479 
1480  map<ossimId, vector<ossimId> > idMapping;
1481  result = addAllSources(idMapping, kwl, prefix);
1482  if(!result)
1483  {
1484  CLOG << "problems adding sources" << std::endl;
1485  }
1486  result = connectAllSources(idMapping);
1487  if(!result)
1488  {
1489  CLOG << "problems connecting sources" << std::endl;
1490  }
1491 
1492  theLoadStateFlag = false;
1493  return result;
1494 }
1495 
1496 
1498 {
1499  static const char* MODULE = "ossimImageChain::initialize()";
1500  if (traceDebug()) CLOG << " Entered..." << std::endl;
1501 
1502  long upper = (ossim_uint32)imageChainList().size();
1503 
1504  for(long index = upper - 1; index >= 0; --index)
1505  {
1506  if(traceDebug())
1507  {
1508  CLOG << "initilizing source: "
1509  << imageChainList()[index]->getClassName()
1510  << std::endl;
1511  }
1512  if(imageChainList()[index].valid())
1513  {
1514  ossimSource* interface =
1515  PTR_CAST(ossimSource, imageChainList()[index].get());
1516 
1517  if(interface)
1518  {
1519  // make sure we initialize in reverse order.
1520  // some source may depend on the initialization of
1521  // its inputs
1522  interface->initialize();
1523  }
1524  }
1525  }
1526  if (traceDebug()) CLOG << " Exited..." << std::endl;
1527 }
1528 
1530 {
1531  ossim_int32 upper = static_cast<ossim_int32>(imageChainList().size());
1532  ossim_int32 index = 0;
1533  for(index = upper - 1; index >= 0; --index)
1534  {
1535  // make sure we initialize in reverse order.
1536  // some source may depend on the initialization of
1537  // its inputs
1538  ossimSource* source = PTR_CAST(ossimSource, imageChainList()[index].get());
1539  if(source)
1540  {
1541  source->enableSource();
1542  }
1543  }
1544 
1545  theEnableFlag = true;
1546 }
1547 
1549 {
1550  long upper = (ossim_uint32)imageChainList().size();
1551 
1552  for(long index = upper - 1; index >= 0; --index)
1553  {
1554  // make sure we initialize in reverse order.
1555  // some source may depend on the initialization of
1556  // its inputs
1557  ossimSource* source = PTR_CAST(ossimSource, imageChainList()[index].get());
1558  if(source)
1559  {
1560  source->disableSource();
1561  }
1562  }
1563 
1564  theEnableFlag = false;
1565 }
1566 
1568 {
1569  if(connectableObject)
1570  {
1571  connectableObject->removeListener((ossimConnectableObjectListener*)this);
1572  connectableObject->changeOwner(0);
1573  connectableObject->disconnect();
1574  }
1575 }
1576 
1578 {
1579  if (imageChainList().size() == 0) return false;
1580 
1582  prepareForRemoval(imageChainList()[0].get());
1583  // Clear any listeners, memory.
1584  event.setObjectList(imageChainList()[0].get());
1585  imageChainList()[0] = 0;
1586  // Remove from the vector.
1587  std::vector<ossimRefPtr<ossimConnectableObject> >::iterator i = imageChainList().begin();
1588  imageChainList().erase(i);
1589  fireEvent(event);
1590  return true;
1591 }
1592 
1594 {
1595  if (imageChainList().size() == 0) return false;
1596 
1598  // Clear any listeners, memory.
1599  ossim_uint32 idx = (ossim_uint32)imageChainList().size() - 1;
1600  prepareForRemoval(imageChainList()[idx].get());
1601  event.setObjectList(imageChainList()[idx].get());
1602  imageChainList()[idx] = 0;
1603  // Remove from the vector.
1604  imageChainList().pop_back();
1605  fireEvent(event);
1606  return true;
1607 }
1608 
1610 {
1611  ossim_uint32 upper = (ossim_uint32) imageChainList().size();
1612  ossim_uint32 idx = 0;
1614  for(; idx < upper; ++idx)
1615  {
1616  if(imageChainList()[idx].valid())
1617  {
1618  event.getObjectList().push_back(imageChainList()[idx].get());
1619  prepareForRemoval(imageChainList()[idx].get());
1620  imageChainList()[idx] = 0;
1621  }
1622  }
1623 
1624  imageChainList().clear();
1625  fireEvent(event);
1626 }
1627 
1628 
1630 {
1631  if(imageChainList().size())
1632  {
1633  if(event.getObject()==this)
1634  {
1635  if(imageChainList()[imageChainList().size()-1].valid())
1636  {
1637  for(ossim_uint32 i = 0; i < event.getNumberOfOldObjects(); ++i)
1638  {
1639  imageChainList()[imageChainList().size()-1]->disconnectMyInput(event.getOldObject(i));
1640  }
1641  }
1642  }
1643  }
1644 }
1645 
1647 {
1648 }
1649 
1651 {
1652  if(imageChainList().size())
1653  {
1654  if(event.getObject()==this)
1655  {
1656  if(imageChainList()[imageChainList().size()-1].valid())
1657  {
1658  for(ossim_uint32 i = 0; i < event.getNumberOfNewObjects(); ++i)
1659  {
1660  ossimConnectableObject* obj = event.getNewObject(i);
1661  imageChainList()[imageChainList().size()-1]->connectMyInputTo(findInputIndex(obj),
1662  obj,
1663  false);
1664  }
1665  }
1666  }
1667  else if(event.getObject() == imageChainList()[0].get())
1668  {
1669  if(!theLoadStateFlag)
1670  {
1671 // theInputObjectList = imageChainList()[0]->getInputList();
1672  }
1673  }
1674  initialize();
1675  }
1676 }
1677 
1679 {
1680 }
1681 
1682 // void ossimImageChain::propertyEvent(ossimPropertyEvent& event)
1683 // {
1684 // if(imageChainList().size())
1685 // {
1686 // ossimConnectableObject* obj = PTR_CAST(ossimConnectableObject,
1687 // event.getObject());
1688 
1689 // if(obj)
1690 // {
1691 // ossimImageSource* interface = findSource(obj->getId());
1692 
1693 // if(interface)
1694 // {
1695 // ossimConnectableObject* obj = PTR_CAST(ossimConnectableObject,
1696 // interface.getObject());
1697 // if(obj)
1698 // {
1699 
1700 // }
1701 // }
1702 // }
1703 // }
1704 // }
1705 
1707 {
1708  if(!event.getObject()) return;
1709 
1710  if(imageChainList().size()&&(event.getObject()!=this))
1711  {
1713  event.getObject()));
1714  }
1715 }
1717 {
1718  //if(thePropagateEventFlag) return;
1719 
1720  //thePropagateEventFlag = true;
1721  if(imageChainList().size())
1722  {
1723  if(imageChainList()[imageChainList().size()-1].valid())
1724  {
1725  imageChainList()[imageChainList().size()-1]->fireEvent(event);
1726  imageChainList()[imageChainList().size()-1]->propagateEventToOutputs(event);
1727  }
1728  }
1729  //ossimConnectableObject::propagateEventToOutputs(event);
1730  // thePropagateEventFlag = false;
1731 }
1733 {
1734 // if(thePropagateEventFlag) return;
1735 
1736 // thePropagateEventFlag = true;
1737  if(imageChainList().size())
1738  {
1739  if(imageChainList()[0].valid())
1740  {
1741  imageChainList()[0]->fireEvent(event);
1742  imageChainList()[0]->propagateEventToInputs(event);
1743  }
1744  }
1745 // thePropagateEventFlag = false;
1746 }
1747 
1749 {
1750  return getConnectableObject(index);
1751 }
1752 
1754  ossim_uint32 index)
1755 {
1756  if(imageChainList().size() && (index < imageChainList().size()))
1757  {
1758  return imageChainList()[index].get();
1759  }
1760 
1761  return 0;
1762 }
1763 
1765 {
1766  ossim_uint32 idx = 0;
1767 
1768  for(idx = 0; idx < imageChainList().size();++idx)
1769  {
1770  if(imageChainList()[idx] == obj)
1771  {
1772  return (ossim_int32)idx;
1773  }
1774  }
1775 
1776  return -1;
1777 }
1778 
1780 {
1781  if(!visitor.hasVisited(this))
1782  {
1783  visitor.visit(this);
1784  ossimVisitor::VisitorType currentType = visitor.getVisitorType();
1785  //---
1786  // Lets make sure inputs and outputs are turned off for we are traversing all children
1787  // and we should not have to have that enabled.
1788  //---
1791  {
1792  ConnectableObjectList::reverse_iterator current = imageChainList().rbegin();
1793  while((current != imageChainList().rend())&&!visitor.stopTraversal())
1794  {
1795  ossimRefPtr<ossimConnectableObject> currentObject = (*current);
1796  if(currentObject.get() && !visitor.hasVisited(currentObject.get())) currentObject->accept(visitor);
1797  ++current;
1798  }
1799  }
1800  visitor.setVisitorType(currentType);
1802  }
1803 }
1804 
1805 //**************************************************************************************************
1806 // Inserts all of its children and inputs into the container provided. Since ossimImageChain is
1807 // itself a form of container, this method will consolidate this chain with the argument
1808 // container. Therefore this chain object will not be represented in the container (but its
1809 // children will be, with correct input and output connections to external objects).
1810 // Returns TRUE if successful.
1811 //**************************************************************************************************
1812 #if 0
1814 {
1815  // Grab the first source in the chain and let it fill the container with itself and inputs. This
1816  // will traverse down the chain and will even pick up external sources that feed this chain:
1818  if (!first_source.valid())
1819  return false;
1820  first_source->fillContainer(container);
1821 
1822  // Instead of adding ourselves, make sure my first source is properly connected to my output,
1823  // thus obviating the need for this image chain (my chain items become part of 'container':
1824  ConnectableObjectList& obj_list = getOutputList();
1825  ossimRefPtr<ossimConnectableObject> output_connection = 0;
1826  while (!obj_list.empty())
1827  {
1828  // Always pick off the beginning of the list since it is shrinking with each disconnect:
1829  output_connection = obj_list[0];
1830  disconnectMyOutput(output_connection.get(), true, false);
1831  first_source->connectMyOutputTo(output_connection.get());
1832  }
1833  return true;
1834 }
1835 #endif
virtual void setNumberOfInputs(ossim_int32 numberOfInputs)
Will set the number of inputs.
void makeNan()
Definition: ossimDrect.h:388
bool deleteFirst()
Deletes the first object.
virtual void visit(ossimObject *obj)
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossimRefPtr< ossimConnectableObject > disconnectMyInput(ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
Will disconnect the object at the given input index and generate a connection event.
virtual bool addListener(ossimListener *listener)
virtual ossim_int32 findInputIndex(const ossimConnectableObject *object)
Return a valid index of the input list if the passed in object is found else return -1...
virtual bool removeChild(ossimConnectableObject *object)
Will remove the child from the container.
virtual void processEvent(ossimEvent &event)
ProcessEvent.
virtual void enableSource()
virtual ossimObject * getFirstObject()
virtual void makeUniqueIds()
Will cycle through all sources setting their ids.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=NULL)
Will load the state.
void setId(const ossimId &id)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
Within the image chain will pass the head of the list.
virtual ossim_uint32 getTileWidth() const
This call is passed to the head of the list.
virtual void disconnectAllOutputs()
Will disconnect all of the output objects.
virtual void processEvent(ossimEvent &event)
ProcessEvent.
bool addLast(ossimConnectableObject *obj)
Adds it to the end.
virtual void objectDestructingEvent(ossimObjectDestructingEvent &event)
bool deleteLast()
Deletes the last object.
#define CLOG
Definition: ossimTrace.h:23
virtual ossimImageSource * getFirstSource()
Return the first source which is the one that first receives the getTile request. ...
virtual void propagateEventToOutputs(ossimEvent &event)
virtual ossimConnectableObject * findFirstObjectOfType(const RTTItypeid &typeInfo, bool recurse=true)=0
virtual void disconnect(ossimConnectableObject *object=0)
Will disconnect the object passed in.
virtual bool getInputListIsFixedFlag() const
virtual ossim_uint32 getNumberOfObjects(bool recurse=true) const =0
Represents serializable keyword/value map.
bool theEnableFlag
Definition: ossimSource.h:62
bool addAllSources(map< ossimId, vector< ossimId > > &idMapping, const ossimKeywordlist &kwl, const char *prefix=NULL)
For dynamic loading to take place we must allocate all objects first and then assign id&#39;s later...
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=NULL) const
Will save the state of the chain.
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
const char * find(const char *key) const
const ossimObject * getCurrentObject() const
Definition: ossimEvent.cpp:74
virtual bool getOutputListIsFixedFlag() const
void setVisitorType(int vType, bool on=true)
virtual void initialize()
ossimConnectableObject * operator[](ossim_uint32 index)
virtual bool connectOutputList(ConnectableObjectList &outputList)
Will disconnect itself from all outputs and reset to the passed in output list.
virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const RTTItypeid &typeInfo, bool recurse=true)=0
static ossimString toString(bool aValue)
Numeric to string methods.
virtual void connectInputEvent(ossimConnectionEvent &event)
virtual void disableSource()
Definition: ossimSource.cpp:89
static ossimObjectFactoryRegistry * instance()
bool insertRight(ossimConnectableObject *newObj, ossimConnectableObject *rightOfThisObj)
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
virtual ossim_uint32 getNumberOfSources() const
Deprecated! Please use getNumberOfObjects(false).
void prepareForRemoval(ossimConnectableObject *connectableObject)
Inserts all of this object&#39;s children and inputs into the container provided.
virtual void disconnectOutputEvent(ossimConnectionEvent &event)
virtual ossimImageSource * getLastSource()
Return the last source which is the one that last receives the getTile request.
virtual void fireEvent(ossimEvent &event)
virtual ossimObject * getLastObject()
virtual void getOutputBandList(std::vector< ossim_uint32 > &bandList) const
Initializes bandList.
virtual ossim_uint32 getNumberOfObjects(bool recurse=true) const
Returns the number of objects within this container and all child containers.
#define OSSIM_EVENT_REMOVE_OBJECT_ID
Definition: ossimEventIds.h:28
virtual ossim_int32 indexOf(ossimConnectableObject *obj) const
void turnOffVisitorType(int vType)
bool replace(ossimConnectableObject *newObj, ossimConnectableObject *oldObj)
virtual ossimScalarType getOutputScalarType() const
This call is passed to the head of the list.
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
const ConnectableObjectList & getInputList() const
OSSIM_DLL double defaultMin(ossimScalarType scalarType)
Definition: ossimCommon.cpp:73
virtual void getOutputBandList(std::vector< ossim_uint32 > &bandList) const
Initializes bandList.
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
virtual void changeOwner(ossimObject *owner)
Permits changing the object&#39;s owner.
const ossimObject * getObject() const
This is the originating object that originally produced the event.
Definition: ossimEvent.cpp:64
virtual ~ossimImageChain()
ossimVertexOrdering
const ossimId & getId() const
Will allow us to get this object&#39;s id.
yy_size_t size
OSSIM_DLL double defaultNull(ossimScalarType scalarType)
virtual ossimConnectableObject::ConnectableObjectList & imageChainList()
These access methods greatly facilitate the implementation of an image chain adaptor class...
#define OSSIM_EVENT_ADD_OBJECT_ID
Definition: ossimEventIds.h:27
virtual void getValidImageVertices(vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
unsigned int ossim_uint32
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
bool hasVisited(ossimObject *obj) const
virtual void enableSource()
Definition: ossimSource.cpp:84
virtual bool add(ossimConnectableObject *source)
Will return true or false if an image source was added to the chain.
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
virtual void getDecimationFactors(vector< ossimDpt > &decimations) const
virtual ossimConnectableObject * getConnectableObject(ossim_uint32 index)
Same as operator[](ossim_uint32 i)
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Will return the decimation factor for the given resolution level.
RTTI_DEF3(ossimImageChain, "ossimImageChain", ossimImageSource, ossimConnectableObjectListener, ossimConnectableContainerInterface)
virtual ossim_uint32 getTileHeight() const
This call is passed to the head of the list.
ossimConnectableObject * getObject()
ossimScalarType
virtual void connectOutputEvent(ossimConnectionEvent &event)
virtual ossim_uint32 getNumberOfDecimationLevels() const
Will return the number of resolution levels.
virtual bool addChild(ossimConnectableObject *attachableObject)
Will add an object to the container and then set the added objects owner to this. ...
virtual bool connectInputList(ConnectableObjectList &inputList)
Will disconnect itself from all inputs and reset to the passed in input list.
virtual ossimConnectableObject * findObject(const ossimId &id, bool recurse=true)=0
virtual void disconnectInputEvent(ossimConnectionEvent &event)
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Will pass this call to the head of the list.
const ConnectableObjectList & getOutputList() const
virtual void reset()
Resets m_object to 0, calls ossimVisitor::reset().
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
virtual ossim_int32 connectMyOutputTo(ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
Will try to connect this objects output to the passed in object.
long toLong() const
toLong&#39;s deprecated, please use the toInts...
ConnectableObjectList theInputObjectList
Holds a list of input objects.
virtual ossimConnectableObject * getOldObject(ossim_uint32 i=0)
OSSIM_DLL double defaultMax(ossimScalarType scalarType)
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual void getChildren(vector< ossimConnectableObject *> &children, bool immediateChildrenOnlyFlag)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.
VisitorType getVisitorType() const
virtual ossimObject * createObject(const ossimString &name) const
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool theInputListIsFixedFlag
Indicates whether the theInputObjectList is fixed.
void findInputConnectionIds(vector< ossimId > &result, const ossimKeywordlist &kwl, const char *prefix=NULL)
VisitorType
Enumeration type can be a mask and will traverse a graph of connectables based on the values...
Definition: ossimVisitor.h:27
bool stopTraversal() const
virtual ossimRefPtr< ossimConnectableObject > disconnectMyOutput(ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
Will disconnect the object at the given output index and generate a connection event.
bool isPropagatingToOutputs() const
Definition: ossimEvent.cpp:99
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
bool connectAllSources(const map< ossimId, vector< ossimId > > &idMapping)
void setId(const ossimId &id)
All connectable objects will have id&#39;s.
bool theOutputListIsFixedFlag
Indicates whether the theOutputObjectList is fixed.
virtual void disconnectAllInputs()
Will disconnect all of the input objects.
virtual ossim_uint32 getNumberOfInputBands() const
this call is passed to the head of the list.
virtual bool fillContainer(ossimConnectableContainer &container)
Inserts this object and all of its children and inputs into the container provided.
virtual void disableSource()
bool insertLeft(ossimConnectableObject *newObj, const ossimId &id)
virtual void propagateEventToInputs(ossimEvent &event)
int toInt() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void makeNan()
Definition: ossimDpt.h:65
static ossimIdManager * instance()
bool addFirst(ossimConnectableObject *obj)
Adds it to the start of the chain.
int ossim_int32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
virtual bool removeListener(ossimListener *listener)