Пример #1
0
bool DragData::containsCompatibleContent() const
{
    return containsPlainText()
        || containsURL()
        || containsHTML(m_platformDragData)
        || containsFiles();
}
Пример #2
0
bool DragData::containsCompatibleContent() const
{
    return containsPlainText() || containsURL(0)
           || ((m_platformDragData) ? (containsHTML(m_platformDragData) || containsFilenames(m_platformDragData))
               : (containsHTML(&m_dragDataMap) || containsFilenames(&m_dragDataMap)))
           || containsColor();
}
Пример #3
0
bool VolumeURLListProperty::isSelected(const std::string& url) const {
    if (!containsURL(url)) {
        LWARNING("isURLSelected(): passed URL not contained by this property: " << url);
        return false;
    }

    return (selectionMap_.find(url) != selectionMap_.end()) && (selectionMap_.find(url)->second == true);
}
Пример #4
0
void TransFuncListProperty::addURL(const std::string& url, bool selected /*=true*/) {
    if (containsURL(url))
        return;

    value_.push_back(url);
    selectionMap_[url] = selected;

    invalidate();
}
Пример #5
0
void VolumeURLListProperty::addURL(const std::string& url, bool selected /*=true*/, bool invalidateUI /*=true*/) {
    if (containsURL(url))
        return;

    value_.push_back(url);
    selectionMap_[url] = selected;

    if( invalidateUI )
        invalidate();
}
Пример #6
0
void VolumeURLListProperty::setSelected(const std::string& url, bool selected) {
    if (!containsURL(url)) {
        LWARNING("setSelected(): passed URL not contained by this property: " << url);
        return;
    }

    if (isSelected(url) != selected) {
        selectionMap_[url] = selected;
        invalidate();
    }
}
Пример #7
0
void VolumeURLListProperty::addVolume_(VolumeBase* handle, bool owner /*= false*/, bool selected /*= false*/) {
    tgtAssert(handle, "null pointer passed");

    std::string url = handle->getOrigin().getURL();
    if (!containsURL(url))
        addURL(url, selected, false);
    else
        removeVolume(handle, false);

    handleMap_[url] = handle;
    ownerMap_[url] = owner;
}
Пример #8
0
VolumeBase* VolumeURLListProperty::getVolume(const std::string& url) const {
    if (!containsURL(url)) {
        LWARNING("getVolume(): passed URL not contained by this property: " << url);
        return 0;
    }

    VolumeBase* result = 0;
    if (handleMap_.find(url) != handleMap_.end()) {
        result = handleMap_.find(url)->second;
        tgtAssert(result, "handleMap_ contains null pointer");
    }

    return result;
}
Пример #9
0
void MoleculeURLListProperty::addMolecule(Molecule* handle, bool owner /*= false*/, bool selected /*= false*/) {
    tgtAssert(handle, "null pointer passed");

    std::string url = handle->getOrigin().getURL();
    if (!containsURL(url))
        addURL(url, selected);
    else
        removeMolecule(handle);

    handleMap_[url] = handle;
    ownerMap_[url] = owner;

    invalidate();
}
Пример #10
0
void VolumeURLListProperty::loadVolume(const std::string& url, bool invalidateUI /*=true*/)
        throw (tgt::FileException, std::bad_alloc) {

    if (!containsURL(url)) {
        LWARNING("loadVolume(): passed URL not contained by this property: " << url);
        return;
    }

    // delete volume, if already loaded and owned by the property
    if (getVolume(url) && isOwner(url))
        delete getVolume(url);
    handleMap_.erase(url);
    ownerMap_.erase(url);

    ProgressBar* progressBar = getProgressBar();
    if (progressBar) {
        progressBar->setTitle("Loading volume");
        progressBar->setProgressMessage("Loading volume ...");
    }

    VolumeSerializerPopulator serializerPopulator(progressBar);
    VolumeBase* handle = serializerPopulator.getVolumeSerializer()->read(VolumeURL(url));

    if (progressBar)
        progressBar->hide();

    if (handle) {
        // url may have been altered by loading routine
        if (url != handle->getOrigin().getURL()) {
            bool selected = isSelected(url);
            selectionMap_.erase(url);
            selectionMap_[handle->getOrigin().getURL()] = selected;

            for (size_t i=0; i<value_.size(); i++) {
                if (value_[i] == url) {
                    value_[i] = handle->getOrigin().getURL();
                    break;

                }
            }
        }

        handleMap_[handle->getOrigin().getURL()] = handle;
        ownerMap_[handle->getOrigin().getURL()] = true;
    }

    if(invalidateUI)
        invalidate();
}
Пример #11
0
void TransFuncListProperty::removeVolume(VolumeBase* handle) {
    tgtAssert(handle, "null pointer passed");
    std::string url = handle->getOrigin().getURL();
    if (!containsURL(url)) {
        LWARNING("removeVolume(): passed handle's URL not contained by this property: " << url);
        return;
    }

    if ((getVolume(url) == handle) && isOwner(url)) {
        delete handle;
    }

    handleMap_.erase(url);
    ownerMap_[url] = false;

    invalidate();
}
Пример #12
0
void MoleculeURLListProperty::loadMolecule(const std::string& url)
        throw (tgt::FileException, std::bad_alloc) {

    if (!containsURL(url)) {
        LWARNING("loadMolecule(): passed URL not contained by this property: " << url);
        return;
    }

    // delete molecule, if already loaded and owned by the property
    if (getMolecule(url) && isOwner(url))
        delete getMolecule(url);
    handleMap_.erase(url);
    ownerMap_.erase(url);

    ProgressBar* progressBar = getProgressBar();
    if (progressBar) {
        progressBar->setTitle("Loading molecule");
        progressBar->setMessage("Loading molecule ...");
    }

    Molecule* handle = MoleculeIO::read(MoleculeURL(url));

    if (handle) {
        // url may have been altered by loading routine
        if (url != handle->getOrigin().getURL()) {
            bool selected = isSelected(url);
            selectionMap_.erase(url);
            selectionMap_[handle->getOrigin().getURL()] = selected;

            for (size_t i=0; i<value_.size(); i++) {
                if (value_[i] == url) {
                    value_[i] = handle->getOrigin().getURL();
                    break;

                }
            }
        }

        handleMap_[handle->getOrigin().getURL()] = handle;
        ownerMap_[handle->getOrigin().getURL()] = true;
    }

    invalidate();
}
Пример #13
0
void TransFuncListProperty::removeURL(const std::string& url) {
    if (!containsURL(url)) {
        LWARNING("removeURL(): passed URL not contained by this property: " << url);
        return;
    }

    // free corresponding volume, if owned by the property
    VolumeBase* handle = getVolume(url);
    if (handle)
        removeVolume(handle);

    // remove url from url list
    std::vector<std::string>::iterator it = std::find(value_.begin(), value_.end(), url);
    tgtAssert(it != value_.end(), "url not found");
    value_.erase(it);

    // remove url from maps
    handleMap_.erase(url);
    selectionMap_.erase(url);
    ownerMap_.erase(url);

    invalidate();
}
Пример #14
0
bool DragData::containsCompatibleContent() const
{
    if (!m_platformDragData)
        return false;
    return containsColor() || containsURL() || m_platformDragData->hasHtml() || m_platformDragData->hasText();
}
Пример #15
0
bool DragData::containsCompatibleContent() const
{
    return containsColor() || containsURL() || containsPlainText();
}
bool DragData::containsCompatibleContent() const
{
    return containsPlainText() || containsURL(0) || m_platformDragData->hasMarkup() || containsColor() || containsFiles();
}