Example #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);
}
Example #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);
    }
}
Example #3
0
void PlotPort::deleteData() {
    tgtAssert(isOutport(), "deletePlotBase called on inport!");
    const PlotBase* tempVol = portData_;
    if (tempVol) {
        setData(0);
        delete tempVol;
    }
}
Example #4
0
void VolumePort::showTextureAccessProperties(bool show) {
    if (isOutport()) {
        LERROR("showTextureAccessProperties(): texture access properties only available for inports.");
    }
    else {
        setPropertyGroupVisible(getID(), show);
    }
}
Example #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;
    }
}
Example #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();
}
Example #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;
}
Example #8
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();
}
Example #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;
    }
}
Example #10
0
void TextPort::setData(const std::string& data) {
    tgtAssert(isOutport(), "called setData on inport!");
    portData_ = data;
    invalidate();
}
Example #11
0
void OTBLabelImagePort::setData(const ImagePointer& pointer) {
    tgtAssert(isOutport(), "called setData on inport!");
    portData_ = pointer;
    invalidate();
}
Example #12
0
bool PlotPort::isReady() const {
    if (isOutport())
        return isConnected();
    else
        return (hasData() && checkConditions());
}
Example #13
0
FloatProperty& VolumePort::getTextureBorderIntensityProperty() {
    if (isOutport())
        LERROR("getTextureBorderIntensityProperty(): only allowed for inports");
    return texBorderIntensity_;
}
Example #14
0
GLEnumOptionProperty& VolumePort::getTextureClampModeProperty() {
    if (isOutport())
        LERROR("getTextureClampModeProperty(): only allowed for inports");
    return texClampMode_;
}
Example #15
0
IntOptionProperty& VolumePort::getTextureFilterModeProperty() {
    if (isOutport())
        LERROR("getTextureFilterModeProperty(): only allowed for inports");
    return texFilterMode_;
}
Example #16
0
PlotPort::~PlotPort() {
    if ((portData_) && (isOutport()) /*&& (portData_->getColumnCount() > 0)*/) {
        delete portData_;
        portData_ = 0;
    }
}
Example #17
0
bool VolumePort::isReady() const {
    if (isOutport())
        return isConnected();
    else
        return (hasData() && /*getData()->getRepresentation<VolumeRAM>() &&*/ checkConditions());
}