当前位置: 首页>>代码示例>>C++>>正文


C++ FactoryResource类代码示例

本文整理汇总了C++中FactoryResource的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource类的具体用法?C++ FactoryResource怎么用?C++ FactoryResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FactoryResource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: determineMetadataFile

unsigned char LandsatGeotiffImporter::getFileAffinity(const std::string& filename)
{
   if (filename.empty())
   {
      return CAN_NOT_LOAD;
   }
   bool originallyTiff = false;
   std::string metadataFile = determineMetadataFile(filename, &originallyTiff);
   bool readMetadata = false;
   FactoryResource<DynamicObject> pImageMetadata = Landsat::parseMtlFile(metadataFile, readMetadata);
   if (!readMetadata)
   {
      return CAN_NOT_LOAD;
   }
   std::string spacecraft = dv_cast<std::string>(
      pImageMetadata->getAttributeByPath("LANDSAT_MTL/L1_METADATA_FILE/PRODUCT_METADATA/SPACECRAFT_ID"), "");
   if (spacecraft != "Landsat5" && spacecraft != "Landsat7")
   {
      return CAN_NOT_LOAD;
   }
   if (originallyTiff)
   {
      return CAN_LOAD + 5; //override normal tiff importers
   }
   return CAN_LOAD;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:26,代码来源:LandsatGeotiffImporter.cpp

示例2: loadDoc

vector<ImportDescriptor*> SignatureSetImporter::getImportDescriptors(const string &filename)
{
   vector<ImportDescriptor*> descriptors;
   if (filename.empty())
   {
      return descriptors;
   }
   mFilename = filename;
   try
   {
      loadDoc(filename);
      if (mDoc[filename] == NULL)
      {
         return descriptors;
      }
      FactoryResource<DynamicObject> pMetadata;
      VERIFYRV(pMetadata.get() != NULL, descriptors);

      mDatasetNumber = 0;
      ImportDescriptorFilter filter;
      DOMTreeWalker* pTree = mDoc[filename]->createTreeWalker(mDoc[filename]->getDocumentElement(), DOMNodeFilter::SHOW_ELEMENT, &filter, false);
      std::vector<std::string> dummy;
      descriptors = createImportDescriptors(pTree, dummy);
   }
   catch(const DOMException &) {}
   catch(const XMLException &) {}

   return descriptors;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:29,代码来源:SignatureSetImporter.cpp

示例3: VERIFY

bool DiHdfImporter::createRasterPager(RasterElement *pRaster) const
{
   VERIFY(pRaster != NULL);
   DataDescriptor *pDescriptor = pRaster->getDataDescriptor();
   VERIFY(pDescriptor != NULL);
   FileDescriptor *pFileDescriptor = pDescriptor->getFileDescriptor();
   VERIFY(pFileDescriptor != NULL);

   std::string filename = pRaster->getFilename();
   Progress *pProgress = getProgress();

   FactoryResource<Filename> pFilename;
   pFilename->setFullPathAndName(filename);

   ExecutableResource pagerPlugIn("DiHdfRasterPager", std::string(), pProgress);
   pagerPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedElementArg(), pRaster);
   pagerPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedFilenameArg(), pFilename.get());

   bool success = pagerPlugIn->execute();

   RasterPager *pPager = dynamic_cast<RasterPager*>(pagerPlugIn->getPlugIn());
   if(!success || pPager == NULL)
   {
      std::string message = "Execution of DiHdfRasterPager failed!";
      if (pProgress != NULL) pProgress->updateProgress(message, 0, ERRORS);
      return false;
   }

   pRaster->setPager(pPager);
   pagerPlugIn->releasePlugIn();

   return true;
}
开发者ID:Siddharthk,项目名称:coan,代码行数:33,代码来源:DiHdfImporter.cpp

示例4:

