Clean up
- Replace deprecated boost::shared_static_cast with boost::static_pointer_cast - Use boost::ends_with in favor of own implementation.
This commit is contained in:
parent
9835dadf71
commit
350d508324
4 changed files with 7 additions and 18 deletions
|
@ -194,7 +194,7 @@ void Canvas::update(double delta_time_sec)
|
||||||
placement_factory->second
|
placement_factory->second
|
||||||
(
|
(
|
||||||
node,
|
node,
|
||||||
boost::shared_static_cast<Canvas>(_self.lock())
|
boost::static_pointer_cast<Canvas>(_self.lock())
|
||||||
);
|
);
|
||||||
node->setStringValue
|
node->setStringValue
|
||||||
(
|
(
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
#define LOG_GEO_RET(msg) \
|
#define LOG_GEO_RET(msg) \
|
||||||
{\
|
{\
|
||||||
SG_LOG\
|
SG_LOG\
|
||||||
|
@ -93,7 +95,7 @@ namespace canvas
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Map::childAdded(SGPropertyNode* parent, SGPropertyNode* child)
|
void Map::childAdded(SGPropertyNode* parent, SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
if( !hasSuffix(child->getNameString(), GEO) )
|
if( !boost::ends_with(child->getNameString(), GEO) )
|
||||||
return Element::childAdded(parent, child);
|
return Element::childAdded(parent, child);
|
||||||
|
|
||||||
_geo_nodes[child].reset(new GeoNodePair());
|
_geo_nodes[child].reset(new GeoNodePair());
|
||||||
|
@ -102,7 +104,7 @@ namespace canvas
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Map::childRemoved(SGPropertyNode* parent, SGPropertyNode* child)
|
void Map::childRemoved(SGPropertyNode* parent, SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
if( !hasSuffix(child->getNameString(), GEO) )
|
if( !boost::ends_with(child->getNameString(), GEO) )
|
||||||
return Element::childRemoved(parent, child);
|
return Element::childRemoved(parent, child);
|
||||||
|
|
||||||
// TODO remove from other node
|
// TODO remove from other node
|
||||||
|
@ -114,7 +116,7 @@ namespace canvas
|
||||||
{
|
{
|
||||||
const std::string& name = child->getNameString();
|
const std::string& name = child->getNameString();
|
||||||
|
|
||||||
if( !hasSuffix(name, GEO) )
|
if( !boost::ends_with(name, GEO) )
|
||||||
return Group::valueChanged(child);
|
return Group::valueChanged(child);
|
||||||
|
|
||||||
GeoNodes::iterator it_geo_node = _geo_nodes.find(child);
|
GeoNodes::iterator it_geo_node = _geo_nodes.find(child);
|
||||||
|
@ -218,15 +220,4 @@ namespace canvas
|
||||||
return coord;
|
return coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool Map::hasSuffix(const std::string& str, const std::string& suffix) const
|
|
||||||
{
|
|
||||||
if( suffix.length() > str.length() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return ( str.compare( str.length() - suffix.length(),
|
|
||||||
suffix.length(),
|
|
||||||
suffix ) == 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|
|
@ -68,8 +68,6 @@ namespace canvas
|
||||||
};
|
};
|
||||||
|
|
||||||
GeoCoord parseGeoCoord(const std::string& val) const;
|
GeoCoord parseGeoCoord(const std::string& val) const;
|
||||||
|
|
||||||
bool hasSuffix(const std::string& str, const std::string& suffix) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|
|
@ -177,7 +177,7 @@ bool GUIMgr::handleEvent(const osgGA::GUIEventAdapter& ea)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
canvas::WindowPtr GUIMgr::getWindow(size_t i)
|
canvas::WindowPtr GUIMgr::getWindow(size_t i)
|
||||||
{
|
{
|
||||||
return boost::shared_static_cast<canvas::Window>(_elements[i]);
|
return boost::static_pointer_cast<canvas::Window>(_elements[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue