本文整理汇总了C++中TextSymbol::provider方法的典型用法代码示例。如果您正苦于以下问题:C++ TextSymbol::provider方法的具体用法?C++ TextSymbol::provider怎么用?C++ TextSymbol::provider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextSymbol
的用法示例。
在下文中一共展示了TextSymbol::provider方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
if (!text) text = sc.getOrCreateSymbol<TextSymbol>();
if (p->second == "screen") text->sizeMode() = TextSymbol::SIZEMODE_SCREEN;
else if (p->second == "object") text->sizeMode() = TextSymbol::SIZEMODE_OBJECT;
}
else if (p->first == CSS_TEXT_REMOVE_DUPLICATE_LABELS)
{
if (!text) text = sc.getOrCreateSymbol<TextSymbol>();
if (p->second == "true") text->removeDuplicateLabels() = true;
else if (p->second == "false") text->removeDuplicateLabels() = false;
}
else if (p->first == CSS_TEXT_LINE_ORIENTATION)
{
if (!text) text = sc.getOrCreateSymbol<TextSymbol>();
if (p->second == "parallel") text->lineOrientation() = TextSymbol::LINEORIENTATION_PARALLEL;
else if (p->second == "horizontal") text->lineOrientation() = TextSymbol::LINEORIENTATION_HORIZONTAL;
else if (p->second == "perpendicular") text->lineOrientation() = TextSymbol::LINEORIENTATION_PERPENDICULAR;
}
else if (p->first == CSS_TEXT_LINE_PLACEMENT)
{
if (!text) text = sc.getOrCreateSymbol<TextSymbol>();
if (p->second == "centroid") text->linePlacement() = TextSymbol::LINEPLACEMENT_CENTROID;
else if (p->second == "along-line") text->linePlacement() = TextSymbol::LINEPLACEMENT_ALONG_LINE;
}
else if (p->first == "text-content")
{
if (!text) text = sc.getOrCreate<TextSymbol>();
text->content() = StringExpression( p->second );
}
else if (p->first == "text-priority")
{
if (!text) text = sc.getOrCreateSymbol<TextSymbol>();
text->priority() = NumericExpression( p->second );
}
else if (p->first == "text-provider")
{
if (!text) text = sc.getOrCreate<TextSymbol>();
text->provider() = p->second;
}
//else if (p->first == CSS_TEXT_CONTENT)
//{
// if (!text) text = sc.getOrCreateSymbol<TextSymbol>();
// text->content() = p->second;
//}
//else if (p->first == CSS_TEXT_CONTENT_ATTRIBUTE_DELIMITER)
//{
// if (!text) text = sc.getOrCreateSymbol<TextSymbol>();
// text->contentAttributeDelimiter() = p->second;
//}
else if (p->first == "marker")
{
if (!marker) marker = sc.getOrCreateSymbol<MarkerSymbol>();
marker->url() = p->second;
}
else if (p->first == "marker-placement")
{
if (!marker) marker = sc.getOrCreateSymbol<MarkerSymbol>();
if (p->second == "centroid") marker->placement() = MarkerSymbol::PLACEMENT_CENTROID;
else if (p->second == "interval") marker->placement() = MarkerSymbol::PLACEMENT_INTERVAL;
else if (p->second == "random" ) marker->placement() = MarkerSymbol::PLACEMENT_RANDOM;
}
else if (p->first == "marker-density")
{
if (!marker) marker = sc.getOrCreateSymbol<MarkerSymbol>();
marker->density() = as<float>(p->second, 1.0f);
示例2: main
//
// NOTE: run this sample from the repo/tests directory.
//
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc,argv);
bool useRaster = arguments.read("--rasterize");
bool useOverlay = arguments.read("--overlay");
bool useStencil = arguments.read("--stencil");
bool useMem = arguments.read("--mem");
bool useLabels = arguments.read("--labels");
osgViewer::Viewer viewer(arguments);
// Start by creating the map:
Map* map = new Map();
// Start with a basemap imagery layer; we'll be using the GDAL driver
// to load a local GeoTIFF file:
GDALOptions basemapOpt;
basemapOpt.url() = "../data/world.tif";
map->addImageLayer( new ImageLayer( ImageLayerOptions("basemap", basemapOpt) ) );
// Next we add a feature layer. First configure a feature driver to
// load the vectors from a shapefile:
OGRFeatureOptions featureOpt;
if ( !useMem )
{
featureOpt.url() = "../data/usa.shp";
}
else
{
Ring* line = new Ring();
line->push_back( osg::Vec3d(-60, 20, 0) );
line->push_back( osg::Vec3d(-120, 20, 0) );
line->push_back( osg::Vec3d(-120, 60, 0) );
line->push_back( osg::Vec3d(-60, 60, 0) );
featureOpt.geometry() = line;
}
// Define a style for the feature data. Since we are going to render the
// vectors as lines, configure the line symbolizer:
Style style;
LineSymbol* ls = style.getOrCreateSymbol<LineSymbol>();
ls->stroke()->color() = osg::Vec4f( 1,1,0,1 ); // yellow
ls->stroke()->width() = 2.0f;
// Add some text labels.
if ( useLabels )
{
TextSymbol* text = style.getOrCreateSymbol<TextSymbol>();
text->provider() = "overlay";
text->content() = StringExpression( "[name]" );
text->priority() = NumericExpression( "[area]" );
text->removeDuplicateLabels() = true;
text->size() = 16.0f;
text->fill()->color() = Color::White;
text->halo()->color() = Color::DarkGray;
}
// That's it, the map is ready; now create a MapNode to render the Map:
MapNodeOptions mapNodeOptions;
mapNodeOptions.enableLighting() = false;
MapNode* mapNode = new MapNode( map, mapNodeOptions );
// Now we'll choose the AGG-Lite driver to render the features. By the way, the
// feature data is actually polygons, so we override that to treat it as lines.
// We apply the feature driver and set the style as well.
if (useStencil)
{
FeatureStencilModelOptions worldOpt;
worldOpt.featureOptions() = featureOpt;
worldOpt.geometryTypeOverride() = Geometry::TYPE_LINESTRING;
worldOpt.styles() = new StyleSheet();
worldOpt.styles()->addStyle( style );
worldOpt.enableLighting() = false;
worldOpt.depthTestEnabled() = false;
map->addModelLayer( new ModelLayer( "my features", worldOpt ) );
}
else if (useRaster)
{
AGGLiteOptions worldOpt;
worldOpt.featureOptions() = featureOpt;
worldOpt.geometryTypeOverride() = Geometry::TYPE_LINESTRING;
worldOpt.styles() = new StyleSheet();
worldOpt.styles()->addStyle( style );
map->addImageLayer( new ImageLayer( ImageLayerOptions("world", worldOpt) ) );
}
else //if (useGeom || useOverlay)
{
FeatureGeomModelOptions worldOpt;
worldOpt.featureOptions() = featureOpt;
worldOpt.geometryTypeOverride() = Geometry::TYPE_LINESTRING;
worldOpt.styles() = new StyleSheet();
worldOpt.styles()->addStyle( style );
worldOpt.enableLighting() = false;
worldOpt.depthTestEnabled() = false;
//.........这里部分代码省略.........