patch for nui plugin

2 messages Options
Embed this post
Permalink
Dardo D Kleiner - CONTRACTOR

patch for nui plugin

Reply Threaded More More options
Print post
Permalink
Try not to let attention to this plugin slide as the project
moves forward, thanks!

Index: nui/ossimNuiHandler.h
===================================================================
--- nui/ossimNuiHandler.h       (revision 1657)
+++ nui/ossimNuiHandler.h       (working copy)
@@ -68,6 +68,7 @@
    virtual ossim_uint32 getNumberOfDecimationLevels()const;
    virtual ossimScalarType getOutputScalarType() const;
   
+   virtual ossimImageGeometry* getImageGeometry();
    virtual bool getImageGeometry(ossimKeywordlist& kwl,
                                  const char* prefix=0);
    virtual double getNullPixelValue(ossim_uint32 band=0)const;
Index: nui/ossimNuiHandler.cpp
===================================================================
--- nui/ossimNuiHandler.cpp     (revision 1657)
+++ nui/ossimNuiHandler.cpp     (working copy)
@@ -5,6 +5,7 @@
 #include <OpenThreads/Mutex>
 #include <OpenThreads/ScopedLock>
 #include <ossim/base/ossimKeywordNames.h>
+#include <ossim/projection/ossimProjectionFactoryRegistry.h>
 
 ossimNuiData::ossimNuiData()
 {
@@ -477,6 +478,70 @@
    }
 }
 
+ossimImageGeometry* ossimNuiHandler::getImageGeometry()
+{
+   //---
+   // Call base class getImageGeometry which will check for external geometry
+   // or an already set geometry.
+   //---
+   ossimImageGeometry* result = ossimImageHandler::getImageGeometry();
+  
+   if( result && !result->getProjection() )
+   {
+      // Validate Header to ensure we support this data type
+      if((theNui.wkt_string!="")&&(theNui.coord_unit!=OSSIM_UNIT_UNKNOWN))
+      {
+         // Get the projection info.
+         ossimKeywordlist kwl;
+        const char *prefix = 0;
+        
+         kwl.add(ossimString(prefix),
+                 ossimKeywordNames::TYPE_KW,
+                 theNui.wkt_string,
+                 true);
+         ossimDpt tiePoint(theNui.top_left_x,
+                           theNui.top_left_y);
+         kwl.add(prefix,
+                 ossimKeywordNames::TIE_POINT_XY_KW,
+                 tiePoint.toString(),
+                 true);
+         kwl.add(prefix,
+                 ossimKeywordNames::TIE_POINT_UNITS_KW,
+                 theNui.coord_unit_string,
+                 true);
+         kwl.add(prefix,
+                 ossimKeywordNames::PIXEL_SCALE_XY_KW,
+                 ossimDpt( theNui.x_pixel_size,
+                           theNui.y_pixel_size).toString(),
+                 true);
+         kwl.add(prefix,
+                 ossimKeywordNames::PIXEL_SCALE_UNITS_KW,
+                 theNui.coord_unit_string,
+                 true);
+        
+         // Create the projection.
+         ossimRefPtr<ossimProjection> proj =
+            ossimProjectionFactoryRegistry::instance()->
+            createProjection(kwl);
+        
+         if ( proj.valid() )
+         {
+            // Assign projection to our ossimImageGeometry object.
+            result->setProjection( proj.get() );
+         }
+         else
+         {
+            theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
+         }
+      }
+      else
+      {
+         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
+      }
+   }
+   return result;
+}
+

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
www.ossim.org
Ossim-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/ossim-developer
Garrett Potts-2

Re: patch for nui plugin

Reply Threaded More More options
Print post
Permalink
Hello:

I build it all the time.  I probably didn't check in the new updates.


One sec


Take care

Garrett

On Nov 4, 2009, at 7:10 PM, Dardo D Kleiner - CONTRACTOR wrote:

> Try not to let attention to this plugin slide as the project
> moves forward, thanks!
> Index: nui/ossimNuiHandler.h
> ===================================================================
> --- nui/ossimNuiHandler.h       (revision 1657)
> +++ nui/ossimNuiHandler.h       (working copy)
> @@ -68,6 +68,7 @@
>   virtual ossim_uint32 getNumberOfDecimationLevels()const;
>   virtual ossimScalarType getOutputScalarType() const;
>
> +   virtual ossimImageGeometry* getImageGeometry();
>   virtual bool getImageGeometry(ossimKeywordlist& kwl,
>                                 const char* prefix=0);
>   virtual double getNullPixelValue(ossim_uint32 band=0)const;
> Index: nui/ossimNuiHandler.cpp
> ===================================================================
> --- nui/ossimNuiHandler.cpp     (revision 1657)
> +++ nui/ossimNuiHandler.cpp     (working copy)
> @@ -5,6 +5,7 @@
> #include <OpenThreads/Mutex>
> #include <OpenThreads/ScopedLock>
> #include <ossim/base/ossimKeywordNames.h>
> +#include <ossim/projection/ossimProjectionFactoryRegistry.h>
>
> ossimNuiData::ossimNuiData()
> {
> @@ -477,6 +478,70 @@
>   }
> }
>
> +ossimImageGeometry* ossimNuiHandler::getImageGeometry()
> +{
> +   //---
> +   // Call base class getImageGeometry which will check for  
> external geometry
> +   // or an already set geometry.
> +   //---
> +   ossimImageGeometry* result =  
> ossimImageHandler::getImageGeometry();
> +
> +   if( result && !result->getProjection() )
> +   {
> +      // Validate Header to ensure we support this data type
> +      if((theNui.wkt_string!="")&&(theNui.coord_unit!
> =OSSIM_UNIT_UNKNOWN))
> +      {
> +         // Get the projection info.
> +         ossimKeywordlist kwl;
> +        const char *prefix = 0;
> +
> +         kwl.add(ossimString(prefix),
> +                 ossimKeywordNames::TYPE_KW,
> +                 theNui.wkt_string,
> +                 true);
> +         ossimDpt tiePoint(theNui.top_left_x,
> +                           theNui.top_left_y);
> +         kwl.add(prefix,
> +                 ossimKeywordNames::TIE_POINT_XY_KW,
> +                 tiePoint.toString(),
> +                 true);
> +         kwl.add(prefix,
> +                 ossimKeywordNames::TIE_POINT_UNITS_KW,
> +                 theNui.coord_unit_string,
> +                 true);
> +         kwl.add(prefix,
> +                 ossimKeywordNames::PIXEL_SCALE_XY_KW,
> +                 ossimDpt( theNui.x_pixel_size,
> +                           theNui.y_pixel_size).toString(),
> +                 true);
> +         kwl.add(prefix,
> +                 ossimKeywordNames::PIXEL_SCALE_UNITS_KW,
> +                 theNui.coord_unit_string,
> +                 true);
> +
> +         // Create the projection.
> +         ossimRefPtr<ossimProjection> proj =
> +            ossimProjectionFactoryRegistry::instance()->
> +            createProjection(kwl);
> +
> +         if ( proj.valid() )
> +         {
> +            // Assign projection to our ossimImageGeometry object.
> +            result->setProjection( proj.get() );
> +         }
> +         else
> +         {
> +            theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
> +         }
> +      }
> +      else
> +      {
> +         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
> +      }
> +   }
> +   return result;
> +}
> +
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july_______________________________________________
> www.ossim.org
> Ossim-developer mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/ossim-developer


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
www.ossim.org
Ossim-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/ossim-developer