Exemple #1
0
void EditDialogDialog::addVariable() {
	
	Variable *var = new Variable();

	var->setName("name");
	
	Representation r;
	r.setType(Representation::TEXTFIELD);
	var->setRepresentation(r);
	
	if (m_TypeCB->currentText() == "bool") {
		var->setType(Variable::BOOL);
	} else 	if (m_TypeCB->currentText() == "integer") {
		var->setType(Variable::INTEGER);
	} else if (m_TypeCB->currentText() == "string") {
		var->setType(Variable::STRING);
	}
	
	m_Variables.push_back(var);
	
	addTableRow("name",m_TypeCB->currentText());
	
	m_LWVariables->selectRow(m_LWVariables->rowCount()-1);
	m_LWVariables->resizeColumnsToContents();
	updateButtonStates();
}
Exemple #2
0
Representation*         BasicCMManager::getRepresentation(Period *period, uint64_t bitrate ) const
{
    std::vector<Group *>    groups = period->getGroups();

    Representation  *best = NULL;
    std::cout << "Sarching for best representation with bitrate: " << bitrate << std::endl;

    for(size_t i = 0; i < groups.size(); i++)
    {
        std::vector<Representation *> reps = groups.at(i)->getRepresentations();
        for( size_t j = 0; j < reps.size(); j++ )
        {
            uint64_t currentBitrate = reps.at(j)->getBandwidth();
            assert( currentBitrate != -1 );

            if ( best == NULL ||
                 ( currentBitrate > best->getBandwidth() &&
                   currentBitrate < bitrate ) )
            {
                std::cout << "Found a better Representation (#" << j << ") in group #" << i << std::endl;
                best = reps.at( j );
            }
        }
    }
    return best;
}
Exemple #3
0
Representation*             IsoffMainManager::getRepresentation     (Period *period, uint64_t bitrate, int width, int height) const
{
    if(period == NULL)
        return NULL;

    std::vector<AdaptationSet *> adaptationSets = period->getAdaptationSets();
    std::vector<Representation *> resMatchReps;

    for(size_t i = 0; i < adaptationSets.size(); i++)
    {
        std::vector<Representation *> reps = adaptationSets.at(i)->getRepresentations();
        for( size_t j = 0; j < reps.size(); j++ )
        {
            if(reps.at(j)->getWidth() == width && reps.at(j)->getHeight() == height)
                resMatchReps.push_back(reps.at(j));
        }
    }

    if(resMatchReps.size() == 0)
        return this->getRepresentation(period, bitrate);

    Representation  *best = NULL;
    for( size_t j = 0; j < resMatchReps.size(); j++ )
    {
        uint64_t currentBitrate = resMatchReps.at(j)->getBandwidth();

        if(best == NULL || (currentBitrate > best->getBandwidth() && currentBitrate < bitrate))
        {
            best = resMatchReps.at(j);
        }
    }

    return best;
}
void    IsoffMainParser::setRepresentations (Node *adaptationSetNode, AdaptationSet *adaptationSet)
{
    std::vector<Node *> representations = DOMHelper::getElementByTagName(adaptationSetNode, "Representation", false);
    uint64_t nextid = 0;

    for(size_t i = 0; i < representations.size(); i++)
    {
        Representation *currentRepresentation = new Representation(adaptationSet);
        Node *repNode = representations.at(i);

        std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL");
        if(!baseUrls.empty())
            currentRepresentation->baseUrl.Set(new Url(baseUrls.front()->getText()));

        if(repNode->hasAttribute("id"))
            currentRepresentation->setID(ID(repNode->getAttributeValue("id")));

        if(repNode->hasAttribute("width"))
            currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str()));

        if(repNode->hasAttribute("height"))
            currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str()));

        if(repNode->hasAttribute("bandwidth"))
            currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str()));

        if(repNode->hasAttribute("mimeType"))
            currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType"));

        if(repNode->hasAttribute("codecs"))
        {
            std::list<std::string> list = Helper::tokenize(repNode->getAttributeValue("codecs"), ',');
            std::list<std::string>::const_iterator it;
            for(it=list.begin(); it!=list.end(); ++it)
            {
                std::size_t pos = (*it).find_first_of('.', 0);
                if(pos != std::string::npos)
                    currentRepresentation->addCodec((*it).substr(0, pos));
                else
                    currentRepresentation->addCodec(*it);
            }
        }

        size_t i_total = parseSegmentInformation(repNode, currentRepresentation, &nextid);
        /* Empty Representation with just baseurl (ex: subtitles) */
        if(i_total == 0 &&
           (currentRepresentation->baseUrl.Get() && !currentRepresentation->baseUrl.Get()->empty()) &&
            adaptationSet->getSegment(SegmentInformation::INFOTYPE_MEDIA, 0) == NULL)
        {
            SegmentBase *base = new (std::nothrow) SegmentBase(currentRepresentation);
            if(base)
                currentRepresentation->setSegmentBase(base);
        }

        adaptationSet->addRepresentation(currentRepresentation);
    }
}
Exemple #5
0
STEPEntity *
Representation::Create(STEPWrapper *sw, SDAI_Application_instance *sse) {
    Factory::OBJECTS::iterator i;
    if ((i = Factory::FindObject(sse->STEPfile_id)) == Factory::objects.end()) {
	Representation *object = new Representation(sw, sse->STEPfile_id);

	Factory::AddObject(object);

	if (!object->Load(sw, sse)) {
	    std::cerr << CLASSNAME << ":Error loading class in ::Create() method." << std::endl;
	    delete object;
	    return NULL;
	}
	return static_cast<STEPEntity *>(object);
    } else {
	return (*i).second;
    }
}
Exemple #6
0
		void LabelDialog::accept()
		{
			list<Composite*> selection = getMainControl()->getMolecularControlSelection();

			// no selection present => return
			if (selection.empty()) return;

			Representation* rep = new Representation;
			rep->setProperty(Representation::PROPERTY__ALWAYS_FRONT);
			rep->setModelType(MODEL_LABEL);

			LabelModel* model = new LabelModel;
			model->setText(ascii(text_box->currentText()));
			model->setColor(custom_color_);
			model->setFont(font_);

			if (		 all_items->isChecked()) model->setMode(LabelModel::ONE_LABEL);
			else if (		every_atom->isChecked()) model->setMode(LabelModel::ALL_ATOMS);
			else if (every_residue->isChecked()) model->setMode(LabelModel::ALL_RESIDUES);
			else if (	  every_item->isChecked()) model->setMode(LabelModel::ALL_ITEMS);

			rep->setModelProcessor(model);

			// process all objects in the selection list
			list<Composite*>::const_iterator list_it = selection.begin();
			list<const Composite*> composites;

			for (; list_it != selection.end(); ++list_it)
			{
				composites.push_back(*list_it);
			}

			rep->setComposites(composites);

			getMainControl()->insert(*rep);
			getMainControl()->update(*rep);

			text_box->addItem(text_box->currentText());

			setStatusbarText(tr("Label added."));
		}
