Commit 3b21df66 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by Jesse Mapel
Browse files

Fixes Qmos grid to properly consider PositiveWest and PositiveEast (#3488)

* Fixes Qmos grid to properly consider PositiveWest and PositiveEast

* clean up

* update as per comments

* added comments on positive west angles as they come into the GridGraphicsItem constructor
parent 94780402
Loading
Loading
Loading
Loading
+28 −9
Original line number Diff line number Diff line
@@ -44,7 +44,11 @@ namespace Isis {
        Latitude startLat;
        Latitude endLat;
      
      if (mappingGroup["LongitudeDirection"][0] == "PositiveWest") {

      if (tproj->IsPositiveWest()) {
        // GridGraphicsItem is written assuming positive east 
        // for all angles. On positive West, lons come in swapped so we 
        // need to account for this.
        Longitude temp = lonMin;
        lonMin = lonMax;
        lonMax = temp;
@@ -193,7 +197,17 @@ namespace Isis {

              double x = 0;
              double y = 0;
              bool valid = tproj->SetUniversalGround(lat.degrees(), lon.degrees());
              
              bool valid;

              // Set ground according to lon direction to get correct X,Y values 
              // when drawing lines. 
              if (tproj->IsPositiveWest()) {
                valid = tproj->SetGround(lat.degrees(), lon.positiveWest(Angle::Degrees));
              }
              else {
                valid = tproj->SetGround(lat.degrees(), lon.positiveEast(Angle::Degrees));
              }

              if (valid) {
                x = tproj->XCoord();
@@ -265,7 +279,6 @@ namespace Isis {

          // Create the longitude grid lines
          for (Longitude lon = minLon; lon != maxLon + lonInc; lon += lonInc) {

            if (lon > endLon && lon < maxLon) {
              lon = endLon;
            }
@@ -283,16 +296,22 @@ namespace Isis {
            while (!atMaxLat) {
              double x = 0;
              double y = 0;
              bool valid = tproj->SetUniversalGround(lat.degrees(), lon.degrees());
              
              // Set ground according to lon direction to get correct X,Y values 
              // when drawing lines.  
              bool valid;
              if (tproj->IsPositiveWest()) {
                valid = tproj->SetGround(lat.degrees(), lon.positiveWest(Angle::Degrees));
              }
              else {
                valid = tproj->SetGround(lat.degrees(), lon.positiveEast(Angle::Degrees));
              }

              if (valid) {
                x = tproj->XCoord();
                y = -1 * tproj->YCoord();

                if(havePrevious) {
                  x = proj->XCoord();
                  y = -1 * proj->YCoord();

                  if(previousX != x || previousY != y) {
                    QGraphicsLineItem* lonLine = 
                        new QGraphicsLineItem(QLineF(previousX, previousY, x, y), this);