FactoryResource<DynamicObject> Nitf::DesSubheader::createDefaultsDynamicObject(
    const RasterDataDescriptor *pDescriptor)
{
    FactoryResource<DynamicObject> pDesSubheader;

    // Per the NITF spec, the field "DE" must contain the value "DE".
    pDesSubheader->setAttribute(DE, DE);
    return pDesSubheader;
}
开发者ID:jonatho7,项目名称:opticks,代码行数:9,代码来源:NitfDesSubheader.cpp

示例5: getWavelengthsFromFile

bool ResamplerPlugIn::getWavelengthsFromFile(const std::string& filename,
   Wavelengths* pWavelengths, std::string& errorMsg)
{
   errorMsg.clear();
   if (filename.empty() || pWavelengths == NULL)
   {
      errorMsg = "Invalid input parameters.";
      return false;
   }
   pWavelengths->clear();

   FactoryResource<Filename> pFilename;
   pFilename->setFullPathAndName(filename);
   std::string importerName;
   std::string extension;
   std::vector<std::string> extensionStrs =
      StringUtilities::split(StringUtilities::toLower(pFilename->getExtension()), '.');
   if (extensionStrs.empty() == false)
   {
      extension = extensionStrs.back();
   }
   if (extension == "wmd")
   {
      importerName = "Wavelength Metadata Importer";
   }
   else
   {
      importerName = "Wavelength Text Importer";
   }
   ExecutableResource pImporter(importerName, std::string());
   if (pImporter->getInArgList().setPlugInArgValue(Wavelengths::WavelengthFileArg(), pFilename.get()) == false)
   {
      errorMsg = "Unable to set filename into plug-in \"" + importerName + "\".";
      return false;
   }

   if (pImporter->execute() == false)
   {
      errorMsg = "Unable to load file \"" + filename + "\".";
      return false;
   }

   Wavelengths* pWave = pImporter->getOutArgList().getPlugInArgValue<Wavelengths>(Wavelengths::WavelengthsArg());
   if (pWave == NULL)
   {
      errorMsg = "Unable to extract wavelengths from plug-in \"" + importerName + "\".";
      return false;
   }

   if (pWavelengths->initializeFromWavelengths(pWave) == false)
   {
      errorMsg = "Unable to retrieve the wavelengths.";
      return false;
   }

   return true;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:57,代码来源:ResamplerPlugIn.cpp

示例6: int

void Simulation_GUI::StartOrtho()
{
   mpStartOrtho->setEnabled(false);

   // Update Grid Information
   OrthoGrid.X_Step = X_Spacing->value();
   OrthoGrid.Y_Step = Y_Spacing->value();

   OrthoGrid.X_Dim = int(OrthoGrid.X_Dim/OrthoGrid.X_Step)+1.0;
   OrthoGrid.Y_Dim = int(OrthoGrid.Y_Dim/OrthoGrid.Y_Step)+1.0; 

   OrthoGrid.Lon_Step = (OrthoGrid.Lon_Max-OrthoGrid.Lon_Min)/OrthoGrid.X_Dim;
   
   OrthoGrid.Lat_Step = (OrthoGrid.Lat_Max-OrthoGrid.Lat_Min)/OrthoGrid.Y_Dim;

   //Start Ortho
   RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());

   FactoryResource<DataRequest> pRequest;
   DataAccessor pAcc = pCube->getDataAccessor(pRequest.release());

   DataDescriptor* dMeta = pCube->getDataDescriptor();

   DynamicObject* oMetadata = dMeta->getMetadata();

	// RETRIEVE & UPDATE METADATA INFORMATION //

	bool control = Metadata->ReadFile(image_path);

	Metadata->UpdateMetadata(oMetadata); 

	SAR_Model *ModProva;
	ModProva = new SAR_Slant_Model(*Metadata, 10);

	if(Metadata->Projection == "SGF")
	{
		ModProva = new SAR_Ground_Model(*Metadata,10);
	}

	SAR_Simulator_Processor ProcessOrtho(pCube, ModProva, OrthoGrid, Height->value());
	
	// RETRIVE SELECTED RESAMPLING METHOD AND EXECUTE ORTHO

	int indexR = mpInterpolationList->currentIndex();
	
	//if (mpFlatten->isChecked() ==true) 
	//{
		//VERIFYNRV(ProcessOrtho.process(indexR));	
	//}
	//else 
	//{
		VERIFYNRV(RetrieveDSMGrid());
		VERIFYNRV(ProcessOrtho.process(indexR, pDSM, DSMGrid, GeoidOffSet->value(),mpDSMInterpolationList->currentIndex()));
	//}

}
开发者ID:GSoC-2012-Nascetti,项目名称:SAR_PlugIn,代码行数:56,代码来源:Simulation_GUI.cpp

示例7: populateDataDescriptor

vector<ImportDescriptor*> Jpeg2000Importer::getImportDescriptors(const string& filename)
{
   vector<ImportDescriptor*> descriptors;
   if (filename.empty() == true)
   {
      return descriptors;
   }

   vector<string>& warnings = msWarnings[filename];
   warnings.clear();

   vector<string>& errors = msErrors[filename];
   errors.clear();

   ImportDescriptor* pImportDescriptor = mpModel->createImportDescriptor(filename, "RasterElement", NULL);
   if (pImportDescriptor != NULL)
   {
      RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pImportDescriptor->getDataDescriptor());
      if (pDescriptor != NULL)
      {
         vector<EncodingType> validDataTypes;
         validDataTypes.push_back(INT1UBYTE);
         validDataTypes.push_back(INT1SBYTE);
         validDataTypes.push_back(INT2UBYTES);
         validDataTypes.push_back(INT2SBYTES);
         validDataTypes.push_back(INT4UBYTES);
         validDataTypes.push_back(INT4SBYTES);
         validDataTypes.push_back(FLT4BYTES);
         pDescriptor->setValidDataTypes(validDataTypes);
         pDescriptor->setProcessingLocation(IN_MEMORY);

         // Create and set a file descriptor in the data descriptor
         FactoryResource<RasterFileDescriptor> pFileDescriptor;
         pFileDescriptor->setEndian(BIG_ENDIAN_ORDER);
         if (pFileDescriptor.get() != NULL)
         {
            pFileDescriptor->setFilename(filename);
            pDescriptor->setFileDescriptor(pFileDescriptor.get());
         }

         // Populate the data descriptor from the file
         bool bSuccess = populateDataDescriptor(pDescriptor);
         if (bSuccess == true)
         {
            descriptors.push_back(pImportDescriptor);
         }
         else
         {
            // Delete the import descriptor
            mpModel->destroyImportDescriptor(pImportDescriptor);
         }
      }
   }

   return descriptors;
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:56,代码来源:Jpeg2000Importer.cpp

示例8: copy

// FileDescriptor
FileDescriptor* FileDescriptorAdapter::copy() const
{
   FactoryResource<FileDescriptor> pFileDescriptor;
   if (pFileDescriptor->clone(this) == false)
   {
      return NULL;
   }

   return pFileDescriptor.release();
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:11,代码来源:FileDescriptorAdapter.cpp

示例9: VERIFYNR

void OptionsFileLocations::applyChanges(CustomTreeWidget* pTree)
{
    VERIFYNR(pTree != NULL);
    Service<ConfigurationSettings> pSettings;
    QTreeWidgetItemIterator iter(pTree);
    while (*iter != NULL)
    {
        QTreeWidgetItem* pItem = *iter;
        if (pItem != NULL)
        {
            string type = pItem->text(0).toStdString();
            string confSettingsKey;
            string confSettingsArgumentKey;
            for (vector<FileLocationDescriptor>::iterator iter2 = mFileLocations.begin();
                    iter2 != mFileLocations.end();
                    ++iter2)
            {
                if (iter2->getText() == type)
                {
                    confSettingsKey = iter2->getKey();
                    confSettingsArgumentKey = iter2->getArgumentKey();
                    break;
                }
            }
            if (!confSettingsKey.empty())
            {
                QString strLocation = pItem->text(1);
                strLocation.replace(QRegExp("\\\\"), "/");
                FactoryResource<Filename> pFilename;
                string location = strLocation.toStdString();
                pFilename->setFullPathAndName(location);
                pSettings->setSetting(confSettingsKey, *(pFilename.get()));

                if (type == "Message Log Path")
                {
                    MessageLogMgrImp::instance()->setPath(location);
                }
                else if (type == "Wizard Path")
                {
                    Service<DesktopServices> pDesktop;
                    ApplicationWindow* pAppWindow = static_cast<ApplicationWindow*>(pDesktop->getMainWidget());
                    if ((location != mWizardPath) && (pAppWindow != NULL))
                    {
                        pAppWindow->updateWizardCommands();
                    }
                }
            }
            if (!confSettingsArgumentKey.empty())
            {
                pSettings->setSetting(confSettingsArgumentKey, pItem->text(2).toStdString());
            }
        }
        ++iter;
    }
}
开发者ID:jonatho7,项目名称:opticks,代码行数:55,代码来源:OptionsFileLocations.cpp

示例10: setAttributeByPath

bool DynamicObjectImp::setAttributeByPath(QStringList pathComponents, DataVariant& value, bool swap)
{
   if (!value.isValid())
   {
      return false;
   }

   QString finalName = pathComponents.back();
   pathComponents.pop_back();

   string loopType = "DynamicObject";
   DynamicObject* pLoopObj = dynamic_cast<DynamicObject*>(this);
   DynamicObject* pCurObj = pLoopObj;
   for (QStringList::const_iterator iter = pathComponents.begin();
      iter != pathComponents.end(); ++iter)
   {
      if (pLoopObj == NULL || loopType != "DynamicObject")
      {
         return false;
      }

      pCurObj = pLoopObj;
      DataVariant& attrValue = pCurObj->getAttribute(iter->toStdString());
      loopType = attrValue.getTypeName();
      pLoopObj = attrValue.getPointerToValue<DynamicObject>();

      if ((pLoopObj != NULL) && (loopType != "DynamicObject"))
      {
         return false;
      }

      if (pLoopObj == NULL)
      {
         FactoryResource<DynamicObject> pNewObj;
         if (pCurObj != NULL)
         {
            pCurObj->setAttribute(iter->toStdString(), *pNewObj.get());
            DataVariant& currentValue = pCurObj->getAttribute(iter->toStdString());
            loopType = currentValue.getTypeName();
            pLoopObj = currentValue.getPointerToValue<DynamicObject>();
         }
      }
   }

   if (pLoopObj == NULL || loopType != "DynamicObject")
   {
      return false;
   }

   pCurObj = pLoopObj;
   DynamicObjectImp* const pCurObjImp = dynamic_cast<DynamicObjectImp*>(pCurObj);
   VERIFY(pCurObjImp != NULL);
   return pCurObjImp->setAttribute(finalName.toStdString(), value, swap);
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:54,代码来源:DynamicObjectImp.cpp

示例11: VERIFY

bool bilinear_bayer::copyImage(RasterElement * pRaster,
							   RasterElement * dRaster, int i,
							   Progress * pProgress)
{
	VERIFY(pRaster != NULL);
	RasterDataDescriptor *pDesc =
		dynamic_cast < RasterDataDescriptor * >(pRaster->getDataDescriptor());
	VERIFY(dRaster != NULL);
	RasterDataDescriptor *rDesc =
		dynamic_cast < RasterDataDescriptor * >(dRaster->getDataDescriptor());



	DimensionDescriptor thirdBand = pDesc->getActiveBand(i);	// get active
																// band

	// source
	FactoryResource < DataRequest > pRequest;
	pRequest->setInterleaveFormat(BSQ);
	pRequest->setBands(thirdBand, thirdBand);
	DataAccessor thirdBandDa = pRaster->getDataAccessor(pRequest.release());
	thirdBand = rDesc->getActiveBand(i);

	// destination
	FactoryResource < DataRequest > pResultRequest;
	pResultRequest->setWritable(true);
	pRequest->setInterleaveFormat(BSQ);
	pResultRequest->setBands(thirdBand, thirdBand);
	DataAccessor pDestAcc = dRaster->getDataAccessor(pResultRequest.release());






	VERIFY(thirdBandDa.isValid());
	VERIFY(pDestAcc.isValid());


	for (unsigned int curRow = 0; curRow < pDesc->getRowCount(); ++curRow)

	{
		for (unsigned int curCol = 0; curCol < pDesc->getColumnCount();
			 ++curCol)
		{

			switchOnEncoding(pDesc->getDataType(), bilinear,
							 pDestAcc->getColumn(), thirdBandDa, curRow,
							 curCol, pDesc->getRowCount(),
							 pDesc->getColumnCount(), i, pRaster);
			pDestAcc->nextColumn();
		}

		pDestAcc->nextRow();

	}

	return true;
}
开发者ID:vijeshm,项目名称:Opticks-Photography-Addons,代码行数:59,代码来源:bilinear_bayer.cpp

示例12: pPager

bool LandsatEtmPlusImporter::createRasterPager(RasterElement* pRaster) const
{
   string srcFile = pRaster->getFilename();
   if (srcFile.empty())
   {
      return false;
   }
   {
      //scoping to ensure the file is closed before creating the pager
      LargeFileResource srcFileRes;
      if (!srcFileRes.open(srcFile, O_RDONLY | O_BINARY, S_IREAD))
      {
         return false;
      }
   }
   // create the pager
   ExecutableResource pPager("BandResamplePager");
   VERIFY(pPager->getPlugIn() != NULL);
   bool isWritable = false;
   bool useDataDescriptor = false;
   FactoryResource<Filename> pFilename;
   VERIFY(pFilename.get() != NULL);
   pFilename->setFullPathAndName(pRaster->getFilename());

   pPager->getInArgList().setPlugInArgValue("Raster Element", pRaster);
   pPager->getInArgList().setPlugInArgValue("Filename", pFilename.get());
   pPager->getInArgList().setPlugInArgValue("isWritable", &isWritable);
   pPager->getInArgList().setPlugInArgValue("Use Data Descriptor", &useDataDescriptor);
   RasterDataDescriptor* pDescriptor = static_cast<RasterDataDescriptor*>(pRaster->getDataDescriptor());
   VERIFY(pDescriptor != NULL);
   RasterFileDescriptor* pFileDescriptor = static_cast<RasterFileDescriptor*>(pDescriptor->getFileDescriptor());
   VERIFY(pFileDescriptor != NULL);
   unsigned int band = 5, rows = mB6Rows, cols = mB6Cols;
   pPager->getInArgList().setPlugInArgValue("Band", &band);
   pPager->getInArgList().setPlugInArgValue("Rows", &rows);
   pPager->getInArgList().setPlugInArgValue("Columns", &cols);
   if (!pPager->execute())
   {
      return false;
   }
   RasterPager* pRasterPager = dynamic_cast<RasterPager*>(pPager->getPlugIn());
   if (pRasterPager != NULL)
   {
      pPager->releasePlugIn();
   }
   else
   {
      return false;
   }

   pRaster->setPager(pRasterPager);
   return true;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:53,代码来源:LandsatEtmPlusImporter.cpp

示例13: execute

bool AoiLogical::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
    if (pInArgList == NULL || pOutArgList == NULL)
    {
        return false;
    }
    if (!extractInputArgs(pInArgList))
    {
        return false;
    }

    mProgress.report("Begin AOI set operation.", 1, NORMAL);

    if (isBatch())
    {
        mProgress.report("Batch mode is not supported.", 0, ERRORS, true);
        return false;
    }

    FactoryResource<BitMask> pResultMask;
    if (pResultMask.get() == NULL)
    {
        mProgress.report("Unable to create result AOI.", 0, ERRORS, true);
        return false;
    }
    mpResult = pResultMask.get();

    if (mOperation == "Union")
    {
        mpResult->merge(*mpSet1);
        mpResult->merge(*mpSet2);
    }
    else if (mOperation == "Intersection")
    {
        mpResult->merge(*mpSet1);
        mpResult->intersect(*mpSet2);
    }
    else
    {
        mProgress.report("Invalid operation: " + mOperation, 0, ERRORS, true);
        return false;
    }
    if (!displayResult())
    {
        return false;
    }
    mProgress.upALevel();
    return true;
}
开发者ID:tclarke,项目名称:coan,代码行数:49,代码来源:AoiLogical.cpp

示例14: getRasterElement

RasterElement* AceAlgorithm::createResults(int numRows, int numColumns, const string& sigName)
{
    RasterElement* pElement = getRasterElement();
    if (pElement == NULL)
    {
        return NULL;
    }

    // Delete an existing element to ensure that the new results element is the correct size
    Service<ModelServices> pModel;

    RasterElement* pExistingResults = static_cast<RasterElement*>(pModel->getElement(sigName,
                                      TypeConverter::toString<RasterElement>(), pElement));
    if (pExistingResults != NULL)
    {
        pModel->destroyElement(pExistingResults);
    }

    // Create the new results element
    ModelResource<RasterElement> pResults(RasterUtilities::createRasterElement(sigName, numRows, numColumns,
                                          FLT4BYTES, true, pElement));
    if (pResults.get() == NULL)
    {
        pResults = ModelResource<RasterElement>(RasterUtilities::createRasterElement(sigName, numRows, numColumns,
                                                FLT4BYTES, false, pElement));
        if (pResults.get() == NULL)
        {
            reportProgress(ERRORS, 0, ACEERR009);
            MessageResource(ACEERR009, "spectral", "C89D361B-DB12-43ED-B276-6D98CA3539EE");
            return NULL;
        }
    }

    FactoryResource<Units> pUnits;
    pUnits->setUnitName("degrees");

    vector<int> badValues(1, 181);

    RasterDataDescriptor* pResultsDescriptor = static_cast<RasterDataDescriptor*>(pResults->getDataDescriptor());
    VERIFYRV(pResultsDescriptor != NULL, NULL);
    pResultsDescriptor->setUnits(pUnits.get());
    pResultsDescriptor->setBadValues(badValues);

    Statistics* pStatistics = pResults->getStatistics();
    VERIFYRV(pStatistics != NULL, NULL);
    pStatistics->setBadValues(badValues);

    return pResults.release();
}
开发者ID:yuguess,项目名称:GSoC,代码行数:49,代码来源:AceAlg.cpp

示例15: DataAccessor

DataAccessor BackgroundSuppressionShell::getCurrentFrameAccessor() const
{
   if(mpRaster == NULL)
   {
      return DataAccessor(NULL, NULL);
   }
   RasterDataDescriptor *pDesc = static_cast<RasterDataDescriptor*>(mpRaster->getDataDescriptor());
   VERIFYRV(pDesc != NULL, DataAccessor(NULL, NULL));
   FactoryResource<DataRequest> request;
   VERIFYRV(request.get() != NULL, DataAccessor(NULL, NULL));
   request->setInterleaveFormat(BSQ);
   DimensionDescriptor band = pDesc->getBands()[mCurrentFrame];
   request->setBands(band, band, 1);
   return mpRaster->getDataAccessor(request.release());
}
开发者ID:Siddharthk,项目名称:coan,代码行数:15,代码来源:BackgroundSuppressionShell.cpp


注:本文中的FactoryResource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。