OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimEsriShapeFileFilter Class Reference

#include <ossimEsriShapeFileFilter.h>

Inheritance diagram for ossimEsriShapeFileFilter:
ossimAnnotationSource ossimViewInterface ossimImageSourceFilter ossimImageSource ossimConnectableObjectListener ossimSource ossimListener ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimEsriShapeFileFilter (ossimImageSource *inputSource=NULL)
 
 ~ossimEsriShapeFileFilter ()
 
virtual bool setView (ossimObject *baseObject)
 
virtual ossimObjectgetView ()
 
virtual const ossimObjectgetView () const
 
virtual bool addObject (ossimAnnotationObject *anObject)
 
virtual void transformObjects (ossimImageGeometry *geom=0)
 
virtual void setImageGeometry (ossimImageGeometry *projection)
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if non defined. More...
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 
virtual void computeBoundingRect ()
 
virtual void drawAnnotations (ossimRefPtr< ossimImageData > tile)
 
virtual bool loadShapeFile (const ossimFilename &shapeFile)
 
virtual ossimFilename getFilename () const
 
virtual ossim_int32 getMaxQuadTreeLevels () const
 
virtual void setMaxQuadTreeLevels (ossim_int32 levels)
 
virtual void setBrushColor (const ossimRgbVector &brushColor)
 
virtual void setPenColor (const ossimRgbVector &penColor)
 
virtual ossimRgbVector getPenColor () const
 
virtual ossimRgbVector getBrushColor () const
 
virtual bool getFillFlag () const
 
virtual void setFillFlag (bool flag)
 
virtual ossimString getFeatureName () const
 
virtual void setFeatureName (const ossimString &name)
 
virtual void setThickness (ossim_int32 thickness)
 
virtual ossim_int32 getThickness () const
 
virtual void setPointRadius (double r)
 
virtual double getPointRadius () const
 
virtual ossimAnnotationObjectnextObject (bool restart=false)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=NULL) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=NULL)
 
- Public Member Functions inherited from ossimAnnotationSource
 ossimAnnotationSource (ossimImageSource *inputSource=0)
 
virtual ~ossimAnnotationSource ()
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual void initialize ()
 
virtual void setNumberOfBands (ossim_uint32 bands)
 
virtual bool deleteObject (ossimAnnotationObject *anObject)
 
AnnotationObjectListType pickObjects (const ossimDpt &imagePoint)
 
AnnotationObjectListType pickObjects (const ossimDrect &imageRect)
 
const AnnotationObjectListTypegetObjectList () const
 
AnnotationObjectListTypegetObjectList ()
 
void deleteAll ()
 
- Public Member Functions inherited from ossimImageSourceFilter
 ossimImageSourceFilter (ossimObject *owner=NULL)
 
 ossimImageSourceFilter (ossimImageSource *inputSource)
 
 ossimImageSourceFilter (ossimObject *owner, ossimImageSource *inputSource)
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 
virtual ossim_uint32 getNumberOfInputBands () const
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual void refreshEvent (ossimRefreshEvent &event)
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
- Public Member Functions inherited from ossimImageSource
 ossimImageSource (ossimObject *owner=0)
 
 ossimImageSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimImageSource ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIpt &origin, ossim_uint32 resLevel=0)
 
virtual bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Method to get a tile. More...
 
virtual ossimObjectgetObject ()
 For RTTI support. More...
 
virtual const ossimObjectgetObject () const
 For RTTI support. More...
 
virtual void getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 Will return the decimation factor for the given resolution level. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Will return the number of resolution levels. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
virtual double getMinPixelValue (ossim_uint32 band=0) const
 Returns the min pixel of the band. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual void saveImageGeometry () const
 Default method to call input's saveImageGeometry. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Default method to call input's saveImageGeometry. More...
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
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. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 
- Public Member Functions inherited from ossimViewInterface
 ossimViewInterface ()
 
 ossimViewInterface (ossimObject *base)
 
virtual ~ossimViewInterface ()
 
virtual void refreshView ()
 
ossimObjectgetBaseObject ()
 

Protected Member Functions

void removeViewProjection ()
 
void deleteCache ()
 
void checkAndSetDefaultView ()
 
virtual void loadPolygon (ossimShapeObject &obj)
 
virtual void loadPoint (ossimShapeObject &obj)
 
virtual void loadArc (ossimShapeObject &obj)
 
- Protected Member Functions inherited from ossimAnnotationSource
void allocate (const ossimIrect &rect)
 
void destroy ()
 
 ossimAnnotationSource (const ossimAnnotationSource &rhs)
 
- Protected Member Functions inherited from ossimImageSourceFilter
virtual ~ossimImageSourceFilter ()
 
- Protected Member Functions inherited from ossimImageSource
 ossimImageSource (const ossimImageSource &rhs)
 
const ossimImageSourceoperator= (const ossimImageSource &)
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

ossimRefPtr< ossimImageGeometrytheImageGeometry
 
ossimRefPtr< ossimProjectiontheShapeFileProjection
 
ossimCoordinateSystemType theCoordinateSystem
 
ossimUnitType theUnitType
 
SHPTreetheTree
 
ossimShapeFile theShapeFile
 
double theMinArray [4]
 
double theMaxArray [4]
 
int theMaxQuadTreeLevels
 
ossimRgbVector thePenColor
 
ossimRgbVector theBrushColor
 
bool theFillFlag
 
ossim_int32 theThickness
 
ossimString theFeatureName
 
ossimDpt thePointWidthHeight
 
double theBorderSize
 
ossimUnitType theBorderSizeUnits
 
std::multimap< int, ossimAnnotationObject * >::iterator theCurrentObject
 
std::multimap< int, ossimAnnotationObject * > theShapeCache
 
ossimDrect theBoundingRect
 
- Protected Attributes inherited from ossimAnnotationSource
ossimDrect theRectangle
 
ossim_uint32 theNumberOfBands
 
ossimRefPtr< ossimRgbImagetheImage
 
ossimRefPtr< ossimImageDatatheTile
 
AnnotationObjectListType theAnnotationObjectList
 
- Protected Attributes inherited from ossimImageSourceFilter
ossimImageSourcetheInputConnection
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 
- Protected Attributes inherited from ossimViewInterface
ossimObjecttheObject
 

Additional Inherited Members

- Public Types inherited from ossimAnnotationSource
typedef std::vector< ossimRefPtr< ossimAnnotationObject > > AnnotationObjectListType
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Detailed Description

class ossimEsriShapeFileFilter

This class is used to render shape files. Iif this filter has an input connection to an ossimImageSourceInterface then it will draw any vectors over the input tile. If it is not connected it will just render its vector data to a tile and return it.

