const PropertyHolder::PropertyList PropertyHolder::PropertiesMatching(const string& reference, const string& prefix, bool lookupParents) const
{
    IRI iri = MakePropertyIRI(reference, prefix);
    if ( iri.IsEmpty() )
        return PropertyList();
    return PropertiesMatching(iri, lookupParents);
}
Beispiel #2
0
static void print_usage(int detail)
{
 fprintf(stderr,
         "Usage: planetsplitter [--help]\n"
         "                      [--dir=<dirname>] [--prefix=<name>]\n"
         "                      [--slim] [--sort-ram-size=<size>]\n"
         "                      [--tmpdir=<dirname>]\n"
         "                      [--parse-only | --process-only]\n"
         "                      [--max-iterations=<number>]\n"
         "                      [--tagging=<filename>]\n"
         "                      [<filename.osm> ...]\n");

 if(detail)
    fprintf(stderr,
            "\n"
            "--help                    Prints this information.\n"
            "\n"
            "--dir=<dirname>           The directory containing the routing database.\n"
            "--prefix=<name>           The filename prefix for the routing database.\n"
            "\n"
            "--slim                    Use less RAM and more temporary files.\n"
            "--sort-ram-size=<size>    The amount of RAM (in MB) to use for data sorting\n"
            "                          (defaults to 64MB with '--slim' or 256MB otherwise.)\n"
            "--tmpdir=<dirname>        The directory name for temporary files.\n"
            "                          (defaults to the '--dir' option directory.)\n"
            "\n"
            "--parse-only              Parse the input OSM files and store the results.\n"
            "--process-only            Process the stored results from previous option.\n"
            "\n"
            "--max-iterations=<number> The number of iterations for finding super-nodes.\n"
            "\n"
            "--tagging=<filename>      The name of the XML file containing the tagging rules\n"
            "                          (defaults to 'tagging.xml' with '--dirname' and\n"
            "                           '--prefix' options).\n"
            "\n"
            "<filename.osm> ...        The name(s) of the file(s) to process (by default\n"
            "                          data is read from standard input).\n"
            "\n"
            "<transport> defaults to all but can be set to:\n"
            "%s"
            "\n"
            "<highway> can be selected from:\n"
            "%s"
            "\n"
            "<property> can be selected from:\n"
            "%s",
            TransportList(),HighwayList(),PropertyList());

 exit(!detail);
}
bool TestPlugin::testCoreUpdateSupported()
{
	bool success = false;

	PropertyList toAdd;
	toAdd.push_back(VehicleProperty::ClutchStatus);

	routingEngine->updateSupported(toAdd,PropertyList());

	PropertyList supported = routingEngine->supported();

	success = ListPlusPlus<VehicleProperty::Property>(&supported).contains(VehicleProperty::ClutchStatus);

	PropertyList toRemove = toAdd;

	routingEngine->updateSupported(PropertyList(),toRemove);

	supported = routingEngine->supported();

	success &= !ListPlusPlus<VehicleProperty::Property>(&supported).contains(VehicleProperty::ClutchStatus);

	return success;
}
Beispiel #4
0
void Mesh::activate() {
	/* Create a discrete distribution for sampling triangles
	   with respect to their surface area */
	m_distr.clear();
	m_distr.reserve(m_triangleCount);
	for (uint32_t i=0; i<m_triangleCount; ++i)
		m_distr.append(surfaceArea(i));
	m_distr.normalize();

	if (!m_bsdf) {
		/* If no material was assigned, instantiate a diffuse BRDF */
		m_bsdf = static_cast<BSDF *>(
			NoriObjectFactory::createInstance("diffuse", PropertyList()));
	}
}
Beispiel #5
0
    void FontPropertyManager::preInitializeProperty(QtProperty *property,
                                                    int type,
                                                    ResetMap &resetMap)
    {
        if (m_createdFontProperty) {
            PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
            if (it == m_propertyToFontSubProperties.end())
                it = m_propertyToFontSubProperties.insert(m_createdFontProperty, PropertyList());
            const int index = it.value().size();
            m_fontSubPropertyToFlag.insert(property, index);
            it.value().push_back(property);
            m_fontSubPropertyToProperty[property] = m_createdFontProperty;
            resetMap[property] = true;
        }

        if (type == QVariant::Font)
            m_createdFontProperty = property;
    }
