Example #1
0
void addLightingTest4( std::shared_ptr<Container> container )
{
    float zoff = -5.0;

    container->add( std::make_shared<Sphere>( 0.0, 0.0, zoff - 2.0, 0.2 ) );
    container->add( std::make_shared<Sphere>( -0.4, 0.0, zoff, 0.2 ) );
    container->add( std::make_shared<Sphere>( 0.4, 0.0, zoff, 0.2 ) );
    container->add( std::make_shared<Sphere>( 0.0, -0.4, zoff, 0.2 ) );
    container->add( std::make_shared<Sphere>( 0.0, 0.4, zoff, 0.2 ) );

    float lightoff = zoff + 0.3;

    addSphereLight( container,
                    Vector4( -0.4, 0.4, lightoff ), 0.1,
                    RGBColor( 0.0, 0.0, 1.0 ), 15.0 );
    addSphereLight( container,
                    Vector4( 0.4, 0.4, lightoff ), 0.1,
                    RGBColor( 0.0, 1.0, 0.0 ), 15.0 );
    addSphereLight( container,
                    Vector4( 0.4, -0.4, lightoff ), 0.1,
                    RGBColor( 1.0, 0.0, 0.0 ), 15.0 );
    addSphereLight( container,
                    Vector4( -0.4, -0.4, lightoff ), 0.1,
                    RGBColor( 1.0, 1.0, 0.0 ), 15.0 );

}
Example #2
0
void addInput(std::shared_ptr<terrama2::services::collector::core::DataManager> dataManager)
{
  ///////////////////////////////////////////////
  //     input
  // DataProvider information
  terrama2::core::DataProvider* dataProvider = new terrama2::core::DataProvider();
  terrama2::core::DataProviderPtr dataProviderPtr(dataProvider);
  dataProvider->uri = "file://"+TERRAMA2_DATA_DIR+"/fire_system";

  dataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT;
  dataProvider->active = true;
  dataProvider->id = 1;
  dataProvider->name = "DataProvider queimadas local";
  dataProvider->dataProviderType = "FILE";

  dataManager->add(dataProviderPtr);

  auto& semanticsManager = terrama2::core::SemanticsManager::getInstance();
  // DataSeries information
  terrama2::core::DataSeries* dataSeries = new terrama2::core::DataSeries();
  terrama2::core::DataSeriesPtr dataSeriesPtr(dataSeries);
  dataSeries->id = 1;
  dataSeries->name = "DataProvider queimadas local";
  dataSeries->semantics = semanticsManager.getSemantics("OCCURRENCE-wfp");
  dataSeries->dataProviderId = dataProviderPtr->id;

  terrama2::core::DataSetOccurrence* dataSet = new terrama2::core::DataSetOccurrence();
  dataSet->id = 1;
  dataSet->active = true;
  dataSet->format.emplace("mask", "exporta_%YYYY%MM%DD_%hh%mm.csv");

  dataSeries->datasetList.emplace_back(dataSet);

  dataManager->add(dataSeriesPtr);
}
Example #3
0
//////////////////////////////////////////
//     Mirror Test
//////////////////////////////////////////
void addMirrors( std::shared_ptr<Container> container )
{
    auto cube1 = std::make_shared<AxisAlignedSlab>( -5.0, -5.0, -5.0,
                                                     5.0, 5.0, -5.2 );
    cube1->material = std::make_shared<MirrorMaterial>();
    container->add( cube1 );
    auto cube2 = std::make_shared<AxisAlignedSlab>( -2.5, -5.0, -5.0,
                                                    -2.7, 5.0, 5.0 );
    cube2->material = std::make_shared<MirrorMaterial>();
    container->add( cube2 );
}
Example #4
0
void addGroundPlane( std::shared_ptr<Container> container )
{
    // makeshift ground plane
    auto floor = std::make_shared<AxisAlignedSlab>( -5.0, -0.5, +10.0,
                                                     5.0, -0.9, -10.0 );
    floor->material = std::make_shared<DiffuseMaterial>( 1.0, 1.0, 1.0 );
    container->add( floor );
    
#if 0
    // DEBUG ME
    TriangleMesh * ground = new TriangleMesh();
    makeTriangleMeshGroundPlatform( *ground, 200.0 );
    container->add( ground );
#endif
}
Example #5
0
// cube pyramid
void addLightingTest2( std::shared_ptr<Container> container )
{
    addGroundPlane( container );
    addSphereLight( container,
                    Vector4( 1.0, 4.0, -2.0 ), 1.5,
                    RGBColor( 1.0, 1.0, 1.0 ), 20.0 );

    float size = 0.4;
    Vector4 c( -0.6, -0.5, -2.0 ); // back corner

    container->add( std::make_shared<AxisAlignedSlab>( c.x,        c.y,        c.z,        size ) );
    container->add( std::make_shared<AxisAlignedSlab>( c.x + size, c.y,        c.z,        size ) );
    container->add( std::make_shared<AxisAlignedSlab>( c.x       , c.y + size, c.z,        size ) );
    container->add( std::make_shared<AxisAlignedSlab>( c.x       , c.y       , c.z + size, size ) );

}
Example #6
0
void addBunny( std::shared_ptr<Container> container )
{
    AssetLoader loader;
    std::string modelPath = "models";

    // bunnies
    std::string bunnyPath = modelPath + "/stanford/bunny/reconstruction";
    auto mesh = loader.load( bunnyPath + "/bun_zipper_res2.ply" );
    //auto mesh = loader.load( bunnyPath + "/bun_zipper_res4.ply" );

    if( !mesh ) {
        fprintf( stderr, "Error loading mesh\n" );
        return;
    }

    //mesh->material = std::make_shared<DiffuseMaterial>( 0.0f, 0.66, 0.42f ); // emerald green
    mesh->material = std::make_shared<MirrorMaterial>();

    printf("Building octree\n");
    auto mesh_octree = new TMOctreeAccelerator( *std::dynamic_pointer_cast<TriangleMesh>(mesh) );
    mesh_octree->build();
    mesh->accelerator = mesh_octree;
    mesh->transform = std::make_shared<Transform>();
    *mesh->transform = makeTranslation( Vector4( 0.0, 0.2, -0.5 ) );
    container->add( mesh );
}
void terrama2::services::alert::core::AdditionalDataHelper::addAdditionalAttributesColumns(std::shared_ptr<te::da::DataSetType> alertDataSetType) const
{
  if(!isDataReady_)
  {
    throw AdditionalDataException() << ErrorDescription(QObject::tr("Data not loaded.\nCall AdditionalDataHelper::prepareData."));
  }

  for(const auto& data : dataMap_)
  {
    const auto& dataSet = data.first;
    const auto& dataSetSeries = data.second;

    for(const auto& attribute : additionalData_.attributes)
    {
      try
      {
        std::string name = dataSeries_->name+"_"+attribute+"_"+std::to_string(dataSet->id);
        auto teDataSetType = dataSetSeries.teDataSetType;
        auto property = teDataSetType->getProperty(attribute);
        auto newProperty = property->clone();
        newProperty->setName(name);
        alertDataSetType->add(newProperty);
      }
      catch(...)
      {
        TERRAMA2_LOG_WARNING() << QObject::tr("Attribute %1 not found in dataset %2").arg(QString::fromStdString(attribute)).arg(dataSet->id);
      }
    }
  }
}
Example #8
0
void addLightingTest1( std::shared_ptr<Container> container )
{
    addGroundPlane( container );
    addSphereLight( container,
                    Vector4( 1.0, 0.8, -3.0 ), 0.5,
                    RGBColor( 1.0, 1.0, 1.0 ), 20.0 );
    auto cube1 = std::make_shared<AxisAlignedSlab>(  0.1, -0.5, -1.0,
                                                     0.3, -0.3, -1.2 );
    auto cube2 = std::make_shared<AxisAlignedSlab>( -0.1, -0.5, -1.2,
                                                     0.1, -0.3, -1.4 );
    container->add( cube1 );
    container->add( cube2 );
    auto cube3 = std::make_shared<AxisAlignedSlab>( -1.0, -0.5, -6.0,
                                                     1.0 );
    container->add( cube3 );
}
Example #9
0
void Scene :: iterate_node(const std::shared_ptr<Node>& parent, const std::shared_ptr<Meta>& doc)
{
    shared_ptr<Node> node;
    string name = doc->at<string>("name", string());
    string type = doc->at<string>("type", string());
    //LOGf("node: %s: %s", name % type);

    //int light_count = 0;
    
    // based on node type, create the node
    if(type == "empty")
        node = make_shared<Node>();
    else if(type == "mesh")
    {
        //LOGf("mesh fn %s name %s", m_Filename % name);
        auto data = doc->at<string>("data", string());
        //if(name.find(":") != string::npos)
        //    return;
        if(not data.empty())
            node = make_shared<Mesh>(m_Filename + ":" + data, m_pCache);
    }
#ifndef QOR_NO_AUDIO
    else if(type == "sound")
    {
        string fn = doc->at<string>("sound", string());
        if(not fn.empty()){
            //LOGf("sound: %s", fn);
            auto snd = make_shared<Sound>(fn, m_pCache);
            node = snd;
        }else{
            //WARNINGf("Object %s has no sound file.");
        }
    }
#endif
    else if(type == "light")
    {
        auto light = make_shared<Light>(doc);
        node = light;
    }
    if(not node)
        node = make_shared<Node>();
    
    try{
        deserialize_node(node, doc);
        //LOGf("matrix %s", Matrix::to_string(*node->matrix()));
        parent->add(node);
        node->pend();
    }catch(const out_of_range&){}
    
    try{
        for(auto& e: *doc->meta("nodes"))
        {
            try{
                iterate_node(node, e.as<std::shared_ptr<Meta>>());
            }catch(const boost::bad_any_cast&){}
        }
    }catch(const out_of_range&){}
}
Example #10
0
void addTransformedCubes( std::shared_ptr<Container> container )
{
    // Offset cubes for testing AO
    float cube_size = 0.2;
    auto cube1 = std::make_shared<AxisAlignedSlab>( 0.0, 0.0, 0.0,
                                                   cube_size );
    auto cube2 = std::make_shared<AxisAlignedSlab>( 0.0, 0.0, 0.0,
                                                    cube_size );
    auto cube3 = std::make_shared<AxisAlignedSlab>( 0.0, 0.0, 0.0,
                                                    cube_size );

    cube1->material = std::make_shared<DiffuseMaterial>( 1.0, 0.0, 0.0 );
    cube2->material = std::make_shared<DiffuseMaterial>( 0.0, 0.0, 1.0 );
    cube3->material = std::make_shared<DiffuseMaterial>( 0.0, 1.0, 0.0 );

    cube1->transform = std::make_shared<Transform>();
    *cube1->transform = makeTranslation( Vector4( 0.1, 0.5, -1.0 ) );

    cube2->transform = std::make_shared<Transform>();
    *cube2->transform = 
        compose(
            makeTranslation( Vector4( 0.0, 0.15, -1.0 ) ),
            compose( 
                makeRotation( M_PI / 4.0, Vector4( 0.0, 1.0, 0.0 ) ),
                makeRotation( M_PI / 4.0, Vector4( 0.0, 0.0, 1.0 ) )
                )
            );

    cube3->transform = std::make_shared<Transform>();
    *cube3->transform = 
        compose(
            makeTranslation( Vector4( -0.3, 0.0, -1.0 ) ),
            makeScaling( 0.2, 3.0, 2.0 )
            );

    container->add( cube1 );
    container->add( cube2 );
    container->add( cube3 );

    addSphereLight( container,
                    Vector4( 3.0, 3.0, -1.0 ), 0.5,
                    RGBColor( 1.0, 1.0, 1.0 ), 200.0 );

    addGroundPlane( container );
}
Example #11
0
void addOutput(std::shared_ptr<terrama2::services::collector::core::DataManager> dataManager)
{
  ///////////////////////////////////////////////
  //     output

  QUrl uri;
  uri.setScheme("postgis");
  uri.setHost(QString::fromStdString(TERRAMA2_DATABASE_HOST));
  uri.setPort(std::stoi(TERRAMA2_DATABASE_PORT));
  uri.setUserName(QString::fromStdString(TERRAMA2_DATABASE_USERNAME));
  uri.setPassword(QString::fromStdString(TERRAMA2_DATABASE_PASSWORD));
  uri.setPath(QString::fromStdString("/"+TERRAMA2_DATABASE_DBNAME));

  // DataProvider information
  terrama2::core::DataProvider* outputDataProvider = new terrama2::core::DataProvider();
  terrama2::core::DataProviderPtr outputDataProviderPtr(outputDataProvider);
  outputDataProvider->id = 2;
  outputDataProvider->name = "DataProvider queimadas postgis";
  outputDataProvider->uri = uri.url().toStdString();
  outputDataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT;
  outputDataProvider->dataProviderType = "POSTGIS";
  outputDataProvider->active = true;

  dataManager->add(outputDataProviderPtr);

  // DataSeries information
  terrama2::core::DataSeries* outputDataSeries = new terrama2::core::DataSeries();
  terrama2::core::DataSeriesPtr outputDataSeriesPtr(outputDataSeries);
  outputDataSeries->id = 2;
  outputDataSeries->name = "DataProvider queimadas postgis";
  auto& semanticsManager = terrama2::core::SemanticsManager::getInstance();
  outputDataSeries->semantics = semanticsManager.getSemantics("OCCURRENCE-postgis");
  outputDataSeries->dataProviderId = outputDataProviderPtr->id;

  dataManager->add(outputDataSeriesPtr);

  // DataSet information
  terrama2::core::DataSetOccurrence* outputDataSet = new terrama2::core::DataSetOccurrence();
  outputDataSet->active = true;
  outputDataSet->id = 2;
  outputDataSet->dataSeriesId = outputDataSeries->id;
  outputDataSet->format.emplace("table_name", "queimadas_test_table");

  outputDataSeries->datasetList.emplace_back(outputDataSet);
}
Example #12
0
void terrama2::core::DataAccessorGrid::addColumns(std::shared_ptr<te::da::DataSetTypeConverter> converter, const std::shared_ptr<te::da::DataSetType>& datasetType) const
{
  for(std::size_t i = 0, size = datasetType->size(); i < size; ++i)
  {
    te::dt::Property* p = datasetType->getProperty(i);

    converter->add(i,p->clone());
  }
}
Example #13
0
void Object::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
    {
        namePrefix += utility::conversions::to_string_t(".");
    }
    multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("object"), m_object));
}
Example #14
0
void addRandomSpheres( std::shared_ptr<Container> container, RandomNumberGenerator & rng, int numSpheres )
{
	for( int si = 0; si < numSpheres; si++ ) {
        container->add( std::make_shared<Sphere>( Vector4( rng.uniformRange( -1.5, 1.5 ),
                                                           rng.uniformRange( -1.5, 1.5 ),
                                                           rng.uniformRange( -10.0, -3.0 ) ),
                                                  0.15 ) );
    }
}
Example #15
0
void Tag::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix[namePrefix.size() - 1] != U('.'))
    {
        namePrefix += U(".");
    }

    if(m_IdIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("id"), m_Id));
    }
    if(m_NameIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("name"), m_Name));
        
    }
}
Example #16
0
void terrama2::core::DataAccessorDcpToa5::adapt(DataSetPtr dataset, std::shared_ptr<te::da::DataSetTypeConverter> converter) const
{
    //only one timestamp column
    te::dt::DateTimeProperty* dtProperty = new te::dt::DateTimeProperty("DateTime", te::dt::TIME_INSTANT_TZ);

    //Find the rigth column to adapt
    std::vector<te::dt::Property*> properties = converter->getConvertee()->getProperties();
    for(size_t i = 0, size = properties.size(); i < size; ++i)
    {
        te::dt::Property* property = properties.at(i);

        if (property->getName() == getRecordPropertyName(dataset))
        {
            te::dt::Property* property = properties.at(i);

            std::string name = property->getName();

            te::dt::SimpleProperty* newProperty = new te::dt::SimpleProperty(name, te::dt::INT32_TYPE);
            converter->add(i, newProperty, boost::bind(&terrama2::core::DataAccessor::stringToInt, this, _1, _2, _3));
        }
        else if (property->getName() == getStationPropertyName(dataset))
        {
            te::dt::Property* property = properties.at(i);

            converter->add(i, property->clone());
        }
        else if(property->getName() == getTimestampPropertyName(dataset))
        {
            // datetime column found
            converter->add(i, dtProperty, boost::bind(&terrama2::core::DataAccessorDcpToa5::stringToTimestamp, this, _1, _2, _3, getTimeZone(dataset)));
        }
        else
        {
            // DCP-TOA5 dataset columns have the name of the dcp before every column,
            // remove the name and keep only the column name
            te::dt::Property* property = properties.at(i);

            std::string name = property->getName();

            te::dt::SimpleProperty* newProperty = new te::dt::SimpleProperty(name, te::dt::DOUBLE_TYPE);
            converter->add(i, newProperty, boost::bind(&terrama2::core::DataAccessor::stringToDouble, this, _1, _2, _3));
        }
    }
}
Example #17
0
void Error_error::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
    {
        namePrefix += utility::conversions::to_string_t(".");
    }

    if(m_MessageIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("message"), m_Message));
        
    }
    if(m_NameIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name));
        
    }
}
Example #18
0
void addRandomCubes( std::shared_ptr<Container> container, RandomNumberGenerator & rng, int numCubes )
{
	for( int si = 0; si < numCubes; si++ ) {
        float x = rng.uniformRange( -1.5, 1.5 );
        float y = rng.uniformRange( -1.5, 1.5 );
        float z = rng.uniformRange( -10.0, -3.0 );
        container->add( std::make_shared<AxisAlignedSlab>( x - 0.1, y - 0.1, z - 0.1,
                                                           x + 0.1, y + 0.1, z + 0.1 ) );
	}
}
void addInput(std::shared_ptr<terrama2::services::collector::core::DataManager> dataManager)
{
  ///////////////////////////////////////////////
  //     input
  // DataProvider information
  terrama2::core::DataProvider* dataProvider = new terrama2::core::DataProvider();
  terrama2::core::DataProviderPtr dataProviderPtr(dataProvider);
  dataProvider->uri = "ftp://*****:*****@server-ftpdsa.cptec.inpe.br";

  dataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT;
  dataProvider->active = true;
  dataProvider->id = 1;
  dataProvider->name = "Dados DSA curso";
  dataProvider->dataProviderType = "FTP";

  dataManager->add(dataProviderPtr);

  auto& semanticsManager = terrama2::core::SemanticsManager::getInstance();
  // DataSeries information
  terrama2::core::DataSeries* dataSeries = new terrama2::core::DataSeries();
  terrama2::core::DataSeriesPtr dataSeriesPtr(dataSeries);
  dataSeries->id = 1;
  dataSeries->name = "Hidroestimador_input";
  dataSeries->semantics = semanticsManager.getSemantics("GRID-grads");
  dataSeries->dataProviderId = dataProviderPtr->id;

  terrama2::core::DataSetOccurrence* dataSet = new terrama2::core::DataSetOccurrence();
  dataSet->id = 1;
  dataSet->active = true;
  dataSet->format.emplace("ctl_filename", "racc.ctl");
  dataSet->format.emplace("folder", "hidro");
  dataSet->format.emplace("srid", "4326");
  dataSet->format.emplace("timezone", "UTC+00");
  dataSet->format.emplace("data_type", "INT16");
  dataSet->format.emplace("number_of_bands", "1");
  dataSet->format.emplace("bytes_before", "0");
  dataSet->format.emplace("bytes_after", "0");

  dataSeries->datasetList.emplace_back(dataSet);

  dataManager->add(dataSeriesPtr);
}
Example #20
0
void addOffsetCubes( std::shared_ptr<Container> container )
{
    // Offset cubes for testing AO
    auto cube1 = std::make_shared<AxisAlignedSlab>(  0.1, -0.5, -1.0,
                                                     0.3, -0.3, -1.2 );
    auto cube2 = std::make_shared<AxisAlignedSlab>( -0.1, -0.5, -1.2,
                                                     0.1, -0.3, -1.4 );
    cube1->material = std::make_shared<DiffuseMaterial>( 1.0, 0.0, 0.0 );
    container->add( cube1 );
    container->add( cube2 );
}
Example #21
0
void addSphereLight( std::shared_ptr<Container> container,
                     const Vector4 & center, float r,
                     const RGBColor & color,
                     float power )
{
    auto emitter = std::make_shared<Sphere>( center, r );
    emitter->material = std::make_shared<Material>();
    emitter->material->emittance = color;
    emitter->material->emittance.scale( power );
    container->add( emitter );
}
Example #22
0
void Order::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
    {
        namePrefix += utility::conversions::to_string_t(".");
    }

    if(m_IdIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id));
    }
    if(m_PetIdIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("petId"), m_PetId));
    }
    if(m_QuantityIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("quantity"), m_Quantity));
    }
    if(m_ShipDateIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("shipDate"), m_ShipDate));
        
    }
    if(m_StatusIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("status"), m_Status));
        
    }
    if(m_CompleteIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("complete"), m_Complete));
    }
}
void addStaticDataSeries(std::shared_ptr<terrama2::services::collector::core::DataManager> dataManager)
{
  terrama2::core::DataProvider* dataProvider = new terrama2::core::DataProvider();
  std::shared_ptr<const terrama2::core::DataProvider> dataProviderPtr(dataProvider);
  dataProvider->name = "Provider";
  dataProvider->uri += TERRAMA2_DATA_DIR;
  dataProvider->uri += "/shapefile";
  dataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT;
  dataProvider->dataProviderType = "FILE";
  dataProvider->active = true;
  dataProvider->id = 3;

  dataManager->add(dataProviderPtr);

  auto& semanticsManager = terrama2::core::SemanticsManager::getInstance();

  terrama2::core::DataSeries* dataSeries = new terrama2::core::DataSeries();
  terrama2::core::DataSeriesPtr dataSeriesPtr(dataSeries);
  dataSeries->dataProviderId = dataProvider->id;
  dataSeries->semantics = semanticsManager.getSemantics("STATIC_DATA-ogr");
  dataSeries->semantics.dataSeriesType = terrama2::core::DataSeriesType::STATIC;
  dataSeries->name = "States Brazil";
  dataSeries->id = 3;
  dataSeries->dataProviderId = dataProvider->id;

  //DataSet information
  terrama2::core::DataSet* dataSet = new terrama2::core::DataSet;
  terrama2::core::DataSetPtr dataSetPtr(dataSet);
  dataSet->active = true;
  dataSet->format.emplace("mask", "estados_2010.shp");
  dataSet->format.emplace("srid", "4326");
  dataSet->format.emplace("identifier", "nome");
  dataSet->id = 1;
  dataSet->dataSeriesId = dataSeries->id;

  dataSeries->datasetList.push_back(dataSetPtr);
  dataManager->add(dataSeriesPtr);

}
Example #24
0
void
Ledger::rawInsert(std::shared_ptr<SLE> const& sle)
{
    Serializer ss;
    sle->add(ss);
    auto item = std::make_shared<
        SHAMapItem const>(sle->key(),
            std::move(ss));
    // VFALCO NOTE addGiveItem should take ownership
    if (! stateMap_->addGiveItem(
            std::move(item), false, false))
        LogicError("Ledger::rawInsert: key already exists");
}
Example #25
0
void
Ledger::rawReplace(std::shared_ptr<SLE> const& sle)
{
    Serializer ss;
    sle->add(ss);
    auto item = std::make_shared<
        SHAMapItem const>(sle->key(),
            std::move(ss));
    // VFALCO NOTE updateGiveItem should take ownership
    if (! stateMap_->updateGiveItem(
            std::move(item), false, false))
        LogicError("Ledger::rawReplace: key not found");
}
void addOutput(std::shared_ptr<terrama2::services::collector::core::DataManager> dataManager)
{
  ///////////////////////////////////////////////
  //     output

  // DataProvider information
  terrama2::core::DataProvider* outputDataProvider = new terrama2::core::DataProvider();
  terrama2::core::DataProviderPtr outputDataProviderPtr(outputDataProvider);
  outputDataProvider->id = 2;
  outputDataProvider->name = "Dados locais";
  outputDataProvider->uri = "file://"+TERRAMA2_DATA_DIR;
  outputDataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT;
  outputDataProvider->dataProviderType = "FILE";
  outputDataProvider->active = true;

  dataManager->add(outputDataProviderPtr);

  // DataSeries information
  terrama2::core::DataSeries* outputDataSeries = new terrama2::core::DataSeries();
  terrama2::core::DataSeriesPtr outputDataSeriesPtr(outputDataSeries);
  outputDataSeries->id = 2;
  outputDataSeries->name = "Hidroestimador";
  auto& semanticsManager = terrama2::core::SemanticsManager::getInstance();
  outputDataSeries->semantics = semanticsManager.getSemantics("GRID-geotiff");
  outputDataSeries->dataProviderId = outputDataProviderPtr->id;

  dataManager->add(outputDataSeriesPtr);

  // DataSet information
  terrama2::core::DataSetOccurrence* outputDataSet = new terrama2::core::DataSetOccurrence();
  outputDataSet->active = true;
  outputDataSet->id = 2;
  outputDataSet->dataSeriesId = outputDataSeries->id;
  outputDataSet->format.emplace("mask", "S10238225_%YYYY%MM%DD%hh%mm");
  outputDataSet->format.emplace("folder", "hidroestimador_crop");

  outputDataSeries->datasetList.emplace_back(outputDataSet);
}
Example #27
0
void addGridSeries(std::shared_ptr<terrama2::services::collector::core::DataManager> dataManager)
{
  //DataProvider information
  terrama2::core::DataProvider* dataProvider = new terrama2::core::DataProvider();
  terrama2::core::DataProviderPtr dataProviderPtr(dataProvider);
  dataProvider->uri = "file://"+TERRAMA2_DATA_DIR;

  dataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT;
  dataProvider->dataProviderType = "FILE";
  dataProvider->active = true;
  dataProvider->id = 3;
  dataProvider->name = "Local Geotiff";

  dataManager->add(dataProviderPtr);

  auto& semanticsManager = terrama2::core::SemanticsManager::getInstance();

  //DataSeries information
  terrama2::core::DataSeries* dataSeries = new terrama2::core::DataSeries();
  terrama2::core::DataSeriesPtr dataSeriesPtr(dataSeries);
  dataSeries->semantics = semanticsManager.getSemantics("GRID-static_geotiff");
  dataSeries->name = "geotiff";
  dataSeries->id = 3;
  dataSeries->dataProviderId = 3;

  terrama2::core::DataSetGrid* dataSet = new terrama2::core::DataSetGrid();
  dataSet->id = 3;
  dataSet->active = true;
  dataSet->format.emplace("mask", "cbers2b_rgb342_crop.tif");
  dataSet->format.emplace("folder", "geotiff");

  dataSeries->datasetList.emplace_back(dataSet);

  dataManager->add(dataSeriesPtr);

}
Example #28
0
void ApiResponse::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix[namePrefix.size() - 1] != U('.'))
    {
        namePrefix += U(".");
    }

    if(m_CodeIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("code"), m_Code));
    }
    if(m_TypeIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("type"), m_Type));
                
    }
    if(m_MessageIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("message"), m_Message));
                
    }
    
}
Example #29
0
	void Initialize(std::shared_ptr<DerandomizePatch> dp, std::shared_ptr<GameHooks> gh, std::shared_ptr<CustomHudPatch> chp) {
		std::shared_ptr<Spelunky> spel = dp->spel;
		mods = std::make_shared<PatchGroup>(spel);
		mods->add("alld", std::make_shared<AllDarkPatch>(spel));
		mods->add("dpos", std::make_shared<DarkPossiblePatch>(spel));
		mods->add("aip", std::make_shared<AppendAIPatch>(spel));
		mods->add("smo", std::make_shared<ShopContentsPatch>(dp));
		mods->add("smlt", std::make_shared<Timer99Patch>(dp));
		mods->add("pret", std::make_shared<PreciseTimerPatch>(dp, gh,  chp));
	}