supported keywords:
  max_quadtree_levels:    // number of levels for faster hit testing
                          // defaults to 10
  fill_flag:              // 1 for true 0 for false.  Default is false
                          // and specifies how all closed surfaces are
                          // to be drawn
  feature_name:           // currently not used.
  pen_color:              // specified in Red Green Blue and is the color used
                          // if the fill flag is not specified.  Future changes
                          // might be to include this as an outline color for
                          // filled objects.  Default is white. Example: 255 255 255
  brush_color:            // Color used by objects that have the fill flag enabled
                          // format is Red Green Blue. Default is white.
  line_thickness:         // line drawing thickness in pixels.
  border_size:            // can be us feet, feet, meters, degrees,
                          // will automatically expand all polygons by the
                          // specified size.  Uses the centroid to estimate
                          // non degree units when converting to degrees.
  point_width_height:     // Specifies the width and height of a point object in
                          // pixels.  Default is 1 and has the following format
                          // w h.  Example 1 1
  filename:               // The esri shape file to be used
example Keyword list:  See ossimAnnotationSource for any additional keywords
brush_color:  255 255 255
feature_name:
filename:
fill_flag:  0
max_quadtree_levels:  10
pen_color:  255 255 255
point_width_height:  1 1
thickness:  1
border_size: 25 meters
type:  ossimEsriShapeFileFilter
 

Definition at line 84 of file ossimEsriShapeFileFilter.h.

Constructor & Destructor Documentation

◆ ossimEsriShapeFileFilter()

ossimEsriShapeFileFilter::ossimEsriShapeFileFilter ( ossimImageSource inputSource = NULL)

Definition at line 44 of file ossimEsriShapeFileFilter.cpp.

References ossimDrect::makeNan(), ossim::nan(), ossimAnnotationSource::setNumberOfBands(), theBoundingRect, theMaxArray, theMinArray, and ossimViewInterface::theObject.

45  :ossimAnnotationSource(inputSource),
49  theTree((SHPTree*)0),
51  thePenColor(255,255,255),
52  theBrushColor(255,255,255),
53  theFillFlag(false),
54  theThickness(1),
55  thePointWidthHeight(1, 1),
56  theBorderSize(0.0),
58 {
64 }
void makeNan()
Definition: ossimDrect.h:388
ossimObject * theObject
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossimAnnotationSource(ossimImageSource *inputSource=0)
virtual void setNumberOfBands(ossim_uint32 bands)
ossimCoordinateSystemType theCoordinateSystem

◆ ~ossimEsriShapeFileFilter()

ossimEsriShapeFileFilter::~ossimEsriShapeFileFilter ( )

Definition at line 66 of file ossimEsriShapeFileFilter.cpp.

References deleteCache(), removeViewProjection(), and theTree.

67 {
69 
70  if(theTree)
71  {
72  SHPDestroyTree(theTree);
73  }
74 
75  deleteCache();
76 }

Member Function Documentation

◆ addObject()

bool ossimEsriShapeFileFilter::addObject ( ossimAnnotationObject anObject)
virtual

Will add an object to the list. it will own the object added.

Reimplemented from ossimAnnotationSource.

Definition at line 116 of file ossimEsriShapeFileFilter.cpp.

References ossimNotify(), and ossimNotifyLevel_WARN.