Beispiel #6
0
PropertyList AudioElement::getProperties() const
{
	BoolPropertyManager *boolManager = new BoolPropertyManager;
	connect(boolManager, &PropertyManager::modified, this, &AudioElement::propertyChanged);

	FilePropertyManager *fileManager = new FilePropertyManager;
	connect(fileManager, &PropertyManager::modified, this, &AudioElement::propertyChanged);

	IntSliderPropertyManager *sliderManager = new IntSliderPropertyManager;
	connect(sliderManager, &PropertyManager::modified, this, &AudioElement::propertyChanged);

	Property *visible = new Property(boolManager, tr("Activer"), QStringLiteral("visible"));
	visible->setToolTip(tr("Activer l'élément"));
	visible->setValue(this->getValue(QStringLiteral("visible")));

	Property *group = new Property(0, tr("Son"));

	Property *src = new Property(fileManager, tr("Source"), QStringLiteral("src"));
	src->setToolTip(tr("Source du fichier audio"));
	src->setValue(this->getValue(QStringLiteral("src")));
	fileManager->setRequired(QStringLiteral("src"), true);
	fileManager->setFilter(QStringLiteral("src"), AUDIO_FILTER);
	group->addProperty(src);

	Property *loop = new Property(boolManager, tr("Boucle"), QStringLiteral("loop"));
	loop->setToolTip(tr("Lire le son en boucle"));
	loop->setValue(this->getValue(QStringLiteral("loop")));
	group->addProperty(loop);

	Property *volume = new Property(sliderManager, tr("Volume"), QStringLiteral("volume"));
	volume->setToolTip(tr("Volume deu son"));
	volume->setValue(this->getValue(QStringLiteral("volume")));
	sliderManager->setMaximum(QStringLiteral("volume"), 100);
	sliderManager->setSuffix(QStringLiteral("volume"), tr(" %"));
	group->addProperty(volume);

	return PropertyList()
		<< SlideshowElement::getProperties()
		<< visible
		<< group;
}
Beispiel #7
0
void Mesh::activate() {
    if (!m_bsdf) {
        /* If no material was assigned, instantiate a diffuse BRDF */
        m_bsdf = static_cast<BSDF *>(
            NoriObjectFactory::createInstance("diffuse", PropertyList()));
    }
    //check if the mesh is an emitter
    if(isEmitter()){
        m_dpdf = new DiscretePDF(m_F.cols());

        //for every face set the surface area
        for (int i = 0; i < m_F.cols(); ++i) {
            float curArea = surfaceArea(i);
            m_dpdf->append(curArea);
            m_surfaceArea += curArea;
        }

        //normalize the pdf
        m_dpdf->normalize();
    }
}
Beispiel #8
0
static void print_usage(int detail,const char *argerr,const char *err)
{
 if(detail<0)
   {
    fprintf(stderr,
            "Routino version " ROUTINO_VERSION " " ROUTINO_URL ".\n"
            );
   }

 if(detail>=0)
   {
    fprintf(stderr,
            "Usage: router [--version]\n"
            "              [--help | --help-profile | --help-profile-xml |\n"
            "                        --help-profile-json | --help-profile-perl ]\n"
            "              [--dir=<dirname>] [--prefix=<name>]\n"
            "              [--profiles=<filename>] [--translations=<filename>]\n"
            "              [--exact-nodes-only]\n"
            "              [--quiet | [--loggable] [--logtime] [--logmemory]]\n"
            "              [--language=<lang>]\n"
            "              [--output-html]\n"
            "              [--output-gpx-track] [--output-gpx-route]\n"
            "              [--output-text] [--output-text-all]\n"
            "              [--output-none] [--output-stdout]\n"
            "              [--profile=<name>]\n"
            "              [--transport=<transport>]\n"
            "              [--shortest | --quickest]\n"
            "              --lon1=<longitude> --lat1=<latitude>\n"
            "              --lon2=<longitude> --lon2=<latitude>\n"
            "              [ ... --lon99=<longitude> --lon99=<latitude>]\n"
            "              [--reverse] [--loop]\n"
            "              [--highway-<highway>=<preference> ...]\n"
            "              [--speed-<highway>=<speed> ...]\n"
            "              [--property-<property>=<preference> ...]\n"
            "              [--oneway=(0|1)] [--turns=(0|1)]\n"
            "              [--weight=<weight>]\n"
            "              [--height=<height>] [--width=<width>] [--length=<length>]\n");

    if(argerr)
       fprintf(stderr,
               "\n"
               "Error with command line parameter: %s\n",argerr);

    if(err)
       fprintf(stderr,
               "\n"
               "Error: %s\n",err);
   }

 if(detail==1)
    fprintf(stderr,
            "\n"
            "--version               Print the version of Routino.\n"
            "\n"
            "--help                  Prints this information.\n"
            "--help-profile          Prints the information about the selected profile.\n"
            "--help-profile-xml      Prints all loaded profiles in XML format.\n"
            "--help-profile-json     Prints all loaded profiles in JSON format.\n"
            "--help-profile-perl     Prints all loaded profiles in Perl format.\n"
            "\n"
            "--dir=<dirname>         The directory containing the routing database.\n"
            "--prefix=<name>         The filename prefix for the routing database.\n"
            "--profiles=<filename>   The name of the XML file containing the profiles\n"
            "                        (defaults to 'profiles.xml' with '--dir' and\n"
            "                         '--prefix' options or the file installed in\n"
            "                         '" ROUTINO_DATADIR "').\n"
            "--translations=<fname>  The name of the XML file containing the translations\n"
            "                        (defaults to 'translations.xml' with '--dir' and\n"
            "                         '--prefix' options or the file installed in\n"
            "                         '" ROUTINO_DATADIR "').\n"
            "\n"
            "--exact-nodes-only      Only route between nodes (don't find closest segment).\n"
            "\n"
            "--quiet                 Don't print any screen output when running.\n"
            "--loggable              Print progress messages suitable for logging to file.\n"
            "--logtime               Print the elapsed time for each processing step.\n"
            "--logmemory             Print the max allocated/mapped memory for each step.\n"
            "\n"
            "--language=<lang>       Use the translations for specified language.\n"
            "--output-html           Write an HTML description of the route.\n"
            "--output-gpx-track      Write a GPX track file with all route points.\n"
            "--output-gpx-route      Write a GPX route file with interesting junctions.\n"
            "--output-text           Write a plain text file with interesting junctions.\n"
            "--output-text-all       Write a plain text file with all route points.\n"
            "--output-none           Don't write any output files or read any translations.\n"
            "                        (If no output option is given then all are written.)\n"
            "--output-stdout         Write to stdout instead of a file (requires exactly\n"
            "                        one output format option, implies '--quiet').\n"
            "\n"
            "--profile=<name>        Select the loaded profile with this name.\n"
            "--transport=<transport> Select the transport to use (selects the profile\n"
            "                        named after the transport if '--profile' is not used.)\n"
            "\n"
            "--shortest              Find the shortest route between the waypoints.\n"
            "--quickest              Find the quickest route between the waypoints.\n"
            "\n"
            "--lon<n>=<longitude>    Specify the longitude of the n'th waypoint.\n"
            "--lat<n>=<latitude>     Specify the latitude of the n'th waypoint.\n"
            "\n"
            "--reverse               Find a route between the waypoints in reverse order.\n"
            "--loop                  Find a route that returns to the first waypoint.\n"
            "\n"
            "--heading=<bearing>     Initial compass bearing at lowest numbered waypoint.\n"
            "\n"
            "                                   Routing preference options\n"
            "--highway-<highway>=<preference>   * preference for highway type (%%).\n"
            "--speed-<highway>=<speed>          * speed for highway type (km/h).\n"
            "--property-<property>=<preference> * preference for proprty type (%%).\n"
            "--oneway=(0|1)                     * oneway restrictions are to be obeyed.\n"
            "--turns=(0|1)                      * turn restrictions are to be obeyed.\n"
            "--weight=<weight>                  * maximum weight limit (tonnes).\n"
            "--height=<height>                  * maximum height limit (metres).\n"
            "--width=<width>                    * maximum width limit (metres).\n"
            "--length=<length>                  * maximum length limit (metres).\n"
            "\n"
            "<transport> defaults to motorcar but can be set to:\n"
            "%s"
            "\n"
            "<highway> can be selected from:\n"
            "%s"
            "\n"
            "<property> can be selected from:\n"
            "%s",
            TransportList(),HighwayList(),PropertyList());

 exit(!detail);
}
Beispiel #9
0
	//----------------------------------------------------------------------------------
	void PropertyManager::createGroup(const std::string& name)
	{
		mPropertyMap.insert(std::pair<std::string, PropertyList>(name, PropertyList()));
	}
