Unverified Commit 79e652ec authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by GitHub
Browse files

Fix for QMOS not updating lat/lon ranges correctly. (#3714)

* qqqqqqmoooooosssssss

* added doc string
parent 683d1130
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ namespace Isis {
        lonMin = lonMax;
        lonMax = temp;
      }
      
      if (mappingGroup["LatitudeType"][0] == "Planetographic") {

          Distance equaRad(tproj->EquatorialRadius(), Distance::Meters);
@@ -116,6 +115,7 @@ namespace Isis {
          maxLat = Latitude(latMax.degrees(), mappingGroup,
                          Angle::Degrees);
          

          // Make sure our lat increment is non-zero
          if (!qFuzzyCompare(latInc.radians(), 0.0)) {
            startLat = Latitude(
@@ -300,8 +300,10 @@ namespace Isis {
              // 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));
                  double glon = tproj->Has180Domain() ? -1*lon.positiveEast(Angle::Degrees): lon.positiveWest(Angle::Degrees);
                  valid = tproj->SetGround(lat.degrees(), glon);
              }
              else {
                valid = tproj->SetGround(lat.degrees(), lon.positiveEast(Angle::Degrees));
+34 −3
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ namespace Isis {
    m_minLon = domainMinLon();
    m_maxLon = domainMaxLon();
    m_density = 10000;
    
    connect(getWidget(), SIGNAL(projectionChanged(Projection *)),
            this, SLOT(onProjectionChanged()), Qt::UniqueConnection);

  }


@@ -445,6 +449,7 @@ namespace Isis {

        case Cubes:
          if (tproj->SetCoordinate(boundingRect.topLeft().x(), -boundingRect.topLeft().y())) {
            
            topLeft = tproj->Longitude();
          }
          else {
@@ -797,6 +802,30 @@ namespace Isis {
    configDialog->show();
  }
  
  /*
   * Updates lat/lon ranges when a new projection file is loaded. Also 
   * forces the lat/lon extent source to Map resetting user options in the grid tool dialog. 
   * 
   */
  void MosaicGridTool::onProjectionChanged() {
    TProjection * tproj = (TProjection *)getWidget()->getProjection();
    
    // If Projection changed from a file, force extents to come from 
    // the new map file
    m_latExtents = Map;
    m_lonExtents = Map; 

    Latitude minLat = Latitude(tproj->MinimumLatitude(), Angle::Degrees);
    Latitude maxLat = Latitude(tproj->MaximumLatitude(), Angle::Degrees);
    
    setLatExtents(m_latExtents, minLat, maxLat);
  
    Longitude minLon = Longitude(tproj->MinimumLongitude(), Angle::Degrees);
    Longitude maxLon = Longitude(tproj->MaximumLongitude(), Angle::Degrees);
  
    setLonExtents(m_lonExtents, minLon, maxLon);
  }


  /**
   * Creates the GridGraphicsItem that will draw the grid. If there is no grid item the grid
@@ -821,6 +850,7 @@ namespace Isis {
      QMessageBox::warning(NULL, tr("Grid Tool Requires Projection"), msg);
    }

    
    if (m_minLon.degrees() < m_maxLon.degrees() && m_minLat.degrees() < m_maxLat.degrees()) {
      m_gridItem = new GridGraphicsItem(m_baseLat, m_baseLon, m_latInc, m_lonInc, getWidget(),
                                        m_density, m_minLat, m_maxLat, m_minLon, m_maxLon);
@@ -834,6 +864,7 @@ namespace Isis {
  
    if (m_gridItem != NULL)
      getWidget()->getScene()->addItem(m_gridItem);
    
  }


+2 −1
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ namespace Isis {
      void drawGrid(bool draw);
      void onCubesChanged();
      void onToolOpen(bool check);
      void onProjectionChanged();
    
    protected:
      QWidget *createToolBarWidget();