117 {
119  << "ossimEsriShapeFileFilter::addObject\n"
120  << "Can't add objects to layer, must go through Esri loadShapeFile"
121  <<endl;
122 
123  return false;
124 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ checkAndSetDefaultView()

void ossimEsriShapeFileFilter::checkAndSetDefaultView ( )
protected

Definition at line 309 of file ossimEsriShapeFileFilter.cpp.

References getImageGeometry(), theImageGeometry, transformObjects(), and ossimRefPtr< T >::valid().

Referenced by loadShapeFile(), and loadState().

310 {
311  if(!theImageGeometry.valid())
312  {
314  if(theImageGeometry.valid())
315  {
317  }
318  }
319 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
ossimRefPtr< ossimImageGeometry > theImageGeometry
virtual void transformObjects(ossimImageGeometry *geom=0)

◆ computeBoundingRect()

void ossimEsriShapeFileFilter::computeBoundingRect ( )
virtual

Reimplemented from ossimAnnotationSource.

Definition at line 126 of file ossimEsriShapeFileFilter.cpp.

References ossimDrect::combine(), ossimDrect::hasNans(), ossimDrect::makeNan(), theBoundingRect, and theShapeCache.

Referenced by transformObjects().

127 {
128 // ossimAnnotationSource::computeBoundingRect();
129 
130  std::multimap<int, ossimAnnotationObject*>::iterator iter = theShapeCache.begin();
131 
133  while(iter != theShapeCache.end())
134  {
135  ossimDrect rect = (*iter).second->getBoundingRect();
137  {
138  theBoundingRect = rect;
139  }
140  else
141  {
142  if(!rect.hasNans())
143  {
145  }
146  }
147 
148  ++iter;
149  }
150 }
void makeNan()
Definition: ossimDrect.h:388
ossimDrect combine(const ossimDrect &rect) const
Definition: ossimDrect.h:826
std::multimap< int, ossimAnnotationObject * > theShapeCache
bool hasNans() const
Definition: ossimDrect.h:396

◆ deleteCache()

void ossimEsriShapeFileFilter::deleteCache ( )
protected

Definition at line 292 of file ossimEsriShapeFileFilter.cpp.

References theShapeCache.

Referenced by loadShapeFile(), loadState(), and ~ossimEsriShapeFileFilter().

293 {
294  std::multimap<int, ossimAnnotationObject*>::iterator iter = theShapeCache.begin();
295 
296 
297  while(iter != theShapeCache.end())
298  {
299  if ((*iter).second)
300  {
301  (*iter).second->unref();
302  }
303  ++iter;
304  }
305 
306  theShapeCache.clear();
307 }
std::multimap< int, ossimAnnotationObject * > theShapeCache

◆ drawAnnotations()

void ossimEsriShapeFileFilter::drawAnnotations ( ossimRefPtr< ossimImageData tile)
virtual

Reimplemented from ossimAnnotationSource.

Definition at line 169 of file ossimEsriShapeFileFilter.cpp.

References ossimAnnotationSource::drawAnnotations(), ossimImageData::getImageRectangle(), ossimShapeFile::isOpen(), ossimGpt::latd(), ossimIrect::ll(), ossimImageGeometry::localToWorld(), ossimGpt::lond(), ossimIrect::lr(), ossimDrect::lr(), n, OSSIM_RIGHT_HANDED, ossimRgbImage::setCurrentImageData(), SHPTreeFindLikelyShapes(), ossimAnnotationSource::theImage, theImageGeometry, theShapeCache, theShapeFile, theTree, ossimIrect::ul(), ossimDrect::ul(), ossimIrect::ur(), ossimRefPtr< T >::valid(), ossimIpt::x, ossimDpt::x, ossimIpt::y, and ossimDpt::y.

170 {
172 
173  if (!theTree||!theShapeFile.isOpen()) return;
174  if(theImageGeometry.valid())
175  {
176  ossimIrect rect = tile->getImageRectangle();
177 
178  rect = ossimIrect(rect.ul().x,
179  rect.ul().y,
180  rect.lr().x,
181  rect.lr().y);
182  double boundsMin[2];
183  double boundsMax[2];
184 
185  ossimGpt gp1;
186  ossimGpt gp2;
187  ossimGpt gp3;
188  ossimGpt gp4;
189 
191  gp1);
193  gp2);
195  gp3);
197  gp4);
198 
199  ossimDrect boundsRect( ossimDpt(gp1.lond(),
200  gp1.latd()),
201  ossimDpt(gp2.lond(),
202  gp2.latd()),
203  ossimDpt(gp3.lond(),
204  gp3.latd()),
205  ossimDpt(gp4.lond(),
206  gp4.latd()),
208 
209  boundsMin[0] = boundsRect.ul().x;
210  boundsMin[1] = boundsRect.lr().y;
211 
212  boundsMax[0] = boundsRect.lr().x;
213  boundsMax[1] = boundsRect.ul().y;
214 
215  int n;
216  int *array=(int*)0;
217 
219  boundsMin,
220  boundsMax,
221  &n);
222 
224  if(n&&array)
225  {
226  for(int i = 0; i < n; ++i)
227  {
228  std::multimap<int, ossimAnnotationObject*>::iterator iter = theShapeCache.find(array[i]);
229  while( ((*iter).first == array[i]) && (iter != theShapeCache.end()) )
230  {
231  (*iter).second->draw(*theImage);
232  ++iter;
233  }
234  }
235 
236  free(array);
237  }
238  }
239 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
bool valid() const
Definition: ossimRefPtr.h:75
const ossimIpt & ul() const
Definition: ossimIrect.h:274
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const ossimIpt & ll() const
Definition: ossimIrect.h:277
int SHPAPI_CALL1 * SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(double *, double *, double *, double *, int
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
os2<< "> n<< " > nendobj n
virtual void drawAnnotations(ossimRefPtr< ossimImageData > tile)
std::multimap< int, ossimAnnotationObject * > theShapeCache
virtual ossimIrect getImageRectangle() const
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossimRefPtr< ossimImageGeometry > theImageGeometry
const ossimIpt & ur() const
Definition: ossimIrect.h:275
ossim_int32 y
Definition: ossimIpt.h:142
ossimRefPtr< ossimRgbImage > theImage
ossim_int32 x
Definition: ossimIpt.h:141
void setCurrentImageData(ossimRefPtr< ossimImageData > &imageData)
Allows you to change the image data that this RgbImage object operates on.
bool isOpen() const

◆ getBoundingRect()

ossimIrect ossimEsriShapeFileFilter::getBoundingRect ( ossim_uint32  resLevel = 0) const
virtual

Will return the bounding rectangle.

Reimplemented from ossimAnnotationSource.

Definition at line 152 of file ossimEsriShapeFileFilter.cpp.

References ossimImageSource::getBoundingRect(), ossimConnectableObject::getInput(), ossimSource::isSourceEnabled(), PTR_CAST, and theBoundingRect.

153 {
154  if(!isSourceEnabled()||
155  getInput())
156  {
157  if(getInput())
158  {
160  if(input)
161  {
162  return input->getBoundingRect(resLevel);
163  }
164  }
165  }
166  return theBoundingRect;
167 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321

◆ getBrushColor()

virtual ossimRgbVector ossimEsriShapeFileFilter::getBrushColor ( ) const
inlinevirtual

Definition at line 144 of file ossimEsriShapeFileFilter.h.

145  {
146  return theBrushColor;
147  }

◆ getFeatureName()

virtual ossimString ossimEsriShapeFileFilter::getFeatureName ( ) const
inlinevirtual

Definition at line 158 of file ossimEsriShapeFileFilter.h.

159  {
160  return theFeatureName;
161  }

◆ getFilename()

virtual ossimFilename ossimEsriShapeFileFilter::getFilename ( ) const
inlinevirtual

Definition at line 115 of file ossimEsriShapeFileFilter.h.

116  {
117  return theShapeFile.getFilename();
118  }
const ossimFilename & getFilename() const

◆ getFillFlag()

virtual bool ossimEsriShapeFileFilter::getFillFlag ( ) const
inlinevirtual

Definition at line 149 of file ossimEsriShapeFileFilter.h.

150  {
151  return theFillFlag;
152  }

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimEsriShapeFileFilter::getImageGeometry ( )
virtual

Returns the image geometry object associated with this tile source or NULL if non defined.

The geometry contains full-to-local image transform as well as projection (image-to-world)

Reimplemented from ossimImageSource.

Definition at line 278 of file ossimEsriShapeFileFilter.cpp.

References theImageGeometry.

Referenced by checkAndSetDefaultView().

279 {
280  if( !theImageGeometry )
281  {
283  }
284  return theImageGeometry;
285 }
ossimRefPtr< ossimImageGeometry > theImageGeometry
Container class that holds both 2D transform and 3D projection information for an image Only one inst...

◆ getMaxQuadTreeLevels()

virtual ossim_int32 ossimEsriShapeFileFilter::getMaxQuadTreeLevels ( ) const
inlinevirtual

Definition at line 119 of file ossimEsriShapeFileFilter.h.

120  {
121  return theMaxQuadTreeLevels;
122  }

◆ getPenColor()

virtual ossimRgbVector ossimEsriShapeFileFilter::getPenColor ( ) const
inlinevirtual

Definition at line 139 of file ossimEsriShapeFileFilter.h.

140  {
141  return thePenColor;
142  }

◆ getPointRadius()

virtual double ossimEsriShapeFileFilter::getPointRadius ( ) const
inlinevirtual

Definition at line 179 of file ossimEsriShapeFileFilter.h.

180  {
181  return thePointWidthHeight.x/2.0;
182  }
double x
Definition: ossimDpt.h:164

◆ getThickness()

virtual ossim_int32 ossimEsriShapeFileFilter::getThickness ( ) const
inlinevirtual

Definition at line 171 of file ossimEsriShapeFileFilter.h.

172  {
173  return theThickness;
174  }

◆ getView() [1/2]

ossimObject * ossimEsriShapeFileFilter::getView ( )
virtual

Implements ossimViewInterface.

Definition at line 106 of file ossimEsriShapeFileFilter.cpp.

References ossimRefPtr< T >::get(), and theImageGeometry.

107 {
108  return theImageGeometry.get();
109 }
ossimRefPtr< ossimImageGeometry > theImageGeometry

◆ getView() [2/2]

const ossimObject * ossimEsriShapeFileFilter::getView ( ) const
virtual

Implements ossimViewInterface.

Definition at line 111 of file ossimEsriShapeFileFilter.cpp.

References ossimRefPtr< T >::get(), and theImageGeometry.

112 {
113  return theImageGeometry.get();
114 }
ossimRefPtr< ossimImageGeometry > theImageGeometry

◆ loadArc()

void ossimEsriShapeFileFilter::loadArc ( ossimShapeObject obj)
protectedvirtual

Definition at line 514 of file ossimEsriShapeFileFilter.cpp.

References ossimString::clear(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimShapeObject::getId(), ossimShapeObject::getNumberOfParts(), ossimShapeObject::getPartByName(), ossimShapeObject::getPartType(), ossimRgbVector::getR(), ossimShapeObject::getShapeObject(), ossimShapeObject::getTypeByName(), SHPObject::nVertices, ossimNotify(), ossimNotifyLevel_WARN, SHPObject::padfX, SHPObject::padfY, SHPObject::panPartStart, ossimAnnotationObject::setName(), SHPP_RING, theBrushColor, theFeatureName, theFillFlag, thePenColor, theShapeCache, and theThickness.

Referenced by loadShapeFile().

515 {
516  int starti = 0;
517  int endi = 0;
518  if(obj.getNumberOfParts() > 1)
519  {
520  starti = obj.getShapeObject()->panPartStart[0];
521  endi = obj.getShapeObject()->panPartStart[1];
522  }
523  else
524  {
525  starti = 0;
526  endi = obj.getShapeObject()->nVertices;
527  }
528 
529  vector<ossimGpt> groundPolygon;
530  for(ossim_uint32 part = 0; part < obj.getNumberOfParts(); ++part)
531  {
532  if(obj.getPartType(part) != SHPP_RING)
533  {
535  << "ossimEsriShapeFileFilter::loadArc\n"
536  << "Part = " << obj.getPartByName(part)
537  << " not supported for shape = "
538  << obj.getTypeByName() << endl;
539  break;
540  }
541  groundPolygon.clear();
542  for(ossim_int32 vertexNumber = starti; vertexNumber < endi; ++vertexNumber)
543  {
544  groundPolygon.push_back(ossimGpt(obj.getShapeObject()->padfY[vertexNumber],
545  obj.getShapeObject()->padfX[vertexNumber]));
546 
547  }
548  starti = endi;
549  if((part + 2) < obj.getNumberOfParts())
550  {
551  endi = obj.getShapeObject()->panPartStart[part+2];
552  }
553  else
554  {
555  endi = obj.getShapeObject()->nVertices;
556  }
557 
558  ossimRgbVector color;
559 
560  if(theFillFlag)
561  {
562  color = theBrushColor;
563  }
564  else
565  {
566  color = thePenColor;
567  }
568 
569  ossimGeoAnnotationObject *newGeoObj = new ossimGeoAnnotationPolyLineObject(groundPolygon,
570  color.getR(),
571  color.getG(),
572  color.getB(),
573  theThickness);
574  newGeoObj->setName(theFeatureName);
575  theShapeCache.insert(make_pair(obj.getId(),
576  newGeoObj));
577  }
578 }
void clear()
Erases the entire container.
Definition: ossimString.h:432
virtual void setName(const ossimString &name)
int getPartType(ossim_uint32 partIndex) const
ossimString getTypeByName() const
unsigned char getR() const
ossim_uint32 getNumberOfParts() const
long getId() const
double * padfY
Definition: shapefil.h:289
int nVertices
Definition: shapefil.h:287
unsigned int ossim_uint32
std::multimap< int, ossimAnnotationObject * > theShapeCache
#define SHPP_RING
Definition: shapefil.h:271
unsigned char getB() const
ossimString getPartByName(ossim_uint32 partIndex) const
int * panPartStart
Definition: shapefil.h:284
unsigned char getG() const
double * padfX
Definition: shapefil.h:288
SHPObject * getShapeObject()
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ loadPoint()

void ossimEsriShapeFileFilter::loadPoint ( ossimShapeObject obj)
protectedvirtual

Definition at line 479 of file ossimEsriShapeFileFilter.cpp.

References ossimShapeObject::getId(), ossimShapeObject::getNumberOfVertices(), ossimShapeObject::getShapeObject(), n, OSSIM_PIXEL, SHPObject::padfX, SHPObject::padfY, ossimGeoAnnotationEllipseObject::setEllipseWidthHeightUnitType(), ossimAnnotationObject::setName(), theBrushColor, theFeatureName, theFillFlag, thePenColor, thePointWidthHeight, theShapeCache, and theThickness.

Referenced by loadShapeFile().

480 {
481  int n = obj.getNumberOfVertices();
482 
483  if(n)
484  {
485  ossimGpt gpt(obj.getShapeObject()->padfY[0],
486  obj.getShapeObject()->padfX[0]);
487 
488  ossimRgbVector color;
489 
490  if(theFillFlag)
491  {
492  color = theBrushColor;
493  }
494  else
495  {
496  color = thePenColor;
497  }
501  theFillFlag,
502  color.getR(),
503  color.getG(),
504  color.getB(),
505  theThickness);
507  newGeoObj->setName(theFeatureName);
508  theShapeCache.insert(make_pair(obj.getId(),
509  newGeoObj));
510 
511  }
512 }
virtual void setName(const ossimString &name)
virtual void setEllipseWidthHeightUnitType(ossimUnitType type)
long getId() const
double * padfY
Definition: shapefil.h:289
ossim_uint32 getNumberOfVertices() const
os2<< "> n<< " > nendobj n
std::multimap< int, ossimAnnotationObject * > theShapeCache
double * padfX
Definition: shapefil.h:288
SHPObject * getShapeObject()

◆ loadPolygon()

void ossimEsriShapeFileFilter::loadPolygon ( ossimShapeObject obj)
protectedvirtual

Definition at line 401 of file ossimEsriShapeFileFilter.cpp.

References ossimString::clear(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimShapeObject::getId(), ossimShapeObject::getNumberOfParts(), ossimShapeObject::getPartByName(), ossimShapeObject::getPartType(), ossimRgbVector::getR(), ossimShapeObject::getShapeObject(), ossimShapeObject::getTypeByName(), ossimGeoPolygon::getVertexList(), SHPObject::nVertices, ossimNotify(), ossimNotifyLevel_WARN, SHPObject::padfX, SHPObject::padfY, SHPObject::panPartStart, ossimAnnotationObject::setName(), SHPP_RING, ossimGeoPolygon::stretchOut(), theBorderSize, theBrushColor, theFeatureName, theFillFlag, thePenColor, theShapeCache, and theThickness.

Referenced by loadShapeFile().

402 {
403  int starti = 0;
404  int endi = 0;
405  if(obj.getNumberOfParts() > 1)
406  {
407  starti = obj.getShapeObject()->panPartStart[0];
408  endi = obj.getShapeObject()->panPartStart[1];
409  }
410  else
411  {
412  starti = 0;
413  endi = obj.getShapeObject()->nVertices;
414  }
415 
416  vector<ossimGpt> groundPolygon;
417  for(ossim_uint32 part = 0; part < obj.getNumberOfParts(); ++part)
418  {
419  if(obj.getPartType(part) != SHPP_RING)
420  {
422  << "ossimEsriShapeFileFilter::loadPolygon\n"
423  << "Part = " << obj.getPartByName(part)
424  << " not supported for shape = "
425  << obj.getTypeByName() << endl;
426  break;
427  }
428  groundPolygon.clear();
429  for(ossim_int32 vertexNumber = starti; vertexNumber < endi; ++vertexNumber)
430  {
431  groundPolygon.push_back(ossimGpt(obj.getShapeObject()->padfY[vertexNumber],
432  obj.getShapeObject()->padfX[vertexNumber]));
433 
434  }
435  starti = endi;
436  if((part + 2) < obj.getNumberOfParts())
437  {
438  endi = obj.getShapeObject()->panPartStart[part+2];
439  }
440  else
441  {
442  endi = obj.getShapeObject()->nVertices;
443  }
444 
445  ossimRgbVector color;
446 
447  if(theFillFlag)
448  {
449  color = theBrushColor;
450  }
451  else
452  {
453  color = thePenColor;
454  }
455 
456  if(theBorderSize != 0.0)
457  {
458  ossimGeoPolygon tempPoly(groundPolygon);
459  ossimGeoPolygon tempPoly2;
460 
461  tempPoly.stretchOut(tempPoly2,
462  theBorderSize);
463  groundPolygon = tempPoly2.getVertexList();
464 
465  }
466 
467  ossimGeoAnnotationObject *newGeoObj = new ossimGeoAnnotationPolyObject(groundPolygon,
468  theFillFlag,
469  color.getR(),
470  color.getG(),
471  color.getB(),
472  theThickness);
473  newGeoObj->setName(theFeatureName);
474  theShapeCache.insert(make_pair(obj.getId(),
475  newGeoObj));
476  }
477 }
void clear()
Erases the entire container.
Definition: ossimString.h:432
virtual void setName(const ossimString &name)
int getPartType(ossim_uint32 partIndex) const
ossimString getTypeByName() const
unsigned char getR() const
ossim_uint32 getNumberOfParts() const
void stretchOut(ossimGeoPolygon &newPolygon, double displacement)
long getId() const
double * padfY
Definition: shapefil.h:289
int nVertices
Definition: shapefil.h:287
unsigned int ossim_uint32
std::multimap< int, ossimAnnotationObject * > theShapeCache
#define SHPP_RING
Definition: shapefil.h:271
const std::vector< ossimGpt > & getVertexList() const
unsigned char getB() const
ossimString getPartByName(ossim_uint32 partIndex) const
int * panPartStart
Definition: shapefil.h:284
unsigned char getG() const
double * padfX
Definition: shapefil.h:288
SHPObject * getShapeObject()
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ loadShapeFile()

bool ossimEsriShapeFileFilter::loadShapeFile ( const ossimFilename shapeFile)
virtual

Will delete the current objects within the layer and add all objects in the passed in file.

Definition at line 321 of file ossimEsriShapeFileFilter.cpp.

References checkAndSetDefaultView(), ossimAnnotationSource::deleteAll(), deleteCache(), ossimShapeFile::getBounds(), ossimShapeFile::getHandle(), ossimShapeFile::getNumberOfShapes(), ossimShapeFile::isOpen(), loadArc(), loadPoint(), loadPolygon(), ossimShapeObject::loadShape(), ossimShapeFile::open(), ossimNotify(), ossimNotifyLevel_WARN, SHPCreateTree(), SHPT_ARC, SHPT_ARCZ, SHPT_NULL, SHPT_POINT, SHPT_POINTZ, SHPT_POLYGON, SHPT_POLYGONZ, theCurrentObject, theImageGeometry, theMaxArray, theMaxQuadTreeLevels, theMinArray, theShapeCache, theShapeFile, theTree, transformObjects(), and ossimRefPtr< T >::valid().

Referenced by loadState().

322 {
323  if(theTree)
324  {
325  SHPDestroyTree(theTree);
326  theTree = (SHPTree*)0;
327  }
328  theShapeFile.open(shapeFile);
329  deleteCache();
330  deleteAll();
331 
332  if(theShapeFile.isOpen())
333  {
336 
338  2,
340  theMinArray,
341  theMaxArray);
342 
343  ossimShapeObject obj;
344  for(int index = 0 ; index < theShapeFile.getNumberOfShapes(); ++index)
345  {
347  index);
348 
349  if(obj.isLoaded())
350  {
351  switch(obj.getType())
352  {
353  case SHPT_POLYGON:
354  case SHPT_POLYGONZ:
355  {
356  loadPolygon(obj);
357  break;
358  }
359  case SHPT_POINT:
360  case SHPT_POINTZ:
361  {
362  loadPoint(obj);
363  break;
364  }
365  case SHPT_ARC:
366  case SHPT_ARCZ:
367  {
368  loadArc(obj);
369  break;
370  }
371  case SHPT_NULL:
372  {
373  break;
374  }
375  default:
376  {
378  << "ossimEsriShapeFileFilter::loadShapeFile\n"
379  << "SHAPE " << obj.getTypeByName()
380  << " Not supported" << endl;
381  break;
382  }
383  }
384  }
385  }
386 
387  theCurrentObject = theShapeCache .begin();
388  if(theImageGeometry.valid())
389  {
391  }
392  else
393  {
395  }
396  }
397 
398  return true;
399 }
virtual void loadPoint(ossimShapeObject &obj)
#define SHPT_ARC
Definition: shapefil.h:247
virtual SHPHandle getHandle()
bool valid() const
Definition: ossimRefPtr.h:75
#define SHPT_ARCZ
Definition: shapefil.h:251
virtual bool open(const ossimFilename &file, const ossimString &flags=ossimString("rb"))
SHPTree SHPAPI_CALL1 * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, double *padfBoundsMin, double *padfBoundsMax);void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree
bool loadShape(const ossimShapeFile &shapeFile, long shapeRecord)
std::multimap< int, ossimAnnotationObject * > theShapeCache
virtual void loadPolygon(ossimShapeObject &obj)
ossimRefPtr< ossimImageGeometry > theImageGeometry
#define SHPT_POINTZ
Definition: shapefil.h:250
std::multimap< int, ossimAnnotationObject * >::iterator theCurrentObject
void getBounds(double &minX, double &minY, double &minZ, double &minM, double &maxX, double &maxY, double &maxZ, double &maxM) const
#define SHPT_POINT
Definition: shapefil.h:246
virtual long getNumberOfShapes() const
#define SHPT_NULL
Definition: shapefil.h:245
#define SHPT_POLYGON
Definition: shapefil.h:248
bool isOpen() const
virtual void loadArc(ossimShapeObject &obj)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual void transformObjects(ossimImageGeometry *geom=0)
#define SHPT_POLYGONZ
Definition: shapefil.h:252

