DYT/Tool/OpenSceneGraph-3.6.5/include/osgEarth/PowerlineLayer
2024-12-25 07:49:36 +08:00

67 lines
2.4 KiB
C++

/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_FEATURES_POWERLINE_LAYER
#define OSGEARTH_FEATURES_POWERLINE_LAYER 1
#include <osgEarth/FeatureModelLayer>
namespace osgEarth
{
class OSGEARTH_EXPORT PowerlineLayer : public FeatureModelLayer
{
// XXX Maybe hide some options from FeatureModelLayer?
public:
class ModelOptions : public ConfigOptions
{
META_ConfigOptions(osgEarth, ModelOptions, ConfigOptions);
OE_OPTION(std::string, name);
OE_OPTION(std::string, uri);
OE_OPTION_VECTOR(osg::Vec3d, attachment_points);
OE_OPTION(float, maxSag);
// Create configuration from Feature
public:
void fromConfig(const Config& conf);
virtual Config getConfig() const;
};
class OSGEARTH_EXPORT Options : public FeatureModelLayer::Options
{
public:
Options();
Options(const ConfigOptions& options);
OE_OPTION_LAYER(FeatureSource, lineSource);
OE_OPTION(bool, point_features);
OE_OPTION(std::string, lineExpr);
OE_OPTION(std::string, cableExpr);
OE_OPTION_VECTOR(ModelOptions, towerModels);
virtual Config getConfig() const;
void fromConfig(const Config& conf);
std::string referrer;
protected: // LayerOptions
virtual void mergeConfig(const Config& conf);
};
public:
META_Layer(osgEarth, PowerlineLayer, Options, FeatureModelLayer, PowerlineModel);
protected:
virtual FeatureNodeFactory* createFeatureNodeFactoryImplementation() const; // override;
};
}
#endif // OSGEARTH_FEATURES_POWERLINE_LAYER