From 9f5790c84391fc611d32d17a6834763ca8c9b5fd Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Tue, 18 Sep 2012 00:29:54 +0200 Subject: [PATCH] Canvas: Use seperate projection instance for each map --- src/Canvas/elements/map.cxx | 14 +++++++------- src/Canvas/elements/map.hxx | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Canvas/elements/map.cxx b/src/Canvas/elements/map.cxx index fd793b8d0..a06ebfe23 100644 --- a/src/Canvas/elements/map.cxx +++ b/src/Canvas/elements/map.cxx @@ -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"), - _node->getDoubleValue("ref-lon") ); + _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; diff --git a/src/Canvas/elements/map.hxx b/src/Canvas/elements/map.hxx index a5ae1fb82..a48bde64b 100644 --- a/src/Canvas/elements/map.hxx +++ b/src/Canvas/elements/map.hxx @@ -28,6 +28,7 @@ namespace canvas { class GeoNodePair; + class HorizontalProjection; class Map: public Group { @@ -51,6 +52,7 @@ namespace canvas boost::shared_ptr > GeoNodes; GeoNodes _geo_nodes; + boost::shared_ptr _projection; bool _projection_dirty; struct GeoCoord -- 2.39.5