◆ loadState()

bool ossimEsriShapeFileFilter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = NULL 
)
virtual

Method to the load (recreate) the state of an object from a keyword list. Return true if ok or false on error.

Reimplemented from ossimAnnotationSource.

Definition at line 654 of file ossimEsriShapeFileFilter.cpp.

References ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimString::c_str(), checkAndSetDefaultView(), deleteCache(), ossimKeywordNames::FEATURE_NAME_KW, ossimKeywordNames::FILENAME_KW, ossimKeywordNames::FILL_FLAG_KW, ossimKeywordlist::find(), ossimUnitConversionTool::getValue(), loadShapeFile(), ossimAnnotationSource::loadState(), ossimImageGeometry::loadState(), ossimKeywordNames::MAX_QUADTREE_LEVELS_KW, OSSIM_DEGREES, OSSIM_FEET, OSSIM_METERS, OSSIM_US_SURVEY_FEET, ossimKeywordNames::PEN_COLOR_KW, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW, theBorderSize, theBorderSizeUnits, theBrushColor, theFeatureName, theFillFlag, theImageGeometry, theMaxQuadTreeLevels, thePenColor, thePointWidthHeight, theThickness, ossimKeywordNames::THICKNESS_KW, ossimString::toBool(), ossimString::toLong(), and ossimString::upcase().

656 {
657 
658  const char* quadLevels = kwl.find(prefix, ossimKeywordNames::MAX_QUADTREE_LEVELS_KW);
659  const char* filename = kwl.find(prefix, ossimKeywordNames::FILENAME_KW);
660  const char* penColor = kwl.find(prefix, ossimKeywordNames::PEN_COLOR_KW);
661  const char* brushColor = kwl.find(prefix, ossimKeywordNames::BRUSH_COLOR_KW);
662  const char* featureName = kwl.find(prefix, ossimKeywordNames::FEATURE_NAME_KW);
663  const char* fillFlag = kwl.find(prefix, ossimKeywordNames::FILL_FLAG_KW);
664  const char* thickness = kwl.find(prefix, ossimKeywordNames::THICKNESS_KW);
665  const char* pointWh = kwl.find(prefix, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW);
666  const char* border_size = kwl.find(prefix, ossimKeywordNames::BORDER_SIZE_KW);
667 
668  deleteCache();
669 
670  if(thickness)
671  {
672  theThickness = ossimString(thickness).toLong();
673  }
674  if(quadLevels)
675  {
676  theMaxQuadTreeLevels = ossimString(quadLevels).toLong();
677  }
678 
679  if(penColor)
680  {
681  int r, g, b;
682  istringstream s(penColor);
683  s>>r>>g>>b;
685  }
686 
687  if(brushColor)
688  {
689  int r, g, b;
690  istringstream s(brushColor);
691  s>>r>>g>>b;
693  }
694  if(pointWh)
695  {
696  double w, h;
697  istringstream s(pointWh);
698  s>>w>>h;
700  }
701 
702  if(fillFlag)
703  {
704  theFillFlag = ossimString(fillFlag).toBool();
705  }
706 
707  if(border_size)
708  {
709  istringstream input(border_size);
710 
711  ossimString s;
712  input >> s;
713 
714  theBorderSize = s.toDouble();
715 
716  ossimString s2;
717 
718  input >> s2;
719 
720  s2 = s2.upcase();
721 
722  if(s2 == "US")
723  {
725  }
726  else if(s2 == "METERS")
727  {
729  }
730  else if(s2 == "FEET")
731  {
733  }
734  else
735  {
737  }
740 
741  theBorderSize = unitConvert.getValue(OSSIM_DEGREES);
743  }
744  else
745  {
746  theBorderSize = 0.0;
748  }
749 
750  theFeatureName = featureName;
751 
752  ossimString newPrefix = prefix;
753  newPrefix += "view_proj.";
754 
756  if(!theImageGeometry->loadState(kwl, newPrefix.c_str()))
757  {
758  theImageGeometry = 0;
759  }
760 
761  if(filename)
762  {
763  loadShapeFile(ossimFilename(filename));
764  }
765 
767 
768  return ossimAnnotationSource::loadState(kwl, prefix);
769 }
static const char * BRUSH_COLOR_KW
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Attempts to initialize a transform and a projection given the KWL.
const char * find(const char *key) const
static const char * MAX_QUADTREE_LEVELS_KW
static const char * FEATURE_NAME_KW
virtual bool loadShapeFile(const ossimFilename &shapeFile)
bool toBool() const
String to numeric methods.
static const char * FILL_FLAG_KW
static const char * BORDER_SIZE_KW
ossimRefPtr< ossimImageGeometry > theImageGeometry
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
long toLong() const
toLong&#39;s deprecated, please use the toInts...
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
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
static const char * PEN_COLOR_KW
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
static const char * POINT_WIDTH_HEIGHT_KW
static const char * FILENAME_KW
static const char * THICKNESS_KW
unsigned char ossim_uint8

