PlotPort::PlotPort(PortDirection direction, const std::string& name, bool allowMultipleConnections, Processor::InvalidationLevel invalidationLevel) : GenericPort<PlotBase>(direction, name, allowMultipleConnections, invalidationLevel) { if (isOutport()) setData(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); } }
void PlotPort::deleteData() { tgtAssert(isOutport(), "deletePlotBase called on inport!"); const PlotBase* tempVol = portData_; if (tempVol) { setData(0); delete tempVol; } }
void VolumePort::showTextureAccessProperties(bool show) { if (isOutport()) { LERROR("showTextureAccessProperties(): texture access properties only available for inports."); } else { setPropertyGroupVisible(getID(), show); } }
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; } }
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(); }
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(); }
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; } }
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(); }
bool PlotPort::isReady() const { if (isOutport()) return isConnected(); else return (hasData() && checkConditions()); }
FloatProperty& VolumePort::getTextureBorderIntensityProperty() { if (isOutport()) LERROR("getTextureBorderIntensityProperty(): only allowed for inports"); return texBorderIntensity_; }
GLEnumOptionProperty& VolumePort::getTextureClampModeProperty() { if (isOutport()) LERROR("getTextureClampModeProperty(): only allowed for inports"); return texClampMode_; }
IntOptionProperty& VolumePort::getTextureFilterModeProperty() { if (isOutport()) LERROR("getTextureFilterModeProperty(): only allowed for inports"); return texFilterMode_; }
PlotPort::~PlotPort() { if ((portData_) && (isOutport()) /*&& (portData_->getColumnCount() > 0)*/) { delete portData_; portData_ = 0; } }
bool VolumePort::isReady() const { if (isOutport()) return isConnected(); else return (hasData() && /*getData()->getRepresentation<VolumeRAM>() &&*/ checkConditions()); }