Canvas: Use seperate projection instance for each map
This commit is contained in:
parent
01376eec31
commit
9f5790c843
2 changed files with 9 additions and 7 deletions
|
@ -41,13 +41,13 @@
|
|||
namespace canvas
|
||||
{
|
||||
|
||||
// TODO make projection configurable
|
||||
SansonFlamsteedProjection projection;
|
||||
const std::string GEO = "-geo";
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Map::Map(SGPropertyNode_ptr node, const Style& parent_style):
|
||||
Group(node, parent_style),
|
||||
// TODO make projection configurable
|
||||
_projection(new SansonFlamsteedProjection),
|
||||
_projection_dirty(true)
|
||||
{
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace canvas
|
|||
continue;
|
||||
|
||||
Projection::ScreenPosition pos =
|
||||
projection.worldToScreen(lat.value, lon.value);
|
||||
_projection->worldToScreen(lat.value, lon.value);
|
||||
|
||||
geo_node->setScreenPos(pos.x, pos.y);
|
||||
|
||||
|
@ -182,12 +182,12 @@ namespace canvas
|
|||
|
||||
if( child->getNameString() == "ref-lat"
|
||||
|| child->getNameString() == "ref-lon" )
|
||||
projection.setWorldPosition( _node->getDoubleValue("ref-lat"),
|
||||
_projection->setWorldPosition( _node->getDoubleValue("ref-lat"),
|
||||
_node->getDoubleValue("ref-lon") );
|
||||
else if( child->getNameString() == "hdg" )
|
||||
projection.setOrientation(child->getFloatValue());
|
||||
_projection->setOrientation(child->getFloatValue());
|
||||
else if( child->getNameString() == "range" )
|
||||
projection.setRange(child->getDoubleValue());
|
||||
_projection->setRange(child->getDoubleValue());
|
||||
else
|
||||
return;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
namespace canvas
|
||||
{
|
||||
class GeoNodePair;
|
||||
class HorizontalProjection;
|
||||
class Map:
|
||||
public Group
|
||||
{
|
||||
|
@ -51,6 +52,7 @@ namespace canvas
|
|||
boost::shared_ptr<GeoNodePair>
|
||||
> GeoNodes;
|
||||
GeoNodes _geo_nodes;
|
||||
boost::shared_ptr<HorizontalProjection> _projection;
|
||||
bool _projection_dirty;
|
||||
|
||||
struct GeoCoord
|
||||
|
|
Loading…
Reference in a new issue