◆ nextObject()

virtual ossimAnnotationObject* ossimEsriShapeFileFilter::nextObject ( bool  restart = false)
inlinevirtual

Definition at line 184 of file ossimEsriShapeFileFilter.h.

185  {
186  if(restart)
187  {
189  }
190  else
191  {
192  if(theCurrentObject != theShapeCache.end())
193  {
195  }
196 
197  }
198 
199  if(theCurrentObject == theShapeCache.end())
200  {
201  return (ossimAnnotationObject*)NULL;
202  }
203  return (*theCurrentObject).second;
204  }
std::multimap< int, ossimAnnotationObject * > theShapeCache
std::multimap< int, ossimAnnotationObject * >::iterator theCurrentObject

◆ removeViewProjection()

void ossimEsriShapeFileFilter::removeViewProjection ( )
protected

Definition at line 287 of file ossimEsriShapeFileFilter.cpp.

References theImageGeometry.

Referenced by ~ossimEsriShapeFileFilter().

288 {
289  theImageGeometry = 0;
290 }
ossimRefPtr< ossimImageGeometry > theImageGeometry

◆ saveState()

bool ossimEsriShapeFileFilter::saveState ( ossimKeywordlist kwl,
const char *  prefix = NULL 
) const
virtual

Saves the current state of this object.

