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
|
namespace canvas
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO make projection configurable
|
|
||||||
SansonFlamsteedProjection projection;
|
|
||||||
const std::string GEO = "-geo";
|
const std::string GEO = "-geo";
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Map::Map(SGPropertyNode_ptr node, const Style& parent_style):
|
Map::Map(SGPropertyNode_ptr node, const Style& parent_style):
|
||||||
Group(node, parent_style),
|
Group(node, parent_style),
|
||||||
|
// TODO make projection configurable
|
||||||
|
_projection(new SansonFlamsteedProjection),
|
||||||
_projection_dirty(true)
|
_projection_dirty(true)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ namespace canvas
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Projection::ScreenPosition pos =
|
Projection::ScreenPosition pos =
|
||||||
projection.worldToScreen(lat.value, lon.value);
|
_projection->worldToScreen(lat.value, lon.value);
|
||||||
|
|
||||||
geo_node->setScreenPos(pos.x, pos.y);
|
geo_node->setScreenPos(pos.x, pos.y);
|
||||||
|
|
||||||
|
@ -182,12 +182,12 @@ namespace canvas
|
||||||
|
|
||||||
if( child->getNameString() == "ref-lat"
|
if( child->getNameString() == "ref-lat"
|
||||||
|| child->getNameString() == "ref-lon" )
|
|| child->getNameString() == "ref-lon" )
|
||||||
projection.setWorldPosition( _node->getDoubleValue("ref-lat"),
|
_projection->setWorldPosition( _node->getDoubleValue("ref-lat"),
|
||||||
_node->getDoubleValue("ref-lon") );
|
_node->getDoubleValue("ref-lon") );
|
||||||
else if( child->getNameString() == "hdg" )
|
else if( child->getNameString() == "hdg" )
|
||||||
projection.setOrientation(child->getFloatValue());
|
_projection->setOrientation(child->getFloatValue());
|
||||||
else if( child->getNameString() == "range" )
|
else if( child->getNameString() == "range" )
|
||||||
projection.setRange(child->getDoubleValue());
|
_projection->setRange(child->getDoubleValue());
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
namespace canvas
|
namespace canvas
|
||||||
{
|
{
|
||||||
class GeoNodePair;
|
class GeoNodePair;
|
||||||
|
class HorizontalProjection;
|
||||||
class Map:
|
class Map:
|
||||||
public Group
|
public Group
|
||||||
{
|
{
|
||||||
|
@ -51,6 +52,7 @@ namespace canvas
|
||||||
boost::shared_ptr<GeoNodePair>
|
boost::shared_ptr<GeoNodePair>
|
||||||
> GeoNodes;
|
> GeoNodes;
|
||||||
GeoNodes _geo_nodes;
|
GeoNodes _geo_nodes;
|
||||||
|
boost::shared_ptr<HorizontalProjection> _projection;
|
||||||
bool _projection_dirty;
|
bool _projection_dirty;
|
||||||
|
|
||||||
struct GeoCoord
|
struct GeoCoord
|
||||||
|
|
Loading…
Add table
Reference in a new issue