Example #30
0
void addSlabGrid( std::shared_ptr<Container> container )
{
    container->add( std::make_shared<AxisAlignedSlab>( -0.1-0.45, -0.1, -1.0,
                                                       0.1-0.45,  0.1, -5.3 ) );
    container->add( std::make_shared<AxisAlignedSlab>( -0.1+0.45, -0.1, -1.0,
                                                       0.1+0.45,  0.1, -5.3 ) );
    container->add( std::make_shared<AxisAlignedSlab>( -0.1, -0.1+0.45, -1.0,
                                                       0.1,  0.1+0.45, -5.3 ) );
    container->add( std::make_shared<AxisAlignedSlab>( -0.1, -0.1-0.45, -1.0,
                                                       0.1,  0.1-0.45, -5.3 ) );

    container->add( std::make_shared<AxisAlignedSlab>( -0.1-0.45, -0.1-0.45, -1.0,
                                                       0.1-0.45,  0.1-0.45, -5.3 ) );
    container->add( std::make_shared<AxisAlignedSlab>( -0.1-0.45, -0.1+0.45, -1.0,
                                                       0.1-0.45,  0.1+0.45, -5.3 ) );
    container->add( std::make_shared<AxisAlignedSlab>( -0.1+0.45, -0.1-0.45, -1.0,
                                                       0.1+0.45,  0.1-0.45, -5.3 ) );
    container->add( std::make_shared<AxisAlignedSlab>( -0.1+0.45, -0.1+0.45, -1.0,
                                                       0.1+0.45,  0.1+0.45, -5.3 ) );
}