VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CustomModelCompiler.h
Go to the documentation of this file.
1 /* -*-c++-*- */
2 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
3 * Copyright 2008-2010 Pelican Mapping
4 * http://osgearth.org
5 *
6 * osgEarth is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>
18 */
19 #ifndef OSGEARTH_FEATURES_CUSTOMMODEL_COMPILER_H
20 #define OSGEARTH_FEATURES_CUSTOMMODEL_COMPILER_H 1
21 
23 #include <osgEarth/Common>
24 #include <osgEarth/Feature>
25 #include <osgEarth/FeatureCursor>
26 #include <osgEarth/ResampleFilter>
27 #include <osgEarth/Style>
28 #include <osgEarth/GeoMath>
29 
30 namespace osgEarth
31 {
32  class SubstituteCustomModelFilter;
33 
35  {
36  public:
38 
39  public:
41  optional<double>& maxGranularity() { return _maxGranularity_deg; }
42  const optional<double>& maxGranularity() const { return _maxGranularity_deg; }
43 
45  optional<GeoInterpolation>& geoInterp() { return _geoInterp; }
46  const optional<GeoInterpolation>& geoInterp() const { return _geoInterp; }
47 
49  optional<bool>& mergeGeometry() { return _mergeGeometry; }
50  const optional<bool>& mergeGeometry() const { return _mergeGeometry; }
51 
53  optional<StringExpression>& featureName() { return _featureNameExpr; }
54  const optional<StringExpression>& featureName() const { return _featureNameExpr; }
55 
57  optional<bool>& clustering() { return _clustering; }
58  const optional<bool>& clustering() const { return _clustering; }
59 
61  optional<bool>& indirectRendering() { return _indirectRendering; }
62  const optional<bool>& indirectRendering() const { return _indirectRendering; }
63 
64  //todo: merge this with geoInterp()
65  optional<osgEarth::ResampleFilter::ResampleMode>& resampleMode() { return _resampleMode;}
66  const optional<osgEarth::ResampleFilter::ResampleMode>& resampleMode() const { return _resampleMode;}
67 
68  optional<double>& resampleMaxLength() { return _resampleMaxLength; }
69  const optional<double>& resampleMaxLength() const { return _resampleMaxLength;}
70 
71 
72  public:
73  Config getConfig() const;
74  void mergeConfig( const Config& conf );
75 
76  private:
77  optional<double> _maxGranularity_deg;
78  optional<GeoInterpolation> _geoInterp;
79  optional<bool> _mergeGeometry;
80  optional<StringExpression> _featureNameExpr;
81  optional<bool> _clustering;
82  optional<bool> _indirectRendering;
83  optional<osgEarth::ResampleFilter::ResampleMode> _resampleMode;
84  optional<double> _resampleMaxLength;
85 
86  void fromConfig( const Config& conf );
87  };
88 
93  {
94  public:
95 
98 
101 
102  virtual ~CustomModelCompiler() { }
103 
105  const CustomModelCompilerOptions& options() const { return _options; }
106 
108  CustomModelCompilerOptions& options() { return _options; }
109 
110  public:
111 
113  osg::Node* compile(
114  FeatureCursor* input,
115  const Style& style,
116  const FilterContext& context);
117 
118  osg::Node* compile(
119  Feature* input,
120  const Style& style,
121  const FilterContext& context);
122 
123  osg::Node* compile(
124  FeatureList& mungeableInput,
125  const Style& style,
126  const FilterContext& context);
127 
128  protected:
130 
132  virtual SubstituteCustomModelFilter* createModelFilter(const Style& style) const;
133  };
134 
135 } // namespace osgEarth
136 
137 #endif // OSGEARTH_FEATURES_GEOMETRY_COMPILER_H
Feature filter that will substitute external nodes for feature geometry.
Definition: SubstituteCustomModelFilter.h:73
CustomModelCompilerOptions _options
Definition: CustomModelCompiler.h:129
optional< bool > & indirectRendering()
Whether to use indirect rendering for speed.
Definition: CustomModelCompiler.h:61
const optional< bool > & indirectRendering() const
Definition: CustomModelCompiler.h:62
const optional< double > & maxGranularity() const
Definition: CustomModelCompiler.h:42
optional< double > & maxGranularity()
Maximum span of a generated edge, in degrees.
Definition: CustomModelCompiler.h:41
optional< double > & resampleMaxLength()
Definition: CustomModelCompiler.h:68
optional< double > _maxGranularity_deg
Definition: CustomModelCompiler.h:77
optional< bool > _mergeGeometry
Definition: CustomModelCompiler.h:79
optional< bool > & mergeGeometry()
Whether to merge geometry from multiple features.
Definition: CustomModelCompiler.h:49
optional< StringExpression > _featureNameExpr
Definition: CustomModelCompiler.h:80
Definition: CustomModelCompiler.h:34
CustomModelCompilerOptions & options()
Access the options for editing.
Definition: CustomModelCompiler.h:108
optional< bool > _clustering
Definition: CustomModelCompiler.h:81
optional< GeoInterpolation > & geoInterp()
Interpolation type to use for geodetic points.
Definition: CustomModelCompiler.h:45
const optional< double > & resampleMaxLength() const
Definition: CustomModelCompiler.h:69
const optional< bool > & clustering() const
Definition: CustomModelCompiler.h:58
Compiles a collection of features against a style.
Definition: CustomModelCompiler.h:92
#define OSGDB_OSGEARTH_MODEL_FEATURE_CUSTOM_EXPORT
Definition: CustomModelPrereqs.h:13
const optional< StringExpression > & featureName() const
Definition: CustomModelCompiler.h:54
const CustomModelCompilerOptions & options() const
Access the options read-only.
Definition: CustomModelCompiler.h:105
optional< double > _resampleMaxLength
Definition: CustomModelCompiler.h:84
optional< GeoInterpolation > _geoInterp
Definition: CustomModelCompiler.h:78
optional< osgEarth::ResampleFilter::ResampleMode > _resampleMode
Definition: CustomModelCompiler.h:83
optional< osgEarth::ResampleFilter::ResampleMode > & resampleMode()
Definition: CustomModelCompiler.h:65
optional< StringExpression > & featureName()
Expression to evaluate to extract a feature&#39;s readable name.
Definition: CustomModelCompiler.h:53
optional< bool > & clustering()
Whether to cluster feature geometries together for speed.
Definition: CustomModelCompiler.h:57
virtual ~CustomModelCompiler()
Definition: CustomModelCompiler.h:102
const optional< GeoInterpolation > & geoInterp() const
Definition: CustomModelCompiler.h:46
const optional< bool > & mergeGeometry() const
Definition: CustomModelCompiler.h:50
optional< bool > _indirectRendering
Definition: CustomModelCompiler.h:82
const optional< osgEarth::ResampleFilter::ResampleMode > & resampleMode() const
Definition: CustomModelCompiler.h:66

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)