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

#include <ossimGdalOgrVectorAnnotation.h>

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

Public Member Functions

 ossimGdalOgrVectorAnnotation (ossimImageSource *inputSource=0)
 
virtual ~ossimGdalOgrVectorAnnotation ()
 
virtual bool open ()
 
virtual bool open (const ossimFilename &file)
 
virtual bool isOpen () const
 
virtual void close ()
 
virtual ossimFilename getFilename () const
 
virtual bool setView (ossimObject *baseObject)
 
virtual ossimObjectgetView ()
 
virtual const ossimObjectgetView () const
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry () const
 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 void setBrushColor (const ossimRgbVector &brushColor)
 
virtual void setPenColor (const ossimRgbVector &penColor)
 
virtual ossimRgbVector getPenColor () const
 
virtual ossimRgbVector getBrushColor () const
 
virtual double getPointRadius () const
 
virtual void setPointRadius (double r)
 
virtual bool getFillFlag () const
 
virtual void setFillFlag (bool flag)
 
virtual void setThickness (ossim_int32 thickness)
 
virtual ossim_int32 getThickness () const
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
std::multimap< long, ossimAnnotationObject * > getFeatureTable ()
 
void setQuery (const ossimString &query)
 
void setGeometryBuffer (ossim_float64 distance, ossimUnitType type)
 
void initializeBoundingRec (vector< ossimGpt > points)
 
bool setCurrentEntry (ossim_uint32 entryIdx)
 
- 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 addObject (ossimAnnotationObject *anObject)
 
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)
 
- 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 ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if not defined. 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)
 
- 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 computeDefaultView ()
 
void transformObjectsFromView ()
 Uses theViewProjection. More...
 
void loadPoint (long id, OGRPoint *point, ossimMapProjection *mapProj)
 
void loadMultiPoint (long id, OGRMultiPoint *multiPoint, ossimMapProjection *mapProj)
 
void loadMultiPolygon (long id, OGRMultiPolygon *multiPolygon, ossimMapProjection *mapProj)
 
void loadPolygon (long id, OGRPolygon *polygon, ossimMapProjection *mapProj)
 
void loadLineString (long id, OGRLineString *lineString, ossimMapProjection *mapProj)
 
void loadMultiLineString (long id, OGRMultiLineString *multiLineString, ossimMapProjection *mapProj)
 
void getFeatures (std::list< long > &result, const ossimIrect &rect)
 
void getFeature (vector< ossimAnnotationObject *> &featureList, long id)
 
ossimProjectioncreateProjFromReference (OGRSpatialReference *reference) const
 
void initializeTables ()
 
void deleteTables ()
 
void updateAnnotationSettings ()
 
void loadExternalGeometryFile ()
 Will set theViewProjection if geometry file is present with projection. More...
 
void loadExternalImageGeometryFromXml ()
 Will set theViewProjection if xml file is present with projection. More...
 
void loadOmdFile ()
 Looks for "file.omd" and loads pen, brush and point settings if present. More...
 
void getDefaults ()
 Will set thePenColor and theBrushColor if keyword found in preferences. More...
 
void verifyViewParams ()
 Checks for nan scale and tie point. More...
 
- 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

OGRDataSource * theDataSource
 
OGRSFDriver * theDriver
 
ossimFilename theFilename
 
OGREnvelope theBoundingExtent
 
ossimRefPtr< ossimImageGeometrytheImageGeometry
 
vector< bool > theLayersToRenderFlagList
 
std::vector< ossimOgrGdalLayerNode * > theLayerTable
 
ossimRgbVector thePenColor
 
ossimRgbVector theBrushColor
 
bool theFillFlag
 
ossim_uint8 theThickness
 
ossimDpt thePointWidthHeight
 
double theBorderSize
 
ossimUnitType theBorderSizeUnits
 
ossimDrect theImageBound
 
bool theIsExternalGeomFlag
 
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
 
ossimString m_query
 
bool m_needPenColor
 
ossim_float64 m_geometryDistance
 
ossimUnitType m_geometryDistanceType
 
ossimString m_layerName
 
std::vector< ossimStringm_layerNames
 
- 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

Definition at line 35 of file ossimGdalOgrVectorAnnotation.h.

Constructor & Destructor Documentation

◆ ossimGdalOgrVectorAnnotation()

ossimGdalOgrVectorAnnotation::ossimGdalOgrVectorAnnotation ( ossimImageSource inputSource = 0)

Definition at line 197 of file ossimGdalOgrVectorAnnotation.cpp.

References getDefaults(), ossimDrect::makeNan(), ossimAnnotationSource::setNumberOfBands(), theImageBound, and ossimViewInterface::theObject.

198  :ossimAnnotationSource(inputSource),
200  theDataSource(0),
201  theDriver(0),
202  theFilename(),
205  theLayerTable(),
206  thePenColor(255,255,255),
207  theBrushColor(255,255,255),
208  theFillFlag(false),
209  theThickness(1),
210  thePointWidthHeight(1, 1),
211  theBorderSize(0.0),
213  theImageBound(),
214  theIsExternalGeomFlag(false),
215  m_query(""),
216  m_needPenColor(false),
217  m_geometryDistance(0.0),
219  m_layerName("")
220 {
221  // Pick up colors from preference file if set.
222  getDefaults();
223 
224  theObject = this;
227 }
void makeNan()
Definition: ossimDrect.h:388
ossimObject * theObject
ossimAnnotationSource(ossimImageSource *inputSource=0)
virtual void setNumberOfBands(ossim_uint32 bands)
void getDefaults()
Will set thePenColor and theBrushColor if keyword found in preferences.
std::vector< ossimOgrGdalLayerNode * > theLayerTable

◆ ~ossimGdalOgrVectorAnnotation()

ossimGdalOgrVectorAnnotation::~ossimGdalOgrVectorAnnotation ( )
virtual

Definition at line 229 of file ossimGdalOgrVectorAnnotation.cpp.

References close(), and ossimViewInterface::theObject.

230 {
232  close();
233 }
ossimObject * theObject

Member Function Documentation

◆ close()

void ossimGdalOgrVectorAnnotation::close ( )
virtual

Definition at line 235 of file ossimGdalOgrVectorAnnotation.cpp.

References deleteTables(), theDataSource, theImageGeometry, and ossimRefPtr< T >::valid().

Referenced by ossimOgrGdalTileSource::close(), and ~ossimGdalOgrVectorAnnotation().

236 {
237  deleteTables();
238  if(theDataSource)
239  {
240  delete theDataSource;
241  theDataSource = 0;
242  }
243  if (theImageGeometry.valid())
244  {
245  theImageGeometry = 0;
246  }
247 }
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75

◆ computeBoundingRect()

void ossimGdalOgrVectorAnnotation::computeBoundingRect ( )
virtual

Reimplemented from ossimAnnotationSource.

Definition at line 726 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimDrect::combine(), ossimAnnotationObject::getBoundingRect(), ossimDrect::hasNans(), ossimDrect::makeNan(), PTR_CAST, ossimDrect::stretchOut(), theFeatureCacheTable, and theImageBound.

Referenced by transformObjectsFromView().

727 {
728  std::multimap<long, ossimAnnotationObject*>::iterator iter = theFeatureCacheTable.begin();
729 
731  while(iter != theFeatureCacheTable.end())
732  {
734  (*iter).second);
735 
736  if(obj)
737  {
738  ossimDrect rect;
739  obj->getBoundingRect(rect);
740 
741  if(theImageBound.hasNans())
742  {
743  theImageBound = rect;
744  }
745  else
746  {
747  if(!rect.hasNans())
748  {
750  }
751  }
752  }
753 
754  ++iter;
755  }
756 
758 }
void makeNan()
Definition: ossimDrect.h:388
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
ossimDrect combine(const ossimDrect &rect) const
Definition: ossimDrect.h:826
virtual void getBoundingRect(ossimDrect &rect) const =0
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
bool hasNans() const
Definition: ossimDrect.h:396
void stretchOut()
Definition: ossimDrect.cpp:379

◆ computeDefaultView()

void ossimGdalOgrVectorAnnotation::computeDefaultView ( )
protected

Definition at line 683 of file ossimGdalOgrVectorAnnotation.cpp.

References ossim::cosd(), isOpen(), ossimMapProjection::setDecimalDegreesPerPixel(), ossimEquDistCylProjection::setOrigin(), ossimMapProjection::setUlGpt(), theBoundingExtent, theImageGeometry, and ossimRefPtr< T >::valid().

684 {
685  if (theImageGeometry.valid())
686  return;
687 
688  if(!isOpen())
689  return;
690 
691  // double horizontal = fabs(theBoundingExtent.MinX - theBoundingExtent.MaxX);
692  // double vertical = fabs(theBoundingExtent.MinY - theBoundingExtent.MaxY);
693 
694  // if((horizontal > 0.0) && (vertical > 0.0))
696 
697  ossim_float64 centerLat = (theBoundingExtent.MaxY + theBoundingExtent.MinY ) / 2.0;
698  ossim_float64 centerLon = (theBoundingExtent.MaxX + theBoundingExtent.MinX ) / 2.0;
699  ossim_float64 deltaLat = theBoundingExtent.MaxY - theBoundingExtent.MinY;
700 
701  // Scale that gives 1024 pixel in the latitude direction.
702  ossim_float64 scaleLat = deltaLat / 1024.0;
703  ossim_float64 scaleLon = scaleLat*ossim::cosd(std::fabs(centerLat));
704  ossimGpt origin(centerLat, centerLon, 0.0);
705  ossimDpt scale(scaleLon, scaleLat);
706 
707  // Set the origin.
708  proj->setOrigin(origin);
709 
710  // Set the tie point.
711  proj->setUlGpt( ossimGpt(theBoundingExtent.MaxY,
712  theBoundingExtent.MinX) );
713 
714  // Set the scale. Note this will handle computing meters per pixel.
715  proj->setDecimalDegreesPerPixel(scale);
716 
717  // Capture the projection.
718  theImageGeometry = new ossimImageGeometry(0, proj);
719 }
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
virtual void setUlGpt(const ossimGpt &ulGpt)
double ossim_float64
virtual void setOrigin(const ossimGpt &origin)
double cosd(double x)
Definition: ossimCommon.h:259
Container class that holds both 2D transform and 3D projection information for an image Only one inst...

◆ createProjFromReference()

ossimProjection * ossimGdalOgrVectorAnnotation::createProjFromReference ( OGRSpatialReference *  reference) const
protected

Definition at line 1555 of file ossimGdalOgrVectorAnnotation.cpp.

1556 {
1557  if(traceDebug())
1558  {
1559  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimGdalOgrVectorAnnotation::createProjFromReference: entered........" << std::endl;
1560  }
1561  if(!reference)
1562  {
1563  if(traceDebug())
1564  {
1565  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimGdalOgrVectorAnnotation::createProjFromReference: leaving 1........" << std::endl;
1566  }
1567  return NULL;
1568  }
1569  if(reference->IsGeographic()||reference->IsLocal())
1570  {
1571  if(traceDebug())
1572  {
1573  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimGdalOgrVectorAnnotation::createProjFromReference: leaving 2........" << std::endl;
1574  }
1575  return NULL;
1576  }
1577  char* wktString = NULL;
1578  ossimKeywordlist kwl;
1579  reference->exportToWkt(&wktString);
1580  wktTranslator.toOssimKwl(wktString,
1581  kwl);
1582  if(traceDebug())
1583  {
1584  ossimNotify(ossimNotifyLevel_DEBUG) << "wktString === " << wktString << std::endl;
1585  ossimNotify(ossimNotifyLevel_DEBUG) << "KWL === " << kwl << std::endl;
1586  }
1587  OGRFree(wktString);
1588  if(traceDebug())
1589  {
1590  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimGdalOgrVectorAnnotation::createProjFromReference: returning........" << std::endl;
1591  }
1593 }
Represents serializable keyword/value map.
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
static ossimProjectionFactoryRegistry * instance()
bool toOssimKwl(const ossimString &wktString, ossimKeywordlist &kwl, const char *prefix=NULL) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ deleteTables()

void ossimGdalOgrVectorAnnotation::deleteTables ( )
protected

Definition at line 1520 of file ossimGdalOgrVectorAnnotation.cpp.

References theFeatureCacheTable, theLayerTable, and ossimReferenced::unref().

Referenced by close(), and loadState().