Reimplemented from ossimAnnotationSource.

Definition at line 580 of file ossimEsriShapeFileFilter.cpp.

References ossimKeywordlist::add(), ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimString::c_str(), ossimKeywordNames::FEATURE_NAME_KW, ossimKeywordNames::FILENAME_KW, ossimKeywordNames::FILL_FLAG_KW, ossimRgbVector::getB(), ossimShapeFile::getFilename(), ossimRgbVector::getG(), ossimRgbVector::getR(), ossimKeywordNames::MAX_QUADTREE_LEVELS_KW, ossimKeywordNames::PEN_COLOR_KW, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW, ossimAnnotationSource::saveState(), ossimImageGeometry::saveState(), theBorderSize, theBrushColor, theFeatureName, theFillFlag, theImageGeometry, theMaxQuadTreeLevels, thePenColor, thePointWidthHeight, theShapeFile, theThickness, ossimKeywordNames::THICKNESS_KW, ossimString::toString(), ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

582 {
583  ossimString s;
584 
585  kwl.add(prefix,
588  true);
589 
590  kwl.add(prefix,
593  true);
594 
595  s = ossimString::toString((int)thePenColor.getR()) + " " +
596  ossimString::toString((int)thePenColor.getG()) + " " +
598 
599  kwl.add(prefix,
601  s.c_str(),
602  true);
603 
604  s = ossimString::toString((int)theBrushColor.getR()) + " " +
607 
608  kwl.add(prefix,
610  s.c_str(),
611  true);
612 
613  kwl.add(prefix,
615  (int)theFillFlag,
616  true);
617 
618  kwl.add(prefix,
621  true);
622 
623  kwl.add(prefix,
625  theThickness,
626  true);
627 
628  ossimString border;
630  border += " degrees";
631  kwl.add(prefix,
633  border,
634  true);
635 
638 
639  kwl.add(prefix,
641  s.c_str(),
642  true);
643 
644  if(theImageGeometry.valid())
645  {
646  ossimString newPrefix = prefix;
647  newPrefix += "view_proj.";
648  theImageGeometry->saveState(kwl, newPrefix.c_str());
649  }
650 
651  return ossimAnnotationSource::saveState(kwl, prefix);
652 }
static const char * BRUSH_COLOR_KW
unsigned char getR() const
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
static ossimString toString(bool aValue)
Numeric to string methods.
static const char * MAX_QUADTREE_LEVELS_KW
static const char * FEATURE_NAME_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * FILL_FLAG_KW
static const char * BORDER_SIZE_KW
unsigned char getB() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
unsigned char getG() const
double x
Definition: ossimDpt.h:164
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
static const char * PEN_COLOR_KW
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the transform (if any) and projection (if any) states to the KWL.
static const char * POINT_WIDTH_HEIGHT_KW
static const char * FILENAME_KW
static const char * THICKNESS_KW
const ossimFilename & getFilename() const

◆ setBrushColor()

virtual void ossimEsriShapeFileFilter::setBrushColor ( const ossimRgbVector brushColor)
inlinevirtual

Definition at line 129 of file ossimEsriShapeFileFilter.h.

130  {
131  theBrushColor = brushColor;
132  }

◆ setFeatureName()

virtual void ossimEsriShapeFileFilter::setFeatureName ( const ossimString name)
inlinevirtual

Definition at line 162 of file ossimEsriShapeFileFilter.h.

163  {
164  theFeatureName = name;
165  }

◆ setFillFlag()

virtual void ossimEsriShapeFileFilter::setFillFlag ( bool  flag)
inlinevirtual

Definition at line 154 of file ossimEsriShapeFileFilter.h.

155  {
156  theFillFlag=flag;
157  }

◆ setImageGeometry()

void ossimEsriShapeFileFilter::setImageGeometry ( ossimImageGeometry projection)
virtual

Definition at line 268 of file ossimEsriShapeFileFilter.cpp.

References theImageGeometry, and transformObjects().

269 {
270  theImageGeometry = geom;
272 }
ossimRefPtr< ossimImageGeometry > theImageGeometry
virtual void transformObjects(ossimImageGeometry *geom=0)

◆ setMaxQuadTreeLevels()

virtual void ossimEsriShapeFileFilter::setMaxQuadTreeLevels ( ossim_int32  levels)
inlinevirtual

Definition at line 124 of file ossimEsriShapeFileFilter.h.

125  {
126  theMaxQuadTreeLevels = (levels>0?levels:10);
127  }

◆ setPenColor()

virtual void ossimEsriShapeFileFilter::setPenColor ( const ossimRgbVector penColor)
inlinevirtual

Definition at line 134 of file ossimEsriShapeFileFilter.h.

135  {
136  thePenColor = penColor;
137  }

◆ setPointRadius()

virtual void ossimEsriShapeFileFilter::setPointRadius ( double  r)
inlinevirtual

Definition at line 175 of file ossimEsriShapeFileFilter.h.

176  {
177  thePointWidthHeight = ossimDpt(fabs(r)*2, fabs(r)*2);
178  }

◆ setThickness()

virtual void ossimEsriShapeFileFilter::setThickness ( ossim_int32  thickness)
inlinevirtual

Definition at line 167 of file ossimEsriShapeFileFilter.h.

168  {
169  theThickness = thickness >= 0? thickness:1;
170  }

◆ setView()

bool ossimEsriShapeFileFilter::setView ( ossimObject baseObject)
virtual

The derived classes should overrid this method and return true or false whether it was able to cast the past in view to a view that it can interface to. So if you are a projective view you might cast to an ossimProjection. The ownsTheView specifies whether or not it owns the passed in view pointer. This will specifiy whether or not the derived classes need to re-allocate the pointer or just delete its old pointer and set it to the passed in pointer.

Implements ossimViewInterface.

Definition at line 78 of file ossimEsriShapeFileFilter.cpp.

References PTR_CAST, ossimImageGeometry::setProjection(), theImageGeometry, and ossimRefPtr< T >::valid().

