void ossimPlanetCacheTextureLayer::getMetadata(ossimRefPtr<ossimXmlNode> metadata)const
{
  if(m_textureLayer.valid())
  {
    m_textureLayer->getMetadata(metadata.get());
  }
}
Exemplo n.º 2
0
void ossimXmlNode::addChildNode(ossimRefPtr<ossimXmlNode> node)
{
    if(node->theParentNode)
    {
        node->theParentNode->removeChild(node);
    }
    node->theParentNode = this;
    theChildNodes.push_back(node.get());
}
Exemplo n.º 3
0
void oms::SingleImageChain::setImageViewTransform(ossimRefPtr<ossimImageViewTransform> imageViewTransform)
{
   theViewCutter->setEnableFlag(false);
   theViewImageCutter->setEnableFlag(false);
   theRenderer->setImageViewTransform(imageViewTransform.get());
   theRenderer->setEnableFlag(true);
   ossimRefreshEvent evt(theRenderer);
   theRenderer->propagateEventToOutputs(evt);
}
bool ossimPlanetCacheTextureLayer::loadXml(ossimRefPtr<ossimXmlNode> node)
{
  if(m_textureLayer.valid())
    {
      return m_textureLayer->loadXml(node.get());
    }

   return false;

}
void ossimImageGaussianFilter::setProperty(ossimRefPtr<ossimProperty> property)
{
   if(!property) return;

   if (property->getName() == PROPERTYNAME_GAUSSSTD) {
      ossimNumericProperty* sProperty = PTR_CAST(ossimNumericProperty,
                                                     property.get());
      if(sProperty)
      {
         setGaussStd(sProperty->asFloat64());
      }
   } else if (property->getName() == PROPERTYNAME_STRICTNODATA) {
      ossimBooleanProperty* booleanProperty = PTR_CAST(ossimBooleanProperty,
                                                     property.get());
      if(booleanProperty)
      {
         setStrictNoData(booleanProperty->getBoolean());
      }
   } else {
      ossimImageSourceFilter::setProperty(property);
   }
}
 void DataManagerProperty::setProperty(ossimRefPtr<ossimProperty> property)
 {
    m_property = property.get();
    
    if(m_property.valid())
    {
       setEditable(!m_property->isReadOnly());
    }
    if(column() != 1)
    {
       setEditable(false);
    }
 }
