Unverified Commit 3e856103 authored by ihumphrey's avatar ihumphrey Committed by GitHub
Browse files

Merge pull request #353 from USGS-Astrogeology/revert-345-ipceBundleWindow_5206

Revert "Ipce bundle window speed up JigsawSetupDialog load"
parents 169714eb 8f3fd548
Loading
Loading
Loading
Loading
+0 −13
Original line number Original line Diff line number Diff line
#include "ObservationNumber.h"
#include "ObservationNumber.h"

#include <QMutex>
#include <QMutexLocker>

#include "IException.h"
#include "IException.h"
#include "Pvl.h"
#include "Pvl.h"
#include "Cube.h"
#include "Cube.h"
@@ -11,8 +7,6 @@
#include "FileName.h"
#include "FileName.h"


namespace Isis {
namespace Isis {
  QMutex ObservationNumber::m_mutex;

  /**
  /**
  * Create an empty SerialNumber object.
  * Create an empty SerialNumber object.
  */
  */
@@ -76,16 +70,9 @@ namespace Isis {
  /**
  /**
   * Get Groups by translating from correct Translation table
   * Get Groups by translating from correct Translation table
   *
   *
   * This method is thread-safe.
   *
   * @param label A pvl formatted label to be used to generate the serial number
   * @param label A pvl formatted label to be used to generate the serial number
   */
   */
  PvlGroup ObservationNumber::FindObservationTranslation(Pvl &label) {
  PvlGroup ObservationNumber::FindObservationTranslation(Pvl &label) {
    // Immediately lock the static mutex so multiple threads don't collide on the static variables
    // inside of this method. This locker auto-locks upon construction and unlocks the mutex when
    // it is destroyed (when this method finishes).
    QMutexLocker lock(&m_mutex);

    Pvl outLabel;
    Pvl outLabel;
    static PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory"));
    static PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory"));


+0 −22
Original line number Original line Diff line number Diff line
@@ -26,8 +26,6 @@


#include <string>
#include <string>


#include <QMutex>

#include "SerialNumber.h"
#include "SerialNumber.h"
#include "SerialNumberList.h"
#include "SerialNumberList.h"


@@ -58,20 +56,6 @@ namespace Isis {
   *
   *
   *  @history 2008-05-09 Steven Lambright - Optimized the
   *  @history 2008-05-09 Steven Lambright - Optimized the
   *           FindObservationTranslation method
   *           FindObservationTranslation method
   *  @history 2018-07-11 Ian Humphrey - Made FindObservationTranslation thread-safe. Added a
   *                          static mutex for the FindObservationTranslation() method. This
   *                          faciliates adding a QString observationNumber member to the Image
   *                          class and calling ObservationNumber::Compose() within the Image
   *                          constructors. When qmos or ipce opens a list of images, it uses an
   *                          ImageReader, which uses a QtConcurrent mapped function to load its
   *                          images. Since the FindObservationTranslation() method declares its
   *                          static local variables within in, this could cause thread collisions
   *                          on these static variables when ObservationNumbers are being composed
   *                          for the Images being conucrrently opened by ImageReader. Added a
   *                          QMutexLoccker to the FindObservationTranslation() method to auto-lock
   *                          and unlock the mutex, which prevents multiple threads from colliding
   *                          on the static variables. References #5206.
   *
   */
   */
  class ObservationNumber : public Isis::SerialNumber {
  class ObservationNumber : public Isis::SerialNumber {
    public:
    public:
@@ -91,12 +75,6 @@ namespace Isis {


      static PvlGroup FindObservationTranslation(Pvl &label);
      static PvlGroup FindObservationTranslation(Pvl &label);


      /**
       * Static mutex for preventing threads from colliding on the static variables in
       * FindObservationTranslation().
       */
      static QMutex m_mutex;

  }; // End of Class
  }; // End of Class
}; // End of namespace
}; // End of namespace


+0 −12
Original line number Original line Diff line number Diff line
#include <map>
#include <map>


#include <QMutex>
#include <QMutexLocker>

#include "SerialNumber.h"
#include "SerialNumber.h"
#include "ObservationNumber.h"
#include "ObservationNumber.h"
#include "SerialNumberList.h"
#include "SerialNumberList.h"
@@ -14,8 +11,6 @@
#include "FileName.h"
#include "FileName.h"


namespace Isis {
namespace Isis {
  QMutex SerialNumber::m_mutex;

  /**
  /**
  * Create an empty SerialNumber object.
  * Create an empty SerialNumber object.
  */
  */
@@ -90,17 +85,10 @@ namespace Isis {
  /**
  /**
   * Get Groups by translating from correct Translation table
   * Get Groups by translating from correct Translation table
   *
   *
   * This method is thread-safe.
   *
   * @param label A pvl formatted label to be used to generate the serial number
   * @param label A pvl formatted label to be used to generate the serial number
   *
   *
   */
   */
  PvlGroup SerialNumber::FindSerialTranslation(Pvl &label) {
  PvlGroup SerialNumber::FindSerialTranslation(Pvl &label) {
    // Immediately lock the static mutex so multiple threads don't collide on the static variables
    // inside of this method. This locker auto-locks upon construction and unlocks the mutex when
    // it is destroyed (when this method finishes).
    QMutexLocker lock(&m_mutex);

    Pvl outLabel;
    Pvl outLabel;
    static PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory"));
    static PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory"));


+0 −21
Original line number Original line Diff line number Diff line
@@ -25,8 +25,6 @@


#include <string>
#include <string>


#include <QMutex>

#include "SerialNumberList.h"
#include "SerialNumberList.h"


namespace Isis {
namespace Isis {
@@ -83,19 +81,6 @@ namespace Isis {
   *  @history 2008-05-09 Steven Lambright Optimized the FindSerialTranslation
   *  @history 2008-05-09 Steven Lambright Optimized the FindSerialTranslation
   *           method
   *           method
   *  @history 2008-05-18 Steven Lambright Fixed documentation
   *  @history 2008-05-18 Steven Lambright Fixed documentation
   *  @history 2018-07-11 Ian Humphrey - Made FindSerialTranslation() thread-safe. Added a static
   *                          mutex for the FindSerialTranslation() method. This facilitates adding
   *                          a QString serialNumber member to the Image class and calling
   *                          SerialNumber::Compose() within the Image constructors. When qmos or
   *                          ipce opens a list of images, it uses an ImageReader, which uses a
   *                          QtConcurrent mapped function call to load its images with multiple
   *                          threads. Since the FindSerialTranslation() method declares static
   *                          local variables within it, this would cause thread collisions on the
   *                          static variables when SerialNumbers are being composed for the Images
   *                          being conurrently opened by the ImageReader. Added a QMutexLocker to
   *                          the FindSerialTranslation() method to auto-lock and unlock the mutex,
   *                          which prevents multiple threads from colliding on the static
   *                          variables. Fixes #5206.
   */
   */
  class SerialNumber {
  class SerialNumber {
    public:
    public:
@@ -119,12 +104,6 @@ namespace Isis {


      static PvlGroup FindSerialTranslation(Pvl &label);
      static PvlGroup FindSerialTranslation(Pvl &label);


      /**
       * Static mutex for preventing threads from colliding on the static variables in
       * SerialNumber::FindSerialTranslation().
       */
      static QMutex m_mutex;

  }; // End of Class
  }; // End of Class
}; // End of namespace
}; // End of namespace


+6 −19
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@
#include <geos/io/WKTWriter.h>
#include <geos/io/WKTWriter.h>


#include "Angle.h"
#include "Angle.h"
#include "Camera.h"
#include "Cube.h"
#include "Cube.h"
#include "CubeAttribute.h"
#include "CubeAttribute.h"
#include "DisplayProperties.h"
#include "DisplayProperties.h"
@@ -54,11 +53,7 @@ namespace Isis {


    m_fileName = imageFileName;
    m_fileName = imageFileName;


    m_observationNumber = ObservationNumber::Compose(*(cube()));
    m_serialNumber = SerialNumber::Compose(*(cube()));
    
    cube();
    cube();
    m_cameraType = m_cube->camera()->GetCameraType();


    initCamStats();
    initCamStats();


@@ -93,10 +88,6 @@ namespace Isis {
    m_lineResolution = Null;
    m_lineResolution = Null;
    m_sampleResolution = Null;
    m_sampleResolution = Null;


    m_cameraType = m_cube->camera()->GetCameraType();
    m_observationNumber = ObservationNumber::Compose(*(cube()));
    m_serialNumber = SerialNumber::Compose(*(cube()));

    initCamStats();
    initCamStats();


    try {
    try {
@@ -291,16 +282,6 @@ namespace Isis {
  }
  }




  /**
   * @brief Get the camera type for this Image.
   * 
   * @return Camera::CameraType Returns the camera type for this Image.
   */
  Camera::CameraType Image::cameraType() const {
    return m_cameraType;
  }


  /**
  /**
   * @brief Get the display (GUI) properties (information) associated with this image.
   * @brief Get the display (GUI) properties (information) associated with this image.
   * @return @b (ImageDisplayProperties *) Returns a poniter to an ImageDisplayProperties
   * @return @b (ImageDisplayProperties *) Returns a poniter to an ImageDisplayProperties
@@ -336,6 +317,9 @@ namespace Isis {
   * @return QString A string representation of the observation number of the cube.
   * @return QString A string representation of the observation number of the cube.
   */
   */
  QString Image::observationNumber() {
  QString Image::observationNumber() {
    if (m_observationNumber.isEmpty()) {
      m_observationNumber = ObservationNumber::Compose(*(cube()));
    }
    return m_observationNumber;
    return m_observationNumber;
  }
  }


@@ -345,6 +329,9 @@ namespace Isis {
   * @return @b QString  A string representation of the serial number of the cube.
   * @return @b QString  A string representation of the serial number of the cube.
   */
   */
  QString Image::serialNumber() {
  QString Image::serialNumber() {
    if (m_serialNumber.isEmpty()) {
      m_serialNumber = SerialNumber::Compose(*(cube()));
    } 
    return m_serialNumber;
    return m_serialNumber;
  }
  }


Loading