/usr/include/ossim/imaging/ossimImageChain.h is in libossim-dev 1.8.16-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | //*******************************************************************
// Copyright (C) 2000 ImageLinks Inc.
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: Garrett Potts
//
//*************************************************************************
// $Id: ossimImageChain.h 20316 2011-12-02 15:56:38Z oscarkramer $
#ifndef ossimImageChain_HEADER
#define ossimImageChain_HEADER
#include <vector>
#include <map>
using namespace std;
#include <ossim/imaging/ossimImageSource.h>
#include <ossim/base/ossimConnectableObjectListener.h>
#include <ossim/base/ossimId.h>
#include <ossim/base/ossimConnectableContainerInterface.h>
class OSSIMDLLEXPORT ossimImageChain : public ossimImageSource,
public ossimConnectableObjectListener,
public ossimConnectableContainerInterface
{
public:
ossimImageChain();
virtual ~ossimImageChain();
ossimConnectableObject::ConnectableObjectList& getChainList(){return theImageChainList;}
const ossimConnectableObject::ConnectableObjectList& getChainList()const{return theImageChainList;}
/**
* @param index Index of object to get.
*
* @see getNumberOfObjects(false) to get the number of objects inside
* the container.
*
* @return Container's object at that index or NULL if out of range.
*/
ossimConnectableObject* operator[](ossim_uint32 index);
/**
* Same as operator[](ossim_uint32 i)
*
* @param index Index of object to get.
*
* @see getNumberOfObjects(false) to get the number of objects inside
* the container.
*
* @return Container's object at that index or NULL if out of range.
*
* @note This does not recurse into other containers.
*/
virtual ossimConnectableObject* getConnectableObject(ossim_uint32 index);
virtual ossim_int32 indexOf(ossimConnectableObject* obj)const;
/**
* Return the first source which is the one that first receives the
* getTile request
*/
virtual ossimImageSource* getFirstSource();
virtual const ossimImageSource* getFirstSource() const;
virtual ossimObject* getFirstObject();
/**
* Return the last source which is the one that last receives the
* getTile request.
*/
virtual ossimImageSource* getLastSource();
virtual const ossimImageSource* getLastSource() const;
virtual ossimObject* getLastObject();
/**
* Adds it to the start of the chain. This is the first one to receive
* the getTile request. This basically inserts it to the right of the
* right most filter.
* Returns true on success, false on error.
*/
bool addFirst(ossimConnectableObject* obj);
/**
* Adds it to the end. this is the last one to receive the getTile
* request. This basically inserts it to the left of the left most filter.
* Returns true on success, false on error.
*/
bool addLast(ossimConnectableObject* obj);
/**
* Deletes the first object.
* Note this is really most right of the chain.
* Returns true if deletion occurred, false if the chain is empty.
*/
bool deleteFirst();
/**
* Deletes the last object.
* Note this is really most left of the chain.
* Returns true if deletion occurred, false if the chain is empty.
*/
bool deleteLast();
/**
*
*/
bool insertRight(ossimConnectableObject* newObj,
ossimConnectableObject* rightOfThisObj);
/**
*
*/
bool insertRight(ossimConnectableObject* newObj,
const ossimId& id);
/**
*
*/
bool insertLeft(ossimConnectableObject* newObj,
const ossimId& id);
/**
*
*/
bool insertLeft(ossimConnectableObject* newObj,
ossimConnectableObject* leftOfThisObj);
bool replace(ossimConnectableObject* newObj,
ossimConnectableObject* oldObj);
/**
* Will return true or false if an image source was
* added to the chain. It will add and do a connection
* to the previous source automatically. This is a
* chain and the order of insertion matters. It adds it to the beginning
* of the list. The last one added is the first one to receive
* the getTile. Basically inserts to the right of the rightmost filter
*
*/
virtual bool add(ossimConnectableObject* source);
/**
* Within the image chain will pass the head of the
* list.
*/
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& tileRect,
ossim_uint32 resLevel=0);
/**
* this call is passed to the head of the list.
*/
virtual ossim_uint32 getNumberOfInputBands() const;
/**
* This call is passed to the head of the list.
*/
virtual ossimScalarType getOutputScalarType() const;
virtual double getNullPixelValue(ossim_uint32 band=0)const;
virtual double getMinPixelValue(ossim_uint32 band=0)const;
virtual double getMaxPixelValue(ossim_uint32 band=0)const;
virtual void getOutputBandList(std::vector<ossim_uint32>& bandList) const;
/**
* This call is passed to the head of the list.
*/
virtual ossim_uint32 getTileWidth()const;
/**
* This call is passed to the head of the list.
*/
virtual ossim_uint32 getTileHeight()const;
/**
* Will pass this call to the head of the list.
*/
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0)const;
virtual void getValidImageVertices(vector<ossimIpt>& validVertices,
ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER,
ossim_uint32 resLevel=0)const;
virtual ossimRefPtr<ossimImageGeometry> getImageGeometry();
virtual void getDecimationFactor(ossim_uint32 resLevel,
ossimDpt& result) const;
virtual void getDecimationFactors(vector<ossimDpt>& decimations) const;
virtual ossim_uint32 getNumberOfDecimationLevels()const;
/**
* Will save the state of the chain.
*/
virtual bool saveState(ossimKeywordlist& kwl,
const char* prefix=NULL)const;
/**
* Will load the state.
*/
virtual bool loadState(const ossimKeywordlist& kwl,
const char* prefix=NULL);
virtual void initialize();
virtual void enableSource();
virtual void disableSource();
bool canConnectMyInputTo(ossim_int32 myInputIndex,
const ossimConnectableObject* object)const
{
if(theImageChainList.size()&&
theImageChainList[theImageChainList.size()-1].valid())
{
ossimConnectableObject* obj = PTR_CAST(ossimConnectableObject, theImageChainList[theImageChainList.size()-1].get());
if(obj)
{
return obj->canConnectMyInputTo(myInputIndex,
object);
}
}
else if(!theImageChainList.size())
{
return true;
}
return false;
}
// bool canConnectMyOutputTo(int32 myOutputIndex,
// const ossimConnectableObject* object)const
// {
// if(theImageChainList.size()&&theImageChainList[0])
// {
// ossimConnectableObject* obj = PTR_CAST(ossimConnectableObject, theImageChainList[0]);
// if(obj)
// {
// return obj->canConnectMyOutputTo(myOutputIndex,
// object);
// }
// }
// return false;
// }
// ________________________CONNECTABLE CONTAINER DEFINTIONS_________________
//
/*!
* These methods are now deprecated. You can achieve the same thing by using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeIdVisitor visitor(tyeId, false, ossimVisitor::VISIT_CHILDREN);
* connectableObject->accept(visitor);
* ossimCollectionVisitor::List& collection = visitor.getObjects();
* </pre>
*/
OSSIM_DEPRECATE_METHOD( virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const RTTItypeid& typeInfo,
bool recurse=true));
/*!
* These methods are now deprecated. You can achieve the same thing by using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeNameVisitor visitor(typeName, false, ossimVisitor::VISIT_CHILDREN);
* connectableObject->accept(visitor);
* ossimCollectionVisitor::List& collection = visitor.getObjects();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const ossimString& className,
bool recurse=true));
/*!
* These methods are now deprecated. You can achieve the same thing by using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeIdVisitor visitor(tyeId, true, ossimVisitor::VISIT_CHILDREN);
* connectableObject->accept(visitor);
* ossimRefPtr<ossimConnectableObject> obj = visitor.getObject();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findFirstObjectOfType(const RTTItypeid& typeInfo,
bool recurse=true));
/*!
* These methods are now deprecated. You can achieve the same thing by using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeNameVisitor visitor(className, true, ossimVisitor::VISIT_CHILDREN);
* connectableObject->accept(visitor);
* ossimRefPtr<ossimConnectableObject> obj = visitor.getObject();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findFirstObjectOfType(const ossimString& className,
bool recurse=true));
/*!
* These methods are now deprecated. You can achieve the same thing by using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding the virtual visit method in ossimVisitor
*
* <pre>
* ossimIdVisitor visitor(tyeId, true, ossimVisitor::VISIT_CHILDREN);
* connectableObject->accept(visitor);
* ossimRefPtr<ossimConnectableObject> obj = visitor.getObject();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findObject(const ossimId& id,
bool recurse=true));
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findObject(const ossimConnectableObject* obj,
bool recurse=true));
/**
* Will cycle through all sources setting their ids. the idLast wlil
* be updated
* so we can recurse into other containers.
*/
virtual void makeUniqueIds();
/**
* Returns the number of objects within this container and all child
* containers.
*
* @param recurse If true and object is a contains containers; all objects
* will be conter. If false only the objects of this container will be
* counted (theImageChainList.size()).
*/
virtual ossim_uint32 getNumberOfObjects(bool recurse=true)const;
/**
* Deprecated! Please use getNumberOfObjects(false).
*
* @return The number of objects in this container or
* (theImageChainList.size()).
*/
virtual ossim_uint32 getNumberOfSources() const;
/**
* Will add an object to the container and then set the added objects owner
* to this.
*/
virtual bool addChild(ossimConnectableObject* attachableObject);
/**
* Will remove the child from the container. Changes the owner of the
* child to be NULL;
*/
virtual bool removeChild(ossimConnectableObject* object);
virtual ossimConnectableObject* removeChild(const ossimId& id);
virtual void getChildren(vector<ossimConnectableObject*>& children,
bool immediateChildrenOnlyFlag);
//______________END CONNECTABLE CONTAINER INTERFACE____________
virtual void disconnectInputEvent(ossimConnectionEvent& event);
virtual void disconnectOutputEvent(ossimConnectionEvent& event);
virtual void connectInputEvent(ossimConnectionEvent& event);
virtual void connectOutputEvent(ossimConnectionEvent& event);
virtual void objectDestructingEvent(ossimObjectDestructingEvent& event);
virtual void propagateEventToOutputs(ossimEvent& event);
virtual void propagateEventToInputs(ossimEvent& event);
virtual void processEvent(ossimEvent& event);
virtual void accept(ossimVisitor& visitor);
void deleteList();
/**
* These access methods greatly facilitate the implementation of an image chain adaptor class.
* They shouldn't be accessed directly by any other classes. These methods really should be
* "protected" but the compiler complains if this base class' declarations are "protected".
*/
virtual ossimConnectableObject::ConnectableObjectList& imageChainList() { return theImageChainList; }
virtual const ossimConnectableObject::ConnectableObjectList& imageChainList() const { return theImageChainList; }
/**
* Inserts all of this object's children and inputs into the container provided. Since this is
* itself a form of container, this method will consolidate this chain with the argument
* container. Consequently, this chain object will not be represented in the container, but its
* children will be, with correct input and output connections to external objects. Ownership
* of children will pass to the argument container.
* @return Returns TRUE if successful.
*/
virtual bool fillContainer(ossimConnectableContainer& container);
protected:
void prepareForRemoval(ossimConnectableObject* connectableObject);
/**
* This will hold a sequence of image sources.
* theFirst one in the list will be the head of the
* list and the last one is the tail.
*/
ossimConnectableObject::ConnectableObjectList theImageChainList;
ossimRefPtr<ossimImageData> theBlankTile;
// mutable bool thePropagateEventFlag;
mutable bool theLoadStateFlag;
/**
* For dynamic loading to take place we must allocate all objects first and
* then assign id's later. We must remember the id's so we can do this.
* we will create a map that takes the id of the source as a key and a
* vector of input id's to connect it's inputs to.
*/
bool addAllSources(map<ossimId, vector<ossimId> >& idMapping,
const ossimKeywordlist& kwl,
const char* prefix = NULL);
void findInputConnectionIds(vector<ossimId>& result,
const ossimKeywordlist& kwl,
const char* prefix=NULL);
bool connectAllSources(const map<ossimId, vector<ossimId> >& idMapping);
TYPE_DATA
};
#endif /* #ifndef ossimImageChain_HEADER */
|