void TestPlugin::setSupported(PropertyList list)
{
	m_re->updateSupported(list,PropertyList());
}
PropertyList TestPlugin::supported()
{
	return PropertyList();
}
PropertyList WebSocketSink::subscriptions()
{
	return PropertyList();
} 
void OBD2Source::setSupported(PropertyList list)
{
	m_supportedProperties = list;
	m_re->updateSupported(list,PropertyList());
}
Beispiel #14
0
    void preprocess(const Scene *scene) {
        /* Create a sample generator for the preprocess step */
        Sampler *sampler = static_cast<Sampler *>(
            NoriObjectFactory::createInstance("independent", PropertyList()));

        Emitter* distantsDisk = scene->getDistantEmitter();
        if(distantsDisk != nullptr ) {
            float lngstDir = scene->getBoundingBox().getLongestDirection();
            distantsDisk->setMaxRadius(lngstDir);
        }

        /* Allocate memory for the photon map */
        m_photonMap = std::unique_ptr<PhotonMap>(new PhotonMap());
        m_photonMap->reserve(m_photonCount);

		/* Estimate a default photon radius */
		if (m_photonRadius == 0)
			m_photonRadius = scene->getBoundingBox().getExtents().norm() / 500.0f;

        int storedPhotons = 0;

        const  std::vector<Emitter *> lights = scene->getEmitters();
        int nLights = lights.size();
        Color3f tp(1.0f, 1.0f, 1.0f);

        cout << "Starting to create "<< m_photonCount << " photons!" << endl;
        int percentDone= 0;
        int onePercent = int(floor(m_photonCount / 100.0));

        // create the expected number of photons
        while(storedPhotons < m_photonCount) {
            //uniformly sample 1 light (assuming that we only have area lights)
            int var = int(std::min(sampler->next1D()*nLights, float(nLights) - 1.0f));
            const areaLight* curLight = static_cast<const areaLight *> (lights[var]);

            //sample a photon
            Photon curPhoton;
            Vector3f unQuantDir(0.0f,0.0f,0.0f);
            curLight->samplePhoton(sampler, curPhoton, 1, nLights, unQuantDir);
            Color3f alpha = curPhoton.getPower();
            Color3f tp(1.0f, 1.0f, 1.0f);


            //trace the photon
            Intersection its;
            Ray3f photonRay(curPhoton.getPosition(), unQuantDir);
            m_shootedRays++;
            if (scene->rayIntersect(photonRay, its)) {
                while(true) {
                    const BSDF* curBSDF = its.mesh->getBSDF();


                    if (curBSDF->isDiffuse()) {
                        //store the photon
                        m_photonMap->push_back(Photon(
                            its.p  /* Position */,
                            -photonRay.d /* Direction*/,
                            tp * alpha  /* Power */
                        ));
                        storedPhotons++;
                    }

                    if(!(storedPhotons < m_photonCount)) break;

                    BSDFQueryRecord query = BSDFQueryRecord(its.toLocal(-photonRay.d), Vector3f(0.0f), EMeasure::ESolidAngle);
                    Color3f fi =  curBSDF->sample(query, sampler->next2D());

                    if(fi.maxCoeff() == 0.0f) break;

                    tp *= fi;

                    Vector3f wo = its.toWorld(query.wo);
                    photonRay = Ray3f(its.p, wo);

                    //ray escapes the scene
                    if (!scene->rayIntersect(photonRay, its)) break;

                    //stop critirium russian roulette
                    float q = tp.maxCoeff();
                    if(q < sampler->next1D()) break;
                    tp /= q;
                }

            }
            if(onePercent != 0) {
                if(storedPhotons % onePercent == 0){
                    int percent = int(floor(storedPhotons / onePercent));
                    if(percent % 10 == 0 && percentDone != percent){
                        percentDone = percent;
                        cout << percent << "%" << endl;
                    }
                }
            }
        }

		/* Build the photon map */
        m_photonMap->build();
    }