1521 {
1522  for(ossim_uint32 i = 0; i < theLayerTable.size(); ++i)
1523  {
1524  if(theLayerTable[i])
1525  {
1526  delete theLayerTable[i];
1527  }
1528  }
1529 
1530  theLayerTable.clear();
1531  std::multimap<long, ossimAnnotationObject*>::iterator current = theFeatureCacheTable.begin();
1532 
1533  while(current != theFeatureCacheTable.end())
1534  {
1535  ((*current).second)->unref();
1536  ++current;
1537  }
1538 
1539  theFeatureCacheTable.clear();
1540 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned int ossim_uint32
void unref() const
decrement the reference count by one, indicating that a pointer to this object is referencing it...
std::vector< ossimOgrGdalLayerNode * > theLayerTable

◆ drawAnnotations()

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

Reimplemented from ossimAnnotationSource.

Definition at line 760 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimGeoAnnotationPolyObject::draw(), ossimObject::dup(), ossimRefPtr< T >::get(), ossimRgbVector::getB(), getFeature(), getFeatures(), ossimRgbVector::getG(), ossimImageData::getImageRectangle(), ossimRgbVector::getR(), initializeTables(), m_needPenColor, PTR_CAST, ossimGeoAnnotationPolyObject::setColor(), ossimRgbImage::setCurrentImageData(), ossimGeoAnnotationPolyObject::setFillFlag(), ossimGeoAnnotationPolyObject::setThickness(), theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, theThickness, ossimRefPtr< T >::valid(), and ossimImageData::validate().

762 {
763  if (theFeatureCacheTable.size() == 0)
764  {
766  }
767 
768  if( theImageGeometry.valid())
769  {
770  list<long> featuresToRender;
771  ossimIrect tileRect = tile->getImageRectangle();
772 
773  getFeatures(featuresToRender, tileRect);
774 
775  list<long>::iterator current = featuresToRender.begin();
776 
778 
779  image->setCurrentImageData(tile);
780  vector<ossimAnnotationObject*> objectList;
781 
782  while(current!=featuresToRender.end())
783  {
784  getFeature(objectList, *current);
785  ++current;
786  }
787 
788  for(ossim_uint32 i = 0; i < objectList.size();++i)
789  {
790  objectList[i]->draw(*image.get());
791 
792  if (theFillFlag && m_needPenColor) //need to draw both the brush and line (pen) for a polygon
793  {
794  ossimObject* objectDup = objectList[i]->dup();
796  if (polyObject)//check if it is the polygon object
797  {
799  polyObject->setThickness(theThickness);
800  polyObject->setFillFlag(false);
801  polyObject->draw(*image.get());
802  }
803  delete objectDup;
804  }
805  }
806 
807  tile->validate();
808  }
809 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
virtual void draw(ossimRgbImage &anImage) const
bool valid() const
Definition: ossimRefPtr.h:75
virtual void setColor(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
virtual ossimDataObjectStatus validate() const
void getFeature(vector< ossimAnnotationObject *> &featureList, long id)
unsigned int ossim_uint32
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual ossimIrect getImageRectangle() const
unsigned char getB() const
unsigned char getG() const
virtual void setThickness(ossim_uint8 thickness)
void getFeatures(std::list< long > &result, const ossimIrect &rect)
virtual ossimObject * dup() const
Definition: ossimObject.cpp:29
void setCurrentImageData(ossimRefPtr< ossimImageData > &imageData)
Allows you to change the image data that this RgbImage object operates on.

◆ getBoundingRect()

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

◆ getBrushColor()

ossimRgbVector ossimGdalOgrVectorAnnotation::getBrushColor ( ) const
virtual

Definition at line 2095 of file ossimGdalOgrVectorAnnotation.cpp.

References theBrushColor.

2096 {
2097  return theBrushColor;
2098 }

◆ getDefaults()

void ossimGdalOgrVectorAnnotation::getDefaults ( )
protected

Will set thePenColor and theBrushColor if keyword found in preferences.

Keyword example: shapefile_normalized_rgb_pen_color: 0.004 1.0 0.004 shapefile_normalized_rgb_brush_color: 0.004 1.0 0.004

Definition at line 2374 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimPreferences::instance().

Referenced by ossimGdalOgrVectorAnnotation().

2375 {
2376  const char* lookup;
2377 
2378  // Look for auto color flag:
2379  bool autocolors = false;
2380  lookup = ossimPreferences::instance()->
2381  findPreference(SHAPEFILE_COLORS_AUTO_KW);
2382  if (lookup)
2383  {
2384  autocolors = ossimString::toBool(ossimString(lookup));
2385  }
2386 
2387  if (autocolors)
2388  {
2389  // Ensure the static index is within bounds of the array.
2390  if (currentAutoColorArrayIndex >= AUTO_COLOR_ARRAY_COUNT)
2391  {
2392  currentAutoColorArrayIndex = 0;
2393  }
2394 
2395  thePenColor.setR(autoColorArray[currentAutoColorArrayIndex].r);
2396  thePenColor.setG(autoColorArray[currentAutoColorArrayIndex].g);
2397  thePenColor.setB(autoColorArray[currentAutoColorArrayIndex].b);
2398 
2399  theBrushColor.setR(autoColorArray[currentAutoColorArrayIndex].r);
2400  theBrushColor.setG(autoColorArray[currentAutoColorArrayIndex].g);
2401  theBrushColor.setB(autoColorArray[currentAutoColorArrayIndex].b);
2402 
2403  ++currentAutoColorArrayIndex;
2404  if (currentAutoColorArrayIndex >= AUTO_COLOR_ARRAY_COUNT)
2405  {
2406  currentAutoColorArrayIndex = 0;
2407  }
2408 
2409  } // End of: if (autocolors)
2410  else
2411  {
2412  // Look for pen color.
2413  lookup = ossimPreferences::instance()->
2414  findPreference(NORMALIZED_RGB_PEN_COLOR_KW);
2415  if (lookup)
2416  {
2417  ossim_float64 r;
2418  ossim_float64 g;
2419  ossim_float64 b;
2420 
2421  std::istringstream in(lookup);
2422  in >> r >> g >> b;
2423 
2424  if ( (r >= 0.0) && (r <=1.0) )
2425  {
2426  thePenColor.setR(static_cast<ossim_uint8>(r * 255.0 + 0.5));
2427  }
2428  if ( (g >= 0.0) && (g <=1.0) )
2429  {
2430  thePenColor.setG(static_cast<ossim_uint8>(g * 255.0 + 0.5));
2431  }
2432  if ( (b >= 0.0) && (b <=1.0) )
2433  {
2434  thePenColor.setB(static_cast<ossim_uint8>(b * 255.0 + 0.5));
2435  }
2436  }
2437 
2438  // Look for brush color.
2439  lookup = ossimPreferences::instance()->
2440  findPreference(NORMALIZED_RGB_BRUSH_COLOR_KW);
2441  if (lookup)
2442  {
2443  ossim_float64 r;
2444  ossim_float64 g;
2445  ossim_float64 b;
2446 
2447  std::istringstream in(lookup);
2448  in >> r >> g >> b;
2449 
2450  if ( (r >= 0.0) && (r <=1.0) )
2451  {
2452  theBrushColor.setR(static_cast<ossim_uint8>(r * 255.0 + 0.5));
2453  }
2454  if ( (g >= 0.0) && (g <=1.0) )
2455  {
2456  theBrushColor.setG(static_cast<ossim_uint8>(g * 255.0 + 0.5));
2457  }
2458  if ( (b >= 0.0) && (b <=1.0) )
2459  {
2460  theBrushColor.setB(static_cast<ossim_uint8>(b * 255.0 + 0.5));
2461  }
2462  }
2463 
2464  } // End of: if (autocolors){...}else{
2465 
2466  // Look for point size.
2467  lookup = ossimPreferences::instance()->
2468  findPreference(POINT_SIZE_KW);
2469  if (lookup)
2470  {
2471  ossim_float64 x;
2472  ossim_float64 y;
2473 
2474  std::istringstream in(lookup);
2475  in >> x >> y;
2476 
2477  if ( (x > 0.0) && (y > 0.0) )
2478  {
2481  }
2482  }
2483 }
ossim_uint32 x
ossim_uint32 y
void setR(unsigned char R)
double y
Definition: ossimDpt.h:165
void setB(unsigned char B)
double ossim_float64
bool toBool() const
String to numeric methods.
static ossimPreferences * instance()
void setG(unsigned char G)
double x
Definition: ossimDpt.h:164
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32

◆ getFeature()

void ossimGdalOgrVectorAnnotation::getFeature ( vector< ossimAnnotationObject *> &  featureList,
long  id 
)
protected

Definition at line 1543 of file ossimGdalOgrVectorAnnotation.cpp.

References theFeatureCacheTable.

Referenced by drawAnnotations().

1545 {
1546  std::multimap<long, ossimAnnotationObject*>::iterator iter = theFeatureCacheTable.find(id);
1547 
1548  while( (iter != theFeatureCacheTable.end()) && ((*iter).first == id) )
1549  {
1550  featureList.push_back((*iter).second);
1551  ++iter;
1552  }
1553 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable

◆ getFeatures()

void ossimGdalOgrVectorAnnotation::getFeatures ( std::list< long > &  result,
const ossimIrect rect 
)
protected

Definition at line 1221 of file ossimGdalOgrVectorAnnotation.cpp.

References isOpen(), ossimGpt::latd(), ossimIrect::ll(), ossimImageGeometry::localToWorld(), ossimGpt::lond(), ossimIrect::lr(), max, min, theImageGeometry, theLayersToRenderFlagList, theLayerTable, ossimIrect::ul(), ossimIrect::ur(), and ossimRefPtr< T >::valid().

Referenced by drawAnnotations().

1223 {
1224  if (isOpen())
1225  {
1226  ossimGpt gp1;
1227  ossimGpt gp2;
1228  ossimGpt gp3;
1229  ossimGpt gp4;
1230  ossimDpt dp1 = rect.ul();
1231  ossimDpt dp2 = rect.ur();
1232  ossimDpt dp3 = rect.lr();
1233  ossimDpt dp4 = rect.ll();
1234 
1235  if (theImageGeometry.valid())
1236  {
1237  theImageGeometry->localToWorld(dp1, gp1);
1238  theImageGeometry->localToWorld(dp2, gp2);
1239  theImageGeometry->localToWorld(dp3, gp3);
1240  theImageGeometry->localToWorld(dp4, gp4);
1241 
1242  double maxX = std::max( gp1.lond(), std::max( gp2.lond(), std::max(gp3.lond(), gp4.lond())));
1243  double minX = std::min( gp1.lond(), std::min( gp2.lond(), std::min(gp3.lond(), gp4.lond())));
1244  double maxY = std::max( gp1.latd(), std::max( gp2.latd(), std::max(gp3.latd(), gp4.latd())));
1245  double minY = std::min( gp1.latd(), std::min( gp2.latd(), std::min(gp3.latd(), gp4.latd())));
1246 
1247  ossimDrect bounds(minX, minY, maxX, maxY);
1248 
1249  for(ossim_uint32 layerI = 0;
1250  layerI < theLayersToRenderFlagList.size();
1251  ++layerI)
1252  {
1253  if(theLayersToRenderFlagList[layerI])
1254  {
1255  if(theLayerTable[layerI])
1256  {
1257  theLayerTable[layerI]->getIdList(result, bounds);
1258  }
1259  }
1260  }
1261  }
1262  }
1263 }
ossimRefPtr< ossimImageGeometry > theImageGeometry
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
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
unsigned int ossim_uint32
const ossimIpt & lr() const
Definition: ossimIrect.h:276
const ossimIpt & ur() const
Definition: ossimIrect.h:275
std::vector< ossimOgrGdalLayerNode * > theLayerTable
#define max(a, b)
Definition: auxiliary.h:76
#define min(a, b)
Definition: auxiliary.h:75

◆ getFeatureTable()

std::multimap< long, ossimAnnotationObject * > ossimGdalOgrVectorAnnotation::getFeatureTable ( )

Definition at line 2527 of file ossimGdalOgrVectorAnnotation.cpp.

References initializeTables(), and theFeatureCacheTable.

Referenced by ossimOgrGdalTileSource::getFeatureTable().

2528 {
2529  if (theFeatureCacheTable.size() == 0)
2530  {
2531  initializeTables();
2532  }
2533  return theFeatureCacheTable;
2534 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable

◆ getFilename()

ossimFilename ossimGdalOgrVectorAnnotation::getFilename ( ) const
virtual

Definition at line 248 of file ossimGdalOgrVectorAnnotation.cpp.

References theFilename.

249 {
250  return theFilename;
251 }

◆ getFillFlag()

bool ossimGdalOgrVectorAnnotation::getFillFlag ( ) const
virtual

Definition at line 2110 of file ossimGdalOgrVectorAnnotation.cpp.

References theFillFlag.

2111 {
2112  return theFillFlag;
2113 }

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimGdalOgrVectorAnnotation::getImageGeometry ( ) const
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)

Definition at line 678 of file ossimGdalOgrVectorAnnotation.cpp.

References theImageGeometry.

Referenced by ossimOgrGdalTileSource::getInternalImageGeometry().

679 {
680  return theImageGeometry;
681 }
ossimRefPtr< ossimImageGeometry > theImageGeometry

◆ getPenColor()

ossimRgbVector ossimGdalOgrVectorAnnotation::getPenColor ( ) const
virtual

Definition at line 2090 of file ossimGdalOgrVectorAnnotation.cpp.

References thePenColor.

2091 {
2092  return thePenColor;
2093 }

◆ getPointRadius()

double ossimGdalOgrVectorAnnotation::getPointRadius ( ) const
virtual

Definition at line 2100 of file ossimGdalOgrVectorAnnotation.cpp.

References thePointWidthHeight, and ossimDpt::x.

2101 {
2102  return thePointWidthHeight.x/2.0;
2103 }
double x
Definition: ossimDpt.h:164

◆ getProperty()

ossimRefPtr< ossimProperty > ossimGdalOgrVectorAnnotation::getProperty ( const ossimString name) const
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 910 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimKeywordNames::FILL_FLAG_KW, ossimImageSourceFilter::getProperty(), getThickness(), ossimNumericProperty::ossimNumericPropertyType_INT, ossimKeywordNames::PEN_COLOR_KW, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW, ossimProperty::setCacheRefreshBit(), ossimProperty::setFullRefreshBit(), ossimNumericProperty::setNumericType(), theBrushColor, theFillFlag, thePenColor, thePointWidthHeight, ossimKeywordNames::THICKNESS_KW, ossimString::toString(), ossimDpt::x, and ossimDpt::y.

Referenced by ossimOgrGdalTileSource::getProperty().

911 {
914  {
915  result = new ossimColorProperty(name,
916  thePenColor);
917  result->setCacheRefreshBit();
918  }
919  else if(name == ossimKeywordNames::BRUSH_COLOR_KW)
920  {
921  result = new ossimColorProperty(name,
922  theBrushColor);
923  result->setCacheRefreshBit();
924  }
925  else if(name == ossimKeywordNames::FILL_FLAG_KW)
926  {
927  result = new ossimBooleanProperty(name,
928  theFillFlag);
929  result->setCacheRefreshBit();
930 
931  }
932  else if(name == ossimKeywordNames::THICKNESS_KW)
933  {
934  ossimNumericProperty* prop =
935  new ossimNumericProperty(name,
937  1.0,
938  255.0);
940  result = prop;
941  result->setFullRefreshBit();
942  }
943  else if(name == ossimKeywordNames::BORDER_SIZE_KW)
944  {
945  }
947  {
948  result = new ossimTextProperty(name,
950  " " +
952  result->setFullRefreshBit();
953  }
954  else
955  {
956  result = ossimAnnotationSource::getProperty(name);
957  }
958 
959  return result;
960 }
static const char * BRUSH_COLOR_KW
double y
Definition: ossimDpt.h:165
static ossimString toString(bool aValue)
Numeric to string methods.
void setFullRefreshBit()
virtual void setNumericType(ossimNumericPropertyType type)
static const char * FILL_FLAG_KW
static const char * BORDER_SIZE_KW
double x
Definition: ossimDpt.h:164
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
static const char * PEN_COLOR_KW
static const char * POINT_WIDTH_HEIGHT_KW
static const char * THICKNESS_KW
void setCacheRefreshBit()

◆ getPropertyNames()

void ossimGdalOgrVectorAnnotation::getPropertyNames ( std::vector< ossimString > &  propertyNames) const
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 962 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimKeywordNames::FILL_FLAG_KW, ossimKeywordNames::PEN_COLOR_KW, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW, and ossimKeywordNames::THICKNESS_KW.

Referenced by ossimOgrGdalTileSource::getPropertyNames().

963 {
964 
965  propertyNames.push_back(ossimKeywordNames::PEN_COLOR_KW);
966  propertyNames.push_back(ossimKeywordNames::BRUSH_COLOR_KW);
967  propertyNames.push_back(ossimKeywordNames::FILL_FLAG_KW);
968  propertyNames.push_back(ossimKeywordNames::THICKNESS_KW);
969  propertyNames.push_back(ossimKeywordNames::BORDER_SIZE_KW);
970  propertyNames.push_back(ossimKeywordNames::POINT_WIDTH_HEIGHT_KW);
971 }
static const char * BRUSH_COLOR_KW
static const char * FILL_FLAG_KW
static const char * BORDER_SIZE_KW
static const char * PEN_COLOR_KW
static const char * POINT_WIDTH_HEIGHT_KW
static const char * THICKNESS_KW

◆ getThickness()

ossim_int32 ossimGdalOgrVectorAnnotation::getThickness ( ) const
virtual

Definition at line 2136 of file ossimGdalOgrVectorAnnotation.cpp.

References theThickness.

Referenced by getProperty(), and saveState().

2137 {
2138  return static_cast<ossim_int32>(theThickness);
2139 }
int ossim_int32

◆ getView() [1/2]

ossimObject * ossimGdalOgrVectorAnnotation::getView ( )
virtual

Implements ossimViewInterface.

Definition at line 671 of file ossimGdalOgrVectorAnnotation.cpp.

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

Referenced by ossimOgrGdalTileSource::getView().

672 {
673  return theImageGeometry.get();
674 }
ossimRefPtr< ossimImageGeometry > theImageGeometry

◆ getView() [2/2]

const ossimObject * ossimGdalOgrVectorAnnotation::getView ( ) const
virtual

Implements ossimViewInterface.

Definition at line 2075 of file ossimGdalOgrVectorAnnotation.cpp.

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

2076 {
2077  return theImageGeometry.get();
2078 }
ossimRefPtr< ossimImageGeometry > theImageGeometry

◆ initializeBoundingRec()

void ossimGdalOgrVectorAnnotation::initializeBoundingRec ( vector< ossimGpt points)

Definition at line 597 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimDrect::makeNan(), theBoundingExtent, theImageBound, theImageGeometry, ossimRefPtr< T >::valid(), and ossimImageGeometry::worldToLocal().

598 {
600 
601  //if the projection is default or geographic, uses the bounding of the OGR Layer
602  if (points.size() == 0)
603  {
604  points.push_back(ossimGpt(theBoundingExtent.MaxY, theBoundingExtent.MinX));
605  points.push_back(ossimGpt(theBoundingExtent.MaxY, theBoundingExtent.MaxX));
606  points.push_back(ossimGpt(theBoundingExtent.MinY, theBoundingExtent.MaxX));
607  points.push_back(ossimGpt(theBoundingExtent.MinY, theBoundingExtent.MinX));
608  }
609 
610  if(theImageGeometry.valid())
611  {
612  std::vector<ossimDpt> rectTmp;
613  rectTmp.resize(points.size());
614  for(std::vector<ossimGpt>::size_type index=0; index < points.size(); ++index)
615  {
616  theImageGeometry->worldToLocal(points[(int)index], rectTmp[(int)index]);
617  }
618 
619  if (rectTmp.size() > 3)
620  {
621  ossimDrect rect2 = ossimDrect(rectTmp[0],
622  rectTmp[1],
623  rectTmp[2],
624  rectTmp[3]);
625 
626  theImageBound = rect2;
627  }
628  }
629 }
void makeNan()
Definition: ossimDrect.h:388
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.

◆ initializeTables()

void ossimGdalOgrVectorAnnotation::initializeTables ( )
protected

Definition at line 1265 of file ossimGdalOgrVectorAnnotation.cpp.

Referenced by drawAnnotations(), getFeatureTable(), loadState(), and transformObjectsFromView().

1266 {
1267  if(traceDebug())
1268  {
1269  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimGdalOgrVectorAnnotation::initializeTables(): entered.........." << std::endl;
1270  }
1271  if(theLayerTable.size())
1272  {
1273  deleteTables();
1274  }
1275 
1276  if(isOpen())
1277  {
1278  int upper = theLayersToRenderFlagList.size();
1279  theLayerTable.resize(upper);
1280 
1281  for(int i = 0; i < upper; ++i)
1282  {
1284  {
1285  OGREnvelope extent;
1286  OGRLayer* layer = NULL;
1287  if (!m_query.empty())
1288  {
1289  layer = theDataSource->ExecuteSQL(m_query, NULL, NULL);
1290  }
1291  else if (!m_layerName.empty())
1292  {
1293  layer = theDataSource->GetLayerByName(m_layerName.c_str());
1294  }
1295  else
1296  {
1297  layer = theDataSource->GetLayer(i);
1298  }
1299 
1302  {
1303  proj = theImageGeometry->getProjection();
1304  }
1305  else
1306  {
1307  proj = createProjFromReference(layer->GetSpatialRef());
1308  }
1309 
1310  ossimMapProjection* mapProj = PTR_CAST(ossimMapProjection, proj.get());
1311 
1312  layer->ResetReading();
1313  layer->GetExtent(&extent, true);
1314  layer->ResetReading();
1315 
1316  OGRFeature* feature = NULL;
1317  if(mapProj)
1318  {
1319  ossimDrect rect(extent.MinX,
1320  extent.MaxY,
1321  extent.MaxX,
1322  extent.MinY,
1324  ossimGpt g1 = mapProj->inverse(rect.ul());
1325  ossimGpt g2 = mapProj->inverse(rect.ur());
1326  ossimGpt g3 = mapProj->inverse(rect.lr());
1327  ossimGpt g4 = mapProj->inverse(rect.ll());
1328 
1329  ossimDrect rect2 = ossimDrect(ossimDpt(g1),
1330  ossimDpt(g2),
1331  ossimDpt(g3),
1332  ossimDpt(g4));
1333  theLayerTable[i] = new ossimOgrGdalLayerNode(rect2);
1334  }
1335  else
1336  {
1337  theLayerTable[i] = new ossimOgrGdalLayerNode(ossimDrect(extent.MinX,
1338  extent.MinY,
1339  extent.MaxX,
1340  extent.MaxY));
1341  }
1342 
1343  while( (feature = layer->GetNextFeature()) != NULL)
1344  {
1345  if(feature)
1346  {
1347  OGRGeometry* geom = feature->GetGeometryRef();
1348 
1349  if(geom)
1350  {
1351  switch(geom->getGeometryType())
1352  {
1353  case wkbMultiPoint:
1354  case wkbMultiPoint25D:
1355  {
1356  if(traceDebug())
1357  {
1358  ossimNotify(ossimNotifyLevel_DEBUG) << "Loading multi point" << std::endl;
1359  }
1360  loadMultiPoint(feature->GetFID(),
1361  (OGRMultiPoint*)geom,
1362  mapProj);
1363  break;
1364  }
1365  case wkbPolygon25D:
1366  case wkbPolygon:
1367  {
1368  if(traceDebug())
1369  {
1370  ossimNotify(ossimNotifyLevel_DEBUG) << "Loading polygon" << std::endl;
1371  }
1372  if (m_geometryDistance > 0.0)
1373  {
1374  OGRPolygon* poly = (OGRPolygon*)geom;
1375  OGRLinearRing* ring = poly->getExteriorRing();
1376  int numPoints = ring->getNumPoints();
1377  OGRGeometry* bufferGeom = geom->Buffer(m_geometryDistance, numPoints);
1378  loadPolygon(feature->GetFID(),
1379  (OGRPolygon*)bufferGeom,
1380  mapProj);
1381  }
1382  else
1383  {
1384  loadPolygon(feature->GetFID(),
1385  (OGRPolygon*)geom,
1386  mapProj);
1387  }
1388 
1389  break;
1390  }
1391  case wkbLineString25D:
1392  case wkbLineString:
1393  {
1394  if(traceDebug())
1395  {
1396  ossimNotify(ossimNotifyLevel_DEBUG) << "Loading line string" << std::endl;
1397  }
1398  loadLineString(feature->GetFID(),
1399  (OGRLineString*)geom,
1400  mapProj);
1401  break;
1402  }
1403  case wkbPoint:
1404  case wkbPoint25D:
1405  {
1406  if(traceDebug())
1407  {
1408  ossimNotify(ossimNotifyLevel_DEBUG) << "Loading point" << std::endl;
1409  }
1410  loadPoint(feature->GetFID(),
1411  (OGRPoint*)geom,
1412  mapProj);
1413  break;
1414  }
1415  case wkbMultiPolygon25D:
1416  case wkbMultiPolygon:
1417  {
1418  if(traceDebug())
1419  {
1420  ossimNotify(ossimNotifyLevel_DEBUG) << "Loading multi polygon" << std::endl;
1421  }
1422  if (m_geometryDistance > 0.0)
1423  {
1424  OGRGeometry* bufferGeom = geom->Buffer(m_geometryDistance);
1425  loadMultiPolygon(feature->GetFID(),
1426  (OGRMultiPolygon*)bufferGeom,
1427  mapProj);
1428  }
1429  else
1430  {
1431  loadMultiPolygon(feature->GetFID(),
1432  (OGRMultiPolygon*)geom,
1433  mapProj);
1434  }
1435  break;
1436 
1437  }
1438  case wkbMultiLineString:
1439  {
1440  if(traceDebug())
1441  {
1442  ossimNotify(ossimNotifyLevel_DEBUG) << "Loading line string" << std::endl;
1443  }
1444  loadMultiLineString(feature->GetFID(),
1445  (OGRMultiLineString*)geom,
1446  mapProj);
1447  break;
1448  }
1449  default:
1450  {
1451  if(traceDebug())
1452  {
1454  << "ossimGdalOgrVectorAnnotation::initializeTables WARNING\n"
1455 
1456  << OGRGeometryTypeToName(geom->getGeometryType())
1457  <<" NOT SUPPORTED!"
1458  << endl;
1459  }
1460  break;
1461  }
1462  }
1463  geom->getEnvelope(&extent);
1464  if(mapProj)
1465  {
1466  ossimDrect rect(extent.MinX,
1467  extent.MaxY,
1468  extent.MaxX,
1469  extent.MinY,
1471  ossimGpt g1 = mapProj->inverse(rect.ul());
1472  ossimGpt g2 = mapProj->inverse(rect.ur());
1473  ossimGpt g3 = mapProj->inverse(rect.lr());
1474  ossimGpt g4 = mapProj->inverse(rect.ll());
1475 
1476  theLayerTable[i]->theFeatureList.push_back(ossimOgrGdalFeatureNode(feature->GetFID(),
1477  ossimDrect(ossimDpt(g1),
1478  ossimDpt(g2),
1479  ossimDpt(g3),
1480  ossimDpt(g4))));
1481 
1482  }
1483  else
1484  {
1485  theLayerTable[i]->theFeatureList.push_back(ossimOgrGdalFeatureNode(feature->GetFID(),
1486  ossimDrect(extent.MinX,
1487  extent.MinY,
1488  extent.MaxX,
1489  extent.MaxY)));
1490  }
1491  }
1492  }
1493  delete feature;
1494  }
1495 
1496  //if an OGRLayer pointer representing a results set from the query, this layer is
1497  //in addition to the layers in the data store and must be destroyed with
1498  //OGRDataSource::ReleaseResultSet() before the data source is closed (destroyed).
1499  if (!m_query.empty() && layer != NULL)
1500  {
1501  theDataSource->ReleaseResultSet(layer);
1502  }
1503  }
1504  else
1505  {
1506  theLayerTable[i] = NULL;
1507  }
1508  }
1509  }
1512  if(traceDebug())
1513  {
1515  << "ossimGdalOgrVectorAnnotation::initializeTables(): leaving..."
1516  << std::endl;
1517  }
1518 }
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
void loadPolygon(long id, OGRPolygon *polygon, ossimMapProjection *mapProj)
void loadPoint(long id, OGRPoint *point, ossimMapProjection *mapProj)
void loadLineString(long id, OGRLineString *lineString, ossimMapProjection *mapProj)
void loadMultiPoint(long id, OGRMultiPoint *multiPoint, ossimMapProjection *mapProj)
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
void loadMultiLineString(long id, OGRMultiLineString *multiLineString, ossimMapProjection *mapProj)
void loadMultiPolygon(long id, OGRMultiPolygon *multiPolygon, ossimMapProjection *mapProj)
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
std::vector< ossimOgrGdalLayerNode * > theLayerTable
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
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 empty() const
Definition: ossimString.h:411
ossimProjection * createProjFromReference(OGRSpatialReference *reference) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ isOpen()

bool ossimGdalOgrVectorAnnotation::isOpen ( ) const
virtual

Definition at line 2070 of file ossimGdalOgrVectorAnnotation.cpp.

References theDataSource.

Referenced by computeDefaultView(), getFeatures(), and ossimOgrGdalTileSource::isOpen().

2071 {
2072  return (theDataSource!=NULL);
2073 }

◆ loadExternalGeometryFile()

void ossimGdalOgrVectorAnnotation::loadExternalGeometryFile ( )
protected

Will set theViewProjection if geometry file is present with projection.

Also sets theIsExternalGeomFlag.

Definition at line 2141 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimKeywordlist::addFile(), ossimFilename::exists(), ossimImageGeometry::getProjection(), ossimImageGeometry::loadState(), PTR_CAST, ossimFilename::setExtension(), theFilename, theImageGeometry, and theIsExternalGeomFlag.

2142 {
2143  ossimFilename filename = theFilename;
2144  filename.setExtension(".geom");
2145  if(!filename.exists())
2146  {
2147  filename.setExtension(".GEOM");
2148  if(!filename.exists())
2149  {
2150  return;
2151  }
2152  }
2153 
2154  ossimKeywordlist kwl;
2155  if(kwl.addFile(filename))
2156  {
2158  geom->loadState(kwl);
2159  if(geom->getProjection())
2160  {
2161  theImageGeometry = geom;
2163  if (mapProj)
2164  {
2165  // drb...
2166  //mapProj->setUlGpt(mapProj->origin());
2167  theIsExternalGeomFlag = true;
2168 
2169  if (traceDebug())
2170  {
2172  << "ossimGdalOgrVectorAnnotation::loadExternalGeometryFile"
2173  << " DEBUG:"
2174  << "\nExternal projection loaded from geometry file."
2175  << "\nProjection dump:" << std::endl;
2177  }
2178  }
2179  }
2180  }
2181 }
ossimRefPtr< ossimImageGeometry > theImageGeometry
Represents serializable keyword/value map.
bool addFile(const char *file)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Attempts to initialize a transform and a projection given the KWL.
bool exists() const
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
virtual std::ostream & print(std::ostream &out) const
Prints data members to stream.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ loadExternalImageGeometryFromXml()

void ossimGdalOgrVectorAnnotation::loadExternalImageGeometryFromXml ( )
protected

Will set theViewProjection if xml file is present with projection.

Also sets theIsExternalGeomFlag.

Definition at line 2183 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimFilename::exists(), ossimRefPtr< T >::get(), ossimFgdcXmlDoc::getProjection(), ossimFilename::noExtension(), ossimFgdcXmlDoc::open(), ossimImageGeometry::setProjection(), theFilename, theImageGeometry, theIsExternalGeomFlag, and ossimRefPtr< T >::valid().

2184 {
2185  ossimFilename filename = theFilename;
2186  ossimString fileBase = filename.noExtension();
2187  ossimFilename xmlFile = ossimString(fileBase + ".xml");
2188  if (!xmlFile.exists())//try the xml file which includes the entire source file name
2189  {
2190  xmlFile = theFilename + ".xml";
2191  }
2192  if (!xmlFile.exists())
2193  {
2194  return;
2195  }
2196  ossimFgdcXmlDoc* fgdcXmlDoc = new ossimFgdcXmlDoc;
2197  if ( fgdcXmlDoc->open(xmlFile) )
2198  {
2199  ossimRefPtr<ossimProjection> proj = fgdcXmlDoc->getProjection();
2200  if ( proj.valid() )
2201  {
2203  theImageGeometry->setProjection( proj.get() );
2204  theIsExternalGeomFlag = true;
2205  }
2206  }
2207  delete fgdcXmlDoc;
2208  fgdcXmlDoc = 0;
2209 }
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
ossimFilename noExtension() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
bool exists() const
Class for FGDC XML doc parsing.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossimRefPtr< ossimProjection > getProjection()
Gets projection from document.
bool open(const ossimFilename &xmlFileName)
Open method.

◆ loadLineString()

void ossimGdalOgrVectorAnnotation::loadLineString ( long  id,
OGRLineString *  lineString,
ossimMapProjection mapProj 
)
protected

Definition at line 1707 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimGpt::datum(), ossimRefPtr< T >::get(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageGeometry::getProjection(), ossimRgbVector::getR(), ossimMapProjection::inverse(), ossimProjection::origin(), theBrushColor, theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, theThickness, ossimGeoAnnotationPolyLineObject::transform(), and ossimRefPtr< T >::valid().

1709 {
1710  int upper = lineString->getNumPoints();
1711  ossimGpt origin;
1713  {
1714  origin = theImageGeometry->getProjection()->origin();
1715  }
1716 
1717  ossimRgbVector color;
1718 
1719  if(theFillFlag)
1720  {
1721  color = theBrushColor;
1722  }
1723  else
1724  {
1725  color = thePenColor;
1726  }
1727  vector<ossimGpt> polyLine(upper);
1728  for(int i = 0; i < upper; ++i)
1729  {
1730  OGRPoint ogrPt;
1731 
1732  lineString->getPoint(i, &ogrPt);
1733 
1734  if(mapProj)
1735  {
1736  ossimDpt eastingNorthing(ogrPt.getX(),
1737  ogrPt.getY());
1738 
1739  polyLine[i] = mapProj->inverse(eastingNorthing);
1740  }
1741  else
1742  {
1743  polyLine[i] = ossimGpt(ogrPt.getY(),
1744  ogrPt.getX(),
1745  ogrPt.getZ(),
1746  origin.datum());
1747  }
1748  }
1749 
1750  ossimGeoAnnotationPolyLineObject* annotation =
1751  new ossimGeoAnnotationPolyLineObject(polyLine,
1752  color.getR(),
1753  color.getG(),
1754  color.getB(),
1755  theThickness);
1756  if(theImageGeometry.valid())
1757  {
1758  annotation->transform(theImageGeometry.get());
1759  }
1760 
1761  theFeatureCacheTable.insert(make_pair(id,
1762  annotation));
1763 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
unsigned char getB() const
unsigned char getG() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimGpt origin() const =0
virtual void transform(ossimImageGeometry *projection)

◆ loadMultiLineString()

void ossimGdalOgrVectorAnnotation::loadMultiLineString ( long  id,
OGRMultiLineString *  multiLineString,
ossimMapProjection mapProj 
)
protected

Definition at line 1765 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimGpt::datum(), ossimRefPtr< T >::get(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageGeometry::getProjection(), ossimRgbVector::getR(), ossimMapProjection::inverse(), ossimProjection::origin(), theBrushColor, theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, theThickness, ossimGeoAnnotationPolyLineObject::transform(), and ossimRefPtr< T >::valid().

1767 {
1768  ossimRgbVector color;
1769 
1770  if(theFillFlag)
1771  {
1772  color = theBrushColor;
1773  }
1774  else
1775  {
1776  color = thePenColor;
1777  }
1778 
1779  ossim_uint32 numGeometries = multiLineString->getNumGeometries();
1780  ossimGpt origin;
1782  {
1783  origin = theImageGeometry->getProjection()->origin();
1784  }
1785 
1786  vector<ossimGeoPolygon> geoPoly;
1787  for(ossim_uint32 geomIdx = 0; geomIdx < numGeometries; ++geomIdx)
1788  {
1789  OGRGeometry* geomRef = multiLineString->getGeometryRef(geomIdx);
1790  OGRLineString* lineString = (OGRLineString*)geomRef;
1791  if (lineString)
1792  {
1793  int upper = lineString->getNumPoints();
1794  vector<ossimGpt> polyLine(upper);
1795  for(int i = 0; i < upper; ++i)
1796  {
1797  OGRPoint ogrPt;
1798 
1799  lineString->getPoint(i, &ogrPt);
1800 
1801  if(mapProj)
1802  {
1803  ossimDpt eastingNorthing(ogrPt.getX(),
1804  ogrPt.getY());
1805 
1806  polyLine[i] = mapProj->inverse(eastingNorthing);
1807  }
1808  else
1809  {
1810  polyLine[i] = ossimGpt(ogrPt.getY(),
1811  ogrPt.getX(),
1812  ogrPt.getZ(),
1813  origin.datum());
1814  }
1815  }
1816 
1817  ossimGeoAnnotationPolyLineObject* annotation =
1818  new ossimGeoAnnotationPolyLineObject(polyLine,
1819  color.getR(),
1820  color.getG(),
1821  color.getB(),
1822  theThickness);
1823  if(theImageGeometry.valid())
1824  {
1825  annotation->transform(theImageGeometry.get());
1826  }
1827 
1828  theFeatureCacheTable.insert(make_pair(id,
1829  annotation));
1830  }
1831  }
1832 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
unsigned int ossim_uint32
unsigned char getB() const
unsigned char getG() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimGpt origin() const =0
virtual void transform(ossimImageGeometry *projection)

◆ loadMultiPoint()

void ossimGdalOgrVectorAnnotation::loadMultiPoint ( long  id,
OGRMultiPoint *  multiPoint,
ossimMapProjection mapProj 
)
protected

Definition at line 1884 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimGeoAnnotationMultiEllipseObject::addPoint(), ossimRefPtr< T >::get(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageGeometry::getProjection(), ossimRgbVector::getR(), ossimMapProjection::inverse(), ossimProjection::origin(), theBrushColor, theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, thePointWidthHeight, theThickness, ossimGeoAnnotationMultiEllipseObject::transform(), and ossimRefPtr< T >::valid().

1887 {
1888  ossim_uint32 numGeometries = multiPoint->getNumGeometries();
1889  ossimRgbVector color;
1890 
1891  if(theFillFlag)
1892  {
1893  color = theBrushColor;
1894  }
1895  else
1896  {
1897  color = thePenColor;
1898  }
1899 
1902  theFillFlag,
1903  color.getR(),
1904  color.getG(),
1905  color.getB(),
1906  theThickness);
1907  ossimGpt origin;
1909  {
1910  origin = theImageGeometry->getProjection()->origin();
1911  }
1912  for(ossim_uint32 i = 0; i < numGeometries; ++i)
1913  {
1914  OGRGeometry* geomRef = multiPoint->getGeometryRef(i);
1915  if( geomRef &&
1916  ( (geomRef->getGeometryType()==wkbPoint) ||
1917  (geomRef->getGeometryType()==wkbPoint25D) ) )
1918  {
1919  OGRPoint* point = (OGRPoint*)geomRef;
1920 
1921  if(mapProj)
1922  {
1923  ossimDpt eastingNorthing(point->getX(),
1924  point->getY());
1925 
1926  annotation->addPoint(mapProj->inverse(eastingNorthing));
1927  }
1928  annotation->addPoint(ossimGpt(point->getY(),
1929  point->getX(),
1930  point->getZ(),
1931  origin.datum()));
1932  }
1933  }
1934  if(theImageGeometry.valid())
1935  {
1936  annotation->transform(theImageGeometry.get());
1937  }
1938 
1939  theFeatureCacheTable.insert(make_pair(id, annotation));
1940 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
unsigned int ossim_uint32
unsigned char getB() const
unsigned char getG() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual void transform(ossimImageGeometry *projection)
virtual ossimGpt origin() const =0

◆ loadMultiPolygon()

void ossimGdalOgrVectorAnnotation::loadMultiPolygon ( long  id,
OGRMultiPolygon *  multiPolygon,
ossimMapProjection mapProj 
)
protected

Definition at line 1943 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimGpt::datum(), ossimRefPtr< T >::get(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageGeometry::getProjection(), ossimRgbVector::getR(), ossimMapProjection::inverse(), ossimProjection::origin(), theBrushColor, theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, theThickness, ossimGeoAnnotationMultiPolyObject::transform(), and ossimRefPtr< T >::valid().

1947 {
1948  ossimRgbVector color;
1949 
1950  if(theFillFlag)
1951  {
1952  color = theBrushColor;
1953  }
1954  else
1955  {
1956  color = thePenColor;
1957  }
1958  ossimGpt origin;
1959  ossim_uint32 numGeometries = multiPolygon->getNumGeometries();
1960 
1962  {
1963  origin = theImageGeometry->getProjection()->origin();
1964  }
1965 
1966  vector<ossimGeoPolygon> geoPoly;
1967  for(ossim_uint32 geomIdx = 0; geomIdx < numGeometries; ++geomIdx)
1968  {
1969  OGRGeometry* geomRef = multiPolygon->getGeometryRef(geomIdx);
1970  if( geomRef &&
1971  ( (geomRef->getGeometryType()==wkbPolygon) ||
1972  (geomRef->getGeometryType()==wkbPolygon25D) ) )
1973  {
1974  geoPoly.push_back(ossimGeoPolygon());
1975  OGRPolygon* poly = (OGRPolygon*)geomRef;
1976  OGRLinearRing* ring = poly->getExteriorRing();
1977  ossim_uint32 currentPoly = geoPoly.size()-1;
1978 
1979  if(ring)
1980  {
1981  ossim_uint32 upper = ring->getNumPoints();
1982 
1983  for(ossim_uint32 ringPointIdx = 0;
1984  ringPointIdx < upper;
1985  ++ringPointIdx)
1986  {
1987  OGRPoint ogrPt;
1988  ring->getPoint(ringPointIdx, &ogrPt);
1989  if(mapProj)
1990  {
1991  geoPoly[currentPoly].addPoint(
1992  mapProj->inverse(ossimDpt(ogrPt.getX(), ogrPt.getY())));
1993  }
1994  else
1995  {
1996  geoPoly[currentPoly].addPoint(ogrPt.getY(),
1997  ogrPt.getX(),
1998  ogrPt.getZ(),
1999  origin.datum());
2000  }
2001  }
2002  }
2003 
2004  ossim_uint32 bound = poly->getNumInteriorRings();
2005 
2006  if(bound)
2007  {
2008  for(ossim_uint32 interiorRingIdx = 0;
2009  interiorRingIdx < bound;
2010  ++interiorRingIdx)
2011  {
2012  ring = poly->getInteriorRing(interiorRingIdx);
2013 
2014  if(ring)
2015  {
2016  geoPoly.push_back(ossimGeoPolygon());
2017  currentPoly = geoPoly.size()-1;
2018 
2019  ossim_uint32 upper = ring->getNumPoints();
2020 
2021  for(ossim_uint32 interiorRingPointIdx = 0;
2022  interiorRingPointIdx < upper;
2023  ++interiorRingPointIdx)
2024  {
2025  OGRPoint ogrPt;
2026  ring->getPoint(interiorRingPointIdx, &ogrPt);
2027  if(mapProj)
2028  {
2029  geoPoly[currentPoly].addPoint(
2030  mapProj->inverse(ossimDpt(ogrPt.getX(),
2031  ogrPt.getY())));
2032  }
2033  else
2034  {
2035  geoPoly[currentPoly].addPoint(ogrPt.getY(),
2036  ogrPt.getX(),
2037  ogrPt.getZ(),
2038  origin.datum());
2039  }
2040  }
2041  }
2042  }
2043  }
2044  }
2045  }
2046 
2047  if(geoPoly.size())
2048  {
2049  ossimGeoAnnotationMultiPolyObject* annotation =
2051  theFillFlag,
2052  color.getR(),
2053  color.getG(),
2054  color.getB(),
2055  theThickness);
2056  if(theImageGeometry.valid())
2057  {
2058  annotation->transform(theImageGeometry.get());
2059  }
2060 
2061  theFeatureCacheTable.insert(make_pair(id, annotation));
2062  }
2063 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
unsigned int ossim_uint32
unsigned char getB() const
virtual void transform(ossimImageGeometry *projection)
unsigned char getG() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimGpt origin() const =0

◆ loadOmdFile()

void ossimGdalOgrVectorAnnotation::loadOmdFile ( )
protected

Looks for "file.omd" and loads pen, brush and point settings if present.

Definition at line 2211 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimKeywordlist::addFile(), ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimString::c_str(), ossimFilename::exists(), ossimKeywordlist::find(), ossimUnitConversionTool::getValue(), ossimUnitTypeLut::instance(), OSSIM_DEGREES, OSSIM_UNIT_UNKNOWN, ossimFilename::setExtension(), theBorderSize, theBorderSizeUnits, theBrushColor, theFilename, and ossimString::toDouble().

2212 {
2213  ossimFilename filename = theFilename;
2214  filename.setExtension(".omd");
2215  if(!filename.exists())
2216  {
2217  filename.setExtension(".OMD");
2218  }
2219 
2220  if( filename.exists() )
2221  {
2222  ossimKeywordlist kwl;
2223  if( kwl.addFile(filename) )
2224  {
2225  //---
2226  // Because loadState can call open() we will not call it here to
2227  // avoid a circuliar loop. This duplicates some code but is safer.
2228  //---
2229  const char* lookup = 0;
2230 
2231  // Border:
2233  if (lookup)
2234  {
2235  theBorderSize = ossimString(lookup).toDouble();
2237  ossimString(".");
2238 
2240  getEntryNumber(kwl, unitPrefix.c_str());
2242  {
2245 
2246  theBorderSize = unitConvert.getValue(OSSIM_DEGREES);
2248  }
2249  else // assume degrees
2250  {
2252  }
2253  }
2254 
2255  // Brush color:
2257  if (lookup)
2258  {
2259  int r, g, b;
2260  std::istringstream s(lookup);
2261  s>>r>>g>>b;
2263  (ossim_uint8)g,
2264  (ossim_uint8)b);
2265  }
2266  else
2267  {
2268  lookup = kwl.find(NORMALIZED_RGB_BRUSH_COLOR_KW);
2269  if (lookup)
2270  {
2271  ossim_float64 r;
2272  ossim_float64 g;
2273  ossim_float64 b;
2274 
2275  std::istringstream in(lookup);
2276  in >> r >> g >> b;
2277 
2278  if ( (r >= 0.0) && (r <=1.0) )
2279  {
2280  theBrushColor.setR(static_cast<ossim_uint8>(r*255.0+0.5));
2281  }
2282  if ( (g >= 0.0) && (g <=1.0) )
2283  {
2284  theBrushColor.setG(static_cast<ossim_uint8>(g*255.0+0.5));
2285  }
2286  if ( (b >= 0.0) && (b <=1.0) )
2287  {
2288  theBrushColor.setB(static_cast<ossim_uint8>(b*255.0+0.5));
2289  }
2290  }
2291  }
2292 
2293  // Fill:
2294  lookup = kwl.find(ossimKeywordNames::FILL_FLAG_KW);
2295  if (lookup)
2296  {
2297  theFillFlag = ossimString(lookup).toBool();
2298  }
2299 
2300  // Pen color:
2301  lookup = kwl.find(ossimKeywordNames::PEN_COLOR_KW);
2302  if (lookup)
2303  {
2304  int r, g, b;
2305  std::istringstream s(lookup);
2306  s>>r>>g>>b;
2308  (ossim_uint8)g,
2309  (ossim_uint8)b);
2310  }
2311  else
2312  {
2313  lookup = kwl.find(NORMALIZED_RGB_PEN_COLOR_KW);
2314  if (lookup)
2315  {
2316  ossim_float64 r;
2317  ossim_float64 g;
2318  ossim_float64 b;
2319 
2320  std::istringstream in(lookup);
2321  in >> r >> g >> b;
2322 
2323  if ( (r >= 0.0) && (r <=1.0) )
2324  {
2325  thePenColor.setR(static_cast<ossim_uint8>(r * 255.0 + 0.5));
2326  }
2327  if ( (g >= 0.0) && (g <=1.0) )
2328  {
2329  thePenColor.setG(static_cast<ossim_uint8>(g * 255.0 + 0.5));
2330  }
2331  if ( (b >= 0.0) && (b <=1.0) )
2332  {
2333  thePenColor.setB(static_cast<ossim_uint8>(b * 255.0 + 0.5));
2334  }
2335  }
2336  }
2337 
2338  // Point size:
2340  if (!lookup)
2341  {
2342  lookup = kwl.find(POINT_SIZE_KW);
2343  }
2344  if (lookup)
2345  {
2346  ossim_float64 x;
2347  ossim_float64 y;
2348 
2349  std::istringstream in(lookup);
2350  in >> x >> y;
2351 
2352  if ( (x > 0.0) && (y > 0.0) )
2353  {
2356  }
2357  }
2358 
2359  // Thickness:
2360  lookup = kwl.find(ossimKeywordNames::THICKNESS_KW);
2361  if (lookup)
2362  {
2363  setThickness(ossimString(lookup).toInt32());
2364  }
2365 
2366  // Update the feature table.
2368 
2369  } // matches: if( kwl.addFile(filename) )
2370 
2371  } // matches: if(filename.exists())
2372 }
ossim_uint32 x
static const char * BRUSH_COLOR_KW
ossimUnitType
Represents serializable keyword/value map.
bool addFile(const char *file)
ossim_uint32 y
const char * find(const char *key) const
void setR(unsigned char R)
double y
Definition: ossimDpt.h:165
void setB(unsigned char B)
double ossim_float64
bool exists() const
bool toBool() const
String to numeric methods.
static const char * FILL_FLAG_KW
double toDouble() const
static const char * BORDER_SIZE_KW
void setG(unsigned char G)
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
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
static const char * POINT_WIDTH_HEIGHT_KW
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
static ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.
static const char * THICKNESS_KW
unsigned char ossim_uint8
virtual void setThickness(ossim_int32 thickness)

◆ loadPoint()

void ossimGdalOgrVectorAnnotation::loadPoint ( long  id,
OGRPoint *  point,
ossimMapProjection mapProj 
)
protected

Definition at line 1834 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimGpt::datum(), ossimRefPtr< T >::get(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageGeometry::getProjection(), ossimRgbVector::getR(), ossimMapProjection::inverse(), ossimProjection::origin(), theBrushColor, theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, thePointWidthHeight, theThickness, ossimGeoAnnotationEllipseObject::transform(), and ossimRefPtr< T >::valid().

1835 {
1836  ossimGpt origin;
1837  ossimRgbVector color;
1838 
1839  if(theFillFlag)
1840  {
1841  color = theBrushColor;
1842  }
1843  else
1844  {
1845  color = thePenColor;
1846  }
1848  {
1849  origin = theImageGeometry->getProjection()->origin();
1850  }
1851 
1852  ossimGpt gpt;
1853  if(mapProj)
1854  {
1855  ossimDpt eastingNorthing(point->getX(),
1856  point->getY());
1857 
1858  gpt = mapProj->inverse(eastingNorthing);
1859  }
1860  else
1861  {
1862  gpt = ossimGpt(point->getY(),
1863  point->getX(),
1864  point->getZ(),
1865  origin.datum());
1866  }
1867 
1868 
1869  ossimGeoAnnotationEllipseObject* annotation =
1872  theFillFlag,
1873  color.getR(),
1874  color.getG(),
1875  color.getB(),
1876  theThickness);
1877  if(theImageGeometry.valid())
1878  {
1879  annotation->transform(theImageGeometry.get());
1880  }
1881  theFeatureCacheTable.insert(make_pair(id, annotation));
1882 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
virtual void transform(ossimImageGeometry *projection)
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
unsigned char getB() const
unsigned char getG() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimGpt origin() const =0

◆ loadPolygon()

void ossimGdalOgrVectorAnnotation::loadPolygon ( long  id,
OGRPolygon *  polygon,
ossimMapProjection mapProj 
)
protected

Definition at line 1595 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimGpt::datum(), ossimRefPtr< T >::get(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageGeometry::getProjection(), ossimRgbVector::getR(), ossimMapProjection::inverse(), ossimProjection::origin(), ossimGeoAnnotationPolyObject::OSSIM_POLY_INTERIOR_RING, ossimGeoAnnotationPolyObject::setPolyType(), theBrushColor, theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, theThickness, ossimGeoAnnotationObject::transform(), ossimGeoAnnotationPolyObject::transform(), and ossimRefPtr< T >::valid().

1596 {
1597  OGRLinearRing* ring = poly->getExteriorRing();
1598 
1599  ossimGpt origin;
1600 
1602  {
1603  origin = theImageGeometry->getProjection()->origin();
1604  }
1605 
1606  ossimRgbVector color;
1607 
1608  if(theFillFlag)
1609  {
1610  color = theBrushColor;
1611  }
1612  else
1613  {
1614  color = thePenColor;
1615  }
1616 
1617  if(ring)
1618  {
1619  int upper = ring->getNumPoints();
1620  vector<ossimGpt> points(upper);
1621  for(int i = 0; i < upper; ++i)
1622  {
1623  OGRPoint ogrPt;
1624  ring->getPoint(i, &ogrPt);
1625  if(mapProj)
1626  {
1627  points[i] = mapProj->inverse(ossimDpt(ogrPt.getX(),
1628  ogrPt.getY()));
1629 
1630  }
1631  else
1632  {
1633  points[i] = ossimGpt(ogrPt.getY(),
1634  ogrPt.getX(),
1635  ogrPt.getZ(),
1636  origin.datum());
1637  }
1638  }
1639  ossimGeoAnnotationObject* annotation =
1640  new ossimGeoAnnotationPolyObject(points,
1641  theFillFlag,
1642  color.getR(),
1643  color.getG(),
1644  color.getB(),
1645  theThickness);
1646  if(theImageGeometry.valid())
1647  {
1648  annotation->transform(theImageGeometry.get());
1649  }
1650 
1651  theFeatureCacheTable.insert(make_pair(id,
1652  annotation));
1653  }
1654  int bound = poly->getNumInteriorRings();
1655  if(bound)
1656  {
1657  for(int i = 0; i < bound; ++i)
1658  {
1659  ring = poly->getInteriorRing(i);
1660  if(ring)
1661  {
1662  int j = 0;
1663  int upper = ring->getNumPoints();
1664  vector<ossimGpt> points(upper);
1665  for(j = 0; j < upper; ++j)
1666  {
1667  OGRPoint ogrPt;
1668  ring->getPoint(j, &ogrPt);
1669  if(mapProj)
1670  {
1671  ossimDpt eastingNorthing(ogrPt.getX(),
1672  ogrPt.getY());
1673 
1674  points[j] = mapProj->inverse(eastingNorthing);
1675 
1676  }
1677  else
1678  {
1679  points[j] = ossimGpt(ogrPt.getY(),
1680  ogrPt.getX(),
1681  ogrPt.getZ(),
1682  origin.datum());
1683  }
1684  }
1685  ossimGeoAnnotationPolyObject* annotation =
1686  new ossimGeoAnnotationPolyObject(points,
1687  theFillFlag,
1688  color.getR(),
1689  color.getG(),
1690  color.getB(),
1691  theThickness);
1693 
1694  if(theImageGeometry.valid())
1695  {
1696  annotation->transform(theImageGeometry.get());
1697  }
1698 
1699  theFeatureCacheTable.insert(make_pair(id,
1700  annotation));
1701 
1702  }
1703  }
1704  }
1705 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
virtual void transform(ossimImageGeometry *projection)
virtual void transform(ossimImageGeometry *projection)=0
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
virtual void setPolyType(ossimPolyType polyType)
unsigned char getB() const
unsigned char getG() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimGpt origin() const =0

◆ loadState()

bool ossimGdalOgrVectorAnnotation::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
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 1055 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimString::c_str(), deleteTables(), ossimKeywordNames::FILENAME_KW, ossimKeywordNames::FILL_FLAG_KW, ossimKeywordlist::find(), ossimUnitConversionTool::getValue(), initializeTables(), ossimUnitTypeLut::instance(), ossimAnnotationSource::loadState(), m_needPenColor, open(), OSSIM_DEGREES, OSSIM_UNIT_UNKNOWN, ossimKeywordNames::PEN_COLOR_KW, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW, ossimKeywordNames::QUERY_KW, setQuery(), setThickness(), ossimString::split(), status, theBorderSize, theBorderSizeUnits, theBrushColor, theFillFlag, thePenColor, thePointWidthHeight, ossimKeywordNames::THICKNESS_KW, ossimString::toBool(), and ossimString::toDouble().

Referenced by ossimOgrGdalTileSource::loadState().

1057 {
1058  const char* filename = kwl.find(prefix, ossimKeywordNames::FILENAME_KW);
1059  const char* penColor = kwl.find(prefix, ossimKeywordNames::PEN_COLOR_KW);
1060  const char* brushColor = kwl.find(prefix, ossimKeywordNames::BRUSH_COLOR_KW);
1061  const char* fillFlag = kwl.find(prefix, ossimKeywordNames::FILL_FLAG_KW);
1062  const char* thickness = kwl.find(prefix, ossimKeywordNames::THICKNESS_KW);
1063  const char* pointWh = kwl.find(prefix, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW);
1064  const char* border_size = kwl.find(prefix, ossimKeywordNames::BORDER_SIZE_KW);
1065  const char* query = kwl.find(prefix, ossimKeywordNames::QUERY_KW);
1066 
1067  deleteTables();
1068  if(thickness)
1069  {
1070  setThickness(ossimString(thickness).toInt32());
1071  }
1072 
1073  if(penColor)
1074  {
1075  int r = 0;
1076  int g = 0;
1077  int b = 0;
1078  ossimString penColorStr = ossimString(penColor);
1079  if (penColorStr.split(",").size() == 3)
1080  {
1081  r = penColorStr.split(",")[0].toInt();
1082  g = penColorStr.split(",")[1].toInt();
1083  b = penColorStr.split(",")[2].toInt();
1084  if (r == 0 && g == 0 && b == 0)
1085  {
1086  r = 1;
1087  g = 1;
1088  b = 1;
1089  }
1090  }
1092  m_needPenColor = true;
1093  }
1094 
1095  if(brushColor)
1096  {
1097  int r = 0;
1098  int g = 0;
1099  int b = 0;
1100  ossimString brushColorStr = ossimString(brushColor);
1101  if (brushColorStr.split(",").size() == 3)
1102  {
1103  r = brushColorStr.split(",")[0].toInt();
1104  g = brushColorStr.split(",")[1].toInt();
1105  b = brushColorStr.split(",")[2].toInt();
1106  if (r == 0 && g == 0 && b == 0)
1107  {
1108  r = 1;
1109  g = 1;
1110  b = 1;
1111  }
1112  }
1113 
1115  }
1116  if(pointWh)
1117  {
1118  double w, h;
1119  std::istringstream s(pointWh);
1120  s>>w>>h;
1121  thePointWidthHeight = ossimDpt(w, h);
1122  }
1123 
1124  if(fillFlag)
1125  {
1126  theFillFlag = ossimString(fillFlag).toBool();
1127  }
1128  theBorderSize = 0.0;
1129  if(border_size)
1130  {
1131  theBorderSize = ossimString(border_size).toDouble();
1132  ossimString unitPrefix = ossimString(prefix) +
1134  ossimString(".");
1135 
1137  getEntryNumber(kwl,
1138  unitPrefix.c_str());
1140  {
1143 
1144  theBorderSize = unitConvert.getValue(OSSIM_DEGREES);
1146  }
1147  else // assume degrees
1148  {
1150  }
1151  }
1152  else
1153  {
1154  theBorderSize = 0.0;
1156  }
1157 
1158  if(filename)
1159  {
1160  if(!open(ossimFilename(filename)))
1161  {
1162  return false;
1163  }
1164  }
1165 
1166  if (query)
1167  {
1168  setQuery(query);
1169  }
1170 
1171  bool status = ossimAnnotationSource::loadState(kwl, prefix);
1172 
1173  initializeTables();
1174 
1175  return status;
1176 }
void setQuery(const ossimString &query)
static const char * BRUSH_COLOR_KW
ossimUnitType
const char * find(const char *key) const
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
static const char * QUERY_KW
bool toBool() const
String to numeric methods.
static const char * FILL_FLAG_KW
double toDouble() const
static const char * BORDER_SIZE_KW
return status
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 ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.
static const char * FILENAME_KW
static const char * THICKNESS_KW
unsigned char ossim_uint8
virtual void setThickness(ossim_int32 thickness)

◆ open() [1/2]

bool ossimGdalOgrVectorAnnotation::open ( )
virtual

◆ open() [2/2]

bool ossimGdalOgrVectorAnnotation::open ( const ossimFilename file)
virtual

Definition at line 265 of file ossimGdalOgrVectorAnnotation.cpp.

266 {
267  const char* MODULE = "ossimGdalOgrVectorAnnotation::open";
268  if(traceDebug())
269  {
270  ossimNotify(ossimNotifyLevel_NOTICE) << MODULE << " entered...\nfile: " << file << "\n";
271  }
272 
273  if(isOpen())
274  {
275  close();
276  }
277  m_layerNames.clear();
278  if(file == "") return false;
279 
280 #if 0 /* Commented out but please leave until I test. drb - 15 July 2011 */
281  ossimString ext = file.ext().downcase();
282  if ( ext != "shp" )
283  {
284  //---
285  // OGRSFDriverRegistrar::Open very touchy and crashes if given a file it cannot handle.
286  // Only allow one type of extension to open file.
287  //---
288  return false;
289  }
290 #endif
291 
292  // theDataSource = OGRSFDriverRegistrar::Open( file.c_str(), false, &theDriver );
293  theDataSource = (OGRDataSource*) OGROpen( file.c_str(), false, NULL );
294  if ( theDataSource )
295  {
296  theDriver = (OGRSFDriver*) theDataSource->GetDriver();
297  }
298 
299  if ( !theDataSource || !theDriver )
300  {
301  if(traceDebug())
302  {
303  ossimNotify(ossimNotifyLevel_NOTICE) << "OGRSFDriverRegistrar::Open failed...\n";
304  }
305  return false;
306  }
307 
308  // Capture the file. Need here for loadExternalGeometryFile method.
309  theFilename = file;
310 
311  // This will set theViewProjection if "file.geom" is present and valid.
313 
314  // This will load external pen, brush and point attributes.
315  loadOmdFile();
316 
318  vector<ossimGpt> points;
319  if(isOpen())
320  {
321  int i = 0;
322  int layerCount = 0;
323  if (!m_query.empty())
324  {
325  layerCount = 1;
326  }
327  else if (!m_layerName.empty())
328  {
329  layerCount = 1;
330  }
331  else
332  {
333  layerCount = theDataSource->GetLayerCount();
334  }
335 
336  bool successfulTest = true;
337  if(layerCount)
338  {
339  theLayersToRenderFlagList.resize(layerCount);
340  for(i = 0; (i < layerCount)&&successfulTest; ++i)
341  {
342  OGRLayer* layer = NULL;
343  if (!m_query.empty())
344  {
345  layer = theDataSource->ExecuteSQL(m_query, NULL, NULL);
346  }
347  else if (!m_layerName.empty())
348  {
349  layer = theDataSource->GetLayerByName(m_layerName.c_str());
350  }
351  else
352  {
353  layer = theDataSource->GetLayer(i);
354  }
355 
356  if(layer)
357  {
358  OGRSpatialReference* spatialReference = layer->GetSpatialRef();
359  theLayersToRenderFlagList[i] = true;
360  m_layerNames.push_back(ossimString(layer->GetLayerDefn()->GetName()));
361 
362  if(!spatialReference)
363  {
364  //try xml file
365  if (!theImageGeometry.valid())
366  {
368  }
369 
370  if(traceDebug())
371  {
373  << MODULE
374  << " No spatial reference given, assuming geographic"
375  << endl;
376  }
377  }
378  else if(spatialReference->IsLocal())
379  {
380  if(traceDebug())
381  {
383  << MODULE
384  << " Only geographic vectors and projected vectors "
385  << "are supported, layer " << i << " is local" << endl;
386  }
387  successfulTest = false;
388  }
389 
390  }
391  else
392  {
393 
394  if(traceDebug())
395  {
397 
398  << MODULE
399  << " layer " << i << " is null." << endl;
400  }
401  successfulTest = false;
402  }
403 
404  if(successfulTest&&layer)
405  {
406  if (!theImageGeometry.valid())
407  {
408  ossimRefPtr<ossimProjection> proj = createProjFromReference(layer->GetSpatialRef());
409  if(proj.valid())
410  {
411  theImageGeometry = new ossimImageGeometry(0, proj.get());
412  }
413  }
414  ossimMapProjection* mapProj = 0;
415  if(theImageGeometry.valid())
416  {
418  }
419  if (!mapProj)
420  {
421  theImageGeometry = 0;
422  }
423 
424  if(i == 0)
425  {
426  layer->GetExtent(&theBoundingExtent, true);
427  if(mapProj)
428  {
429  if (layer->GetSpatialRef())
430  {
431  double unitValue = layer->GetSpatialRef()->GetLinearUnits();
432  theBoundingExtent.MinX = theBoundingExtent.MinX * unitValue;
433  theBoundingExtent.MaxY = theBoundingExtent.MaxY * unitValue;
434  theBoundingExtent.MaxX = theBoundingExtent.MaxX * unitValue;
435  theBoundingExtent.MinY = theBoundingExtent.MinY * unitValue;
436  }
437 
438  ossimDrect rect(theBoundingExtent.MinX,
439  theBoundingExtent.MaxY,
440  theBoundingExtent.MaxX,
441  theBoundingExtent.MinY,
443 
444  ossimGpt g1 = mapProj->inverse(rect.ul());
445  ossimGpt g2 = mapProj->inverse(rect.ur());
446  ossimGpt g3 = mapProj->inverse(rect.lr());
447  ossimGpt g4 = mapProj->inverse(rect.ll());
448  ossimDrect rect2 = ossimDrect(ossimDpt(g1),
449  ossimDpt(g2),
450  ossimDpt(g3),
451  ossimDpt(g4));
452 
453  theBoundingExtent.MinX = rect2.ul().x;
454  theBoundingExtent.MinY = rect2.ul().y;
455  theBoundingExtent.MaxX = rect2.lr().x;
456  theBoundingExtent.MaxY = rect2.lr().y;
457 
458  //insert the bounding values to points to convert to bounding rect
459  points.push_back(g1);
460  points.push_back(g2);
461  points.push_back(g3);
462  points.push_back(g4);
463  }
464  }
465  else
466  {
467  OGREnvelope extent;
468  layer->GetExtent(&extent, true);
469  if(mapProj)
470  {
471  ossimDrect rect(extent.MinX,
472  extent.MaxY,
473  extent.MaxX,
474  extent.MinY,
476 
477  ossimGpt g1 = mapProj->inverse(rect.ul());
478  ossimGpt g2 = mapProj->inverse(rect.ur());
479  ossimGpt g3 = mapProj->inverse(rect.lr());
480  ossimGpt g4 = mapProj->inverse(rect.ll());
481  ossimDrect rect2 = ossimDrect(ossimDpt(g1),
482  ossimDpt(g2),
483  ossimDpt(g3),
484  ossimDpt(g4));
485  extent.MinX = rect2.ul().x;
486  extent.MinY = rect2.ul().y;
487  extent.MaxX = rect2.lr().x;
488  extent.MaxY = rect2.lr().y;
489 
490  //compare the current values of points with the first layer to
491  //get the MBR of the datasource
492  if (points.size() == 4)
493  {
494  if (doubleLess(g1.lon, points[0].lon, 0.0001))
495  {
496  points[0].lon = g1.lon;
497  }
498  if (doubleGreater(g1.lat, points[0].lat, 0.0001))
499  {
500  points[0].lat = g1.lat;
501  }
502  if (doubleGreater(g2.lon, points[1].lon, 0.0001))
503  {
504  points[1].lon = g2.lon;
505  }
506  if (doubleGreater(g2.lat, points[1].lat, 0.0001))
507  {
508  points[1].lat = g2.lat;
509  }
510  if (doubleGreater(g3.lon, points[2].lon, 0.0001))
511  {
512  points[2].lon = g3.lon;
513  }
514  if (doubleLess(g3.lat, points[2].lat, 0.0001))
515  {
516  points[2].lat = g3.lat;
517  }
518  if (doubleLess(g4.lon, points[3].lon, 0.0001))
519  {
520  points[3].lon = g4.lon;
521  }
522  if (doubleLess(g4.lat, points[3].lat, 0.0001))
523  {
524  points[3].lat = g4.lat;
525  }
526  }
527  }
528  theBoundingExtent.MinX = std::min(extent.MinX,
529  theBoundingExtent.MinX);
530  theBoundingExtent.MinY = std::min(extent.MinY,
531  theBoundingExtent.MinY);
532  theBoundingExtent.MaxX = std::max(extent.MaxX,
533  theBoundingExtent.MaxX);
534  theBoundingExtent.MaxY = std::max(extent.MaxY,
535  theBoundingExtent.MaxY);
536  }
537  }
538 
539  //if an OGRLayer pointer representing a results set from the query, this layer is
540  //in addition to the layers in the data store and must be destroyed with
541  //OGRDataSource::ReleaseResultSet() before the data source is closed (destroyed).
542  if (!m_query.empty() && layer != NULL)
543  {
544  theDataSource->ReleaseResultSet(layer);
545  }
546  }
547  }
548  if(!successfulTest)
549  {
550  delete theDataSource;
551  theDataSource = NULL;
553 
554  return false;
555  }
556  }
557  if(traceDebug())
558  {
559  CLOG << "Extents = "
560  << theBoundingExtent.MinX << ", "
561  << theBoundingExtent.MinY << ", "
562  << theBoundingExtent.MaxX << ", "
563  << theBoundingExtent.MaxY << endl;
564  }
565  if(!theImageGeometry.valid())
566  {
568  }
569  else
570  {
572  }
573 
574  //initialize the bounding rect
575  initializeBoundingRec(points);
576 
577  //only initializeTables when need to draw features. This eliminate the memory allocate problem
578  //when only do ossim-info for a large shape file
579  //initializeTables();
580 
581  if (traceDebug())
582  {
584  << MODULE << " DEBUG:"
585  << "\ntheViewProjection:"
586  << endl;
587  if(theImageGeometry.valid())
588  {
590  }
592  }
593 
594  return (theDataSource!=NULL);
595 }
void loadOmdFile()
Looks for "file.omd" and loads pen, brush and point settings if present.
bool doubleGreater(double first, double second, double epsilon, bool orequal=false)
void loadExternalGeometryFile()
Will set theViewProjection if geometry file is present with projection.
void loadExternalImageGeometryFromXml()
Will set theViewProjection if xml file is present with projection.
#define CLOG
Definition: ossimTrace.h:23
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
std::ostream & print(std::ostream &out) const
Prints contents to output stream.
const ossimDpt & ul() const
Definition: ossimDrect.h:339
double y
Definition: ossimDpt.h:165
bool doubleLess(double first, double second, double epsilon, bool orequal=false)
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const =0
Will take a point in meters and convert it to ground.
ossim_float64 lon
Definition: ossimGpt.h:266
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
#define max(a, b)
Definition: auxiliary.h:76
void verifyViewParams()
Checks for nan scale and tie point.
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
bool empty() const
Definition: ossimString.h:411
ossimString ext() const
ossim_float64 lat
Definition: ossimGpt.h:265
ossimProjection * createProjFromReference(OGRSpatialReference *reference) const
const ossimDpt & lr() const
Definition: ossimDrect.h:341
std::vector< ossimString > m_layerNames
void initializeBoundingRec(vector< ossimGpt > points)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
#define min(a, b)
Definition: auxiliary.h:75

◆ print()

std::ostream & ossimGdalOgrVectorAnnotation::print ( std::ostream &  out) const
virtual

Outputs theErrorStatus as an ossimErrorCode and an ossimString.

Returns
std::ostream&
Note
Derived classes should only have to implement a virtual print, not an operator<< funtion as it's implemented here.

Reimplemented from ossimSource.

Definition at line 1178 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimSource::print(), theLayersToRenderFlagList, and theLayerTable.

1179 {
1180  out << "ossimGdalOgrVectorAnnotation::print"
1181  << "\ntheLayersToRenderFlagList.size(): "
1182  << theLayersToRenderFlagList.size()
1183  << "\ntheLayerTable.size(): " << theLayerTable.size();
1184 
1185  ossim_uint32 i;
1186  for(i=0; i<theLayersToRenderFlagList.size(); ++i)
1187  {
1188  out << "layer[" << i << "]:"
1189  << (theLayersToRenderFlagList[i]?"enabled":"disabled")
1190  << std::endl;
1191  }
1192  return ossimAnnotationSource::print(out);
1193 }
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
unsigned int ossim_uint32
std::vector< ossimOgrGdalLayerNode * > theLayerTable

◆ saveState()

bool ossimGdalOgrVectorAnnotation::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Saves the current state of this object.

Reimplemented from ossimAnnotationSource.

Definition at line 974 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimKeywordlist::add(), ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimString::c_str(), ossimString::empty(), ossimKeywordNames::FILENAME_KW, ossimKeywordNames::FILL_FLAG_KW, ossimRgbVector::getB(), ossimRgbVector::getG(), ossimRgbVector::getR(), getThickness(), ossimUnitTypeLut::instance(), m_query, ossimKeywordNames::PEN_COLOR_KW, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW, ossimKeywordNames::QUERY_KW, ossimAnnotationSource::saveState(), ossimImageGeometry::saveState(), theBorderSize, theBorderSizeUnits, theBrushColor, theFilename, theFillFlag, theImageGeometry, thePenColor, thePointWidthHeight, ossimKeywordNames::THICKNESS_KW, ossimString::toString(), ossimKeywordNames::UNITS_KW, ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

Referenced by ossimOgrGdalTileSource::saveState().

976 {
977  ossimString s;
978 
979  kwl.add(prefix,
981  theFilename.c_str(),
982  true);
983 
984 
985  s = ossimString::toString((int)thePenColor.getR()) + " " +
986  ossimString::toString((int)thePenColor.getG()) + " " +
988 
989  kwl.add(prefix,
991  s.c_str(),
992  true);
993 
994  s = ossimString::toString((int)theBrushColor.getR()) + " " +
997 
998  kwl.add(prefix,
1000  s.c_str(),
1001  true);
1002 
1003  kwl.add(prefix,
1005  (int)theFillFlag,
1006  true);
1007 
1008  kwl.add(prefix,
1010  getThickness(),
1011  true);
1012 
1013  ossimString border;
1015  border += " degrees";
1016  kwl.add(prefix,
1018  border,
1019  true);
1020 
1021  kwl.add(prefix,
1023  "."+
1024  ossimKeywordNames::UNITS_KW).c_str(),
1026  true);
1027 
1028  s = ossimString::toString((int)thePointWidthHeight.x) + " " +
1030 
1031  kwl.add(prefix,
1033  s.c_str(),
1034  true);
1035 
1036  if (!m_query.empty())
1037  {
1038  kwl.add(prefix,
1040  m_query.c_str(),
1041  true);
1042  }
1043 
1044  if(theImageGeometry.valid())
1045  {
1046  ossimString newPrefix = prefix;
1047  newPrefix += "view_proj.";
1049  newPrefix.c_str());
1050  }
1051 
1052  return ossimAnnotationSource::saveState(kwl, prefix);
1053 }
static const char * BRUSH_COLOR_KW
unsigned char getR() const
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
static ossimString toString(bool aValue)
Numeric to string methods.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * QUERY_KW
static const char * FILL_FLAG_KW
static const char * BORDER_SIZE_KW
unsigned char getB() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static const char * UNITS_KW
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
bool empty() const
Definition: ossimString.h:411
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 ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.
static const char * FILENAME_KW
static const char * THICKNESS_KW

◆ setBrushColor()

void ossimGdalOgrVectorAnnotation::setBrushColor ( const ossimRgbVector brushColor)
virtual

Definition at line 2080 of file ossimGdalOgrVectorAnnotation.cpp.

References theBrushColor.

2081 {
2082  theBrushColor = brushColor;
2083 }

◆ setCurrentEntry()

bool ossimGdalOgrVectorAnnotation::setCurrentEntry ( ossim_uint32  entryIdx)

Definition at line 2536 of file ossimGdalOgrVectorAnnotation.cpp.

References m_layerName, m_layerNames, open(), and theFilename.

Referenced by ossimOgrGdalTileSource::setCurrentEntry().

2537 {
2538  if (entryIdx < m_layerNames.size())
2539  {
2540  m_layerName = m_layerNames[entryIdx];
2541  return open(theFilename);
2542  }
2543  return false;
2544 }
std::vector< ossimString > m_layerNames

◆ setFillFlag()

void ossimGdalOgrVectorAnnotation::setFillFlag ( bool  flag)
virtual

Definition at line 2115 of file ossimGdalOgrVectorAnnotation.cpp.

References theFillFlag.

2116 {
2117  theFillFlag=flag;
2118 }

◆ setGeometryBuffer()

void ossimGdalOgrVectorAnnotation::setGeometryBuffer ( ossim_float64  distance,
ossimUnitType  type 
)

Definition at line 259 of file ossimGdalOgrVectorAnnotation.cpp.

References distance(), m_geometryDistance, and m_geometryDistanceType.

Referenced by ossimOgrGdalTileSource::setGeometryBuffer().

260 {
262  m_geometryDistanceType = type;
263 }
float distance(double lat1, double lon1, double lat2, double lon2, int units)

◆ setPenColor()

void ossimGdalOgrVectorAnnotation::setPenColor ( const ossimRgbVector penColor)
virtual

Definition at line 2085 of file ossimGdalOgrVectorAnnotation.cpp.

References thePenColor.

2086 {
2087  thePenColor = penColor;
2088 }

◆ setPointRadius()

void ossimGdalOgrVectorAnnotation::setPointRadius ( double  r)
virtual

Definition at line 2105 of file ossimGdalOgrVectorAnnotation.cpp.

References thePointWidthHeight.

2106 {
2107  thePointWidthHeight = ossimDpt(fabs(r)*2, fabs(r)*2);
2108 }

◆ setProperty()

void ossimGdalOgrVectorAnnotation::setProperty ( ossimRefPtr< ossimProperty property)
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 853 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimKeywordNames::BORDER_SIZE_KW, ossimKeywordNames::BRUSH_COLOR_KW, ossimKeywordNames::FILL_FLAG_KW, ossimKeywordNames::PEN_COLOR_KW, ossimKeywordNames::POINT_WIDTH_HEIGHT_KW, ossimRgbVector::setB(), ossimRgbVector::setG(), ossimImageSourceFilter::setProperty(), ossimRgbVector::setR(), setThickness(), theBrushColor, theFillFlag, thePenColor, thePointWidthHeight, ossimKeywordNames::THICKNESS_KW, ossimString::toBool(), ossimString::toInt32(), updateAnnotationSettings(), ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

Referenced by ossimOgrGdalTileSource::setProperty().

854 {
855  if(!property.valid()) return;
856 
857  ossimString name = property->getName();
858  ossimString value = property->valueToString();
859 
861  {
862  int r;
863  int g;
864  int b;
865  std::istringstream in(value);
866  in >> r >> g >> b;
867  thePenColor.setR((unsigned char)r);
868  thePenColor.setG((unsigned char)g);
869  thePenColor.setB((unsigned char)b);
871  }
872  else if(name == ossimKeywordNames::BRUSH_COLOR_KW)
873  {
874  int r;
875  int g;
876  int b;
877  std::istringstream in(value);
878  in >> r >> g >> b;
879  theBrushColor.setR((unsigned char)r);
880  theBrushColor.setG((unsigned char)g);
881  theBrushColor.setB((unsigned char)b);
883  }
884  else if(name == ossimKeywordNames::FILL_FLAG_KW)
885  {
886  theFillFlag = value.toBool();
888  }
889  else if(name == ossimKeywordNames::THICKNESS_KW)
890  {
891  setThickness(value.toInt32());
893  }
894  else if(name == ossimKeywordNames::BORDER_SIZE_KW)
895  {
896  }
898  {
899  std::istringstream in(value);
900  in >> thePointWidthHeight.x;
901  in >> thePointWidthHeight.y;
903  }
904  else
905  {
907  }
908 }
virtual void setProperty(ossimRefPtr< ossimProperty > property)
static const char * BRUSH_COLOR_KW
bool valid() const
Definition: ossimRefPtr.h:75
void setR(unsigned char R)
double y
Definition: ossimDpt.h:165
void setB(unsigned char B)
ossim_int32 toInt32() const
bool toBool() const
String to numeric methods.
static const char * FILL_FLAG_KW
static const char * BORDER_SIZE_KW
void setG(unsigned char G)
double x
Definition: ossimDpt.h:164
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 * THICKNESS_KW
virtual void setThickness(ossim_int32 thickness)

◆ setQuery()

void ossimGdalOgrVectorAnnotation::setQuery ( const ossimString query)

◆ setThickness()

void ossimGdalOgrVectorAnnotation::setThickness ( ossim_int32  thickness)
virtual

Definition at line 2120 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimNotify(), ossimNotifyLevel_WARN, and theThickness.

Referenced by loadState(), and setProperty().

2121 {
2122  if ( (thickness > 0) && (thickness < 256) )
2123  {
2124  theThickness = static_cast<ossim_uint8>(thickness);
2125  }
2126  else
2127  {
2129  << "ossimGdalOgrVectorAnnotation::setThickness range error: "
2130  << thickness
2131  << "\nValid range: 1 to 255"
2132  << std::endl;
2133  }
2134 }
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ setView()

bool ossimGdalOgrVectorAnnotation::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 631 of file ossimGdalOgrVectorAnnotation.cpp.

References PTR_CAST, ossimImageGeometry::setProjection(), theImageGeometry, and transformObjectsFromView().

Referenced by ossimOgrGdalTileSource::setView().

632 {
633  bool result = false;
634 
635  if(baseObject)
636  {
637  // Test for projection...
638  ossimProjection* p = PTR_CAST(ossimProjection, baseObject);
639  if (p)
640  {
641  if(!theImageGeometry)
642  {
644  }
645  else
646  {
648  }
649 
650  // Reproject the points to the current new projection.
652  result = true;
653 
654  }
655  else
656  {
657  ossimImageGeometry* geom = dynamic_cast<ossimImageGeometry*> (baseObject);
658  if(geom)
659  {
660  theImageGeometry = geom;
661  // Reproject the points to the current new projection.
663  result = true;
664  }
665  }
666  } // if (baseObject)
667 
668  return result;
669 }
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
ossimRefPtr< ossimImageGeometry > theImageGeometry
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
void transformObjectsFromView()
Uses theViewProjection.

◆ transformObjectsFromView()

void ossimGdalOgrVectorAnnotation::transformObjectsFromView ( )
protected

Uses theViewProjection.

Definition at line 1195 of file ossimGdalOgrVectorAnnotation.cpp.

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

Referenced by setView().

1196 {
1197  if (theImageGeometry.valid())
1198  {
1199  if (theFeatureCacheTable.size() == 0)
1200  {
1201  initializeTables();
1202  }
1203  std::multimap<long, ossimAnnotationObject*>::iterator iter =
1204  theFeatureCacheTable.begin();
1205 
1206  while(iter != theFeatureCacheTable.end())
1207  {
1209  (*iter).second);
1210 
1211  if(obj&&theImageGeometry.valid())
1212  {
1213  obj->transform(theImageGeometry.get());
1214  }
1215  ++iter;
1216  }
1218  }
1219 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool valid() const
Definition: ossimRefPtr.h:75
virtual void transform(ossimImageGeometry *projection)=0
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321

◆ updateAnnotationSettings()

void ossimGdalOgrVectorAnnotation::updateAnnotationSettings ( )
protected

Definition at line 811 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimRefPtr< T >::get(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimRgbVector::getR(), PTR_CAST, ossimGeoAnnotationMultiPolyObject::setFillFlag(), ossimGeoAnnotationPolyObject::setFillFlag(), ossimGeoAnnotationEllipseObject::setFillFlag(), ossimGeoAnnotationEllipseObject::setWidthHeight(), theBrushColor, theFeatureCacheTable, theFillFlag, theImageGeometry, thePenColor, thePointWidthHeight, theThickness, and ossimGeoAnnotationEllipseObject::transform().

Referenced by setProperty().

812 {
813  std::multimap<long, ossimAnnotationObject*>::iterator iter = theFeatureCacheTable.begin();
814 
815  while(iter != theFeatureCacheTable.end())
816  {
817  iter->second->setThickness(theThickness);
818 
819  iter->second->setColor(thePenColor.getR(),
820  thePenColor.getG(),
821  thePenColor.getB());
822 
823  if(PTR_CAST(ossimGeoAnnotationPolyObject, iter->second))
824  {
826  (ossimGeoAnnotationPolyObject*)(iter->second);
827  poly->setFillFlag(theFillFlag);
828  }
829  else if(PTR_CAST(ossimGeoAnnotationMultiPolyObject, iter->second))
830  {
832  (ossimGeoAnnotationMultiPolyObject*)(iter->second);
833  poly->setFillFlag(theFillFlag);
834  }
835  else if(PTR_CAST(ossimGeoAnnotationEllipseObject, iter->second))
836  {
838 
840  ell->setFillFlag(theFillFlag);
842  }
843  if(theFillFlag)
844  {
845  iter->second->setColor(theBrushColor.getR(),
847  theBrushColor.getB());
848  }
849  ++iter;
850  }
851 }
std::multimap< long, ossimAnnotationObject * > theFeatureCacheTable
unsigned char getR() const
virtual void setWidthHeight(const ossimDpt &pt)
Sets the width and height of point.
ossimRefPtr< ossimImageGeometry > theImageGeometry
virtual void transform(ossimImageGeometry *projection)
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
unsigned char getB() const
unsigned char getG() const
virtual void setFillFlag(bool flag)
Sets the fill flag.

◆ verifyViewParams()

void ossimGdalOgrVectorAnnotation::verifyViewParams ( )
protected

Checks for nan scale and tie point.

Sets to some default if nan.

Definition at line 2485 of file ossimGdalOgrVectorAnnotation.cpp.

References ossimMapProjection::getDecimalDegreesPerPixel(), ossimMapProjection::getMetersPerPixel(), ossimImageGeometry::getProjection(), ossimMapProjection::getUlGpt(), ossimDpt::hasNans(), ossimMapProjection::isGeographic(), ossimGpt::isLatNan(), ossimGpt::isLonNan(), PTR_CAST, ossimMapProjection::setDecimalDegreesPerPixel(), ossimMapProjection::setMetersPerPixel(), ossimMapProjection::setUlGpt(), theBoundingExtent, theImageGeometry, and ossimRefPtr< T >::valid().

2486 {
2487  if (!theImageGeometry.valid())
2488  {
2489  return;
2490  }
2491 
2494  if (!proj)
2495  {
2496  return;
2497  }
2498 
2499  ossimGpt ulGpt = proj->getUlGpt();
2500  if ( ulGpt.isLatNan() || ulGpt.isLonNan() )
2501  {
2502  proj->setUlGpt( ossimGpt(theBoundingExtent.MaxY,
2503  theBoundingExtent.MinX) );
2504  }
2505 
2506  if (proj->isGeographic())
2507  {
2508  ossimDpt pt = proj->getDecimalDegreesPerPixel();
2509  if( pt.hasNans() )
2510  {
2511  // roughly... 10 meters per pixel in decimal degrees.
2512  ossim_float64 d = 1.0 / 11131.49079;
2513  proj->setDecimalDegreesPerPixel(ossimDpt(d, d));
2514  }
2515 
2516  }
2517  else
2518  {
2519  ossimDpt pt = proj->getMetersPerPixel();
2520  if (pt.hasNans())
2521  {
2522  proj->setMetersPerPixel(ossimDpt(10.0, 10.0));
2523  }
2524  }
2525 }
virtual const ossimDpt & getDecimalDegreesPerPixel() const
Returns decimal degrees per pixel as an ossimDpt with "x" representing longitude and "y" representing...
ossimRefPtr< ossimImageGeometry > theImageGeometry
bool isLonNan() const
Definition: ossimGpt.h:140
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool isGeographic() const
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
bool isLatNan() const
Definition: ossimGpt.h:139
virtual void setUlGpt(const ossimGpt &ulGpt)
virtual void setMetersPerPixel(const ossimDpt &gsd)
double ossim_float64
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
bool hasNans() const
Definition: ossimDpt.h:67
virtual const ossimGpt & getUlGpt() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimDpt getMetersPerPixel() const

Member Data Documentation

◆ m_geometryDistance

ossim_float64 ossimGdalOgrVectorAnnotation::m_geometryDistance
protected

Definition at line 121 of file ossimGdalOgrVectorAnnotation.h.

Referenced by setGeometryBuffer().

◆ m_geometryDistanceType

ossimUnitType ossimGdalOgrVectorAnnotation::m_geometryDistanceType
protected

Definition at line 122 of file ossimGdalOgrVectorAnnotation.h.

Referenced by setGeometryBuffer().

◆ m_layerName

ossimString ossimGdalOgrVectorAnnotation::m_layerName
protected

Definition at line 123 of file ossimGdalOgrVectorAnnotation.h.

Referenced by setCurrentEntry().

◆ m_layerNames

std::vector<ossimString> ossimGdalOgrVectorAnnotation::m_layerNames
protected

Definition at line 124 of file ossimGdalOgrVectorAnnotation.h.

Referenced by setCurrentEntry().

◆ m_needPenColor

bool ossimGdalOgrVectorAnnotation::m_needPenColor
protected

Definition at line 120 of file ossimGdalOgrVectorAnnotation.h.

Referenced by drawAnnotations(), and loadState().

◆ m_query

ossimString ossimGdalOgrVectorAnnotation::m_query
protected

Definition at line 119 of file ossimGdalOgrVectorAnnotation.h.

Referenced by saveState(), and setQuery().

◆ theBorderSize

double ossimGdalOgrVectorAnnotation::theBorderSize
protected

Definition at line 112 of file ossimGdalOgrVectorAnnotation.h.

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

◆ theBorderSizeUnits

ossimUnitType ossimGdalOgrVectorAnnotation::theBorderSizeUnits
protected

Definition at line 113 of file ossimGdalOgrVectorAnnotation.h.

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

◆ theBoundingExtent

OGREnvelope ossimGdalOgrVectorAnnotation::theBoundingExtent
protected

◆ theBrushColor

ossimRgbVector ossimGdalOgrVectorAnnotation::theBrushColor
protected

◆ theDataSource

OGRDataSource* ossimGdalOgrVectorAnnotation::theDataSource
protected

Definition at line 100 of file ossimGdalOgrVectorAnnotation.h.

Referenced by close(), and isOpen().

◆ theDriver

OGRSFDriver* ossimGdalOgrVectorAnnotation::theDriver
protected

Definition at line 101 of file ossimGdalOgrVectorAnnotation.h.

◆ theFeatureCacheTable

std::multimap<long, ossimAnnotationObject*> ossimGdalOgrVectorAnnotation::theFeatureCacheTable
protected

◆ theFilename

ossimFilename ossimGdalOgrVectorAnnotation::theFilename
protected

◆ theFillFlag

bool ossimGdalOgrVectorAnnotation::theFillFlag
protected

◆ theImageBound

ossimDrect ossimGdalOgrVectorAnnotation::theImageBound
protected

◆ theImageGeometry

ossimRefPtr<ossimImageGeometry> ossimGdalOgrVectorAnnotation::theImageGeometry
protected

◆ theIsExternalGeomFlag

bool ossimGdalOgrVectorAnnotation::theIsExternalGeomFlag
protected

◆ theLayersToRenderFlagList

vector<bool> ossimGdalOgrVectorAnnotation::theLayersToRenderFlagList
protected

Definition at line 105 of file ossimGdalOgrVectorAnnotation.h.

Referenced by getFeatures(), and print().

◆ theLayerTable

std::vector<ossimOgrGdalLayerNode*> ossimGdalOgrVectorAnnotation::theLayerTable
protected

Definition at line 106 of file ossimGdalOgrVectorAnnotation.h.

Referenced by deleteTables(), getFeatures(), and print().

◆ thePenColor

ossimRgbVector ossimGdalOgrVectorAnnotation::thePenColor
protected

◆ thePointWidthHeight

ossimDpt ossimGdalOgrVectorAnnotation::thePointWidthHeight
protected

◆ theThickness

ossim_uint8 ossimGdalOgrVectorAnnotation::theThickness
protected

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