- Timestamp:
- Feb 28, 2016 3:54:11 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/RendererCmd.cpp
r6070 r6075 31 31 #include <osgEarthSymbology/Style> 32 32 #include <osgEarthSymbology/StyleSheet> 33 #include <osgEarthSymbology/CssUtils> 33 34 #include <osgEarthSymbology/IconSymbol> 35 #include <osgEarthSymbology/ModelSymbol> 34 36 #include <osgEarthSymbology/LineSymbol> 35 37 #include <osgEarthSymbology/RenderSymbol> … … 1679 1681 styleConf.add("type", "text/css"); 1680 1682 INFO("style CSS: %s", styleConf.value().c_str()); 1683 #if 1 1684 geomOpts.styles() = new osgEarth::Symbology::StyleSheet(); 1685 // For relative paths: 1686 //styleConf.setReferrer(g_renderer->getCacheDirectory()); 1687 std::string cssString = styleConf.value(); 1688 std::vector<std::string> blocks; 1689 osgEarth::Symbology::CssUtils::split(cssString, blocks); 1690 for (std::vector<std::string>::iterator itr = blocks.begin(); 1691 itr != blocks.end(); ++itr) { 1692 osgEarth::Config blockConf(styleConf); 1693 blockConf.value() = *itr; 1694 osgEarth::Symbology::Style style(blockConf); 1695 1696 INFO("Style: %s", style.getName().c_str()); 1697 INFO("%s", itr->c_str()); 1698 1699 if (style.has<osgEarth::Symbology::IconSymbol>()) { 1700 INFO("Found icon symbol"); 1701 osgEarth::Symbology::IconSymbol *is = 1702 style.get<osgEarth::Symbology::IconSymbol>(); 1703 if (is->url().isSet()) { 1704 INFO("Icon url before: expr: '%s' eval: '%s'", 1705 is->url()->expr().c_str(), is->url()->eval().c_str()); 1706 // eval() will try to evaluate the expr() 1707 std::string path = g_renderer->getCanonicalPath(is->url()->eval()); 1708 //setInfix() to set the expr() string, setLiteral() will quote 1709 is->url()->setLiteral(path); 1710 INFO("Icon url after: %s", path.c_str()); 1711 } 1712 } 1713 if (style.has<osgEarth::Symbology::ModelSymbol>()) { 1714 osgEarth::Symbology::ModelSymbol *ms = 1715 style.get<osgEarth::Symbology::ModelSymbol>(); 1716 if (ms->url().isSet()) { 1717 // eval() will try to evaluate the expr() 1718 std::string path = g_renderer->getCanonicalPath(ms->url()->eval()); 1719 //setInfix() to set the expr() string, setLiteral() will quote 1720 ms->url()->setLiteral(path); 1721 } 1722 } 1723 // Need to create a new style otherwise the original CSS is used 1724 // without the re-written URLs 1725 geomOpts.styles()->addStyle(osgEarth::Symbology::Style(style.getConfig(false))); 1726 } 1727 #else 1681 1728 osgEarth::Config stylesheetConf; 1682 1729 stylesheetConf.add(styleConf); 1683 1730 geomOpts.styles() = new osgEarth::Symbology::StyleSheet(stylesheetConf); 1731 #endif 1684 1732 1685 1733 if (objc > 11) { … … 1700 1748 return TCL_ERROR; 1701 1749 } 1750 INFO("Num Selectors: %d", numSelectors); 1702 1751 for (int i = 0; i < numSelectors; i++) { 1703 1752 int numFields;
Note: See TracChangeset
for help on using the changeset viewer.