mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-03 01:59:35 -06:00
OpenSpace and Glue can both send and receive messages, and update their properties.
This commit is contained in:
@@ -141,77 +141,5 @@ namespace openspace {
|
||||
return true;
|
||||
}
|
||||
|
||||
void SoftwareConnection::handleProperties(std::string identifier) {
|
||||
|
||||
const Renderable* myRenderable = renderable(identifier);
|
||||
properties::Property* colorProperty = myRenderable->property("Color");
|
||||
properties::Property* opacityProperty = myRenderable->property("Opacity");
|
||||
properties::Property* sizeProperty = myRenderable->property("Size");
|
||||
|
||||
// Update color of renderable
|
||||
auto updateColor = [colorProperty, identifier]() {
|
||||
std::string lengthOfIdentifier = std::to_string(identifier.length());
|
||||
std::string propertyValue = colorProperty->getStringValue();
|
||||
std::string lengthOfValue = std::to_string(propertyValue.length());
|
||||
std::string messageType = "UPCO";
|
||||
std::string subject = lengthOfIdentifier + identifier + lengthOfValue + propertyValue;
|
||||
|
||||
// Format length of subject to always be 4 digits
|
||||
std::ostringstream os;
|
||||
os << std::setfill('0') << std::setw(4) << subject.length();
|
||||
std::string lengthOfSubject = os.str();
|
||||
|
||||
std::string message = messageType + lengthOfSubject + subject;
|
||||
SoftwareConnection send;
|
||||
send.sendMessage(message);
|
||||
LERROR(fmt::format("Meddelandet som skickas {}", message));
|
||||
};
|
||||
colorProperty->onChange(updateColor);
|
||||
|
||||
/*
|
||||
|
||||
// Update opacity of renderable
|
||||
auto updateOpacity = [opacityProperty, identifier]() {
|
||||
std::string lengthOfIdentifier = std::to_string(identifier.length());
|
||||
std::string propertyValue = opacityProperty->getStringValue();
|
||||
std::string lengthOfValue = std::to_string(propertyValue.length());
|
||||
std::string messageType = "UPOP";
|
||||
std::string subject = lengthOfIdentifier + identifier + lengthOfValue + propertyValue;
|
||||
|
||||
// Format length of subject to always be 4 digits
|
||||
std::ostringstream os;
|
||||
os << std::setfill('0') << std::setw(4) << subject.length();
|
||||
std::string lengthOfSubject = os.str();
|
||||
|
||||
std::string message = messageType + lengthOfSubject + subject;
|
||||
SoftwareConnection send;
|
||||
send.sendMessage(message);
|
||||
LERROR(fmt::format("Meddelandet som skickas {}", message));
|
||||
};
|
||||
opacityProperty->onChange(updateOpacity);
|
||||
|
||||
// Update size of renderable
|
||||
auto updateSize = [sizeProperty, identifier]() {
|
||||
std::string lengthOfIdentifier = std::to_string(identifier.length());
|
||||
std::string propertyValue = sizeProperty->getStringValue();
|
||||
std::string lengthOfValue = std::to_string(propertyValue.length());
|
||||
std::string messageType = "UPSI";
|
||||
std::string subject = lengthOfIdentifier + identifier + lengthOfValue + propertyValue;
|
||||
|
||||
// Format length of subject to always be 4 digits
|
||||
std::ostringstream os;
|
||||
os << std::setfill('0') << std::setw(4) << subject.length();
|
||||
std::string lengthOfSubject = os.str();
|
||||
|
||||
std::string message = messageType + lengthOfSubject + subject;
|
||||
SoftwareConnection send;
|
||||
send.sendMessage(message);
|
||||
LERROR(fmt::format("Meddelandet som skickas {}", message));
|
||||
};
|
||||
sizeProperty->onChange(updateSize);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user