コード例 #1
0
bool rspfBandClipFilter::saveState(rspfKeywordlist& kwl,
                                    const char* prefix)const
{
   rspfString minPrefix    = rspfString("min");
   rspfString maxPrefix    = rspfString("max");
   rspfString medianPrefix = rspfString("median");

   for(rspf_uint32 index = 1; index <= getNumberOfValues(); ++index)
   {
      rspfString value = (minPrefix+rspfString::toString(index));
      kwl.add(prefix,
              value.c_str(),
              theMinPix[index-1],
              true);
      value = (maxPrefix+rspfString::toString(index));
      kwl.add(prefix,
              value.c_str(),
              theMaxPix[index-1],
              true);
      value = (medianPrefix+rspfString::toString(index));
      kwl.add(prefix,
              value.c_str(),
              theMedian[index-1],
              true);
   }
   rspfString clipType;
   switch(theClipType)
   {
      case rspfBandClipType_NONE:
      {
         clipType = "NONE";
         break;
      }
      case rspfBandClipType_CLIP:
      {
         clipType = "CLIP";
         break;
      }
      case rspfBandClipType_LINEAR_STRETCH:
      {
         clipType = "LINEAR_STRETCH";
         break;
      }
      case rspfBandClipType_MEDIAN_STRETCH:
      {
         clipType = "MEDIAN_STRETCH";
         break;
      }
      default:
         break;
   }
   kwl.add(prefix,
           "clip_type",
           clipType.c_str(),
           true);
   
   return rspfImageSourceFilter::saveState(kwl, prefix);
}
コード例 #2
0
ossimString ossimStringListProperty::getValueAt(int idx)const
{
   if((idx >= 0)&&
      (idx < (int)getNumberOfValues()))
   {
      return theValueList[idx];
   }
   
   return ossimString("");;
}
コード例 #3
0
bool ossimStringListProperty::setValueAt(int idx,
                                         const ossimString& value)
{
   bool result = true;
   
   if(canAddValue(value))
   {
      if((idx < (int)getNumberOfValues())&&
         (idx >= 0))
      {
         theValueList[idx] = value;
      }
   }
   else
   {
      result = false;
   }
   return result;
   
}
コード例 #4
0
rspfRefPtr<rspfImageData> rspfBandClipFilter::getTile(
   const rspfIrect& rect,
   rspf_uint32 resLevel)
{
   if(!theInputConnection)
   {
      return NULL;
   }
   
   rspfRefPtr<rspfImageData> data =
      theInputConnection->getTile(rect, resLevel);
   if(!data.get())
   {
      return data;
   }
   rspfDataObjectStatus status = data->getDataObjectStatus();
   if((status != RSPF_NULL) &&
      (status != RSPF_EMPTY))
   {
      rspf_uint32 dw = data->getWidth();
      rspf_uint32 dh = data->getHeight();
      rspf_uint32 db = data->getNumberOfBands();

      rspf_uint32 tw = theTile->getWidth();
      rspf_uint32 th = theTile->getHeight();
      rspf_uint32 tb = theTile->getNumberOfBands();

      if(((tw*th)!=(dw*dh))||
         (tb != db))
      {
         theTile = new rspfImageData(this,
                                      RSPF_NORMALIZED_FLOAT,
                                      db,
                                      dw,
                                      dh);
         theTile->initialize();
      }

      if(getNumberOfValues() != theTile->getNumberOfBands())
      {
         // Should this go on??? (drb)
         rspfNotify(rspfNotifyLevel_WARN)
            << "rspfBandClipFilter::getTile\n"
            << "getNumberOfValues() != theTile->getNumberOfBands"
            << endl;
      }
      
      data->copyTileToNormalizedBuffer(static_cast<float*>(theTile->getBuf()));
      theTile->setDataObjectStatus(data->getDataObjectStatus());
      
      switch(theClipType)
      {
         case rspfBandClipType_CLIP:
         {
            runClip();
            break;
         }
         case rspfBandClipType_CLAMP:
         {
            runClamp();
            break;
         }
         case rspfBandClipType_LINEAR_STRETCH:
         {
            runLinearStretch();
            break;
         }
         case rspfBandClipType_MEDIAN_STRETCH:
         {
            runMedianStretch();
            break;
         }
         default:
            break;
      }
      data->copyNormalizedBufferToTile(static_cast<float*>(theTile->getBuf()));
   }
   
   return data;
}