Exemplo n.º 7
0
void ossimMemoryImageSource::setImage(ossimRefPtr<ossimImageData> image)
{
   m_image = image.get();
	if(m_image.valid())
	{
		m_boundingRect = m_image->getImageRectangle();
	}
	else
	{
		m_boundingRect.makeNan();
	}
   m_result = 0;
}
Exemplo n.º 8
0
ossimRefPtr<ossimImageData> ossimMaskFilter::executeMaskFilter(ossimRefPtr<ossimImageData> imageSourceData,
                                                               ossimRefPtr<ossimImageData> maskSourceData)
{
   if(!theTile)
   {
      theTile = (ossimImageData*)imageSourceData->dup();
      if(!theTile->getBuf())
      {
         theTile->initialize();
      }
   }
   else
   {
      ossim_uint32 tw = theTile->getWidth();
      ossim_uint32 th = theTile->getHeight();
      ossim_uint32 dw = imageSourceData->getWidth();
      ossim_uint32 dh = imageSourceData->getHeight();
      
      theTile->setWidthHeight(imageSourceData->getWidth(),
			      imageSourceData->getHeight());
      theTile->setOrigin(imageSourceData->getOrigin());
      if((tw*th) != (dw*dh))
      {
         theTile->initialize();
      }
     theTile->setDataObjectStatus(imageSourceData->getDataObjectStatus());
   }
   theTile->loadTile(imageSourceData.get());
   theTile->setDataObjectStatus(imageSourceData->getDataObjectStatus());
  switch(theMaskType)
  {
  case OSSIM_MASK_TYPE_SELECT:
  {
     return executeMaskFilterSelect(theTile,
                                    maskSourceData);
  }
  case OSSIM_MASK_TYPE_INVERT:
  {
     return executeMaskFilterInvertSelect(theTile,
                                          maskSourceData);
  }
  case OSSIM_MASK_TYPE_WEIGHTED:
  {
     return executeMaskFilterWeighted(theTile,
                                      maskSourceData);
  }
  }
  
  return imageSourceData;
}
void ossimCFARFilter::setProperty(ossimRefPtr<ossimProperty> property)
{
   if(!property) return;
   ossimString name = property->getName();

	if(name == "threshold")
	{
		theThreshold = property->valueToString().toDouble();
	}
   else if(name == "Kernel")
   {
      ossimMatrixProperty* matrixProperty = PTR_CAST(ossimMatrixProperty,
                                                     property.get());
      if(matrixProperty)
      {
      	for(ossim_int32 r = 0; r < 5; r++)
   		{
      		for(ossim_int32 c = 0; c < 5; c++)
      		{
      			theKernel[r][c] = (*matrixProperty)(r,c);
      		}
   		}
   		/*
         theKernel[0][0] = (*matrixProperty)(0,0);
         theKernel[1][0] = (*matrixProperty)(1,0);
         theKernel[2][0] = (*matrixProperty)(2,0);
         theKernel[0][1] = (*matrixProperty)(0,1);
         theKernel[1][1] = (*matrixProperty)(1,1);
         theKernel[2][1] = (*matrixProperty)(2,1);
         theKernel[0][2] = (*matrixProperty)(0,2);
         theKernel[1][2] = (*matrixProperty)(1,2);
         theKernel[2][2] = (*matrixProperty)(2,2);
			*/
      }
      else
      {
         ossimImageSourceFilter::setProperty(property);
      }
   }
   else
   {
      ossimImageSourceFilter::setProperty(property);
   }
}
Exemplo n.º 10
0
void ossimXmlNode::addAttribute(ossimRefPtr<ossimXmlAttribute> attribute)
{
    theAttributes.push_back(attribute.get());
}
Exemplo n.º 11
0
// Create histogram for entry:
void ossimImageUtil::createHistogram(ossimRefPtr<ossimImageHandler>& ih,
                                     ossim_uint32 entry,
                                     bool useEntryIndex)
{
   static const char M[] = "ossimImageUtil::createHistogram #2";
   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n";
   }
   
   if ( ih.valid() )
   {
      if (useEntryIndex)
      {
         // Set entry before deriving file name.
         ih->setCurrentEntry(entry);
         ossimNotify(ossimNotifyLevel_NOTICE) << "entry number: "<< entry << std::endl;
      }

      ossimFilename outputFile =
         ih->getFilenameWithThisExtension(ossimString(".his"), useEntryIndex);

      // Only build if needed:
      if ( (outputFile.exists() == false) || rebuildHistogram() )
      {
         ossimNotify(ossimNotifyLevel_NOTICE)
            << "Computing histogram for file: " << ih->getFilename() << std::endl;

         // Check handler to see if it's filtering bands.
         std::vector<ossim_uint32> originalBandList(0);
         if ( ih->isBandSelector() )
         { 
            // Capture for finalize method.
            ih->getOutputBandList( originalBandList );
            
            // Set output list to input.
            ih->setOutputToInputBandList();
         }

         ossimRefPtr<ossimImageHistogramSource> histoSource = new ossimImageHistogramSource;
         ossimRefPtr<ossimHistogramWriter> writer = new ossimHistogramWriter;
         
         histoSource->setMaxNumberOfRLevels(1); // Currently hard coded...
         
#if 0 /* TODO tmp drb */
         if( !ossim::isnan(histoMin) )
         {
            histoSource->setMinValueOverride(histoMin);
         }
         
         if( !ossim::isnan(histoMax) )
         {
            histoSource->setMaxValueOverride(histoMax);
         }
         
         if(histoBins > 0)
         {
            histoSource->setNumberOfBinsOverride(histoBins);
         }
#endif
         
         if(traceDebug())
         {
            ossimNotify(ossimNotifyLevel_DEBUG)
               << "Histogram mode: " << getHistogramMode() << "\n";
         }
         
         // Connect histogram source to image handler.
         histoSource->setComputationMode( getHistogramMode() );
         histoSource->connectMyInputTo(0, ih.get() );
         histoSource->enableSource();
         
         // Connect writer to histogram source.
         writer->connectMyInputTo(0, histoSource.get());
         writer->setFilename(outputFile);
         theStdOutProgress.setFlushStreamFlag(true);
         writer->addListener(&theStdOutProgress);
         
         // Compute...
         writer->execute();
         
         writer=0;

         // Reset the band list.
         if ( ih->isBandSelector() && originalBandList.size() )
         {
            ih->setOutputBandList( originalBandList );
         }

      } // Matches: if ( (outputFile.exists() == false) || rebuildHistogram() )
      
   } // Matches: if ( ih.valid() )

   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG) << M << " exited...\n";
   }

} // End: ossimImageUtil::createHistogram #2
Exemplo n.º 12
0
// Create overview for entry:
void ossimImageUtil::createOverview(ossimRefPtr<ossimImageHandler>& ih,
                                    ossimRefPtr<ossimOverviewBuilderBase>& ob,
                                    ossim_uint32 entry,
                                    bool useEntryIndex,
                                    bool& consumedHistogramOptions)
{
   static const char M[] = "ossimImageUtil::createOverview #2";
   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n";
   }
   
   if ( ih.valid() && ob.valid() )
   {
      if (useEntryIndex)
      {
         // Set entry before deriving file name.
         ih->setCurrentEntry(entry);
         ossimNotify(ossimNotifyLevel_NOTICE) << "entry number: "<< entry << std::endl;
      }
      
      ossimFilename outputFile =
         ih->getFilenameWithThisExtension(ossimString(".ovr"), useEntryIndex);
      
      if ( rebuildOverviews() )
      {
         ih->closeOverview(); 
         if ( outputFile.exists() )
         {
            outputFile.remove();
         }
      }

      if ( getInternalOverviewsFlag() )
      {
         if ( ih->getClassName() == "ossimTiffTileSource")
         {
            //---
            // INTERNAL_OVERVIEWS_FLAG_KW is set to true:
            // Tiff reader can handle internal overviews.  Set the output file to
            // input file.  Do it after the above remove so that if there were
            // external overviews they will get removed.
            //---
            outputFile = ih->getFilename();
         }
         else 
         {
            ossimNotify(ossimNotifyLevel_NOTICE)
               << "Internal overviews not supported for reader type: "
               <<ih->getClassName()
               << "\nIgnoring option..."
               << endl;
         }
      }

      if ( hasRequiredOverview( ih, ob ) == false )
      {
         //---
         // Set create histogram code...
         //
         // Notes:
         // 1) Must put this logic after any removal of external overview file.
         // 
         // 2) Base file could have built in overviews, e.g. jp2 files.  So the sequensor could
         //    start at R6 even if there is no external overview file.
         //
         // 3) If user want the histogram from R0 the overview builder can do as long as
         //    ossimImageHandler::getNumberOfDecimationLevels returns 1.  If we are starting
         //    overview building at R6 then we must do the create histogram in a separate path.
         //---
         ossimHistogramMode histoMode = OSSIM_HISTO_MODE_UNKNOWN;
         if ( createHistogram() ||
              ( createHistogramR0() && ( ih->getNumberOfDecimationLevels() == 1 ) ) )
         {
            histoMode = OSSIM_HISTO_MODE_NORMAL;
         }
         else if ( createHistogramFast() )
         {
            histoMode = OSSIM_HISTO_MODE_FAST;
         }
         
         if(traceDebug())
         {
            ossimNotify(ossimNotifyLevel_DEBUG) << "Histogram mode: " << histoMode << "\n";
         }
         
         if ( histoMode != OSSIM_HISTO_MODE_UNKNOWN )
         {
            consumedHistogramOptions = true;
            ob->setHistogramMode(histoMode);
            
            ossimNotify(ossimNotifyLevel_NOTICE)
               << "Creating overviews with histogram for file: " << ih->getFilename() << std::endl;
         }
         else
         {
            if ( histoMode != OSSIM_HISTO_MODE_UNKNOWN )
            {
               consumedHistogramOptions = false;  
               ossimNotify(ossimNotifyLevel_NOTICE)
                  << "Creating overviews for file: " << ih->getFilename() << std::endl;
            }
         }
         
         ob->setOutputFile(outputFile);
         ob->setInputSource(ih.get());
         
         // Create the overview for this entry in this file:
         if ( ob->execute() == false )
         {
            setErrorStatus( ossimErrorCodes::OSSIM_ERROR );
            ossimNotify(ossimNotifyLevel_WARN)
               << "Error returned creating overviews for file: " << ih->getFilename() << std::endl;
         }
      }
      else
      {
         consumedHistogramOptions = false;
         ossimNotify(ossimNotifyLevel_NOTICE)
            << "Image has required reduced resolution data sets." << std::endl;
      }
   }

   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG) << M << " exited...\n";
   }
}
Exemplo n.º 13
0
void ossimImageFileWriter::setProperty(ossimRefPtr<ossimProperty> property)
{
   if(!property) return;
   
   if(property->getName() == ossimKeywordNames::FILENAME_KW)
   {
      theFilename = property->valueToString();
   }
   else if (property->getName() == "create_envi_hdr")
   {
      theWriteEnviHeaderFlag = property->valueToString().toBool();
   }
   else if (property->getName() == "create_ers_hdr")
   {
      theWriteErsHeaderFlag = property->valueToString().toBool();
   }
   else if (property->getName() ==
            ossimKeywordNames::CREATE_EXTERNAL_GEOMETRY_KW)
   {
      theWriteExternalGeometryFlag = property->valueToString().toBool();
   }
   else if (property->getName() == "create_fgdc")
   {
      theWriteFgdcFlag = property->valueToString().toBool();
   }
   else if (property->getName() == "create_jpeg_world_file")
   {
      theWriteJpegWorldFileFlag = property->valueToString().toBool();
   }
   else if (property->getName() == "create_readme")
   {
      theWriteReadmeFlag = property->valueToString().toBool();
   }
   else if (property->getName() == "create_tiff_world_file")
   {
      theWriteTiffWorldFileFlag = property->valueToString().toBool();
   }
   else if (property->getName() == "create_world_file")
   {
      theWriteWorldFileFlag = property->valueToString().toBool();
   }
   else if (property->getName() == ossimKeywordNames::CREATE_IMAGE_KW)
   {
      theWriteImageFlag = property->valueToString().toBool();
   }
   else if (property->getName() == ossimKeywordNames::CREATE_OVERVIEW_KW)
   {
      theWriteOverviewFlag = property->valueToString().toBool();
   }
   else if (property->getName() == ossimKeywordNames::CREATE_HISTOGRAM_KW)
   {
      theWriteHistogramFlag = property->valueToString().toBool();
   }
   else if (property->getName() == SCALE_TO_EIGHT_BIT_KW)
   {
      theScaleToEightBitFlag = property->valueToString().toBool();
   }
   else if(property->getName() == AUTO_CREATE_DIRECTORY_KW)
   {
      theAutoCreateDirectoryFlag = property->valueToString().toBool();
   }
   else if (property->getName() == "linear_units")
   {
      theLinearUnits = (ossimUnitType)
         (ossimUnitTypeLut::instance()->
          getEntryNumber(property->valueToString()));
   }
   else if(property->getName() == ossimKeywordNames::IMAGE_TYPE_KW)
   {
      setOutputImageType(property->valueToString());
   }
   else if(property->getName() == ossimKeywordNames::PIXEL_TYPE_KW)
   {
      ossimStringProperty* stringProperty = PTR_CAST(ossimStringProperty,
                                                     property.get());
      if (stringProperty)
      {
         ossimString s;
         stringProperty->valueToString(s);
         setPixelType(s);
      }
   }
   else
   {
      ossimImageWriter::setProperty(property);
   }
}