Exemple #7
0
void EditDialogDialog::RepresentationChanged(int index) {
	
	createRepresentationFrameWidgets(m_RepresentCB->itemText(index));
	
	int idx=0;
	if (getSelectedVariableRow(idx)) {
	
		Representation r;
		
		if (m_RepresentCB->itemText(index) == "Textfield") {
			r.setType(Representation::TEXTFIELD);
		} else if (m_RepresentCB->itemText(index) == "CheckBox") {
			r.setType(Representation::CHECKBOX);
		} else if (m_RepresentCB->itemText(index) == "RadioButton") {
			r.setType(Representation::RADIOBUTTON);
		} 
		
		m_Variables.at(idx)->setRepresentation(r);
		m_NameLineEdit->setText(m_Variables.at(idx)->Name());
	}
}
Exemple #8
0
void    IsoffMainParser::setRepresentations (Node *adaptationSetNode, AdaptationSet *adaptationSet)
{
    std::vector<Node *> representations = DOMHelper::getElementByTagName(adaptationSetNode, "Representation", false);

    for(size_t i = 0; i < representations.size(); i++)
    {
        Representation *currentRepresentation = new Representation(adaptationSet, getMPD());
        Node *repNode = representations.at(i);

        std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL");
        if(!baseUrls.empty())
            currentRepresentation->baseUrl.Set(new Url(baseUrls.front()->getText()));

        if(repNode->hasAttribute("id"))
            currentRepresentation->setId(repNode->getAttributeValue("id"));

        if(repNode->hasAttribute("width"))
            currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str()));

        if(repNode->hasAttribute("height"))
            currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str()));

        if(repNode->hasAttribute("bandwidth"))
            currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str()));

        if(repNode->hasAttribute("mimeType"))
            currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType"));

        parseSegmentInformation(repNode, currentRepresentation);

        adaptationSet->addRepresentation(currentRepresentation);
    }
}
void    IsoffMainParser::print              ()
{
    if(this->mpd)
    {
        msg_Dbg(this->p_stream, "MPD profile=%d mediaPresentationDuration=%ld minBufferTime=%ld", this->mpd->getProfile(),
                                                                                                  this->mpd->getDuration(),
                                                                                                  this->mpd->getMinBufferTime());
        const std::vector<BaseUrl *> baseurls = this->mpd->getBaseUrls();

        for(size_t i = 0; i < baseurls.size(); i++)
            msg_Dbg(this->p_stream, "BaseUrl=%s", baseurls.at(i)->getUrl().c_str());

        const std::vector<Period *> periods = this->mpd->getPeriods();

        for(size_t i = 0; i < periods.size(); i++)
        {
            Period *period = periods.at(i);
            msg_Dbg(this->p_stream, " Period");
            for(size_t j = 0; j < period->getAdaptationSets().size(); j++)
            {
                AdaptationSet *aset = period->getAdaptationSets().at(j);
                msg_Dbg(this->p_stream, "  AdaptationSet");
                for(size_t k = 0; k < aset->getRepresentations().size(); k++)
                {
                    Representation *rep = aset->getRepresentations().at(k);
                    msg_Dbg(this->p_stream, "   Representation");
                    Segment *initSeg = rep->getSegmentBase()->getInitSegment();
                    msg_Dbg(this->p_stream, "    InitSeg url=%s", initSeg->getSourceUrl().c_str());
                    for(size_t l = 0; l < rep->getSegmentList()->getSegments().size(); l++)
                    {
                        Segment *seg = rep->getSegmentList()->getSegments().at(l);
                        msg_Dbg(this->p_stream, "    Segment url=%s", seg->getSourceUrl().c_str());
                    }
                }
            }
        }
    }
}
Exemple #10
0
void    IsoffMainParser::setRepresentations (Node *adaptationSetNode, AdaptationSet *adaptationSet)
{
    std::vector<Node *> representations = DOMHelper::getElementByTagName(adaptationSetNode, "Representation", false);

    for(size_t i = 0; i < representations.size(); i++)
    {
        Representation *currentRepresentation = new Representation(adaptationSet);
        Node *repNode = representations.at(i);

        std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL");
        if(!baseUrls.empty())
            currentRepresentation->baseUrl.Set(new Url(baseUrls.front()->getText()));

        if(repNode->hasAttribute("id"))
            currentRepresentation->setId(repNode->getAttributeValue("id"));

        if(repNode->hasAttribute("width"))
            currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str()));

        if(repNode->hasAttribute("height"))
            currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str()));

        if(repNode->hasAttribute("bandwidth"))
            currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str()));

        if(repNode->hasAttribute("mimeType"))
            currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType"));

        if(repNode->hasAttribute("codecs"))
        {
            std::list<std::string> list = Helper::tokenize(repNode->getAttributeValue("codecs"), ',');
            std::list<std::string>::const_iterator it;
            for(it=list.begin(); it!=list.end(); ++it)
            {
                std::size_t pos = (*it).find_first_of('.', 0);
                if(pos != std::string::npos)
                    currentRepresentation->addCodec((*it).substr(0, pos));
                else
                    currentRepresentation->addCodec(*it);
            }
        }

        parseSegmentInformation(repNode, currentRepresentation);

        adaptationSet->addRepresentation(currentRepresentation);
    }
}
Exemple #11
0
Representation*             IsoffMainManager::getRepresentation     (Period *period, uint64_t bitrate) const
{
    if(period == NULL)
        return NULL;

    std::vector<AdaptationSet *> adaptationSets = period->getAdaptationSets();

    Representation  *best = NULL;

    for(size_t i = 0; i < adaptationSets.size(); i++)
    {
        std::vector<Representation *> reps = adaptationSets.at(i)->getRepresentations();
        for( size_t j = 0; j < reps.size(); j++ )
        {
            uint64_t currentBitrate = reps.at(j)->getBandwidth();

            if(best == NULL || (currentBitrate > best->getBandwidth() && currentBitrate < bitrate))
            {
                best = reps.at( j );
            }
        }
    }
    return best;
}
Exemple #12
0
Representation * M3U8Parser::createRepresentation(BaseAdaptationSet *adaptSet, const AttributesTag * tag)
{
    const Attribute *uriAttr = tag->getAttributeByName("URI");
    const Attribute *bwAttr = tag->getAttributeByName("BANDWIDTH");
    const Attribute *codecsAttr = tag->getAttributeByName("CODECS");
    const Attribute *resAttr = tag->getAttributeByName("RESOLUTION");

    Representation *rep = new (std::nothrow) Representation(adaptSet);
    if(rep)
    {
        if(uriAttr)
        {
            std::string uri;
            if(tag->getType() == AttributesTag::EXTXMEDIA)
            {
                uri = uriAttr->quotedString();
            }
            else
            {
                uri = uriAttr->value;
            }
            rep->setID(uri);
            rep->setPlaylistUrl(uri);
            if(uri.find('/') != std::string::npos)
            {
                uri = Helper::getDirectoryPath(uri);
                if(!uri.empty())
                    rep->baseUrl.Set(new Url(uri.append("/")));
            }
        }

        if(bwAttr)
            rep->setBandwidth(bwAttr->decimal());

        if(codecsAttr)
            setFormatFromCodecs(rep, codecsAttr->quotedString());

        if(resAttr)
        {
            std::pair<int, int> res = resAttr->getResolution();
            if(res.first * res.second)
            {
                rep->setWidth(res.first);
                rep->setHeight(res.second);
            }
        }
    }

    return rep;
}
IlwisObject *InternalIlwisObjectFactory::createRepresentation(const Resource& resource, const IOOptions &options) const{
    QString code = resource.code();
    Representation *rpr = createFromResource<Representation>(resource, options);


    if ( code != sUNDEF) {

        InternalDatabaseConnection db;
        QString query = QString("Select linkedtable from codes where code = '%1'").arg(code);
        if (db.exec(query)) {
            if ( db.next()){
                QString table = db.value(0).toString();
                if ( table == "representation"){
                    query = QString("Select * from representation where code='%1'").arg(code);
                    if (db.exec(query)) {
                        if ( db.next()){
                            QSqlRecord rec = db.record();
                            rpr->fromInternal(rec);
                            QString relateddomain = rec.field("relateddomain").value().toString();
                            QString rprType = rec.field("representationtype").value().toString();
                            QString  definition = rec.field("definition").value().toString();
							QString mode = rec.field("mode").value().toString();
                            if ( rprType == "continuouscolor"){
                                rpr->colors(new ContinuousColorLookup(definition, mode));
                            }else if ( rprType == "palettecolor"){
                                rpr->colors(new PaletteColorLookUp(definition));
                            }
                            if ( relateddomain == "value"){
                                rpr->domain(IDomain("value"));
                            }
                            rpr->readOnly(true);
                        }else
                            return 0;
                    }else
                        return 0;
                }else
                    return 0;
            }else
                return 0;
        }else
            return 0;
    }


    return rpr;
}
Exemple #14
0
SwitchArray::SwitchArray(Representation const& rep) {
    switches_.reserve(rep.size());
    for (auto const& r: rep)
        switches_.emplace_back(r, Switch());
}
Exemple #15
0
void SwitchArray::describe(Representation& rep) const {
    for (auto& s: switches_) {
        if (s.second)
            rep.push_back(s.first);
    }
}