Ejemplo n.º 1
0
void oms::SingleImageChain::setImageCut(const ossimIrect& rect)
{
   std::vector<ossimDpt> pointList(4);
   pointList[0] = rect.ul();
   pointList[1] = rect.ur();
   pointList[2] = rect.lr();
   pointList[3] = rect.ll();
   
   setImageCut(pointList);
}
Ejemplo n.º 2
0
ossimPolygon::ossimPolygon(const ossimIrect& rect)
   : theVertexList(4),
     theCurrentVertex(0),
     theOrderingType(OSSIM_CLOCKWISE_ORDER)
{
   theVertexList[0] = rect.ul();
   theVertexList[1] = rect.ur();
   theVertexList[2] = rect.lr();
   theVertexList[3] = rect.ll();
}
Ejemplo n.º 3
0
//*******************************************************************
// Public Constructor: ossimDrect
//
//*******************************************************************
ossimDrect::ossimDrect(const ossimIrect& rect)
    :
    theUlCorner(rect.ul()),
    theUrCorner(rect.ur()),
    theLrCorner(rect.lr()),
    theLlCorner(rect.ll()),
    theOrientMode(rect.orientMode())
{
    if(rect.isNan())
    {
        makeNan();
    }
}
Ejemplo n.º 4
0
ossimDrect shapefileClip::LineSampleToWorld(ossimIrect rect, ossimRefPtr<ossimImageGeometry> ImageGeom)
{
	ossimGpt gp1;
	ossimGpt gp2;
	ossimGpt gp3;
	ossimGpt gp4;

	ImageGeom->localToWorld(rect.ul(), gp1);
	ImageGeom->localToWorld(rect.ur(), gp2);
	ImageGeom->localToWorld(rect.lr(), gp3);
	ImageGeom->localToWorld(rect.ll(), gp4);
   
	ossimDrect boundsRect(ossimDpt(gp1.lond(), gp1.latd()),
		ossimDpt(gp2.lond(), gp2.latd()),
		ossimDpt(gp3.lond(), gp3.latd()),	
		ossimDpt(gp4.lond(), gp4.latd()),
		OSSIM_RIGHT_HANDED);

	return boundsRect;
}
Ejemplo n.º 5
0
bool ossim_hdf5::crossesDateline( H5::DataSet& dataset, const ossimIrect& validRect )
{
   bool result = false;

   H5::DataSpace dataspace = dataset.getSpace();
         
   // Number of dimensions of the input dataspace:
   const ossim_int32 DIM_COUNT = dataspace.getSimpleExtentNdims();
         
   if ( DIM_COUNT == 2 )
   {
      const ossim_uint32 ROWS = validRect.height();
      const ossim_uint32 COLS = validRect.width();
      
      // Get the extents. Assuming dimensions are same for lat lon dataset. 
      std::vector<hsize_t> dimsOut(DIM_COUNT);
      dataspace.getSimpleExtentDims( &dimsOut.front(), 0 );

      if ( (ROWS <= dimsOut[0]) && (COLS <= dimsOut[1]) )
      {
         std::vector<hsize_t> inputCount(DIM_COUNT);
         std::vector<hsize_t> inputOffset(DIM_COUNT);
         
         inputCount[0] = 1;    // row
         inputCount[1] = COLS; // col
         
         // Output dataspace dimensions.
         const ossim_int32 OUT_DIM_COUNT = 3;
         std::vector<hsize_t> outputCount(OUT_DIM_COUNT);
         outputCount[0] = 1; // single band
         outputCount[1] = 1; // single line
         outputCount[2] = COLS; // single sample
               
         // Output dataspace offset.
         std::vector<hsize_t> outputOffset(OUT_DIM_COUNT);
         outputOffset[0] = 0;
         outputOffset[1] = 0;
         outputOffset[2] = 0;
               
         ossimScalarType scalar = ossim_hdf5::getScalarType( &dataset );
         if ( scalar == OSSIM_FLOAT32 )
         {
            // See if we need to swap bytes:
            ossimEndian* endian = 0;
            if ( ( ossim::byteOrder() != ossim_hdf5::getByteOrder( &dataset ) ) )
            {
               endian = new ossimEndian();
            }

            // Native type:
            H5::DataType datatype = dataset.getDataType();
                  
            // Output dataspace always the same one line.
            H5::DataSpace bufferDataSpace( OUT_DIM_COUNT, &outputCount.front());
            bufferDataSpace.selectHyperslab( H5S_SELECT_SET,
                                             &outputCount.front(),
                                             &outputOffset.front() );

            //---
            // Dataset sample has NULL lines at the end so scan for valid rect.
            // Use "<= -999" for test as per NOAA as it seems the NULL value is
            // fuzzy.  e.g. -999.3.
            //---

            // Buffer to hold a line:
            std::vector<ossim_float32> lineBuffer(validRect.width());

            // Read the first line:
            inputOffset[0] = static_cast<hsize_t>(validRect.ul().y);
            inputOffset[1] = static_cast<hsize_t>(validRect.ul().x);
            dataspace.selectHyperslab( H5S_SELECT_SET,
                                       &inputCount.front(),
                                       &inputOffset.front() );
            dataset.read( &(lineBuffer.front()), datatype, bufferDataSpace, dataspace );

            if ( endian )
            {
               // If the endian pointer is initialized(not zero) swap the bytes.
               endian->swap( &(lineBuffer.front()), COLS );
            }

            // Test the first line:
            result = ossim_hdf5::crossesDateline( lineBuffer );

            if ( !result )
            {
               // Test the last line:
               inputOffset[0] = static_cast<hsize_t>(validRect.ll().y);
               inputOffset[1] = static_cast<hsize_t>(validRect.ll().x);
               dataspace.selectHyperslab( H5S_SELECT_SET,
                                          &inputCount.front(),
                                          &inputOffset.front() );
               dataset.read( &(lineBuffer.front()), datatype, bufferDataSpace, dataspace );

               result = ossim_hdf5::crossesDateline( lineBuffer );
            }

            if ( endian )
            {
               delete endian;
               endian = 0;
            }
         }
         else // Matches: if ( scalar == OSSIM_FLOAT32 ){...}
         {
            ossimNotify(ossimNotifyLevel_WARN)
               << "ossim_hdf5::crossesDateline WARNING!"
               << "\nUnhandled scalar type: "
               << ossimScalarTypeLut::instance()->getEntryString( scalar )
               << std::endl;
         }
         
      } // Matches: if ( dimsOut...
      
   } // Matches: if ( IN_DIM_COUNT == 2 )
   
   dataspace.close();
   
   return result;
   
} // End: ossim_hdf5::crossesDateline(...)