Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gwaldron/osgearth
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Nov 15, 2023
2 parents 32ef032 + 17d568a commit 1e714df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/osgEarth/XYZModelLayer
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace osgEarth
OE_OPTION(bool, invertY);
OE_OPTION(int, minLevel);
OE_OPTION(int, maxLevel);
OE_OPTION(float, rangeFactor);
OE_OPTION(ProfileOptions, profile);
Config getConfig() const override;
void fromConfig(const Config& conf);
Expand Down Expand Up @@ -77,6 +78,10 @@ namespace osgEarth
void setMaxLevel(unsigned value);
unsigned getMaxLevel() const override;

//! The range factor. Default is 6
void setRangeFactor(float value);
float getRangeFactor() const;

//! Forces a rebuild on this layer.
void dirty();

Expand Down
16 changes: 16 additions & 0 deletions src/osgEarth/XYZModelLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ void XYZModelLayer::Options::fromConfig(const Config& conf)
{
invertY().setDefault(false);
additive().setDefault(false);
rangeFactor().setDefault(6.0);

conf.get("additive", additive());
conf.get("url", url());
conf.get("min_level", minLevel());
conf.get("max_level", maxLevel());
conf.get("range_factor", rangeFactor());
conf.get("profile", profile());
}

Expand All @@ -51,6 +53,7 @@ XYZModelLayer::Options::getConfig() const
conf.set("min_level", minLevel());
conf.set("max_level", maxLevel());
conf.set("profile", profile());
conf.set("range_factor", rangeFactor());

return conf;
}
Expand Down Expand Up @@ -80,6 +83,18 @@ XYZModelLayer::getMaxLevel() const {
return options().maxLevel().get();
}

void
XYZModelLayer::setRangeFactor(float value)
{
options().rangeFactor() = value;
}

float
XYZModelLayer::getRangeFactor() const
{
return options().rangeFactor().get();
}


XYZModelLayer::~XYZModelLayer()
{
Expand Down Expand Up @@ -191,6 +206,7 @@ XYZModelLayer::create()
xyzGraph->setAdditive(*_options->additive());
xyzGraph->setMinLevel(*_options->minLevel());
xyzGraph->setMaxLevel(*_options->maxLevel());
xyzGraph->setRangeFactor(*_options->rangeFactor());
xyzGraph->setSceneGraphCallbacks(getSceneGraphCallbacks());
xyzGraph->build();

Expand Down

0 comments on commit 1e714df

Please sign in to comment.