Beispiel #15
0
void
ComposeKeyInstance::focus_in ()
{
    register_properties (PropertyList ());
    reset ();
}
Beispiel #16
0
const PropertyList& getGeneratorProperties( const std::string& generator )
{
    static GeneratorPropertyMap generatorProperties;
    static PropertyList emptyMap;
    if( generatorProperties.empty( ))
    {
        BOOST_FOREACH( const std::string& gen, getGenerators( ))
        {
            generatorProperties[ gen ] = PropertyList();

            PropertyList& map = generatorProperties[ gen ];
            if( gen == "ac_generator" )
            {
                addProperty( map, "amplitude", 0.0 );
                addProperty( map, "frequency", 0.0 );
                addProperty( map, "phase", 0.0 );
                continue;
            }
            else if( gen == "dc_generator" )
            {
                addProperty( map, "amplitude", 0.0 );
                continue;
            }
            else if( gen ==  "gamma_sup_generator" )
            {
                addProperty( map, "gamma_shape", false );
                addProperty( map, "rate", 0.0 );
                continue;
            }
            else if( gen ==  "mip_generator" )
            {
                addProperty( map, "mother_seed", 0 );
                continue;
            }
            else if( gen ==  "noise_generator" )
            {
                addProperty( map, "dt", 1.0 );
                addProperty( map, "frequency", 0.0 );
                addProperty( map, "mean", 0.0 );
                addProperty( map, "phase", 0.0 );
                addProperty( map, "y_0", 0.0 );
                addProperty( map, "y_1", 0.0 );
                continue;
            }
            else if( gen ==  "poisson_generator" )
            {
                addProperty( map, "rate", 0.0 );
                continue;
            }
            else if( gen ==  "poisson_generator_ps" )
            {
                addProperty( map, "rate", 0.0 );
                continue;
            }
            else if( gen ==  "ppd_sup_generator" )
            {
                addProperty( map, "amplitude", 0.0 );
                addProperty( map, "dead_time", 0.0 );
                addProperty( map, "frequency", 0.0 );
                addProperty( map, "rate", 1.0 );
                continue;
            }
            else if( gen ==  "sinusoidal_gamma_generator" )
            {
                addProperty( map, "ac", 0.0 );
                addProperty( map, "dc", 0.0 );
                addProperty( map, "individual_spike_trains", true );
                addProperty( map, "freq", 0.0 );
                addProperty( map, "phi", 0.0 );
                continue;
            }
            else if( gen ==  "sinusoidal_poisson_generator" )
            {
                addProperty( map, "ac", 0.0 );
                addProperty( map,"dc", 0.0 );
                addProperty( map,"individual_spike_trains", true );
                addProperty( map,"freq", 0.0 );
                addProperty( map,"phi", 0.0 );
                continue;
            }
            else if( gen ==  "spike_generator" )
            {
                addProperty( map, "allow_offgrid_spikes", false );
                addProperty( map, "precise_times", false );
                addProperty( map, "shift_now_spikes", true );
                addProperty( map, "spike_times", QList<QVariant>() );
                addProperty( map, "spike_weights", QList<QVariant>() );
                continue;
            }
            else if( gen ==  "step_current_generator" )
            {
                addProperty( map, "amplitude_times", QList<QVariant>() );
                addProperty( map, "amplitude_values", QList<QVariant>() );
                continue;
            }
        }
Beispiel #17
0
    /// Invoke a series of t-tests on the provided input
    void activate() {
        int total = 0, passed = 0;
        pcg32 random;

        if (!m_bsdfs.empty()) {
            if (m_references.size() * m_bsdfs.size() != m_angles.size())
                throw NoriException("Specified a different number of angles and reference values!");
            if (!m_scenes.empty())
                throw NoriException("Cannot test BSDFs and scenes at the same time!");

            /* Test each registered BSDF */
            int ctr = 0;
            for (auto bsdf : m_bsdfs) {
                for (size_t i=0; i<m_references.size(); ++i) {
                    float angle = m_angles[i], reference = m_references[ctr++];

                    cout << "------------------------------------------------------" << endl;
                    cout << "Testing (angle=" << angle << "): " << bsdf->toString() << endl;
                    ++total;

                    BSDFQueryRecord bRec(sphericalDirection(degToRad(angle), 0));

                    cout << "Drawing " << m_sampleCount << " samples .. " << endl;
                    double mean=0, variance = 0;
                    for (int k=0; k<m_sampleCount; ++k) {
                        Point2f sample(random.nextFloat(), random.nextFloat());
                        double result = (double) bsdf->sample(bRec, sample).getLuminance();

                        /* Numerically robust online variance estimation using an
                           algorithm proposed by Donald Knuth (TAOCP vol.2, 3rd ed., p.232) */
                        double delta = result - mean;
                        mean += delta / (double) (k+1);
                        variance += delta * (result - mean);
                    }
                    variance /= m_sampleCount - 1;
                    std::pair<bool, std::string>
                        result = hypothesis::students_t_test(mean, variance, reference,
                            m_sampleCount, m_significanceLevel, (int) m_references.size());

                    if (result.first)
                        ++passed;
                    cout << result.second << endl;
                }
            }
        } else {
            if (m_references.size() != m_scenes.size())
                throw NoriException("Specified a different number of scenes and reference values!");

            Sampler *sampler = static_cast<Sampler *>(
                NoriObjectFactory::createInstance("independent", PropertyList()));

            int ctr = 0;
            for (auto scene : m_scenes) {
                const Integrator *integrator = scene->getIntegrator();
                const Camera *camera = scene->getCamera();
                float reference = m_references[ctr++];

                cout << "------------------------------------------------------" << endl;
                cout << "Testing scene: " << scene->toString() << endl;
                ++total;

                cout << "Generating " << m_sampleCount << " paths.. " << endl;

                double mean = 0, variance = 0;
                for (int k=0; k<m_sampleCount; ++k) {
                    /* Sample a ray from the camera */
                    Ray3f ray;
                    Point2f pixelSample = (sampler->next2D().array()
                        * camera->getOutputSize().cast<float>().array()).matrix();
                    Color3f value = camera->sampleRay(ray, pixelSample, sampler->next2D());

                    /* Compute the incident radiance */
                    value *= integrator->Li(scene, sampler, ray);

                    /* Numerically robust online variance estimation using an
                       algorithm proposed by Donald Knuth (TAOCP vol.2, 3rd ed., p.232) */
                    double result = (double) value.getLuminance();
                    double delta = result - mean;
                    mean += delta / (double) (k+1);
                    variance += delta * (result - mean);
                }
                variance /= m_sampleCount - 1;

                std::pair<bool, std::string>
                    result = hypothesis::students_t_test(mean, variance, reference,
                        m_sampleCount, m_significanceLevel, (int) m_references.size());

                if (result.first)
                    ++passed;
                cout << result.second << endl;
            }
        }
        cout << "Passed " << passed << "/" << total << " tests." << endl;
    }