Exemple #1
0
PlotPort::PlotPort(PortDirection direction, const std::string& name,
        bool allowMultipleConnections, Processor::InvalidationLevel invalidationLevel)
 : GenericPort<PlotBase>(direction, name, allowMultipleConnections, invalidationLevel)
{
    if (isOutport())
        setData(0);
}
Exemple #2
0
VolumePort::VolumePort(PortDirection direction, const std::string& id, const std::string& guiName,
      bool allowMultipleConnections, Processor::InvalidationLevel invalidationLevel)
    : GenericPort<VolumeBase>(direction, id, guiName, allowMultipleConnections, invalidationLevel),
      VolumeObserver(),
      texFilterMode_("textureFilterMode_", "Texture Filtering"),
      texClampMode_("textureClampMode_", "Texture Clamp"),
      texBorderIntensity_("textureBorderIntensity", "Texture Border Intensity", 0.f)
{
    // add texture access properties for inports
    if (!isOutport()) {
        // volume texture filtering
        texFilterMode_.addOption("nearest", "Nearest",  GL_NEAREST);
        texFilterMode_.addOption("linear",  "Linear",   GL_LINEAR);
        texFilterMode_.selectByKey("linear");
        addProperty(texFilterMode_);

        // volume texture clamping
        texClampMode_.addOption("clamp",           "Clamp",             GL_CLAMP);
        texClampMode_.addOption("clamp-to-edge",   "Clamp to Edge",     GL_CLAMP_TO_EDGE);
        texClampMode_.addOption("clamp-to-border", "Clamp to Border",   GL_CLAMP_TO_BORDER);
        texClampMode_.selectByKey("clamp-to-edge");
        addProperty(texClampMode_);
        addProperty(texBorderIntensity_);

        // assign texture access properties to property group
        texFilterMode_.setGroupID(id);
        texClampMode_.setGroupID(id);
        texBorderIntensity_.setGroupID(id);
        setPropertyGroupGuiName(id, (isInport() ? "Inport: " : "Outport: ") + guiName);

        showTextureAccessProperties(false);
    }
}
Exemple #3
0
void PlotPort::deleteData() {
    tgtAssert(isOutport(), "deletePlotBase called on inport!");
    const PlotBase* tempVol = portData_;
    if (tempVol) {
        setData(0);
        delete tempVol;
    }
}
Exemple #4
0
void VolumePort::showTextureAccessProperties(bool show) {
    if (isOutport()) {
        LERROR("showTextureAccessProperties(): texture access properties only available for inports.");
    }
    else {
        setPropertyGroupVisible(getID(), show);
    }
}
Exemple #5
0
void PlotPort::setData(const PlotBase* handle, bool deletePrevious) {
    tgtAssert(isOutport(), "called setData on inport!");
    const PlotBase* tempVol = portData_;
    if (handle != 0 || portData_ != 0) {
        portData_ = handle;
        invalidate();
    }
    else {
        portData_ = 0;
    }
    if (deletePrevious && tempVol && (tempVol != handle)) {
        delete tempVol;
    }
}
Exemple #6
0
void VolumePort::setData(const VolumeBase* handle, bool takeOwnership) {
    tgtAssert(isOutport(), "called setData on inport!");

    if (portData_ != handle) {
        if (portData_)
            portData_->removeObserver(this);

        GenericPort<VolumeBase>::setData(handle, takeOwnership);
        //portData_ = handle;

        if (handle)
            handle->addObserver(this);
    }
    invalidatePort();
}
Exemple #7
0
std::string TextPort::getData() const {
    if (isOutport())
        return portData_;
    else {
        for (size_t i = 0; i < connectedPorts_.size(); ++i) {
            if (!connectedPorts_[i]->isOutport())
                continue;

            TextPort* p = static_cast< TextPort* >(connectedPorts_[i]);
            if (p)
                return p->getData();
        }
    }
    return 0;
}
OTBLabelImagePort::ImagePointer OTBLabelImagePort::getData() const {
    if (isOutport())
        return portData_;
    else {
        for (size_t i = 0; i < connectedPorts_.size(); ++i) {
            if (!connectedPorts_[i]->isOutport())
                continue;

            OTBLabelImagePort* p = static_cast< OTBLabelImagePort* >(connectedPorts_[i]);
            if (p)
                return p->getData();
        }
    }
    ImageSmartPointer po = ImageType::New();
    return po.GetPointer();
}
Exemple #9
0
std::vector<std::string> TextPort::getAllData() const {
    if (isOutport()) {
        std::vector<std::string> allData;
        allData.push_back(portData_);
        return allData;
    }
    else {
        std::vector<std::string> allData;
        for (size_t i = 0; i < connectedPorts_.size(); ++i) {
            if (connectedPorts_[i]->isOutport() == false)
                continue;
            TextPort* p = static_cast<TextPort*>(connectedPorts_[i]);
            allData.push_back(p->getData());
        }
        return allData;
    }
}
Exemple #10
0
void TextPort::setData(const std::string& data) {
    tgtAssert(isOutport(), "called setData on inport!");
    portData_ = data;
    invalidate();
}
void OTBLabelImagePort::setData(const ImagePointer& pointer) {
    tgtAssert(isOutport(), "called setData on inport!");
    portData_ = pointer;
    invalidate();
}
Exemple #12
0
bool PlotPort::isReady() const {
    if (isOutport())
        return isConnected();
    else
        return (hasData() && checkConditions());
}
Exemple #13
0
FloatProperty& VolumePort::getTextureBorderIntensityProperty() {
    if (isOutport())
        LERROR("getTextureBorderIntensityProperty(): only allowed for inports");
    return texBorderIntensity_;
}
Exemple #14
0
GLEnumOptionProperty& VolumePort::getTextureClampModeProperty() {
    if (isOutport())
        LERROR("getTextureClampModeProperty(): only allowed for inports");
    return texClampMode_;
}
Exemple #15
0
IntOptionProperty& VolumePort::getTextureFilterModeProperty() {
    if (isOutport())
        LERROR("getTextureFilterModeProperty(): only allowed for inports");
    return texFilterMode_;
}
Exemple #16
0
PlotPort::~PlotPort() {
    if ((portData_) && (isOutport()) /*&& (portData_->getColumnCount() > 0)*/) {
        delete portData_;
        portData_ = 0;
    }
}
Exemple #17
0
bool VolumePort::isReady() const {
    if (isOutport())
        return isConnected();
    else
        return (hasData() && /*getData()->getRepresentation<VolumeRAM>() &&*/ checkConditions());
}