Issue/453 (#556)

* Introduced guiName to PropertyOwner
  * Added requirement that PropertyOwner::identifier may not contain whitespaces
  * Changed Name to Identifier in asset and scene files
  * Added new PropertyOwner to RenderEngine that owns the ScreenSpaceRenderables
  * Moved Name and GuiPath into GUI group
  * Added user-facing names to layer groups
This commit is contained in:
Alexander Bock
2018-03-16 09:21:29 -04:00
committed by GitHub
parent 7a93a4fa37
commit db7ae7e384
234 changed files with 2921 additions and 1676 deletions

View File

@@ -299,8 +299,8 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
, _hardShadows(false)
{
ghoul_precondition(
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyName),
"RenderableAtmosphere needs the name to be specified"
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyIdentifier),
"RenderableAtmosphere needs the identifier to be specified"
);
documentation::testSpecificationAndThrow(
@@ -309,7 +309,9 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
"RenderableAtmosphere"
);
const std::string name = dictionary.value<std::string>(SceneGraphNode::KeyName);
const std::string identifier = dictionary.value<std::string>(
SceneGraphNode::KeyIdentifier
);
//================================================================
//======== Reads Shadow (Eclipses) Entries in mod file ===========
//================================================================
@@ -335,7 +337,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
"No Radius value expecified for Shadow Source Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
sourceName,
name
identifier
));
disableShadows = true;
break;
@@ -364,7 +366,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
"No Radius value expecified for Shadow Caster Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
casterName,
name
identifier
));
disableShadows = true;
break;
@@ -398,7 +400,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (!atmosphereDictionary.getValue(keyAtmosphereRadius, _atmosphereRadius)) {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Atmosphere Radius value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -407,7 +409,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (!atmosphereDictionary.getValue(keyPlanetRadius, _atmospherePlanetRadius)) {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Planet Radius value expecified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -419,7 +421,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
{
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Average Atmosphere Ground Reflectance value specified for "
"Atmosphere Effects. Disabling atmosphere effects for this planet."
);
@@ -431,7 +433,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
{
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Ground Radiance Emitted percentage value specified for Atmosphere "
"Effects. Disabling atmosphere effects for this planet."
);
@@ -454,7 +456,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
{
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Rayleigh Scattering parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -466,7 +468,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
{
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Rayleigh Height Scale value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -475,7 +477,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
else {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Rayleigh parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -506,7 +508,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (!mieDictionary.getValue(keyMieHeightScale, _mieHeightScale)) {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Mie Height Scale value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -515,7 +517,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (!mieDictionary.getValue("Coefficients.Scattering", _mieScatteringCoeff)) {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Mie Scattering parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -524,7 +526,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (!mieDictionary.getValue("Coefficients.Extinction", _mieExtinctionCoeff)) {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Mie Extinction parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -533,7 +535,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (!mieDictionary.getValue(keyMiePhaseConstant, _miePhaseConstant)) {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Mie Phase Constant value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
@@ -542,7 +544,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
else {
errorReadingAtmosphereData = true;
LWARNINGC(
name,
identifier,
"No Mie parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);

View File

@@ -381,7 +381,7 @@ std::pair<glm::dvec3, std::string> DashboardItemAngle::positionAndLabel(
switch (comp.type) {
case Type::Node:
return { comp.node->worldPosition(), comp.node->name() };
return { comp.node->worldPosition(), comp.node->guiName() };
case Type::Focus:
return {
OsEng.navigationHandler().focusNode()->worldPosition(),

View File

@@ -381,7 +381,7 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
switch (mainComp.type) {
case Type::Node:
return { mainComp.node->worldPosition(), mainComp.node->name() };
return { mainComp.node->worldPosition(), mainComp.node->guiName() };
case Type::NodeSurface:
{
glm::dvec3 otherPos;
@@ -398,7 +398,7 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
glm::dvec3 dir = glm::normalize(otherPos - thisPos);
glm::dvec3 dirLength = dir * glm::dvec3(mainComp.node->boundingSphere());
return { thisPos + dirLength, "surface of " + mainComp.node->name() };
return { thisPos + dirLength, "surface of " + mainComp.node->guiName() };
}
case Type::Focus:
return {

View File

@@ -86,7 +86,7 @@ documentation::Documentation DashboardItemParallelConnection::Documentation() {
DashboardItemParallelConnection::DashboardItemParallelConnection(
ghoul::Dictionary dictionary)
: DashboardItem("Parallel Connection")
: DashboardItem("ParallelConnection", "Parallel Connection")
, _fontName(FontNameInfo, KeyFontMono)
, _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f)
{

View File

@@ -123,7 +123,7 @@ documentation::Documentation DashboardItemSimulationIncrement::Documentation() {
DashboardItemSimulationIncrement::DashboardItemSimulationIncrement(
ghoul::Dictionary dictionary)
: DashboardItem("Simulation Increment")
: DashboardItem("SimulationIncrement", "Simulation Increment")
, _fontName(FontNameInfo, KeyFontMono)
, _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f)
, _doSimplification(SimplificationInfo, true)

View File

@@ -112,11 +112,6 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
, _programObject(nullptr)
, _texture(nullptr)
{
ghoul_precondition(
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyName),
"Name was not passed to RenderableModel"
);
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
@@ -128,9 +123,7 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
if (dictionary.hasKey(KeyGeometry)) {
std::string name = dictionary.value<std::string>(SceneGraphNode::KeyName);
ghoul::Dictionary dict = dictionary.value<ghoul::Dictionary>(KeyGeometry);
dict.setValue(SceneGraphNode::KeyName, name);
_geometry = modelgeometry::ModelGeometry::createFromDictionary(dict);
}

View File

@@ -159,20 +159,25 @@ ScreenSpaceDashboard::ScreenSpaceDashboard(const ghoul::Dictionary& dictionary)
"ScreenSpaceDashboard"
);
if (dictionary.hasKey(KeyName)) {
setName(dictionary.value<std::string>(KeyName));
}
else {
int iIdentifier = 0;
if (_identifier.empty()) {
static int id = 0;
if (id == 0) {
setName("ScreenSpaceDashboard");
iIdentifier = id;
if (iIdentifier == 0) {
setIdentifier("ScreenSpaceDashboard");
}
else {
setName("ScreenSpaceDashboard" + std::to_string(id));
setIdentifier("ScreenSpaceDashboard" + std::to_string(iIdentifier));
}
++id;
}
if (_guiName.empty()) {
// Adding an extra space to the user-facing name as it looks nicer
setGuiName("ScreenSpaceDashboard " + std::to_string(iIdentifier));
}
if (dictionary.hasKey(UseMainInfo.identifier)) {
_useMainDashboard = dictionary.value<bool>(UseMainInfo.identifier);
}

View File

@@ -65,12 +65,21 @@ ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictiona
"ScreenSpaceFramebuffer"
);
_id = id();
if (_id == 0) {
setName("ScreenSpaceFramebuffer");
int iIdentifier = 0;
if (_identifier.empty()) {
iIdentifier = id();
if (iIdentifier == 0) {
setIdentifier("ScreenSpaceFramebuffer");
}
else {
setIdentifier("ScreenSpaceFramebuffer" + std::to_string(iIdentifier));
}
}
else {
setName("ScreenSpaceFramebuffer " + std::to_string(_id));
if (_guiName.empty()) {
// Adding an extra space to the user-facing name as it looks nicer
setGuiName("ScreenSpaceFramebuffer " + std::to_string(iIdentifier));
}
glm::vec2 resolution = OsEng.windowWrapper().currentWindowResolution();

View File

@@ -74,8 +74,6 @@ private:
std::vector<std::function<void()>> _renderFunctions;
std::unique_ptr<ghoul::opengl::Texture> _texture;
int _id;
};
} //namespace openspace

View File

@@ -84,20 +84,25 @@ ScreenSpaceImageLocal::ScreenSpaceImageLocal(const ghoul::Dictionary& dictionary
"ScreenSpaceImageLocal"
);
if (dictionary.hasKey(KeyName)) {
setName(dictionary.value<std::string>(KeyName));
}
else {
int iIdentifier = 0;
if (_identifier.empty()) {
static int id = 0;
if (id == 0) {
setName("ScreenSpaceImageLocal");
iIdentifier = id;
if (iIdentifier == 0) {
setIdentifier("ScreenSpaceImageLocal");
}
else {
setName("ScreenSpaceImageLocal " + std::to_string(id));
setIdentifier("ScreenSpaceImageLocal" + std::to_string(iIdentifier));
}
++id;
}
if (_guiName.empty()) {
// Adding an extra space to the user-facing name as it looks nicer
setGuiName("ScreenSpaceImageLocal " + std::to_string(iIdentifier));
}
_texturePath.onChange([this]() { _textureIsDirty = true; });
addProperty(_texturePath);

View File

@@ -80,23 +80,28 @@ ScreenSpaceImageOnline::ScreenSpaceImageOnline(const ghoul::Dictionary& dictiona
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"ScreenSpaceImage"
"ScreenSpaceImageOnline"
);
if (dictionary.hasKey(KeyName)) {
setName(dictionary.value<std::string>(KeyName));
}
else {
int iIdentifier = 0;
if (_identifier.empty()) {
static int id = 0;
if (id == 0) {
setName("ScreenSpaceImageOnline");
iIdentifier = id;
if (iIdentifier == 0) {
setIdentifier("ScreenSpaceImageOnline");
}
else {
setName("ScreenSpaceImageOnline " + std::to_string(id));
setIdentifier("ScreenSpaceImageOnline" + std::to_string(iIdentifier));
}
++id;
}
if (_guiName.empty()) {
// Adding an extra space to the user-facing name as it looks nicer
setGuiName("ScreenSpaceImageOnline " + std::to_string(iIdentifier));
}
_texturePath.onChange([this]() { _textureIsDirty = true; });
addProperty(_texturePath);
@@ -104,7 +109,6 @@ ScreenSpaceImageOnline::ScreenSpaceImageOnline(const ghoul::Dictionary& dictiona
if (dictionary.hasKey(TextureInfo.identifier)) {
_texturePath = dictionary.value<std::string>(TextureInfo.identifier);
}
}
void ScreenSpaceImageOnline::update() {

View File

@@ -1111,7 +1111,7 @@ bool RenderableBillboardsCloud::loadSpeckData() {
std::string cachedFile = FileSys.cacheManager()->cachedFilename(
ghoul::filesystem::File(_file),
"RenderableDUMeshes|" + name(),
"RenderableDUMeshes|" + identifier(),
ghoul::filesystem::CacheManager::Persistent::Yes
);

View File

@@ -123,16 +123,10 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary)
, _fieldlineVAO(0)
, _vertexPositionBuffer(0)
{
ghoul_assert(
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyName),
"Renderable does not have a name"
);
std::string identifier = dictionary.value<std::string>(SceneGraphNode::KeyIdentifier);
setIdentifier(identifier);
std::string name;
dictionary.getValue(SceneGraphNode::KeyName, name);
setName(name);
_loggerCat = "RenderableFieldlines [" + name + "]";
_loggerCat = "RenderableFieldlines [" + identifier + "]";
bool success = dictionary.getValue(keyVectorField, _vectorFieldInfo);
if (!success) {

View File

@@ -374,13 +374,13 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
SourceFileType& sourceFileType)
{
_dictionary->getValue(SceneGraphNode::KeyName, _name);
_dictionary->getValue(SceneGraphNode::KeyIdentifier, _identifier);
// ------------------- EXTRACT MANDATORY VALUES FROM DICTIONARY ------------------- //
std::string inputFileTypeString;
if (!_dictionary->getValue(KeyInputFileType, inputFileTypeString)) {
LERROR(fmt::format(
"{}: The field {} is missing", _name, KeyInputFileType
"{}: The field {} is missing", _identifier, KeyInputFileType
));
}
else {
@@ -403,7 +403,7 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
else {
LERROR(fmt::format(
"{}: {} is not a recognized {}",
_name, inputFileTypeString, KeyInputFileType
_identifier, inputFileTypeString, KeyInputFileType
));
sourceFileType = SourceFileType::Invalid;
return false;
@@ -413,7 +413,7 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
std::string sourceFolderPath;
if (!_dictionary->getValue(KeySourceFolder, sourceFolderPath)) {
LERROR(fmt::format(
"{}: The field {} is missing", _name, KeySourceFolder
"{}: The field {} is missing", _identifier, KeySourceFolder
));
return false;
}
@@ -445,14 +445,14 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
if (_sourceFiles.empty()) {
LERROR(fmt::format(
"{}: {} contains no {} files",
_name, sourceFolderPath, inputFileTypeString
_identifier, sourceFolderPath, inputFileTypeString
));
return false;
}
}
else {
LERROR(fmt::format(
"{}: FieldlinesSequence {} is not a valid directory", _name, sourceFolderPath
"{}: FieldlinesSequence {} is not a valid directory", _identifier, sourceFolderPath
));
return false;
}
@@ -472,7 +472,7 @@ void RenderableFieldlinesSequence::extractOptionalInfoFromDictionary(
else {
LERROR(fmt::format(
"{}: The specified output path: '{}', does not exist",
_name, outputFolderPath
_identifier, outputFolderPath
));
outputFolderPath = "";
}
@@ -532,7 +532,7 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod
}
else {
LERROR(fmt::format(
"{}: Must specify '{}'", _name, KeyJsonSimulationModel
"{}: Must specify '{}'", _identifier, KeyJsonSimulationModel
));
return false;
}
@@ -544,7 +544,7 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod
else {
LWARNING(fmt::format(
"{}: Does not provide scalingFactor. Assumes coordinates are in meters",
_name
_identifier
));
}
return true;
@@ -611,7 +611,7 @@ void RenderableFieldlinesSequence::extractOsflsInfoFromDictionary() {
else {
LWARNING(fmt::format(
"{}: {} is not specified. States will be stored in RAM",
_name, KeyOslfsLoadAtRuntime
_identifier, KeyOslfsLoadAtRuntime
));
}
}
@@ -746,10 +746,10 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
}
_pFocusOnOriginBtn.onChange([this] {
SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(_name);
SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(_identifier);
if (!node) {
LWARNING(fmt::format(
"Could not find a node in scenegraph called '{}'", _name
"Could not find a node in scenegraph called '{}'", _identifier
));
return;
}
@@ -899,20 +899,20 @@ bool RenderableFieldlinesSequence::extractCdfInfoFromDictionary(std::string& see
else {
LERROR(fmt::format(
"{}: The specified seed poitn file: '{}' does not exist",
_name, seedFilePath
_identifier, seedFilePath
));
return false;
}
}
else {
LERROR(fmt::format("{}: Must specify '{}'", _name, KeyCdfSeedPointFile));
LERROR(fmt::format("{}: Must specify '{}'", _identifier, KeyCdfSeedPointFile));
return false;
}
if (!_dictionary->getValue(KeyCdfTracingVariable, tracingVar)) {
tracingVar = "b"; // Magnetic field variable as default
LWARNING(fmt::format("{}: No '{}', using default '{}'",
_name, KeyCdfTracingVariable, tracingVar
_identifier, KeyCdfTracingVariable, tracingVar
));
}

View File

@@ -62,7 +62,7 @@ private:
};
// ------------------------------------ STRINGS ------------------------------------//
std::string _name; // Name of the Node!
std::string _identifier; // Name of the Node!
// ------------------------------------- FLAGS -------------------------------------//
// Used for 'runtime-states'. True when loading a new state from disk on another

View File

@@ -521,10 +521,10 @@ std::string GlobeBrowsingModule::layerGroupNamesList() {
std::string listLayerGroups("");
for (int i = 0; i < globebrowsing::layergroupid::NUM_LAYER_GROUPS - 1; ++i) {
listLayerGroups +=
globebrowsing::layergroupid::LAYER_GROUP_NAMES[i] + std::string(", ");
globebrowsing::layergroupid::LAYER_GROUP_IDENTIFIERS[i] + std::string(", ");
}
listLayerGroups +=
std::string(" and ") + globebrowsing::layergroupid::LAYER_GROUP_NAMES[
std::string(" and ") + globebrowsing::layergroupid::LAYER_GROUP_IDENTIFIERS[
globebrowsing::layergroupid::NUM_LAYER_GROUPS - 1];
return listLayerGroups;
}

View File

@@ -57,7 +57,7 @@ const GeodeticPatch ChunkedLodGlobe::COVERAGE = GeodeticPatch(0, 0, 90, 180);
ChunkedLodGlobe::ChunkedLodGlobe(const RenderableGlobe& owner, size_t segmentsPerPatch,
std::shared_ptr<LayerManager> layerManager)
: Renderable({ { "Name", owner.name() } })
: Renderable({ { "Identifier", owner.identifier() }, { "Name", owner.guiName() } })
, minSplitDepth(2)
, maxSplitDepth(22)
, stats(StatsCollector(absPath("test_stats"), 1, StatsCollector::Enabled::No))

View File

@@ -51,7 +51,7 @@ namespace {
namespace openspace::globebrowsing {
PointGlobe::PointGlobe(const RenderableGlobe& owner)
: Renderable({ { "Name", owner.name() } })
: Renderable({ { "Identifier", owner.identifier() }, { "Name", owner.guiName() } })
, _owner(owner)
, _intensityClamp(IntensityClampInfo, 1.f, 0.f, 1.f)
, _lightIntensity(LightIntensityInfo, 1.f, 0.f, 50.f)

View File

@@ -29,7 +29,6 @@
#include <modules/globebrowsing/globes/pointglobe.h>
#include <modules/globebrowsing/rendering/layer/layermanager.h>
namespace {
const char* keyFrame = "Frame";
const char* keyRadii = "Radii";
@@ -199,7 +198,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
})
, _debugPropertyOwner({ "Debug" })
{
setName("RenderableGlobe");
setIdentifier("RenderableGlobe");
dictionary.getValue(keyFrame, _frame);

View File

@@ -50,7 +50,7 @@ void GPULayerManager::bind(ghoul::opengl::ProgramObject* programObject,
}
for (size_t i = 0; i < layerGroups.size(); ++i) {
const std::string& nameBase = layergroupid::LAYER_GROUP_NAMES[i];
const std::string& nameBase = layergroupid::LAYER_GROUP_IDENTIFIERS[i];
_gpuLayerGroups[i]->bind(
programObject,
*layerGroups[i],

View File

@@ -34,6 +34,7 @@ namespace openspace::globebrowsing {
namespace {
constexpr const char* _loggerCat = "Layer";
constexpr const char* keyIdentifier = "Identifier";
constexpr const char* keyName = "Name";
constexpr const char* keyDescription = "Description";
constexpr const char* keyEnabled = "Enabled";
@@ -90,7 +91,8 @@ namespace {
Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict,
LayerGroup& parent)
: properties::PropertyOwner({
layerDict.value<std::string>(keyName),
layerDict.value<std::string>(keyIdentifier),
layerDict.hasKey(keyName) ? layerDict.value<std::string>(keyName) : "",
layerDict.hasKey(keyDescription) ?
layerDict.value<std::string>(keyDescription) :
""
@@ -180,7 +182,7 @@ Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict,
}
}
catch (...) {
_parent.deleteLayer(name());
_parent.deleteLayer(identifier());
throw;
}
});

View File

@@ -43,7 +43,10 @@ namespace {
namespace openspace::globebrowsing {
LayerGroup::LayerGroup(layergroupid::GroupID id)
: properties::PropertyOwner({ std::move(layergroupid::LAYER_GROUP_NAMES[id]) })
: properties::PropertyOwner({
layergroupid::LAYER_GROUP_IDENTIFIERS[id],
layergroupid::LAYER_GROUP_NAMES[id]
})
, _groupId(id)
, _levelBlendingEnabled(BlendTileInfo, true)
{
@@ -104,14 +107,14 @@ void LayerGroup::update() {
}
std::shared_ptr<Layer> LayerGroup::addLayer(const ghoul::Dictionary& layerDict) {
if (!layerDict.hasKeyAndValue<std::string>("Name")) {
LERROR("'Name' must be specified for layer.");
if (!layerDict.hasKeyAndValue<std::string>("Identifier")) {
LERROR("'Identifier' must be specified for layer.");
return nullptr;
}
auto layer = std::make_shared<Layer>(_groupId, layerDict, *this);
layer->onChange(_onChangeCallback);
if (hasPropertySubOwner(layer->name())) {
LINFO("Layer with name " + layer->name() + " already exists.");
if (hasPropertySubOwner(layer->identifier())) {
LINFO("Layer with identifier " + layer->identifier() + " already exists.");
_levelBlendingEnabled.setVisibility(properties::Property::Visibility::User);
return nullptr;
}
@@ -132,7 +135,7 @@ void LayerGroup::deleteLayer(const std::string& layerName) {
it != _layers.end();
++it)
{
if (it->get()->name() == layerName) {
if (it->get()->identifier() == layerName) {
removePropertySubOwner(it->get());
(*it)->deinitialize();
_layers.erase(it);

View File

@@ -37,7 +37,7 @@ TypeID getTypeIDFromTypeString(const std::string& typeString) {
layergroupid::GroupID getGroupIDFromName(const std::string& layerGroupName) {
for (int i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) {
if (layerGroupName == layergroupid::LAYER_GROUP_NAMES[i]) {
if (layerGroupName == layergroupid::LAYER_GROUP_IDENTIFIERS[i]) {
return static_cast<layergroupid::GroupID>(i);
}
}

View File

@@ -30,7 +30,7 @@
namespace openspace::globebrowsing::layergroupid {
static constexpr int NUM_LAYER_GROUPS = 5;
static constexpr const char* LAYER_GROUP_NAMES[NUM_LAYER_GROUPS] = {
static constexpr const char* LAYER_GROUP_IDENTIFIERS[NUM_LAYER_GROUPS] = {
"HeightLayers",
"ColorLayers",
"Overlays",
@@ -38,6 +38,14 @@ static constexpr const char* LAYER_GROUP_NAMES[NUM_LAYER_GROUPS] = {
"WaterMasks"
};
static constexpr const char* LAYER_GROUP_NAMES[NUM_LAYER_GROUPS] = {
"Height Layers",
"Color Layers",
"Overlays",
"Night Layers",
"Water Masks"
};
enum GroupID {
HeightLayers,
ColorLayers,

View File

@@ -166,7 +166,7 @@ void LayerShaderManager::recompileShaderProgram(
for (size_t i = 0; i < textureTypes.size(); i++) {
// lastLayerIndex must be at least 0 for the shader to compile,
// the layer type is inactivated by setting use to false
std::string groupName = layergroupid::LAYER_GROUP_NAMES[i];
std::string groupName = layergroupid::LAYER_GROUP_IDENTIFIERS[i];
shaderDictionary.setValue(
"lastLayerIndex" + groupName,
glm::max(textureTypes[i].lastLayerIdx, 0)
@@ -219,7 +219,7 @@ void LayerShaderManager::recompileShaderProgram(
ghoul::Dictionary layerGroupNames;
for (int i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) {
layerGroupNames.setValue(std::to_string(i), layergroupid::LAYER_GROUP_NAMES[i]);
layerGroupNames.setValue(std::to_string(i), layergroupid::LAYER_GROUP_IDENTIFIERS[i]);
}
shaderDictionary.setValue("layerGroups", layerGroupNames);

View File

@@ -29,18 +29,15 @@
#include <ghoul/logging/logmanager.h>
namespace {
const char* KeyProviders = "LevelTileProviders";
const char* KeyMaxLevel = "MaxLevel";
const char* KeyTileProvider = "TileProvider";
const char* KeyLayerGroupID = "LayerGroupID";
constexpr const char* KeyProviders = "LevelTileProviders";
constexpr const char* KeyMaxLevel = "MaxLevel";
constexpr const char* KeyTileProvider = "TileProvider";
constexpr const char* KeyLayerGroupID = "LayerGroupID";
} // namespace
namespace openspace::globebrowsing::tileprovider {
TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) {
std::string name = "Name unspecified";
dictionary.getValue("Name", name);
layergroupid::GroupID layerGroupID;
dictionary.getValue(KeyLayerGroupID, layerGroupID);
@@ -93,9 +90,14 @@ TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) {
))
);
std::string providerIdentifier;
providerDict.getValue("Identifier", providerIdentifier);
_levelTileProviders.back()->setIdentifier(providerIdentifier);
std::string providerName;
providerDict.getValue("Name", providerName);
_levelTileProviders.back()->setName(providerName);
_levelTileProviders.back()->setGuiName(providerName);
addPropertySubOwner(_levelTileProviders.back().get());
// Ensure we can represent the max level

View File

@@ -79,9 +79,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
gui._screenSpaceProperty.setSource(
[]() {
const std::vector<ScreenSpaceRenderable*>& ssr =
OsEng.renderEngine().screenSpaceRenderables();
return std::vector<properties::PropertyOwner*>(ssr.begin(), ssr.end());
return OsEng.renderEngine().screenSpaceOwner().propertySubOwners();
}
);

View File

@@ -38,7 +38,7 @@ class GUI;
class GuiComponent : public properties::PropertyOwner {
public:
/// Constructor that initializes this components member variables
GuiComponent(std::string name);
GuiComponent(std::string identifier, std::string guiName = "");
/**
* Returns if this component is enabled, that is, if it is currently active and

View File

@@ -51,7 +51,8 @@ public:
using UseTreeLayout = ghoul::Boolean;
GuiPropertyComponent(std::string name, UseTreeLayout useTree = UseTreeLayout::No);
GuiPropertyComponent(std::string identifier, std::string guiName = "",
UseTreeLayout useTree = UseTreeLayout::No);
// This is the function that evaluates to the list of Propertyowners that this
// component should render

View File

@@ -280,15 +280,19 @@ void CaptionText(const char* text) {
GUI::GUI()
: GuiComponent("Main")
, _globalProperty("Global Properties")
, _globalProperty("Global", "Global Properties")
, _sceneProperty(
"Scene Properties",
"SceneProperties", "Scene Properties",
GuiPropertyComponent::UseTreeLayout::Yes
)
, _screenSpaceProperty("ScreenSpace Properties")
, _moduleProperty("Module Properties")
, _virtualProperty("Virtual Properties")
, _featuredProperties("Featured Properties", GuiPropertyComponent::UseTreeLayout::No)
, _screenSpaceProperty("ScreenSpaceProperties", "ScreenSpace Properties")
, _moduleProperty("ModuleProperties", "Module Properties")
, _virtualProperty("VirtualProperties", "Virtual Properties")
, _featuredProperties(
"FeaturedProperties",
"Featured Properties",
GuiPropertyComponent::UseTreeLayout::No
)
, _showInternals(false)
, _showHelpText(ShowHelpInfo, true)
, _helpTextDelay(HelpTextDelayInfo, 1.0, 0.0, 10.0)

View File

@@ -40,8 +40,8 @@ namespace {
namespace openspace::gui {
GuiComponent::GuiComponent(std::string name)
: properties::PropertyOwner({ std::move(name) })
GuiComponent::GuiComponent(std::string identifier, std::string guiName)
: properties::PropertyOwner({ std::move(identifier), std::move(guiName) })
, _isEnabled(EnabledInfo, false)
, _isCollapsed(CollapsedInfo, false)
{

View File

@@ -31,7 +31,7 @@
namespace openspace::gui {
GuiFilePathComponent::GuiFilePathComponent()
: GuiComponent("File Path")
: GuiComponent("FilePath", "File Path")
{}
void GuiFilePathComponent::render() {

View File

@@ -53,7 +53,7 @@ namespace {
namespace openspace::gui {
GuiGlobeBrowsingComponent::GuiGlobeBrowsingComponent()
: GuiPropertyComponent("GlobeBrowsing")
: GuiPropertyComponent("GlobeBrowsing", "Globe Browsing")
{}
void GuiGlobeBrowsingComponent::render() {
@@ -80,7 +80,8 @@ void GuiGlobeBrowsingComponent::render() {
nodes.begin(),
nodes.end(),
[](SceneGraphNode* n) {
return !(n->renderable() && n->renderable()->name() == "RenderableGlobe");
return !(n->renderable() &&
n->renderable()->identifier() == "RenderableGlobe");
}
),
nodes.end()
@@ -88,11 +89,13 @@ void GuiGlobeBrowsingComponent::render() {
std::sort(
nodes.begin(),
nodes.end(),
[](SceneGraphNode* lhs, SceneGraphNode* rhs) { return lhs->name() < rhs->name(); }
[](SceneGraphNode* lhs, SceneGraphNode* rhs) {
return lhs->guiName() < rhs->guiName();
}
);
std::string nodeNames;
for (SceneGraphNode* n : nodes) {
nodeNames += n->name() + '\0';
nodeNames += n->identifier() + '\0';
}
int iNode = -1;
@@ -104,7 +107,7 @@ void GuiGlobeBrowsingComponent::render() {
const SceneGraphNode* const focus = OsEng.navigationHandler().focusNode();
auto it = std::find(nodes.cbegin(), nodes.cend(), focus);
if (it != nodes.end()) {
_currentNode = focus->name();
_currentNode = focus->identifier();
iNode = static_cast<int>(std::distance(nodes.cbegin(), it));
}
}
@@ -113,7 +116,7 @@ void GuiGlobeBrowsingComponent::render() {
nodes.cbegin(),
nodes.cend(),
[this](SceneGraphNode* lhs) {
return lhs->name() == _currentNode;
return lhs->identifier() == _currentNode;
}
);
iNode = static_cast<int>(std::distance(nodes.cbegin(), it));
@@ -127,7 +130,7 @@ void GuiGlobeBrowsingComponent::render() {
const SceneGraphNode* const focus = OsEng.navigationHandler().focusNode();
auto it = std::find(nodes.cbegin(), nodes.cend(), focus);
if (it != nodes.end()) {
_currentNode = focus->name();
_currentNode = focus->identifier();
iNode = static_cast<int>(std::distance(nodes.cbegin(), it));
nodeChanged = true;
}
@@ -138,7 +141,7 @@ void GuiGlobeBrowsingComponent::render() {
// or if there are no nodes
return;
}
_currentNode = nodes[iNode]->name();
_currentNode = nodes[iNode]->identifier();
if (nodeChanged) {
_currentServer = "";

View File

@@ -95,12 +95,14 @@ namespace {
namespace openspace::gui {
GuiMissionComponent::GuiMissionComponent() : GuiComponent("Mission Information") {}
GuiMissionComponent::GuiMissionComponent() :
GuiComponent("Missions", "Mission Information")
{}
void GuiMissionComponent::render() {
ImGui::SetNextWindowCollapsed(_isCollapsed);
bool v = _isEnabled;
ImGui::Begin(name().c_str(), &v, Size, 0.75f);
ImGui::Begin(guiName().c_str(), &v, Size, 0.75f);
_isEnabled = v;
_isCollapsed = ImGui::IsWindowCollapsed();

View File

@@ -40,7 +40,7 @@
namespace openspace::gui {
GuiParallelComponent::GuiParallelComponent()
: GuiPropertyComponent("GuiParallelComponent")
: GuiPropertyComponent("Parallel", "Parallel Connection")
{
setVisibility(properties::Property::Visibility::All);
}

View File

@@ -80,7 +80,7 @@ namespace {
namespace openspace::gui {
GuiPerformanceComponent::GuiPerformanceComponent()
: GuiComponent("PerformanceComponent")
: GuiComponent("PerformanceComponent", "Performance Component")
, _sortingSelection(SortingSelectionInfo, -1, -1, 6)
, _sceneGraphIsEnabled(SceneGraphEnabledInfo, false)
, _functionsIsEnabled(FunctionsEnabledInfo, false)

View File

@@ -161,8 +161,9 @@ namespace {
namespace openspace::gui {
GuiPropertyComponent::GuiPropertyComponent(std::string name, UseTreeLayout useTree)
: GuiComponent(std::move(name))
GuiPropertyComponent::GuiPropertyComponent(std::string identifier, std::string guiName,
UseTreeLayout useTree)
: GuiComponent(std::move(identifier), std::move(guiName))
, _useTreeLayout(UseTreeInfo, useTree)
, _treeOrdering(OrderingInfo)
{
@@ -188,7 +189,7 @@ void GuiPropertyComponent::renderPropertyOwner(properties::PropertyOwner* owner)
}
int nThisProperty = nVisibleProperties(owner->properties(), _visibility);
ImGui::PushID(owner->name().c_str());
ImGui::PushID(owner->identifier().c_str());
const auto& subOwners = owner->propertySubOwners();
for (properties::PropertyOwner* subOwner : subOwners) {
std::vector<properties::Property*> properties = subOwner->propertiesRecursive();
@@ -200,7 +201,7 @@ void GuiPropertyComponent::renderPropertyOwner(properties::PropertyOwner* owner)
renderPropertyOwner(subOwner);
}
else {
bool opened = ImGui::TreeNode(subOwner->name().c_str());
bool opened = ImGui::TreeNode(subOwner->guiName().c_str());
renderTooltip(subOwner);
if (opened) {
renderPropertyOwner(subOwner);
@@ -251,7 +252,7 @@ void GuiPropertyComponent::render() {
ImGui::SetNextWindowCollapsed(_isCollapsed);
bool v = _isEnabled;
ImGui::Begin(name().c_str(), &v, Size, 0.75f);
ImGui::Begin(guiName().c_str(), &v, Size, 0.75f);
_isEnabled = v;
_isCollapsed = ImGui::IsWindowCollapsed();
@@ -264,7 +265,7 @@ void GuiPropertyComponent::render() {
owners.begin(),
owners.end(),
[](properties::PropertyOwner* lhs, properties::PropertyOwner* rhs) {
return lhs->name() < rhs->name();
return lhs->guiName() < rhs->guiName();
}
);
@@ -357,11 +358,11 @@ void GuiPropertyComponent::render() {
auto header = [&]() -> bool {
if (owners.size() > 1) {
// Create a header in case we have multiple owners
return ImGui::CollapsingHeader(pOwner->name().c_str());
return ImGui::CollapsingHeader(pOwner->guiName().c_str());
}
else if (!pOwner->name().empty()) {
else if (!pOwner->identifier().empty()) {
// If the owner has a name, print it first
ImGui::Text("%s", pOwner->name().c_str());
ImGui::Text("%s", pOwner->guiName().c_str());
ImGui::Spacing();
return true;
}
@@ -462,7 +463,7 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
if (owner) {
it->second(
prop,
owner->name(),
owner->identifier(),
IsRegularProperty(_hasOnlyRegularProperties),
ShowToolTip(_showHelpTooltip),
_tooltipDelay

View File

@@ -76,7 +76,7 @@ namespace {
namespace openspace::gui {
GuiSpaceTimeComponent::GuiSpaceTimeComponent()
: GuiComponent("Space/Time")
: GuiComponent("SpaceTime", "Space/Time")
, _deltaTime(0.f)
, _deltaTimeUnit(static_cast<int>(TimeUnit::Second))
, _accelerationDelta(0.f)
@@ -95,7 +95,7 @@ GuiSpaceTimeComponent::GuiSpaceTimeComponent()
void GuiSpaceTimeComponent::render() {
ImGui::SetNextWindowCollapsed(_isCollapsed);
bool v = _isEnabled;
ImGui::Begin(name().c_str(), &v, Size, 0.5f, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Begin(guiName().c_str(), &v, Size, 0.5f, ImGuiWindowFlags_AlwaysAutoResize);
_isEnabled = v;
_isCollapsed = ImGui::IsWindowCollapsed();
@@ -106,7 +106,7 @@ void GuiSpaceTimeComponent::render() {
nodes.begin(),
nodes.end(),
[](SceneGraphNode* lhs, SceneGraphNode* rhs) {
return lhs->name() < rhs->name();
return lhs->guiName() < rhs->guiName();
}
);
@@ -119,12 +119,12 @@ void GuiSpaceTimeComponent::render() {
const std::vector<std::string>& tags = n->tags();
auto it = std::find(tags.begin(), tags.end(), "GUI.Interesting");
if (it != tags.end()) {
bool pressed = ImGui::Button(n->name().c_str());
bool pressed = ImGui::Button(n->guiName().c_str());
ImGui::SameLine();
if (pressed) {
OsEng.scriptEngine().queueScript(
"openspace.setPropertyValue('NavigationHandler.Origin', '" +
n->name() + "');",
n->identifier() + "');",
scripting::ScriptEngine::RemoteScripting::Yes
);
}
@@ -138,7 +138,7 @@ void GuiSpaceTimeComponent::render() {
std::string nodeNames = "";
for (SceneGraphNode* n : nodes) {
nodeNames += n->name() + '\0';
nodeNames += n->identifier() + '\0';
}
auto iCurrentFocus = std::find(nodes.begin(), nodes.end(), currentFocus);
@@ -153,7 +153,7 @@ void GuiSpaceTimeComponent::render() {
if (hasChanged) {
OsEng.scriptEngine().queueScript(
"openspace.setPropertyValue('NavigationHandler.Origin', '" +
nodes[currentPosition]->name() + "');",
nodes[currentPosition]->identifier() + "');",
scripting::ScriptEngine::RemoteScripting::Yes
);
}

View File

@@ -334,61 +334,92 @@ void DataCygnet::setPropertyCallbacks() {
void DataCygnet::subscribeToGroup() {
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event dataOptionsChanged");
std::vector<int> values;
bool success = dict.getValue<std::vector<int> >("dataOptions", values);
if (success) {
_dataOptions.setValue(values);
groupEvent->subscribe(
identifier(),
"dataOptionsChanged",
[&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event dataOptionsChanged");
std::vector<int> values;
bool success = dict.getValue<std::vector<int> >("dataOptions", values);
if (success) {
_dataOptions.setValue(values);
}
}
});
);
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event normValuesChanged");
glm::vec2 values;
bool success = dict.getValue("normValues", values);
if (success) {
_normValues.setValue(values);
groupEvent->subscribe(
identifier(),
"normValuesChanged",
[&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event normValuesChanged");
glm::vec2 values;
bool success = dict.getValue("normValues", values);
if (success) {
_normValues.setValue(values);
}
}
});
);
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict) {
LDEBUG(name() + " Event backgroundValuesChanged");
glm::vec2 values;
bool success = dict.getValue("backgroundValues", values);
if (success) {
_backgroundValues.setValue(values);
groupEvent->subscribe(
identifier(),
"backgroundValuesChanged",
[&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event backgroundValuesChanged");
glm::vec2 values;
bool success = dict.getValue("backgroundValues", values);
if (success) {
_backgroundValues.setValue(values);
}
}
});
);
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict)
{
LDEBUG(name() + " Event transferFunctionsChanged");
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
});
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict) {
LDEBUG(name() + " Event useLogChanged");
_useLog.setValue(dict.value<bool>("useLog"));
});
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict) {
LDEBUG(name() + " Event useHistogramChanged");
_useHistogram.setValue(dict.value<bool>("useHistogram"));
});
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict) {
LDEBUG(name() + " Event autoFilterChanged");
_autoFilter.setValue(dict.value<bool>("autoFilter"));
});
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary) {
LDEBUG(name() + " Event updateGroup");
if (_autoFilter.value()) {
_backgroundValues.setValue(_dataProcessor->filterValues());
groupEvent->subscribe(
identifier(),
"transferFunctionsChanged",
[&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event transferFunctionsChanged");
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
}
updateTexture();
});
);
groupEvent->subscribe(
identifier(),
"useLogChanged",
[&](const ghoul::Dictionary& dict) {
LDEBUG(identifier() + " Event useLogChanged");
_useLog.setValue(dict.value<bool>("useLog"));
}
);
groupEvent->subscribe(
identifier(),
"useHistogramChanged",
[&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event useHistogramChanged");
_useHistogram.setValue(dict.value<bool>("useHistogram"));
}
);
groupEvent->subscribe(
identifier(),
"autoFilterChanged",
[&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event autoFilterChanged");
_autoFilter.setValue(dict.value<bool>("autoFilter"));
}
);
groupEvent->subscribe(
identifier(),
"updateGroup",
[&](ghoul::Dictionary) {
LDEBUG(identifier() + " Event updateGroup");
if (_autoFilter.value()) {
_backgroundValues.setValue(_dataProcessor->filterValues());
}
updateTexture();
}
);
}
} //namespace openspace

View File

@@ -178,7 +178,7 @@ std::vector<float*> DataPlane::textureData(){
std::chrono::duration<double> elapsed_seconds = end-start;
_avgBenchmarkTime = ((_avgBenchmarkTime * (_numOfBenchmarks - 1))
+ elapsed_seconds.count()) / _numOfBenchmarks;
std::cout << " processData() " << name() << std::endl;
std::cout << " processData() " << identifier() << std::endl;
std::cout << "avg elapsed time: " << _avgBenchmarkTime << "s\n";
std::cout << "num Benchmarks: " << _numOfBenchmarks << "\n";
// ===========

View File

@@ -85,14 +85,14 @@ bool IswaBaseGroup::isType(std::string type){
}
void IswaBaseGroup::updateGroup(){
LDEBUG("Group " + name() + " published updateGroup");
LDEBUG("Group " + identifier() + " published updateGroup");
_groupEvent->publish("updateGroup", ghoul::Dictionary());
}
void IswaBaseGroup::clearGroup(){
_groupEvent->publish("clearGroup", ghoul::Dictionary());
LDEBUG("Group " + name() + " published clearGroup");
LDEBUG("Group " + identifier() + " published clearGroup");
unregisterProperties();
}
@@ -106,7 +106,7 @@ std::shared_ptr<ghoul::Event<ghoul::Dictionary> > IswaBaseGroup::groupEvent() {
void IswaBaseGroup::registerProperties(){
_enabled.onChange([this]{
LDEBUG("Group " + name() + " published enabledChanged");
LDEBUG("Group " + identifier() + " published enabledChanged");
_groupEvent->publish(
"enabledChanged",
ghoul::Dictionary({{"enabled", _enabled.value()}})
@@ -114,7 +114,7 @@ void IswaBaseGroup::registerProperties(){
});
_alpha.onChange([this]{
LDEBUG("Group " + name() + " published alphaChanged");
LDEBUG("Group " + identifier() + " published alphaChanged");
_groupEvent->publish(
"alphaChanged",
ghoul::Dictionary({{"alpha", _alpha.value()}})

View File

@@ -60,9 +60,10 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
, _textureDirty(false)
, _rotation(glm::mat4(1.0f))
{
// This changed from setIdentifier to setGuiName, 2018-03-14 ---abock
std::string name;
dictionary.getValue("Name", name);
setName(name);
setGuiName(name);
_data = std::make_shared<Metadata>();
@@ -124,7 +125,7 @@ void IswaCygnet::initialize() {
_delete.onChange([this]() {
deinitialize();
OsEng.scriptEngine().queueScript(
"openspace.removeSceneGraphNode('" + name() + "')",
"openspace.removeSceneGraphNode('" + identifier() + "')",
scripting::ScriptEngine::RemoteScripting::Yes
);
});
@@ -138,7 +139,7 @@ void IswaCygnet::initialize() {
void IswaCygnet::deinitialize() {
if (!_data->groupName.empty()) {
_group->groupEvent()->unsubscribe(name());
_group->groupEvent()->unsubscribe(identifier());
}
unregisterProperties();
@@ -282,20 +283,28 @@ void IswaCygnet::initializeGroup() {
//Subscribe to enable and delete property
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "enabledChanged", [&](const ghoul::Dictionary& dict) {
LDEBUG(name() + " Event enabledChanged");
_enabled.setValue(dict.value<bool>("enabled"));
});
groupEvent->subscribe(
identifier(),
"enabledChanged",
[&](const ghoul::Dictionary& dict) {
LDEBUG(identifier() + " Event enabledChanged");
_enabled.setValue(dict.value<bool>("enabled"));
}
);
groupEvent->subscribe(name(), "alphaChanged", [&](const ghoul::Dictionary& dict) {
LDEBUG(name() + " Event alphaChanged");
_alpha.setValue(dict.value<float>("alpha"));
});
groupEvent->subscribe(
identifier(),
"alphaChanged",
[&](const ghoul::Dictionary& dict) {
LDEBUG(identifier() + " Event alphaChanged");
_alpha.setValue(dict.value<float>("alpha"));
}
);
groupEvent->subscribe(name(), "clearGroup", [&](ghoul::Dictionary){
LDEBUG(name() + " Event clearGroup");
groupEvent->subscribe(identifier(), "clearGroup", [&](ghoul::Dictionary) {
LDEBUG(identifier() + " Event clearGroup");
OsEng.scriptEngine().queueScript(
"openspace.removeSceneGraphNode('" + name() + "')",
"openspace.removeSceneGraphNode('" + identifier() + "')",
scripting::ScriptEngine::RemoteScripting::Yes
);
});

View File

@@ -121,7 +121,7 @@ void IswaDataGroup::registerProperties(){
_useLog.onChange([this]{
LDEBUG("Group " + name() + " published useLogChanged");
LDEBUG("Group " + identifier() + " published useLogChanged");
_groupEvent->publish(
"useLogChanged",
ghoul::Dictionary({{"useLog", _useLog.value()}})
@@ -129,7 +129,7 @@ void IswaDataGroup::registerProperties(){
});
_useHistogram.onChange([this]{
LDEBUG("Group " + name() + " published useHistogramChanged");
LDEBUG("Group " + identifier() + " published useHistogramChanged");
_groupEvent->publish(
"useHistogramChanged",
ghoul::Dictionary({{"useHistogram", _useHistogram.value()}})
@@ -138,7 +138,7 @@ void IswaDataGroup::registerProperties(){
//If autofiler is on, background values property should be hidden
_autoFilter.onChange([this](){
LDEBUG("Group " + name() + " published autoFilterChanged");
LDEBUG("Group " + identifier() + " published autoFilterChanged");
// If autofiler is selected, use _dataProcessor to set backgroundValues
// and unregister backgroundvalues property.
if(_autoFilter.value()){
@@ -157,7 +157,7 @@ void IswaDataGroup::registerProperties(){
});
_normValues.onChange([this]{
LDEBUG("Group " + name() + " published normValuesChanged");
LDEBUG("Group " + identifier() + " published normValuesChanged");
_groupEvent->publish(
"normValuesChanged",
ghoul::Dictionary({{"normValues", _normValues.value()}})
@@ -165,7 +165,7 @@ void IswaDataGroup::registerProperties(){
});
_backgroundValues.onChange([this]{
LDEBUG("Group " + name() + " published backgroundValuesChanged");
LDEBUG("Group " + identifier() + " published backgroundValuesChanged");
_groupEvent->publish(
"backgroundValuesChanged",
ghoul::Dictionary({{"backgroundValues", _backgroundValues.value()}})
@@ -173,7 +173,7 @@ void IswaDataGroup::registerProperties(){
});
_transferFunctionsFile.onChange([this]{
LDEBUG("Group " + name() + " published transferFunctionsChanged");
LDEBUG("Group " + identifier() + " published transferFunctionsChanged");
_groupEvent->publish(
"transferFunctionsChanged",
ghoul::Dictionary({{"transferFunctions", _transferFunctionsFile.value()}})
@@ -181,7 +181,7 @@ void IswaDataGroup::registerProperties(){
});
_dataOptions.onChange([this]{
LDEBUG("Group " + name() + " published dataOptionsChanged");
LDEBUG("Group " + identifier() + " published dataOptionsChanged");
ghoul::Dictionary dict;
dict.setValue<std::vector<int>>("dataOptions", _dataOptions.value());
_groupEvent->publish("dataOptionsChanged", dict);

View File

@@ -98,7 +98,7 @@ void IswaKameleonGroup::registerProperties() {
//OsEng.gui()._iswa.registerProperty(&_fieldlines);
_resolution.onChange([this]{
LDEBUG("Group " + name() + " published resolutionChanged");
LDEBUG("Group " + identifier() + " published resolutionChanged");
_groupEvent->publish(
"resolutionChanged",
ghoul::Dictionary({{"resolution", _resolution.value()}})
@@ -132,7 +132,7 @@ void IswaKameleonGroup::readFieldlinePaths(std::string indexFile) {
for (json::iterator it = fieldlines.begin(); it != fieldlines.end(); ++it) {
_fieldlines.addOption({i, it.key()});
_fieldlineState[i] = std::make_tuple<std::string, std::string, bool>(
name() + "/" + it.key(),
identifier() + "/" + it.key(),
it.value(),
false
);

View File

@@ -341,7 +341,7 @@ void KameleonPlane::readFieldlinePaths(std::string indexFile) {
//Parse and add each fieldline as an selection
json fieldlines = json::parse(seedFile);
int i = 0;
std::string fullName = name();
std::string fullName = identifier();
std::string partName = fullName.substr(0,fullName.find_last_of("-"));
for (json::iterator it = fieldlines.begin(); it != fieldlines.end(); ++it) {
_fieldlines.addOption({i, it.key()});
@@ -367,8 +367,8 @@ void KameleonPlane::subscribeToGroup() {
//Add additional Events specific to KameleonPlane
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "resolutionChanged", [&](ghoul::Dictionary dict) {
LDEBUG(name() + " Event resolutionChanged");
groupEvent->subscribe(identifier(), "resolutionChanged", [&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event resolutionChanged");
float resolution;
bool success = dict.getValue("resolution", resolution);
if (success) {
@@ -376,8 +376,8 @@ void KameleonPlane::subscribeToGroup() {
}
});
groupEvent->subscribe(name(), "cdfChanged", [&](ghoul::Dictionary dict) {
LDEBUG(name() + " Event cdfChanged");
groupEvent->subscribe(identifier(), "cdfChanged", [&](ghoul::Dictionary dict) {
LDEBUG(identifier() + " Event cdfChanged");
std::string path;
bool success = dict.getValue("path", path);
if (success) {

View File

@@ -229,7 +229,8 @@ RenderableKameleonVolume::RenderableKameleonVolume(const ghoul::Dictionary& dict
ghoul::Dictionary clipPlanesDictionary;
dictionary.getValue(KeyClipPlanes, clipPlanesDictionary);
_clipPlanes = std::make_shared<volume::VolumeClipPlanes>(clipPlanesDictionary);
_clipPlanes->setName("clipPlanes");
_clipPlanes->setIdentifier("clipPlanes");
_clipPlanes->setGuiName("Clip Planes");
bool cache;
if (dictionary.getValue(KeyCache, cache)) {

View File

@@ -193,8 +193,6 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
"RenderablePlanet"
);
const std::string name = dictionary.value<std::string>(SceneGraphNode::KeyName);
ghoul::Dictionary geomDict = dictionary.value<ghoul::Dictionary>(KeyGeometry);
if (dictionary.hasKey(KeyRadius)) {
@@ -299,7 +297,7 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
"No Radius value specified for Shadow Source Name '{}' from "
"'{}' planet. Disabling shadows for this planet",
sourceName,
name
identifier()
));
disableShadows = true;
break;
@@ -328,7 +326,7 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
"No Radius value expecified for Shadow Caster Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
casterName,
name
identifier()
));
disableShadows = true;
break;

View File

@@ -132,16 +132,9 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
dictionary,
"RenderableModelProjection"
);
std::string name;
[[ maybe_unused ]] bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
ghoul_assert(success, "Name was not passed to RenderableModelProjection");
using ghoul::Dictionary;
Dictionary geometryDictionary = dictionary.value<Dictionary>(keyGeometry);
using modelgeometry::ModelGeometry;
geometryDictionary.setValue(SceneGraphNode::KeyName, name);
_geometry = ModelGeometry::createFromDictionary(geometryDictionary);
_geometry = modelgeometry::ModelGeometry::createFromDictionary(geometryDictionary);
_colorTexturePath = absPath(dictionary.value<std::string>(
ColorTextureInfo.identifier
@@ -154,6 +147,7 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
_colorTexturePath.onChange(std::bind(&RenderableModelProjection::loadTextures, this));
_projectionComponent.initialize(
identifier(),
dictionary.value<ghoul::Dictionary>(keyProjection)
);

View File

@@ -200,19 +200,18 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
"RenderablePlanetProjection"
);
std::string name;
bool success = dict.getValue(SceneGraphNode::KeyName, name);
ghoul_assert(success, "");
ghoul::Dictionary geometryDictionary;
success = dict.getValue(KeyGeometry, geometryDictionary);
bool success = dict.getValue(KeyGeometry, geometryDictionary);
if (success) {
geometryDictionary.setValue(SceneGraphNode::KeyName, name);
using planetgeometry::PlanetGeometry;
_geometry = PlanetGeometry::createFromDictionary(geometryDictionary);
_geometry = planetgeometry::PlanetGeometry::createFromDictionary(
geometryDictionary
);
}
_projectionComponent.initialize(dict.value<ghoul::Dictionary>(KeyProjection));
_projectionComponent.initialize(
identifier(),
dict.value<ghoul::Dictionary>(KeyProjection)
);
_colorTexturePaths.addOption(0, NoImageText);
_colorTexturePaths.onChange([this](){

View File

@@ -247,7 +247,9 @@ ProjectionComponent::ProjectionComponent()
_applyTextureSize.onChange([this]() { _textureSizeDirty = true; });
}
void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
void ProjectionComponent::initialize(const std::string& identifier,
const ghoul::Dictionary& dictionary)
{
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
@@ -290,9 +292,6 @@ void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
static_cast<float>(dictionary.value<double>(keyTextureMapAspectRatio));
}
std::string name;
dictionary.getValue(SceneGraphNode::KeyName, name);
std::vector<SequenceParser*> parsers;
if (dictionary.hasKey(keySequenceDir)) {
@@ -324,7 +323,7 @@ void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
for (std::string& sequenceSource : sequenceSources) {
if (sequenceType == sequenceTypePlaybook) {
parsers.push_back(new HongKangParser(
name,
identifier,
std::move(sequenceSource),
_projectorID,
translationDictionary,
@@ -332,14 +331,14 @@ void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
}
else if (sequenceType == sequenceTypeImage) {
parsers.push_back(new LabelParser(
name,
identifier,
std::move(sequenceSource),
translationDictionary));
}
else if (sequenceType == sequenceTypeHybrid) {
//first read labels
parsers.push_back(new LabelParser(
name,
identifier,
std::move(sequenceSource),
translationDictionary));
@@ -349,7 +348,7 @@ void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
//then read playbook
_eventFile = absPath(_eventFile);
parsers.push_back(new HongKangParser(
name,
identifier,
_eventFile,
_projectorID,
translationDictionary,
@@ -361,7 +360,7 @@ void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
}
else if (sequenceType == sequenceTypeInstrumentTimes) {
parsers.push_back(new InstrumentTimesParser(
name,
identifier,
std::move(sequenceSource),
translationDictionary)
);

View File

@@ -48,7 +48,7 @@ class ProjectionComponent : public properties::PropertyOwner {
public:
ProjectionComponent();
void initialize(const ghoul::Dictionary& dictionary);
void initialize(const std::string& identifier, const ghoul::Dictionary& dictionary);
bool initializeGL();
bool deinitialize();

View File

@@ -99,19 +99,25 @@ RenderablePlaneSpout::RenderablePlaneSpout(const ghoul::Dictionary& dictionary)
"RenderablePlaneSpout"
);
if (dictionary.hasKey(KeyName)) {
setName(dictionary.value<std::string>(KeyName));
}
else {
int iIdentifier = 0;
if (_identifier.empty()) {
static int id = 0;
if (id == 0) {
setName("ScreenSpaceSpout");
iIdentifier = id;
if (iIdentifier == 0) {
setIdentifier("ScreenSpaceSpout");
}
else {
setName("ScreenSpaceSpout " + std::to_string(id));
setIdentifier("ScreenSpaceSpout" + std::to_string(iIdentifier));
}
++id;
}
if (_guiName.empty()) {
// Adding an extra space to the user-facing name as it looks nicer
setGuiName("ScreenSpaceSpout " + std::to_string(iIdentifier));
}
_isSpoutDirty = true;
if (dictionary.hasKey(NameInfo.identifier)) {

View File

@@ -94,19 +94,25 @@ ScreenSpaceSpout::ScreenSpaceSpout(const ghoul::Dictionary& dictionary)
"ScreenSpaceSpout"
);
if (dictionary.hasKey(KeyName)) {
setName(dictionary.value<std::string>(KeyName));
}
else {
int iIdentifier = 0;
if (_identifier.empty()) {
static int id = 0;
if (id == 0) {
setName("ScreenSpaceSpout");
iIdentifier = id;
if (iIdentifier == 0) {
setIdentifier("ScreenSpaceSpout");
}
else {
setName("ScreenSpaceSpout " + std::to_string(id));
setIdentifier("ScreenSpaceSpout" + std::to_string(iIdentifier));
}
++id;
}
if (_guiName.empty()) {
// Adding an extra space to the user-facing name as it looks nicer
setGuiName("ScreenSpaceSpout " + std::to_string(iIdentifier));
}
_isSpoutDirty = true;
if (dictionary.hasKey(NameInfo.identifier)) {

View File

@@ -593,8 +593,9 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
std::vector<SceneGraphNode*> selectableNodes;
for (SceneGraphNode* node : OsEng.renderEngine().scene()->allSceneGraphNodes())
for (std::string name : selectables)
if (node->name() == name)
if (node->identifier() == name) {
selectableNodes.push_back(node);
}
glm::dquat camToWorldSpace = _camera->rotationQuaternion();
glm::dvec3 camPos = _camera->positionVec3();
@@ -678,7 +679,10 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
// If the user touched the planet directly, this is definitely the one
// they are interested in => minimum distance
if (dist <= 0.0) {
LINFOC(node->name(), "Picking candidate based on direct touch");
LINFOC(
node->identifier(),
"Picking candidate based on direct touch"
);
pickingInfo.push_back({
node,
-std::numeric_limits<double>::max(),
@@ -687,7 +691,10 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
}
else {
// The node was considered due to minimum picking distance radius
LINFOC(node->name(), "Picking candidate based on proximity");
LINFOC(
node->identifier(),
"Picking candidate based on proximity"
);
pickingInfo.push_back({
node,
ndcDist,
@@ -713,7 +720,7 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
// If an item has been picked, it's in the first position of the vector now
if (!pickingInfo.empty()) {
_pickingSelected = pickingInfo.begin()->node;
LINFOC("Picking", "Picked node: " + _pickingSelected->name());
LINFOC("Picking", "Picked node: " + _pickingSelected->identifier());
}
_selected = std::move(newSelected);

View File

@@ -203,7 +203,8 @@ RenderableTimeVaryingVolume::RenderableTimeVaryingVolume(
ghoul::Dictionary clipPlanesDictionary;
dictionary.getValue(KeyClipPlanes, clipPlanesDictionary);
_clipPlanes = std::make_shared<volume::VolumeClipPlanes>(clipPlanesDictionary);
_clipPlanes->setName("clipPlanes");
_clipPlanes->setIdentifier("clipPlanes");
_clipPlanes->setGuiName("Clip Planes");
if (dictionary.hasValue<std::string>(KeyGridType)) {
VolumeGridType gridType = volume::parseGridType(

View File

@@ -40,7 +40,7 @@ VolumeClipPlanes::VolumeClipPlanes(const ghoul::Dictionary& dictionary)
ghoul::Dictionary cutPlaneDictionary;
dictionary.getValue(key, cutPlaneDictionary);
auto clipPlane = std::make_shared<VolumeClipPlane>(cutPlaneDictionary);
clipPlane->setName(key);
clipPlane->setIdentifier(key);
_clipPlanes.push_back(clipPlane);
}
_nClipPlanes = static_cast<int>(keys.size());