79 {
80  ossimProjection* proj = PTR_CAST(ossimProjection, baseObject);
81  if(proj)
82  {
84  {
86  }
87  else
88  {
89  theImageGeometry = new ossimImageGeometry(0, proj);
90  }
91  return true;
92  }
93  else
94  {
95  ossimImageGeometry* geom = dynamic_cast<ossimImageGeometry*> (baseObject);
96  if(geom)
97  {
98  theImageGeometry = geom;
99  return true;
100  }
101  }
102 
103  return false;
104 }
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
bool valid() const
Definition: ossimRefPtr.h:75
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimRefPtr< ossimImageGeometry > theImageGeometry
Container class that holds both 2D transform and 3D projection information for an image Only one inst...

◆ transformObjects()

void ossimEsriShapeFileFilter::transformObjects ( ossimImageGeometry geom = 0)
virtual

Definition at line 241 of file ossimEsriShapeFileFilter.cpp.

References computeBoundingRect(), ossimRefPtr< T >::get(), PTR_CAST, theImageGeometry, theShapeCache, and ossimGeoAnnotationObject::transform().

Referenced by checkAndSetDefaultView(), loadShapeFile(), and setImageGeometry().

242 {
243  std::multimap<int, ossimAnnotationObject*>::iterator iter = theShapeCache.begin();
244 
245 
247  if(geom)
248  {
249  tempGeom = geom;
250  }
251 
252  if(!tempGeom) return;
253 
254  while(iter != theShapeCache.end())
255  {
257  (*iter).second);
258  if(obj)
259  {
260  obj->transform(tempGeom);
261  }
262  ++iter;
263  }
264 
266 }
virtual void transform(ossimImageGeometry *projection)=0
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
std::multimap< int, ossimAnnotationObject * > theShapeCache
ossimRefPtr< ossimImageGeometry > theImageGeometry
Container class that holds both 2D transform and 3D projection information for an image Only one inst...

Member Data Documentation

◆ theBorderSize

double ossimEsriShapeFileFilter::theBorderSize
protected

Definition at line 252 of file ossimEsriShapeFileFilter.h.

Referenced by loadPolygon(), loadState(), and saveState().

◆ theBorderSizeUnits

ossimUnitType ossimEsriShapeFileFilter::theBorderSizeUnits
protected

Definition at line 253 of file ossimEsriShapeFileFilter.h.

Referenced by loadState().

◆ theBoundingRect

ossimDrect ossimEsriShapeFileFilter::theBoundingRect
protected

◆ theBrushColor

ossimRgbVector ossimEsriShapeFileFilter::theBrushColor
protected

Definition at line 247 of file ossimEsriShapeFileFilter.h.

Referenced by loadArc(), loadPoint(), loadPolygon(), loadState(), and saveState().

◆ theCoordinateSystem

ossimCoordinateSystemType ossimEsriShapeFileFilter::theCoordinateSystem
protected

Specifies if its image/pixel space, Geographic, projected ...etc.

Definition at line 229 of file ossimEsriShapeFileFilter.h.

◆ theCurrentObject

std::multimap<int, ossimAnnotationObject*>::iterator ossimEsriShapeFileFilter::theCurrentObject
mutableprotected

Definition at line 255 of file ossimEsriShapeFileFilter.h.

Referenced by loadShapeFile().

◆ theFeatureName

ossimString ossimEsriShapeFileFilter::theFeatureName
protected

Definition at line 250 of file ossimEsriShapeFileFilter.h.

Referenced by loadArc(), loadPoint(), loadPolygon(), loadState(), and saveState().

◆ theFillFlag

bool ossimEsriShapeFileFilter::theFillFlag
protected

Definition at line 248 of file ossimEsriShapeFileFilter.h.

Referenced by loadArc(), loadPoint(), loadPolygon(), loadState(), and saveState().

◆ theImageGeometry

ossimRefPtr<ossimImageGeometry> ossimEsriShapeFileFilter::theImageGeometry
protected

This holds the output projection. This is used to transform the objects to the projection plane.

Definition at line 218 of file ossimEsriShapeFileFilter.h.

Referenced by checkAndSetDefaultView(), drawAnnotations(), getImageGeometry(), getView(), loadShapeFile(), loadState(), removeViewProjection(), saveState(), setImageGeometry(), setView(), and transformObjects().

◆ theMaxArray

double ossimEsriShapeFileFilter::theMaxArray[4]
protected

Definition at line 243 of file ossimEsriShapeFileFilter.h.

Referenced by loadShapeFile(), and ossimEsriShapeFileFilter().

◆ theMaxQuadTreeLevels

int ossimEsriShapeFileFilter::theMaxQuadTreeLevels
protected

Definition at line 245 of file ossimEsriShapeFileFilter.h.

Referenced by loadShapeFile(), loadState(), and saveState().

◆ theMinArray

double ossimEsriShapeFileFilter::theMinArray[4]
protected

Definition at line 242 of file ossimEsriShapeFileFilter.h.

Referenced by loadShapeFile(), and ossimEsriShapeFileFilter().

◆ thePenColor

ossimRgbVector ossimEsriShapeFileFilter::thePenColor
protected

Definition at line 246 of file ossimEsriShapeFileFilter.h.

Referenced by loadArc(), loadPoint(), loadPolygon(), loadState(), and saveState().

◆ thePointWidthHeight

ossimDpt ossimEsriShapeFileFilter::thePointWidthHeight
protected

Definition at line 251 of file ossimEsriShapeFileFilter.h.

Referenced by loadPoint(), loadState(), and saveState().

◆ theShapeCache

std::multimap<int, ossimAnnotationObject*> ossimEsriShapeFileFilter::theShapeCache
protected

◆ theShapeFile

ossimShapeFile ossimEsriShapeFileFilter::theShapeFile
protected

Definition at line 240 of file ossimEsriShapeFileFilter.h.

Referenced by drawAnnotations(), loadShapeFile(), and saveState().

◆ theShapeFileProjection

ossimRefPtr<ossimProjection> ossimEsriShapeFileFilter::theShapeFileProjection
protected

If the shape file is projected we must know the projector. This will allow us to define the geographic objects correctly.

Definition at line 224 of file ossimEsriShapeFileFilter.h.

◆ theThickness

ossim_int32 ossimEsriShapeFileFilter::theThickness
protected

Definition at line 249 of file ossimEsriShapeFileFilter.h.

Referenced by loadArc(), loadPoint(), loadPolygon(), loadState(), and saveState().

◆ theTree

SHPTree* ossimEsriShapeFileFilter::theTree
protected

◆ theUnitType

ossimUnitType ossimEsriShapeFileFilter::theUnitType
protected

If its projected this spceifies the type of unit. We need to know if the projection is in meters, feet, us survey feet ... etc.

Definition at line 236 of file ossimEsriShapeFileFilter.h.


The documentation for this class was generated from the following files: