#include <vector>
#include <stdexcept>
#include <set>
#include <string>
#include <sstream>
#include <iostream>
#include <memory>
using namespace Radar;
class ProductVisitor {
public:
protected:
};
if (type == OdimH5v20::PRODUCT_PPI) {
}
else if (type == OdimH5v20::PRODUCT_CAPPI) {
} else {
visit(*prod);
}
}
class ObjectVisitor {
public:
protected:
};
if (type == OdimH5v20::OBJECT_IMAGE) {
} else if (type == OdimH5v20::OBJECT_COMP) {
} else {
visit(*obj);
}
}
class Object2DSplitter {
private:
int id_max ;
int id_hsp ;
int id_vsp ;
public:
Object2DSplitter(){
id_max = -1;
id_hsp = -1;
id_vsp = -1;
}
~Object2DSplitter(){
delete factory;
}
std::string createProductFileName(std::string prodObject,double prodPar, std::string Quantity,time_t prodDateTime){
std::string result;
result=prodObject;
my_time.erase(16,3);
my_time.erase(13,1);
my_time.erase(10,1);
my_time.erase( 7,1);
my_time.erase( 4,1);
result=result+my_time+".h5";
return result;
}
std::string createProductFileName(std::string prodObject,
OdimH5v20::VILHeights prodPar, std::string Quantity,time_t prodDateTime){
std::string result;
result=prodObject;
my_time.erase(16,3);
my_time.erase(13,1);
my_time.erase(10,1);
my_time.erase( 7,1);
my_time.erase( 4,1);
result=result+my_time+".h5";
return result;
}
std::string createProductFileName(std::string prodObject, std::string Quantity,time_t prodDateTime){
std::string result;
result=prodObject;
result=result +"_"+Quantity + "_";
my_time.erase(16,3);
my_time.erase(13,1);
my_time.erase(10,1);
my_time.erase( 7,1);
my_time.erase( 4,1);
result=result+my_time+".h5";
return result;
}
const std::string& objtype = obj->
getObject();
if (not (objtype != OdimH5v20::OBJECT_IMAGE ||
objtype != OdimH5v20::OBJECT_COMP)) {
throw std::logic_error(objtype + " is not supported");
}
const std::string& prod_type = prod->
getProduct();
if (prod_type == OdimH5v20::PRODUCT_MAX ) {
id_max = nprod;
} else if (prod_type == OdimH5v20::PRODUCT_HSP ) {
id_hsp = nprod;
} else if (prod_type == OdimH5v20::PRODUCT_VSP ) {
id_vsp = nprod;
} else {
std::string filename;
std::string quantity ;
if (inputQ->existWhat()){
quantity = inputQ->getWhat()->getStr (ATTRIBUTE_WHAT_QUANTITY);
} else
else
extractProduct( obj, prod, inputQ, filename);
delete inputQ ;
std::cerr<<"ultimo nome definito :"<<filename<<std::endl;
}
}
delete prod;
}
if (id_max >= 0 && (id_hsp >= 0 || id_vsp >=0) ) {
std::string filename;
std::string quantity ;
if (inputQ->existWhat()){
quantity = inputQ->getWhat()->getStr (ATTRIBUTE_WHAT_QUANTITY);
} else
filename = createProductFileName(
"HVMI",quantity,obj->
getDateTime());
extractProduct( obj, prod, inputQ, filename);
if(id_hsp >=0 ) {
extractProduct( obj, prod, inputQ, filename,true);
}
if(id_vsp >=0 ) {
extractProduct( obj, prod, inputQ, filename,true);
}
} else if (id_max >= 0 ) {
std::string filename;
std::string quantity ;
if (inputQ->existWhat()){
quantity = inputQ->getWhat()->getStr (ATTRIBUTE_WHAT_QUANTITY);
} else
extractProduct( obj, prod, inputQ, filename);
}
}
#if 0
protected:
throw std::runtime_error(
"Unsupported object " + obj.
getObject());
}
throw std::runtime_error(
"Unsupported product " + prod.
getProduct());
}
visit(prod);
delete prod;
}
}
const std::string& prod_type = prod->
getProduct();
if (prod_type == OdimH5v20::PRODUCT_MAX ) {
prod_max = prod;
} else if (prod_type == OdimH5v20::PRODUCT_HSP ) {
prod_hsp = prod;
} else if (prod_type == OdimH5v20::PRODUCT_VSP ) {
prod_VSP = prod;
} else if {
visit(prod);
}
delete prod;
}
}
for (int i = 0; i < obj.getQuantityDataCount(); ++i) {
std::auto_ptr<OdimObject> outputObject ;
std::auto_ptr<OdimDataset> outputDataset ;
if (type == OdimH5v20::OBJECT_IMAGE) {
} else if (type == OdimH5v20::OBJECT_COMP) {
}
if (root->
existHow()) outputObject->getHow()->import( root->
getHow() );
const std::string& prod_type = prod.
getObject();
if (prod_type == OdimH5v20::PRODUCT_MAX ) {
prod_max = prod;
} else if (prod_type == OdimH5v20::PRODUCT_HSP ) {
prod_hsp = prod;
} else if (prod_type == OdimH5v20::PRODUCT_VSP ) {
prod_VSP = prod;
} else if {
visit(prod);
}
delete prod;
}
}
count++;
}
#endif
};
std::string quantity ;
} else
if (type == OdimH5v20::OBJECT_IMAGE) {
} else if (type == OdimH5v20::OBJECT_COMP) {
}
std::vector<char> buff ( AtomType.getSize() * height * width );
outputQ->
writeData(&(buff[0]), width, height, AtomType);
QualOutput->getWhat()->import (QualInput->getWhat() );
QualOutput->getWhere()->import(QualInput->getWhere() );
QualOutput->getHow()->import (QualInput->getHow() );
AtomType = QualInput->getQualityType();
std::vector<char> qual( AtomType.getSize() * height * width );
QualInput->readQuality(&(qual[0]));
QualOutput->writeQuality(&(qual[0]), width, height, AtomType);
}
delete outputObject ;
delete outputDataset ;
delete outputQ ;
return ;
}
int main(int argc, const char** argv)
{
Object2DSplitter splitter;
try {
splitter.split(object);
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
}
return 0;
}
OdimH5 v2.0 CompObject.
Definition odimh5v20_classes.hpp:1698
OdimH5 v2.0 horizontalObject.
Definition odimh5v20_classes.hpp:1612
OdimH5 v2.0 ImageObject.
Definition odimh5v20_classes.hpp:1671
virtual Product_2D * createProduct2D(const char *type)
Create a new generic 2D product in this volume.
Definition odimh5v20_classes.cpp:2040
virtual int getProductCount()
Get the number of products dataset store in this volume.
Definition odimh5v20_classes.cpp:2036
virtual Product_2D * getProduct(int index)
Get a pointer to a generic 2D product of the volume.
Definition odimh5v20_classes.cpp:2318
virtual bool existHow()
Test is the HOW attributes group exist.
Definition odimh5v20_classes.cpp:475
virtual H5::AtomType getDataType()
Get the HDF5 atom type of the elements of the HDF5 dataset contained inside this 'data' group.
Definition odimh5v20_classes.cpp:506
virtual MetadataGroup * getWhat()
Get the WHAT attributes group.
Definition odimh5v20_classes.cpp:480
virtual int getDataHeight()
Get the height (rows num) of the matrix associated to this data group.
Definition odimh5v20_classes.cpp:542
virtual bool existWhat()
Test is the WHAT attributes group exist.
Definition odimh5v20_classes.cpp:465
virtual MetadataGroup * getWhere()
Get the WHERE attributes group.
Definition odimh5v20_classes.cpp:487
virtual void readData(void *buffer)
Read data from the dataset of this 'data' group
Definition odimh5v20_classes.cpp:654
virtual void writeData(const void *buff, int width, int height, const H5::DataType &elemtype)
Write data to the matrix associated to this 'data' group.
Definition odimh5v20_classes.cpp:584
virtual MetadataGroup * getHow()
Get the HOW attributes group.
Definition odimh5v20_classes.cpp:494
virtual bool existWhere()
Test is the WHERE attributes group exist.
Definition odimh5v20_classes.cpp:470
virtual int getDataWidth()
Get the width (cols num) of the matrix associated to this data group.
Definition odimh5v20_classes.cpp:535
virtual bool existWhat()
Test is the WHAT attributes group exist.
Definition odimh5v20_classes.cpp:332
virtual bool existHow()
Test is the HOW attributes group exist.
Definition odimh5v20_classes.cpp:342
virtual MetadataGroup * getWhere()
Get the WHERE attributes group.
Definition odimh5v20_classes.cpp:354
virtual MetadataGroup * getWhat()
Get the WHAT attributes group.
Definition odimh5v20_classes.cpp:347
virtual MetadataGroup * getHow()
Get the HOW attributes group.
Definition odimh5v20_classes.cpp:361
virtual bool existWhere()
Test is the WHERE attributes group exist.
Definition odimh5v20_classes.cpp:337
OdimH5 objects factory.
Definition odimh5v20_factory.hpp:50
virtual OdimObject * open(const std::string &path)
Get a OdimH5 object from an existing file.
Definition odimh5v20_factory.cpp:112
virtual CompObject * createCompObject(const std::string &path)
Create a new OdimH5 COMP object and the associated file.
Definition odimh5v20_factory.cpp:215
virtual CompObject * openCompObject(const std::string &path)
Get a OdimH5 COMP object from an existing file.
Definition odimh5v20_factory.cpp:310
virtual ImageObject * openImageObject(const std::string &path)
Get a OdimH5 IMAGE object from an existing file.
Definition odimh5v20_factory.cpp:285
virtual ImageObject * createImageObject(const std::string &path)
Create a new OdimH5 IMAGE object and the associated file.
Definition odimh5v20_factory.cpp:190
Generic OdimH5 v2.0 object.
Definition odimh5v20_classes.hpp:95
virtual time_t getDateTime()
Get the joined value of 'date' and 'time' attributes.
Definition odimh5v20_classes.cpp:296
virtual MetadataGroup * getWhere()
Get the WHERE attributes group.
Definition odimh5v20_classes.cpp:179
virtual std::string getObject()
Get the value of 'object' attribute.
Definition odimh5v20_classes.cpp:292
virtual bool existHow()
Test is the HOW attributes group exist.
Definition odimh5v20_classes.cpp:203
virtual MetadataGroup * getWhat()
Get the WHAT attributes group.
Definition odimh5v20_classes.cpp:172
virtual MetadataGroup * getHow()
Get the HOW attributes group.
Definition odimh5v20_classes.cpp:186
virtual bool existWhere()
Test is the WHERE attributes group exist.
Definition odimh5v20_classes.cpp:198
virtual bool existWhat()
Test is the WHAT attributes group exist.
Definition odimh5v20_classes.cpp:193
Generic OdimH5 v2.0 quality group.
Definition odimh5v20_classes.hpp:630
OdimH5 v2.0 2d product quantity data.
Definition odimh5v20_classes.hpp:2542
virtual int getQualityDataCount()
Get number of quality fields stored in the scan.
Definition odimh5v20_classes.cpp:3602
virtual OdimQuality * createQualityData()
Create a new group for quality within the 'data' group.
Definition odimh5v20_classes.cpp:3627
virtual OdimQuality * getQualityData(int index)
Get the data associated to a quality.
Definition odimh5v20_classes.cpp:3606
OdimH5 v2.0 Product_2D Dataset.
Definition odimh5v20_classes.hpp:1786
virtual VILHeights getProdParVIL()
Get the value of 'prodpar' attribute as VILHeights pair.
Definition odimh5v20_classes.cpp:2748
virtual double getProdPar()
Get the value of 'prodpar' attribute as double value.
Definition odimh5v20_classes.cpp:2747
virtual int getQuantityDataCount()
Get number of quantities stored in the scan.
Definition odimh5v20_classes.cpp:2915
virtual std::string getObject()
Get the value of 'object' attribute.
Definition odimh5v20_classes.cpp:2711
virtual std::string getProduct()
Get the value of 'product' attribute.
Definition odimh5v20_classes.cpp:2745
virtual Product_2D_Data * createQuantityData(const char *name)
Create a new group for a quantity in the product.
Definition odimh5v20_classes.cpp:2895
virtual Product_2D_Data * getQuantityData(int index)
Get the data associated to a quantity.
Definition odimh5v20_classes.cpp:2982
std::set< std::string > getStoredQuantities()
Get the name of all quantities present in this scan.
Definition odimh5v20_classes.cpp:2960
OdimH5 v2.0 CAPPI Product Dataset.
Definition odimh5v20_classes.hpp:2141
OdimH5 v2.0 PPI Product Dataset.
Definition odimh5v20_classes.hpp:2115
Bottom and top heights (m) of the integration layer.
Definition odimh5v20_support.hpp:418
double bottom
Lower value in meters.
Definition odimh5v20_support.hpp:423
double top
Upper value in meters.
Definition odimh5v20_support.hpp:427
Namespace related to ODIMH5 version 2.0.
Definition odimh5v20.hpp:46
void split(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters)
Splits a string into substrings using the chacatars of a given string as tokens separators.
Definition string.cpp:34
std::string toString(bool value)
Convert a boolean value to its string rapresentation (0/1).
Definition string.cpp:109
std::string absoluteToString(time_t value)
, const char* fmt)
Definition time.cpp:256
Main header file of the library.