From 16c594ad174f51ff21bb8c8984868bc6d80f7d20 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Mon, 20 Jul 2015 08:48:35 -0600 Subject: [PATCH 01/24] Tests for saveHistogram and setBinCount. I'm not sure if they are working yet, though - it's been a while since I last worked on this. --- Skeleton3/scriptedClient/tests/conftest.py | 5 +++- .../scriptedClient/tests/test_cartavis.py | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Skeleton3/scriptedClient/tests/conftest.py b/Skeleton3/scriptedClient/tests/conftest.py index 09088f29..60aa87d2 100644 --- a/Skeleton3/scriptedClient/tests/conftest.py +++ b/Skeleton3/scriptedClient/tests/conftest.py @@ -58,7 +58,7 @@ def fin(): print "deleting " + imageDir + '/' + file os.remove(imageDir + '/' + file) os.rmdir(imageDir) - request.addfinalizer(fin) + #request.addfinalizer(fin) return imageDir @pytest.fixture(scope="function") @@ -79,6 +79,9 @@ def cleanSlate(request, cartavisInstance): c[0].setColorMix(1,1,1) c[0].setDataTransform('none') c[0].setGamma(1) + # Reset the histogram + #h = cartavisInstance.getHistogramViews() + #h[0].setPlaneMode('all') # Close all open images for imageName in i[0].getImageNames(): i[0].closeImage(imageName) diff --git a/Skeleton3/scriptedClient/tests/test_cartavis.py b/Skeleton3/scriptedClient/tests/test_cartavis.py index 7736c850..6d143d83 100644 --- a/Skeleton3/scriptedClient/tests/test_cartavis.py +++ b/Skeleton3/scriptedClient/tests/test_cartavis.py @@ -263,3 +263,32 @@ def test_setGamma(cartavisInstance, tempImageDir, cleanSlate): reference = Image.open(os.getcwd() + '/data/' + imageName) comparison = Image.open(tempImageDir + '/' + imageName) assert list(reference.getdata()) == list(comparison.getdata()) + +def test_saveHistogram(cartavisInstance, tempImageDir, cleanSlate): + """ + Test that an image of the histogram can be saved. + """ + imageName = 'histogram.png' + i = cartavisInstance.getImageViews() + h = cartavisInstance.getHistogramViews() + i[0].loadLocalFile(os.getcwd() + '/data/mexinputtest.fits') + h[0].setPlaneMode('all') + h[0].saveHistogram(tempImageDir + '/' + imageName, 200, 200) + reference = Image.open(os.getcwd() + '/data/' + imageName) + comparison = Image.open(tempImageDir + '/' + imageName) + assert list(reference.getdata()) == list(comparison.getdata()) + +def test_setBinCount(cartavisInstance, tempImageDir, cleanSlate): + """ + Test that an image of the histogram can be saved. + """ + imageName = 'histogram_100bin.png' + i = cartavisInstance.getImageViews() + h = cartavisInstance.getHistogramViews() + i[0].loadLocalFile(os.getcwd() + '/data/mexinputtest.fits') + h[0].setPlaneMode('all') + h[0].setBinCount(100) + h[0].saveHistogram(tempImageDir + '/' + imageName, 200, 200) + reference = Image.open(os.getcwd() + '/data/' + imageName) + comparison = Image.open(tempImageDir + '/' + imageName) + assert list(reference.getdata()) == list(comparison.getdata()) From 02e6b65c8f2b626d82a567fea029a3d628ce8ab1 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Wed, 22 Jul 2015 19:55:20 -0600 Subject: [PATCH 02/24] New scripted command: setShowGridLines() --- .../cpp/common/Data/Image/Controller.cpp | 4 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 24 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 8 +++++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++++ 6 files changed, 73 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 9b2cde24..536446f0 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1044,6 +1044,10 @@ QString Controller::setClipValue( double clipVal ) { return result; } +QString Controller::setShowGridLines( bool showGridLines ) { + QString result = m_gridControls->setShowGridLines( showGridLines ); + return result; +} void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 9acfce28..680605c1 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -293,6 +293,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ void resetState( const QString& state ); + /** + * Set whether or not the grid lines should be shown. + * @param showGridLines - true if the grid lines should be shown; false otherwise. + * @return an error message if there was a problem changing the visibility of the + * grid; an empty string otherwise. + */ + QString setShowGridLines( bool showGridLines ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index be986955..829369ff 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -10,6 +10,7 @@ #include "Data/Histogram/Histogram.h" #include "Data/Layout/Layout.h" #include "Data/Statistics.h" +#include "Data/Image/GridControls.h" #include @@ -1362,3 +1363,26 @@ QStringList ScriptFacade::saveHistogram( const QString& histogramId, const QStri } return resultList; } + +QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { + QStringList resultList(""); + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setShowGridLines( showGridLines ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index bb62d22e..e48c9f6a 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -540,6 +540,15 @@ class ScriptFacade: public QObject { */ QStringList saveHistogram( const QString& histogramId, const QString& filename, int width, int height ); + /** + * Set whether or not the grid lines should be shown. + * @param controlId the unique server-side id of an object managing a controller. + * @param showGridLines - true if the grid lines should be shown; false otherwise. + * @return an error message if there was a problem changing the visibility of the + * grid; an empty string otherwise. + */ + QStringList setShowGridLines( const QString& controlId, bool showGridLines ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index d240415b..a85b1265 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -429,6 +429,14 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->saveHistogram( histogramView, filename, width, height ); } + /// grid commands + + else if ( cmd == "setshowgridlines" ) { + QString imageView = args["imageView"].toString(); + bool showGridLines = args["showGridLines"].toBool(); + result = m_scriptFacade->setShowGridLines( imageView, showGridLines ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index dc7427f9..f7c815cf 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -628,3 +628,23 @@ def closeImage(self, imageName): result = self.con.cmdTagList("closeImage", imageView=self.getId(), imageName=imageName) return result + + def setShowGridLines(self, showGridLines=True): + """ + Set whether or not to show grid lines. + + Parameters + ---------- + showGridLines: boolean + The default value is True, which caues the grid lines to be + shown. + + Returns + ------- + list + Error message if an error occurred; empty otherwise. + """ + result = self.con.cmdTagList("setShowGridLines", + imageView=self.getId(), + showGridLines=showGridLines) + return result From 91eae0f82ddc80d7ebb60abcb4d5b3ea0840241e Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Thu, 23 Jul 2015 20:38:01 -0600 Subject: [PATCH 03/24] New scripted command: setGridAxesColor() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 9 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 25 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 8 ++++++ Skeleton3/scriptedClient/image.py | 23 +++++++++++++++++ 6 files changed, 79 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 536446f0..04256445 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1044,6 +1044,11 @@ QString Controller::setClipValue( double clipVal ) { return result; } +QStringList Controller::setGridAxesColor( int red, int green, int blue ) { + QStringList result = m_gridControls->setAxesColor( red, green, blue ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 680605c1..913c5ec9 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -293,6 +293,15 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ void resetState( const QString& state ); + /** + * Set the grid axes color. + * @param redAmount - an integer in [0, 255] indicating the amount of red. + * @param greenAmount an integer in [0,255] indicating the amount of green. + * @param blueAmount - an integer in [0,255] indicating the amount of blue. + * @return a list of errors or an empty list if the color was successfully set. + */ + QStringList setGridAxesColor( int redAmount, int greenAmount, int blueAmount ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 829369ff..1817694e 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1364,6 +1364,31 @@ QStringList ScriptFacade::saveHistogram( const QString& histogramId, const QStri return resultList; } +QStringList ScriptFacade::setGridAxesColor( const QString& controlId, int red, int green, int blue ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + resultList = controller->setGridAxesColor( red, green, blue ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index e48c9f6a..d112678b 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -540,6 +540,15 @@ class ScriptFacade: public QObject { */ QStringList saveHistogram( const QString& histogramId, const QString& filename, int width, int height ); + /** + * Set the grid axes color. + * @param red- an integer in [0, 255] indicating the amount of red. + * @param green - an integer in [0,255] indicating the amount of green. + * @param blue - an integer in [0,255] indicating the amount of blue. + * @return a list of errors or an empty list if the color was successfully set. + */ + QStringList setGridAxesColor( const QString& controlId, int red, int green, int blue ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index a85b1265..f4811f30 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -437,6 +437,14 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setShowGridLines( imageView, showGridLines ); } + else if ( cmd == "setgridaxescolor" ) { + QString imageView = args["imageView"].toString(); + int red = args["red"].toInt(); + int green = args["green"].toInt(); + int blue = args["blue"].toInt(); + result = m_scriptFacade->setGridAxesColor( imageView, red, green, blue ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index f7c815cf..415e870d 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -629,6 +629,29 @@ def closeImage(self, imageName): imageName=imageName) return result + def setGridAxesColor(self, red, green, blue): + """ + Set the color of the grid axes. + + Parameters + ---------- + red: integer + An integer in [0, 255] indicating the amount of red. + green: integer + An integer in [0, 255] indicating the amount of green. + blue: integer + An integer in [0, 255] indicating the amount of blue. + + Returns + ------- + list + Error message if an error occurred; empty otherwise. + """ + result = self.con.cmdTagList("setGridAxesColor", + imageView=self.getId(), + red=red, green=green, blue=blue) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 05b25e3196854d23a798249589f747044269cda0 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Thu, 23 Jul 2015 21:34:18 -0600 Subject: [PATCH 04/24] New scripted command: setGridAxesThickness() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 10 +++++++ .../ScriptedCommandInterpreter.cpp | 18 ++++++++----- Skeleton3/scriptedClient/image.py | 20 ++++++++++++++ 6 files changed, 81 insertions(+), 6 deletions(-) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 04256445..a7428aaf 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1049,6 +1049,11 @@ QStringList Controller::setGridAxesColor( int red, int green, int blue ) { return result; } +QString Controller::setGridAxesThickness( int thickness ) { + QString result = m_gridControls->setAxesThickness( thickness ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 913c5ec9..ad540241 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -302,6 +302,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QStringList setGridAxesColor( int redAmount, int greenAmount, int blueAmount ); + /** + * Set axis thickness. + * @param thickness - a positive integer. + * @return an error message if the thickness could not be set or an empty string + * if the thickness was successfully set. + */ + QString setGridAxesThickness( int thickness ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 1817694e..c94b0fbd 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1389,6 +1389,32 @@ QStringList ScriptFacade::setGridAxesColor( const QString& controlId, int red, i return resultList; } +QStringList ScriptFacade::setGridAxesThickness( const QString& controlId, int thickness ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridAxesThickness( thickness ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index d112678b..fb28e1cc 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -542,6 +542,7 @@ class ScriptFacade: public QObject { /** * Set the grid axes color. + * @param controlId the unique server-side id of an object managing a controller. * @param red- an integer in [0, 255] indicating the amount of red. * @param green - an integer in [0,255] indicating the amount of green. * @param blue - an integer in [0,255] indicating the amount of blue. @@ -549,6 +550,15 @@ class ScriptFacade: public QObject { */ QStringList setGridAxesColor( const QString& controlId, int red, int green, int blue ); + /** + * Set grid axis thickness. + * @param controlId the unique server-side id of an object managing a controller. + * @param thickness - a positive integer. + * @return an error message if the thickness could not be set or an empty string + * if the thickness was successfully set. + */ + QStringList setGridAxesThickness( const QString& controldId, int thickness ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index f4811f30..7924eb60 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -431,12 +431,6 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) /// grid commands - else if ( cmd == "setshowgridlines" ) { - QString imageView = args["imageView"].toString(); - bool showGridLines = args["showGridLines"].toBool(); - result = m_scriptFacade->setShowGridLines( imageView, showGridLines ); - } - else if ( cmd == "setgridaxescolor" ) { QString imageView = args["imageView"].toString(); int red = args["red"].toInt(); @@ -445,6 +439,18 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridAxesColor( imageView, red, green, blue ); } + else if ( cmd == "setgridaxesthickness" ) { + QString imageView = args["imageView"].toString(); + int thickness = args["thickness"].toInt(); + result = m_scriptFacade->setGridAxesThickness( imageView, thickness ); + } + + else if ( cmd == "setshowgridlines" ) { + QString imageView = args["imageView"].toString(); + bool showGridLines = args["showGridLines"].toBool(); + result = m_scriptFacade->setShowGridLines( imageView, showGridLines ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 415e870d..80115687 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -652,6 +652,26 @@ def setGridAxesColor(self, red, green, blue): red=red, green=green, blue=blue) return result + def setGridAxesThickness(self, thickness): + """ + Set grid axis thickness. + + Parameters + ---------- + thickness: integer + A positive integer. + + Returns + ------- + list + An error message if the thickness could not be set or an + empty string if the thickness was successfully set. + """ + result = self.con.cmdTagList("setGridAxesThickness", + imageView=self.getId(), + thickness=thickness) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 3932f9063561f514121b41d5d49348a860a7de32 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Thu, 23 Jul 2015 22:18:09 -0600 Subject: [PATCH 05/24] New command: setGridAxesTransparency(). Also fixed a small bug in the error reporting for DataGrid::_setAxesThickness() (an extra 1 was being concatenated to the message, making it look like the upper limit was 101 instead of 10). --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 10 ++++++- Skeleton3/cpp/common/Data/Image/DataGrid.cpp | 2 +- .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 18 +++++++++++++ 7 files changed, 74 insertions(+), 2 deletions(-) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index a7428aaf..e1d43ae7 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1054,6 +1054,11 @@ QString Controller::setGridAxesThickness( int thickness ) { return result; } +QString Controller::setGridAxesTransparency( int transparency ) { + QString result = m_gridControls->setAxesTransparency( transparency ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index ad540241..0db0bec9 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -303,13 +303,21 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo QStringList setGridAxesColor( int redAmount, int greenAmount, int blueAmount ); /** - * Set axis thickness. + * Set grid axis thickness. * @param thickness - a positive integer. * @return an error message if the thickness could not be set or an empty string * if the thickness was successfully set. */ QString setGridAxesThickness( int thickness ); + /** + * Set the grid axis transparency. + * @param transparency - a nonnegative integer between 0 and 255, with 255 opaque. + * @return an error message if the transparency could not be set or an empty string + * if it was successfully set. + */ + QString setGridAxesTransparency( int transparency ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/Data/Image/DataGrid.cpp b/Skeleton3/cpp/common/Data/Image/DataGrid.cpp index bd0f9a1f..f03b6740 100644 --- a/Skeleton3/cpp/common/Data/Image/DataGrid.cpp +++ b/Skeleton3/cpp/common/Data/Image/DataGrid.cpp @@ -419,7 +419,7 @@ QString DataGrid::_setAxesThickness( int thickness, bool* thicknessChanged ){ QString result; if ( thickness < 0 || thickness > PEN_FACTOR ){ result = "Axes thickness must be in [0,"+QString::number(PEN_FACTOR)+ - "1]: "+QString::number(thickness); + "]: "+QString::number(thickness); } else { QString lookup = Carta::State::UtilState::getLookup( AXES, PEN_WIDTH ); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index c94b0fbd..8055024e 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1415,6 +1415,32 @@ QStringList ScriptFacade::setGridAxesThickness( const QString& controlId, int th return resultList; } +QStringList ScriptFacade::setGridAxesTransparency( const QString& controlId, int transparency ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridAxesTransparency( transparency ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index fb28e1cc..069d757e 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -559,6 +559,15 @@ class ScriptFacade: public QObject { */ QStringList setGridAxesThickness( const QString& controldId, int thickness ); + /** + * Set the grid axis transparency. + * @param controlId the unique server-side id of an object managing a controller. + * @param transparency - a nonnegative integer between 0 and 255, with 255 opaque. + * @return an error message if the transparency could not be set or an empty string + * if it was successfully set. + */ + QStringList setGridAxesTransparency( const QString& controldId, int transparency ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 7924eb60..f3e10f3c 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -445,6 +445,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridAxesThickness( imageView, thickness ); } + else if ( cmd == "setgridaxestransparency" ) { + QString imageView = args["imageView"].toString(); + int transparency = args["transparency"].toInt(); + result = m_scriptFacade->setGridAxesTransparency( imageView, transparency ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 80115687..e66794ca 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -672,6 +672,24 @@ def setGridAxesThickness(self, thickness): thickness=thickness) return result + def setGridAxesTransparency(self, transparency): + """ + Parameters + ---------- + transparency: integer + A nonnegative integer between 0 and 255, with 255 opaque. + + Returns + ------- + list + An error message if the transparency could not be set or an + empty string if it was successfully set. + """ + result = self.con.cmdTagList("setGridAxesTransparency", + imageView=self.getId(), + transparency=transparency) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 89483bc5f9374671bb3f2218a1649299e7d9c6ab Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 08:31:53 -0600 Subject: [PATCH 06/24] New scripted command: setGridApplyAll(). This command runs, but it doesn't update the check box in the GUI. --- .../cpp/common/Data/Image/Controller.cpp | 4 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 7 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 22 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 8 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 21 ++++++++++++++++++ 6 files changed, 68 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index e1d43ae7..915fa54e 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1059,6 +1059,10 @@ QString Controller::setGridAxesTransparency( int transparency ) { return result; } +void Controller::setGridApplyAll( bool applyAll ) { + m_gridControls->setApplyAll( applyAll ); +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 0db0bec9..95381344 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -318,6 +318,13 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridAxesTransparency( int transparency ); + /** + * Set whether or not grid control settings should apply to all images on the set. + * @param applyAll - true if the settings apply to all images on the stack; + * false otherwise. + */ + void setGridApplyAll( bool applyAll ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 8055024e..ecbd2184 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1441,6 +1441,28 @@ QStringList ScriptFacade::setGridAxesTransparency( const QString& controlId, int return resultList; } +QStringList ScriptFacade::setGridApplyAll( const QString& controlId, bool applyAll ) { + QStringList resultList(""); + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + controller->setGridApplyAll( applyAll ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 069d757e..a7152d8d 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -568,6 +568,14 @@ class ScriptFacade: public QObject { */ QStringList setGridAxesTransparency( const QString& controldId, int transparency ); + /** + * Set whether or not grid control settings should apply to all images on the set. + * @param controlId the unique server-side id of an object managing a controller. + * @param applyAll - true if the settings apply to all images on the stack; + * false otherwise. + */ + QStringList setGridApplyAll( const QString& controlId, bool applyAll ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index f3e10f3c..6f115ce0 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -451,6 +451,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridAxesTransparency( imageView, transparency ); } + else if ( cmd == "setgridapplyall" ) { + QString imageView = args["imageView"].toString(); + bool applyAll = args["applyAll"].toBool(); + result = m_scriptFacade->setGridApplyAll( imageView, applyAll ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index e66794ca..bfaa13f7 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -690,6 +690,27 @@ def setGridAxesTransparency(self, transparency): transparency=transparency) return result + def setGridApplyAll(self, applyAll): + """ + Set whether or not grid control settings should apply to all + images on the set. + + Paramters + --------- + applyAll: boolean + True if the settings apply to all images on the stack; + False otherwise. + + Returns + ------- + list + Error message if an error occurred; empty otherwise. + """ + result = self.con.cmdTagList("setGridApplyAll", + imageView=self.getId(), + applyAll=applyAll) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From b230055776527773cf63a704d5508c3126e11018 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 09:33:03 -0600 Subject: [PATCH 07/24] New scripted command: setGridCoordinateSystem() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++ 6 files changed, 74 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 915fa54e..8f3994ee 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1063,6 +1063,11 @@ void Controller::setGridApplyAll( bool applyAll ) { m_gridControls->setApplyAll( applyAll ); } +QString Controller::setGridCoordinateSystem( const QString& coordSystem ) { + QString result = m_gridControls->setCoordinateSystem( coordSystem ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 95381344..357458de 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -325,6 +325,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ void setGridApplyAll( bool applyAll ); + /** + * Set the grid coordinate system. + * @param coordSystem - an identifier for a grid coordinate system. + * @return an error message if there was a problem setting the coordinate system; + * an empty string otherwise. + */ + QString setGridCoordinateSystem( const QString& coordSystem ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index ecbd2184..d23cee74 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1463,6 +1463,32 @@ QStringList ScriptFacade::setGridApplyAll( const QString& controlId, bool applyA return resultList; } +QStringList ScriptFacade::setGridCoordinateSystem( const QString& controlId, const QString& coordSystem ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridCoordinateSystem( coordSystem ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index a7152d8d..24284b68 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -576,6 +576,15 @@ class ScriptFacade: public QObject { */ QStringList setGridApplyAll( const QString& controlId, bool applyAll ); + /** + * Set the grid coordinate system. + * @param controlId the unique server-side id of an object managing a controller. + * @param coordSystem - an identifier for a grid coordinate system. + * @return an error message if there was a problem setting the coordinate system; + * an empty string otherwise. + */ + QStringList setGridCoordinateSystem( const QString& controlId, const QString& coordSystem ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 6f115ce0..03c927cb 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -457,6 +457,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridApplyAll( imageView, applyAll ); } + else if ( cmd == "setgridcoordinatesystem" ) { + QString imageView = args["imageView"].toString(); + QString coordSystem = args["coordSystem"].toString(); + result = m_scriptFacade->setGridCoordinateSystem( imageView, coordSystem ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index bfaa13f7..faece914 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -711,6 +711,26 @@ def setGridApplyAll(self, applyAll): applyAll=applyAll) return result + def setGridCoordinateSystem(self, coordSystem): + """ + Set the grid coordinate system. + + Parameters + --------- + coordSystem: string + An identifier for a grid coordinate system. + + Returns + ------- + list + An error message if there was a problem setting the + coordinate system; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridCoordinateSystem", + imageView=self.getId(), + coordSystem=coordSystem) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 5e4be444eda1a707b4486a6f65bd1573e4ea61e6 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 09:47:32 -0600 Subject: [PATCH 08/24] New scripted command: setGridFontFamily() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++ 6 files changed, 74 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 8f3994ee..b1924a8c 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1068,6 +1068,11 @@ QString Controller::setGridCoordinateSystem( const QString& coordSystem ) { return result; } +QString Controller::setGridFontFamily( const QString& fontFamily ) { + QString result = m_gridControls->setFontFamily( fontFamily ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 357458de..d3c048bd 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -333,6 +333,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridCoordinateSystem( const QString& coordSystem ); + /** + * Set the font family used for grid labels. + * @param fontFamily - an identifier for a font family. + * @return an error message if there was a problem setting the font family; + * an empty string otherwise. + */ + QString setGridFontFamily( const QString& fontFamily ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index d23cee74..f489704e 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1489,6 +1489,32 @@ QStringList ScriptFacade::setGridCoordinateSystem( const QString& controlId, con return resultList; } +QStringList ScriptFacade::setGridFontFamily( const QString& controlId, const QString& fontFamily ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridFontFamily( fontFamily ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 24284b68..9c242da9 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -585,6 +585,15 @@ class ScriptFacade: public QObject { */ QStringList setGridCoordinateSystem( const QString& controlId, const QString& coordSystem ); + /** + * Set the font family used for grid labels. + * @param controlId the unique server-side id of an object managing a controller. + * @param fontFamily - an identifier for a font family. + * @return an error message if there was a problem setting the font family; + * an empty string otherwise. + */ + QStringList setGridFontFamily( const QString& controlId, const QString& fontFamily ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 03c927cb..3b134e31 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -463,6 +463,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridCoordinateSystem( imageView, coordSystem ); } + else if ( cmd == "setgridfontfamily" ) { + QString imageView = args["imageView"].toString(); + QString fontFamily = args["fontFamily"].toString(); + result = m_scriptFacade->setGridFontFamily( imageView, fontFamily ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index faece914..0910f5e1 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -731,6 +731,26 @@ def setGridCoordinateSystem(self, coordSystem): coordSystem=coordSystem) return result + def setGridFontFamily(self, fontFamily): + """ + Set the font family used for grid labels. + + Parameters + ---------- + fontFamily: string + An identifier for a font family. + + Returns + ------- + list + An error message if there was a problem setting the font + family; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridFontFamily", + imageView=self.getId(), + fontFamily=fontFamily) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 52061a62f0ee6d2894f2362cd2caf112d4d74756 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 11:22:34 -0600 Subject: [PATCH 09/24] New scripted command: setGridFontSize() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++ 6 files changed, 74 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index b1924a8c..ac8ef09f 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1073,6 +1073,11 @@ QString Controller::setGridFontFamily( const QString& fontFamily ) { return result; } +QString Controller::setGridFontSize( int fontSize ) { + QString result = m_gridControls->setFontSize( fontSize ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index d3c048bd..379ddfb5 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -341,6 +341,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridFontFamily( const QString& fontFamily ); + /** + * Set the font size used for grid labels. + * @param fontSize - an identifier for a font point size. + * @return an error message if there was a problem setting the font point size; + * an empty string otherwise. + */ + QString setGridFontSize( int fontSize ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index f489704e..f7e58340 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1515,6 +1515,32 @@ QStringList ScriptFacade::setGridFontFamily( const QString& controlId, const QSt return resultList; } +QStringList ScriptFacade::setGridFontSize( const QString& controlId, int fontSize ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridFontSize( fontSize ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 9c242da9..175d4b5a 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -594,6 +594,15 @@ class ScriptFacade: public QObject { */ QStringList setGridFontFamily( const QString& controlId, const QString& fontFamily ); + /** + * Set the font size used for grid labels. + * @param controlId the unique server-side id of an object managing a controller. + * @param fontSize - an identifier for a font point size. + * @return an error message if there was a problem setting the font point size; + * an empty string otherwise. + */ + QStringList setGridFontSize( const QString& controlId, int fontSize ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 3b134e31..2a3e5340 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -469,6 +469,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridFontFamily( imageView, fontFamily ); } + else if ( cmd == "setgridfontsize" ) { + QString imageView = args["imageView"].toString(); + int fontSize = args["fontSize"].toInt(); + result = m_scriptFacade->setGridFontSize( imageView, fontSize ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 0910f5e1..b3a04d78 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -751,6 +751,26 @@ def setGridFontFamily(self, fontFamily): fontFamily=fontFamily) return result + def setGridFontSize(self, fontSize): + """ + Set the font size used for grid labels. + + Parameters + ---------- + fontSize: integer + An identifier for a font point size. + + Returns + ------- + list + An error message if there was a problem setting the font + point size; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridFontSize", + imageView=self.getId(), + fontSize=fontSize) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From f37c0ec87923c97b917e6caac627347aee3d9ba2 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 11:47:20 -0600 Subject: [PATCH 10/24] New scripted command: setGridColor() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 9 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 25 ++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 10 +++++++ .../ScriptedCommandInterpreter.cpp | 8 ++++++ Skeleton3/scriptedClient/image.py | 26 +++++++++++++++++++ 6 files changed, 83 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index ac8ef09f..b31bbf92 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1078,6 +1078,11 @@ QString Controller::setGridFontSize( int fontSize ) { return result; } +QStringList Controller::setGridColor( int redAmount, int greenAmount, int blueAmount ) { + QStringList result = m_gridControls->setGridColor( redAmount, greenAmount, blueAmount ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 379ddfb5..16213676 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -349,6 +349,15 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridFontSize( int fontSize ); + /** + * Set the grid color. + * @param redAmount - an integer in [0, 255] indicating the amount of red. + * @param greenAmount an integer in [0,255] indicating the amount of green. + * @param blueAmount - an integer in [0,255] indicating the amount of blue. + * @return a list of errors or an empty list if the color was successfully set. + */ + QStringList setGridColor( int redAmount, int greenAmount, int blueAmount ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index f7e58340..49da7861 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1541,6 +1541,31 @@ QStringList ScriptFacade::setGridFontSize( const QString& controlId, int fontSiz return resultList; } +QStringList ScriptFacade::setGridColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + resultList = controller->setGridColor( redAmount, greenAmount, blueAmount ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 175d4b5a..36b77288 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -603,6 +603,16 @@ class ScriptFacade: public QObject { */ QStringList setGridFontSize( const QString& controlId, int fontSize ); + /** + * Set the grid color. + * @param controlId the unique server-side id of an object managing a controller. + * @param redAmount - an integer in [0, 255] indicating the amount of red. + * @param greenAmount an integer in [0,255] indicating the amount of green. + * @param blueAmount - an integer in [0,255] indicating the amount of blue. + * @return a list of errors or an empty list if the color was successfully set. + */ + QStringList setGridColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 2a3e5340..0878899d 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -475,6 +475,14 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridFontSize( imageView, fontSize ); } + else if ( cmd == "setgridcolor" ) { + QString imageView = args["imageView"].toString(); + int redAmount = args["redAmount"].toInt(); + int greenAmount = args["greenAmount"].toInt(); + int blueAmount = args["blueAmount"].toInt(); + result = m_scriptFacade->setGridColor( imageView, redAmount, greenAmount, blueAmount ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index b3a04d78..40cc3941 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -771,6 +771,32 @@ def setGridFontSize(self, fontSize): fontSize=fontSize) return result + def setGridColor(self, redAmount, greenAmount, blueAmount): + """ + Set the grid color. + + Parameters + ---------- + redAmount: integer + An integer in [0, 255] indicating the amount of red. + greenAmount: integer + An integer in [0,255] indicating the amount of green. + blueAmount: integer + An integer in [0,255] indicating the amount of blue. + + Returns + ------- + list + A list of errors or an empty list if the color was + successfully set. + """ + result = self.con.cmdTagList("setGridColor", + imageView=self.getId(), + redAmount=redAmount, + greenAmount=greenAmount, + blueAmount=blueAmount) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 2f88488ec7810d966cae254fb93af7b0a8647136 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 12:36:35 -0600 Subject: [PATCH 11/24] New scriped command: setGridSpacing() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 21 +++++++++++++++ 6 files changed, 75 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index b31bbf92..7be232e8 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1083,6 +1083,11 @@ QStringList Controller::setGridColor( int redAmount, int greenAmount, int blueAm return result; } +QString Controller::setGridSpacing( double spacing ) { + QString result = m_gridControls->setGridSpacing( spacing ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 16213676..cbbb9b15 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -358,6 +358,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QStringList setGridColor( int redAmount, int greenAmount, int blueAmount ); + /** + * Set the spacing between grid lines. + * @param spacing - the grid spacing in [0,1] with 1 having the least amount of spacing. + * @return an error message if there was a problem setting the grid spacing; an empty + * string otherwise. + */ + QString setGridSpacing( double spacing ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 49da7861..49bcaa71 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1566,6 +1566,32 @@ QStringList ScriptFacade::setGridColor( const QString& controlId, int redAmount, return resultList; } +QStringList ScriptFacade::setGridSpacing( const QString& controlId, double spacing ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridSpacing( spacing ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 36b77288..d7d97bd6 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -613,6 +613,15 @@ class ScriptFacade: public QObject { */ QStringList setGridColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ); + /** + * Set the spacing between grid lines. + * @param controlId the unique server-side id of an object managing a controller. + * @param spacing - the grid spacing in [0,1] with 1 having the least amount of spacing. + * @return an error message if there was a problem setting the grid spacing; an empty + * string otherwise. + */ + QStringList setGridSpacing( const QString& controlId, double spacing ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 0878899d..50ad446f 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -483,6 +483,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridColor( imageView, redAmount, greenAmount, blueAmount ); } + else if ( cmd == "setgridspacing" ) { + QString imageView = args["imageView"].toString(); + double spacing = args["spacing"].toDouble(); + result = m_scriptFacade->setGridSpacing( imageView, spacing ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 40cc3941..f59f11ce 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -797,6 +797,27 @@ def setGridColor(self, redAmount, greenAmount, blueAmount): blueAmount=blueAmount) return result + def setGridSpacing(self, spacing): + """ + Set the spacing between grid lines. + + Parameters + ---------- + spacing: float + The grid spacing in [0,1] with 1 having the least amount of + spacing. + + Returns + ------- + list + An error message if there was a problem setting the grid + spacing; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridSpacing", + imageView=self.getId(), + spacing=spacing) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From f5bb31c5c207da7c47e96f5586df017325cd1894 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 13:07:25 -0600 Subject: [PATCH 12/24] New scripted command: setGridThickness() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++ 6 files changed, 74 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 7be232e8..192da60e 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1088,6 +1088,11 @@ QString Controller::setGridSpacing( double spacing ) { return result; } +QString Controller::setGridThickness( int thickness ) { + QString result = m_gridControls->setGridThickness( thickness ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index cbbb9b15..10f5a832 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -366,6 +366,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridSpacing( double spacing ); + /** + * Set the thickness of the grid lines. + * @param thickness -a positive integer. + * @return an error message if there was a problem setting the grid line thickness; an empty + * string otherwise. + */ + QString setGridThickness( int thickness ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 49bcaa71..275038c6 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1592,6 +1592,32 @@ QStringList ScriptFacade::setGridSpacing( const QString& controlId, double spaci return resultList; } +QStringList ScriptFacade::setGridThickness( const QString& controlId, int thickness ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridThickness( thickness ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; + +} QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index d7d97bd6..6df1eb2a 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -622,6 +622,15 @@ class ScriptFacade: public QObject { */ QStringList setGridSpacing( const QString& controlId, double spacing ); + /** + * Set the thickness of the grid lines. + * @param controlId the unique server-side id of an object managing a controller. + * @param thickness -a positive integer. + * @return an error message if there was a problem setting the grid line thickness; an empty + * string otherwise. + */ + QStringList setGridThickness( const QString& controlId, int thickness ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 50ad446f..3cf63ff8 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -489,6 +489,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridSpacing( imageView, spacing ); } + else if ( cmd == "setgridthickness" ) { + QString imageView = args["imageView"].toString(); + int thickness = args["thickness"].toInt(); + result = m_scriptFacade->setGridThickness( imageView, thickness ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index f59f11ce..eeca96ba 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -818,6 +818,26 @@ def setGridSpacing(self, spacing): spacing=spacing) return result + def setGridThickness(self, thickness): + """ + Set the thickness of the grid lines. + + Parameters + ---------- + thickness: integer + A positive integer. + + Returns + ------- + list + An error message if there was a problem setting the grid + line thickness; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridThickness", + imageView=self.getId(), + thickness=thickness) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From f954bd642a7787e7ecf5e6bd1fc3474341360280 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 13:51:35 -0600 Subject: [PATCH 13/24] New scripted command: setGridTransparency() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 27 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 21 +++++++++++++++ 6 files changed, 76 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 192da60e..ab7d539a 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1093,6 +1093,11 @@ QString Controller::setGridThickness( int thickness ) { return result; } +QString Controller::setGridTransparency( int transparency ) { + QString result = m_gridControls->setGridTransparency( transparency ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 10f5a832..1aabc9be 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -374,6 +374,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridThickness( int thickness ); + /** + * Set the transparency of the grid. + * @param transparency - the amount of transparency in [0,255] with 255 completely opaque. + * @return an error message if there was a problem setting the transparency; an empty + * string otherwise. + */ + QString setGridTransparency( int transparency ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 275038c6..be1184c2 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1618,6 +1618,33 @@ QStringList ScriptFacade::setGridThickness( const QString& controlId, int thickn return resultList; } + +QStringList ScriptFacade::setGridTransparency( const QString& controlId, int transparency ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridTransparency( transparency ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 6df1eb2a..8f8a13f1 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -631,6 +631,15 @@ class ScriptFacade: public QObject { */ QStringList setGridThickness( const QString& controlId, int thickness ); + /** + * Set the transparency of the grid. + * @param controlId the unique server-side id of an object managing a controller. + * @param transparency - the amount of transparency in [0,255] with 255 completely opaque. + * @return an error message if there was a problem setting the transparency; an empty + * string otherwise. + */ + QStringList setGridTransparency( const QString& controlId, int transparency ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 3cf63ff8..e4f03d15 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -495,6 +495,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridThickness( imageView, thickness ); } + else if ( cmd == "setgridtransparency" ) { + QString imageView = args["imageView"].toString(); + int transparency = args["transparency"].toInt(); + result = m_scriptFacade->setGridTransparency( imageView, transparency ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index eeca96ba..f20257c5 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -838,6 +838,27 @@ def setGridThickness(self, thickness): thickness=thickness) return result + def setGridTransparency(self, transparency): + """ + Set the transparency of the grid. + + Parameters + ---------- + transparency: integer + The amount of transparency in [0,255] with 255 completely + opaque. + + Returns + ------- + list + An error message if there was a problem setting the + transparency; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridTransparency", + imageView=self.getId(), + transparency=transparency) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 64dd12a0a99f0e0c0dd184b0bbf677ce7182342b Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 15:20:33 -0600 Subject: [PATCH 14/24] New scripted command: setGridLabelColor() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 9 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 25 ++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 10 +++++++ .../ScriptedCommandInterpreter.cpp | 8 ++++++ Skeleton3/scriptedClient/image.py | 26 +++++++++++++++++++ 6 files changed, 83 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index ab7d539a..2edede1a 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1098,6 +1098,11 @@ QString Controller::setGridTransparency( int transparency ) { return result; } +QStringList Controller::setGridLabelColor( int redAmount, int greenAmount, int blueAmount ) { + QStringList result = m_gridControls->setLabelColor( redAmount, greenAmount, blueAmount ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 1aabc9be..b78e7943 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -382,6 +382,15 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridTransparency( int transparency ); + /** + * Set the color of grid labels color. + * @param redAmount - an integer in [0, 255] indicating the amount of red. + * @param greenAmount an integer in [0,255] indicating the amount of green. + * @param blueAmount - an integer in [0,255] indicating the amount of blue. + * @return a list of errors or an empty list if the color was successfully set. + */ + QStringList setGridLabelColor( int redAmount, int greenAmount, int blueAmount ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index be1184c2..81b9a925 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1645,6 +1645,31 @@ QStringList ScriptFacade::setGridTransparency( const QString& controlId, int tra return resultList; } +QStringList ScriptFacade::setGridLabelColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + resultList = controller->setGridLabelColor( redAmount, greenAmount, blueAmount ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 8f8a13f1..58c2ab48 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -640,6 +640,16 @@ class ScriptFacade: public QObject { */ QStringList setGridTransparency( const QString& controlId, int transparency ); + /** + * Set the color of grid labels color. + * @param controlId the unique server-side id of an object managing a controller. + * @param redAmount - an integer in [0, 255] indicating the amount of red. + * @param greenAmount an integer in [0,255] indicating the amount of green. + * @param blueAmount - an integer in [0,255] indicating the amount of blue. + * @return a list of errors or an empty list if the color was successfully set. + */ + QStringList setGridLabelColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index e4f03d15..51666410 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -501,6 +501,14 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridTransparency( imageView, transparency ); } + else if ( cmd == "setgridlabelcolor" ) { + QString imageView = args["imageView"].toString(); + int redAmount = args["redAmount"].toInt(); + int greenAmount = args["greenAmount"].toInt(); + int blueAmount = args["blueAmount"].toInt(); + result = m_scriptFacade->setGridLabelColor( imageView, redAmount, greenAmount, blueAmount ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index f20257c5..77d77c17 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -859,6 +859,32 @@ def setGridTransparency(self, transparency): transparency=transparency) return result + def setGridLabelColor(self, redAmount, greenAmount, blueAmount): + """ + Set the color of grid labels. + + Parameters + ---------- + redAmount: integer + An integer in [0, 255] indicating the amount of red. + greenAmount: integer + An integer in [0,255] indicating the amount of green. + blueAmount: integer + An integer in [0,255] indicating the amount of blue. + + Returns + ------- + list + A list of errors or an empty list if the color was + successfully set. + """ + result = self.con.cmdTagList("setGridLabelColor", + imageView=self.getId(), + redAmount=redAmount, + greenAmount=greenAmount, + blueAmount=blueAmount) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From 5bbc16101b45233d84f141140dcbd27ff64fef27 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 15:45:03 -0600 Subject: [PATCH 15/24] New scripted command: setShowGridAxis() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 23 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 ++++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++++ 6 files changed, 71 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 2edede1a..ec791f21 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1103,6 +1103,11 @@ QStringList Controller::setGridLabelColor( int redAmount, int greenAmount, int b return result; } +QString Controller::setShowGridAxis( bool showAxis ) { + QString result = m_gridControls->setShowAxis( showAxis ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index b78e7943..5f9c9a53 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -391,6 +391,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QStringList setGridLabelColor( int redAmount, int greenAmount, int blueAmount ); + /** + * Set whether or not the axes should be shown. + * @param showAxis - true if the axes should be shown; false otherwise. + * @return an error message if there was a problem changing the visibility of the + * axes; an empty string otherwise. + */ + QString setShowGridAxis( bool showAxis ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 81b9a925..2bfc6210 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1670,6 +1670,29 @@ QStringList ScriptFacade::setGridLabelColor( const QString& controlId, int redAm return resultList; } +QStringList ScriptFacade::setShowGridAxis( const QString& controlId, bool showAxis ) { + QStringList resultList(""); + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setShowGridAxis( showAxis ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + return resultList; +} + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 58c2ab48..7cf890a2 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -650,6 +650,15 @@ class ScriptFacade: public QObject { */ QStringList setGridLabelColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ); + /** + * Set whether or not the grid axes should be shown. + * @param controlId the unique server-side id of an object managing a controller. + * @param showAxis - true if the axes should be shown; false otherwise. + * @return an error message if there was a problem changing the visibility of the + * axes; an empty string otherwise. + */ + QStringList setShowGridAxis( const QString& controlId, bool showAxis ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 51666410..3cb10e82 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -509,6 +509,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridLabelColor( imageView, redAmount, greenAmount, blueAmount ); } + else if ( cmd == "setshowgridaxis" ) { + QString imageView = args["imageView"].toString(); + bool showAxis = args["showAxis"].toBool(); + result = m_scriptFacade->setShowGridAxis( imageView, showAxis ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 77d77c17..c561c9f1 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -885,6 +885,26 @@ def setGridLabelColor(self, redAmount, greenAmount, blueAmount): blueAmount=blueAmount) return result + def setShowGridAxis(self, showAxis): + """ + Set whether or not the grid axes should be shown. + + Parameters + ---------- + showAxis: boolean + True if the axes should be shown; False otherwise. + + Returns + ------- + list + an error message if there was a problem changing the + visibility of the axes; an empty string otherwise. + """ + result = self.con.cmdTagList("setShowGridAxis", + imageView=self.getId(), + showAxis=showAxis) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From f6862e63d2e4bcfea2f4991fb74674a7c8109711 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 17:00:55 -0600 Subject: [PATCH 16/24] New scripted command: setShowGridCoordinateSystem() --- .../cpp/common/Data/Image/Controller.cpp | 5 +++++ Skeleton3/cpp/common/Data/Image/Controller.h | 11 +++++++++- .../common/ScriptedClient/ScriptFacade.cpp | 22 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 10 +++++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 21 ++++++++++++++++++ 6 files changed, 74 insertions(+), 1 deletion(-) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index ec791f21..33f4f75c 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1108,6 +1108,11 @@ QString Controller::setShowGridAxis( bool showAxis ) { return result; } +QString Controller::setShowGridCoordinateSystem( bool showCoordinateSystem ) { + QString result = m_gridControls->setShowCoordinateSystem( showCoordinateSystem ); + return result; +} + QString Controller::setShowGridLines( bool showGridLines ) { QString result = m_gridControls->setShowGridLines( showGridLines ); return result; diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 5f9c9a53..cd7f579b 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -392,13 +392,22 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo QStringList setGridLabelColor( int redAmount, int greenAmount, int blueAmount ); /** - * Set whether or not the axes should be shown. + * Set whether or not the grid axes should be shown. * @param showAxis - true if the axes should be shown; false otherwise. * @return an error message if there was a problem changing the visibility of the * axes; an empty string otherwise. */ QString setShowGridAxis( bool showAxis ); + /** + * Set whether or not the grid coordinate system should be visible. + * @param showCoordinateSystem - true if the coordinate system should be shown; + * false otherwise. + * @return an error message if there was a problem setting the coordinate system; + * an empty string otherwise. + */ + QString setShowGridCoordinateSystem( bool showCoordinateSystem ); + /** * Set whether or not the grid lines should be shown. * @param showGridLines - true if the grid lines should be shown; false otherwise. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 2bfc6210..6488979b 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1693,6 +1693,28 @@ QStringList ScriptFacade::setShowGridAxis( const QString& controlId, bool showAx return resultList; } +QStringList ScriptFacade::setShowGridCoordinateSystem( const QString& controlId, bool showCoordinateSystem ) { + QStringList resultList(""); + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setShowGridCoordinateSystem( showCoordinateSystem ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + return resultList; +} QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 7cf890a2..f2b80918 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -659,6 +659,16 @@ class ScriptFacade: public QObject { */ QStringList setShowGridAxis( const QString& controlId, bool showAxis ); + /** + * Set whether or not the grid coordinate system should be visible. + * @param controlId the unique server-side id of an object managing a controller. + * @param showCoordinateSystem - true if the coordinate system should be shown; + * false otherwise. + * @return an error message if there was a problem setting the coordinate system; + * an empty string otherwise. + */ + QStringList setShowGridCoordinateSystem( const QString& controlId, bool showCoordinateSystem ); + /** * Set whether or not the grid lines should be shown. * @param controlId the unique server-side id of an object managing a controller. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 3cb10e82..ae03bc1c 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -515,6 +515,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setShowGridAxis( imageView, showAxis ); } + else if ( cmd == "setshowgridcoordinatesystem" ) { + QString imageView = args["imageView"].toString(); + bool showCoordinateSystem = args["showCoordinateSystem"].toBool(); + result = m_scriptFacade->setShowGridCoordinateSystem( imageView, showCoordinateSystem ); + } + else if ( cmd == "setshowgridlines" ) { QString imageView = args["imageView"].toString(); bool showGridLines = args["showGridLines"].toBool(); diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index c561c9f1..3fa8b081 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -905,6 +905,27 @@ def setShowGridAxis(self, showAxis): showAxis=showAxis) return result + def setShowGridCoordinateSystem(self, showCoordinateSystem): + """ + Set whether or not the grid coordinate system should be visible. + + Parameters + ---------- + showCoordinateSystem: boolean + True if the coordinate system should be shown; False + otherwise. + + Returns + ------- + list + An error message if there was a problem setting the + coordinate system; an empty string otherwise. + """ + result = self.con.cmdTagList("setShowGridCoordinateSystem", + imageView=self.getId(), + showCoordinateSystem=showCoordinateSystem) + return result + def setShowGridLines(self, showGridLines=True): """ Set whether or not to show grid lines. From fc7934b44540ba3bba4daa76afcf6752eddd6f79 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 21:34:07 -0600 Subject: [PATCH 17/24] New scripted command: setShowGridInternalLabels() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 24 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++++ 6 files changed, 72 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 33f4f75c..cf4e6a9a 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1118,6 +1118,11 @@ QString Controller::setShowGridLines( bool showGridLines ) { return result; } +QString Controller::setShowGridInternalLabels( bool showInternalLabels ) { + QString result = m_gridControls->setShowInternalLabels( showInternalLabels ); + return result; +} + void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index cd7f579b..0eaeaf48 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -416,6 +416,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setShowGridLines( bool showGridLines ); + /** + * Set whether or not the grid axis should be internal or external. + * @param showInternalLabels - true if the axes should be internal; false otherwise. + * @return an error message if there was a problem setting the axes internal/external; + * false otherwise. + */ + QString setShowGridInternalLabels( bool showInternalLabels ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 6488979b..41a340d5 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1715,6 +1715,7 @@ QStringList ScriptFacade::setShowGridCoordinateSystem( const QString& controlId, } return resultList; } + QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showGridLines ) { QStringList resultList(""); ObjectManager* objMan = ObjectManager::objectManager(); @@ -1737,3 +1738,26 @@ QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showG } return resultList; } + +QStringList ScriptFacade::setShowGridInternalLabels( const QString& controlId, bool showInternalLabels ) { + QStringList resultList(""); + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setShowGridInternalLabels( showInternalLabels ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index f2b80918..99e7641e 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -678,6 +678,15 @@ class ScriptFacade: public QObject { */ QStringList setShowGridLines( const QString& controlId, bool showGridLines ); + /** + * Set whether or not the grid axis should be internal or external. + * @param controlId the unique server-side id of an object managing a controller. + * @param showInternalLabels - true if the axes should be internal; false otherwise. + * @return an error message if there was a problem setting the axes internal/external; + * false otherwise. + */ + QStringList setShowGridInternalLabels( const QString& controlId, bool showInternalLabels ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index ae03bc1c..c00670d3 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -527,6 +527,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setShowGridLines( imageView, showGridLines ); } + else if ( cmd == "setshowgridinternallabels" ) { + QString imageView = args["imageView"].toString(); + bool showInternalLabels = args["showInternalLabels"].toBool(); + result = m_scriptFacade->setShowGridInternalLabels( imageView, showInternalLabels ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 3fa8b081..1a7ab3d1 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -945,3 +945,23 @@ def setShowGridLines(self, showGridLines=True): imageView=self.getId(), showGridLines=showGridLines) return result + + def setShowGridInternalLabels(self, showInternalLabels): + """ + Set whether or not the grid axis should be internal or external. + + Parameters + ---------- + showInternalLabels: boolean + True if the axes should be internal; False otherwise. + + Returns + ------- + list + An error message if there was a problem setting the axes + internal/external; false otherwise. + """ + result = self.con.cmdTagList("setShowGridInternalLabels", + imageView=self.getId(), + showInternalLabels=showInternalLabels) + return result From c09ac2500f5151b32477dc084a4d49d0585957fd Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Fri, 24 Jul 2015 21:54:51 -0600 Subject: [PATCH 18/24] New scripted command: setShowGridStatistics() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 23 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 ++++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 21 +++++++++++++++++ 6 files changed, 72 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index cf4e6a9a..dcf87fe0 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1123,6 +1123,11 @@ QString Controller::setShowGridInternalLabels( bool showInternalLabels ) { return result; } +QString Controller::setShowGridStatistics( bool showStatistics ) { + QString result = m_gridControls->setShowStatistics( showStatistics ); + return result; +} + void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 0eaeaf48..b4e355b3 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -424,6 +424,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setShowGridInternalLabels( bool showInternalLabels ); + /** + * Sets whether or not cursor position image statistics should be shown. + * @param showStatistics - true if cursor statistics should be shown; false otherwise. + * @return an error message if there was a problem hiding/showing cursor statistics; + * an empty string otherwise. + */ + QString setShowGridStatistics( bool showStatistics ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 41a340d5..a7505d69 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1761,3 +1761,26 @@ QStringList ScriptFacade::setShowGridInternalLabels( const QString& controlId, b } return resultList; } + +QStringList ScriptFacade::setShowGridStatistics( const QString& controlId, bool showStatistics ) { + QStringList resultList(""); + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setShowGridStatistics( showStatistics ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 99e7641e..5850bb0b 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -687,6 +687,15 @@ class ScriptFacade: public QObject { */ QStringList setShowGridInternalLabels( const QString& controlId, bool showInternalLabels ); + /** + * Sets whether or not cursor position image statistics should be shown. + * @param controlId the unique server-side id of an object managing a controller. + * @param showStatistics - true if cursor statistics should be shown; false otherwise. + * @return an error message if there was a problem hiding/showing cursor statistics; + * an empty string otherwise. + */ + QStringList setShowGridStatistics( const QString& controlId, bool showStatistics ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index c00670d3..04c2d4b6 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -533,6 +533,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setShowGridInternalLabels( imageView, showInternalLabels ); } + else if ( cmd == "setshowgridstatistics" ) { + QString imageView = args["imageView"].toString(); + bool showStatistics = args["showStatistics"].toBool(); + result = m_scriptFacade->setShowGridStatistics( imageView, showStatistics ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 1a7ab3d1..f027e142 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -965,3 +965,24 @@ def setShowGridInternalLabels(self, showInternalLabels): imageView=self.getId(), showInternalLabels=showInternalLabels) return result + + def setShowGridStatistics(self, showStatistics): + """ + Sets whether or not cursor position image statistics should be + shown. + + Parameters + ---------- + showStatistics: boolean + True if cursor statistics should be shown; False otherwise. + + Returns + ------- + list + An error message if there was a problem hiding/showing + cursor statistics; an empty string otherwise. + """ + result = self.con.cmdTagList("setShowGridStatistics", + imageView=self.getId(), + showStatistics=showStatistics) + return result From 321db4908dc4fef1669de5da08a873ce6d1ce929 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Mon, 27 Jul 2015 08:00:36 -0600 Subject: [PATCH 19/24] New scripted command: setShowGridTicks() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 23 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 ++++++++ .../ScriptedCommandInterpreter.cpp | 7 ++++++ Skeleton3/scriptedClient/image.py | 21 +++++++++++++++++ 6 files changed, 73 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index dcf87fe0..730f8a74 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1128,6 +1128,11 @@ QString Controller::setShowGridStatistics( bool showStatistics ) { return result; } +QString Controller::setShowGridTicks( bool showTicks ) { + QString result = m_gridControls->setShowTicks( showTicks ); + return result; +} + void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index b4e355b3..e60e0fca 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -432,6 +432,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setShowGridStatistics( bool showStatistics ); + /** + * Set whether or not to show grid axis ticks. + * @param showTicks - true if the grid axis ticks should be shown; false otherwise. + * @return an error message if there was a problem setting the visibility of grid axis + * ticks; and empty string otherwise. + */ + QString setShowGridTicks( bool showTicks ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index a7505d69..5cba6e2f 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1784,3 +1784,26 @@ QStringList ScriptFacade::setShowGridStatistics( const QString& controlId, bool } return resultList; } + +QStringList ScriptFacade::setShowGridTicks( const QString& controlId, bool showTicks ) { + QStringList resultList(""); + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setShowGridTicks( showTicks ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 5850bb0b..2ce5fa83 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -696,6 +696,15 @@ class ScriptFacade: public QObject { */ QStringList setShowGridStatistics( const QString& controlId, bool showStatistics ); + /** + * Set whether or not to show grid axis ticks. + * @param controlId the unique server-side id of an object managing a controller. + * @param showTicks - true if the grid axis ticks should be shown; false otherwise. + * @return an error message if there was a problem setting the visibility of grid axis + * ticks; and empty string otherwise. + */ + QStringList setShowGridTicks( const QString& controldId, bool showTicks ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 04c2d4b6..3b3d8b9d 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -539,6 +539,13 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setShowGridStatistics( imageView, showStatistics ); } + else if ( cmd == "setshowgridticks" ) { + QString imageView = args["imageView"].toString(); + bool showTicks = args["showTicks"].toBool(); + result = m_scriptFacade->setShowGridTicks( imageView, showTicks ); + + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index f027e142..7c796d32 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -986,3 +986,24 @@ def setShowGridStatistics(self, showStatistics): imageView=self.getId(), showStatistics=showStatistics) return result + + def setShowGridTicks(self, showTicks): + """ + Set whether or not to show grid axis ticks. + + Paramters + ---------- + showTicks: boolean + True if the grid axis ticks should be shown; False + otherwise. + + Returns + ------- + list + An error message if there was a problem setting the + visibility of grid axis ticks; an empty string otherwise. + """ + result = self.con.cmdTagList("setShowGridTicks", + imageView=self.getId(), + showTicks=showTicks) + return result From 7e8cae097ce46946cb401a4dd27a3af685ee5f2e Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Mon, 27 Jul 2015 12:06:15 -0600 Subject: [PATCH 20/24] New scripted command: setGridTickColor() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 10 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 25 ++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 11 ++++++++ .../ScriptedCommandInterpreter.cpp | 7 +++++ Skeleton3/scriptedClient/image.py | 26 +++++++++++++++++++ 6 files changed, 84 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 730f8a74..88724527 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1133,6 +1133,11 @@ QString Controller::setShowGridTicks( bool showTicks ) { return result; } +QStringList Controller::setGridTickColor( int redAmount, int greenAmount, int blueAmount ) { + QStringList result = m_gridControls->setTickColor( redAmount, greenAmount, blueAmount ); + return result; +} + void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index e60e0fca..1586ed2d 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -440,6 +440,16 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setShowGridTicks( bool showTicks ); + /** + * Set the color of the grid tick marks. + * @param redAmount - a nonnegative integer in [0,255]. + * @param greenAmount - a nonnegative integer in [0,255]. + * @param blueAmount - a nonnegative integer in [0,255]. + * @return a list of error message(s) if there was a problem setting the tick + * color; an empty list otherwise. + */ + QStringList setGridTickColor( int redAmount, int greenAmount, int blueAmount ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 5cba6e2f..932ed579 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1807,3 +1807,28 @@ QStringList ScriptFacade::setShowGridTicks( const QString& controlId, bool showT } return resultList; } + +QStringList ScriptFacade::setGridTickColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + resultList = controller->setGridTickColor( redAmount, greenAmount, blueAmount ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 2ce5fa83..e5e83030 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -705,6 +705,17 @@ class ScriptFacade: public QObject { */ QStringList setShowGridTicks( const QString& controldId, bool showTicks ); + /** + * Set the color of the grid tick marks. + * @param controlId the unique server-side id of an object managing a controller. + * @param redAmount - a nonnegative integer in [0,255]. + * @param greenAmount - a nonnegative integer in [0,255]. + * @param blueAmount - a nonnegative integer in [0,255]. + * @return a list of error message(s) if there was a problem setting the tick + * color; an empty list otherwise. + */ + QStringList setGridTickColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 3b3d8b9d..977e2a4d 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -543,7 +543,14 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) QString imageView = args["imageView"].toString(); bool showTicks = args["showTicks"].toBool(); result = m_scriptFacade->setShowGridTicks( imageView, showTicks ); + } + else if ( cmd == "setgridtickcolor" ) { + QString imageView = args["imageView"].toString(); + int redAmount = args["redAmount"].toInt(); + int greenAmount = args["greenAmount"].toInt(); + int blueAmount = args["blueAmount"].toInt(); + result = m_scriptFacade->setGridTickColor( imageView, redAmount, greenAmount, blueAmount ); } /// commands for testing diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 7c796d32..7f71e70f 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -1007,3 +1007,29 @@ def setShowGridTicks(self, showTicks): imageView=self.getId(), showTicks=showTicks) return result + + def setGridTickColor(self, redAmount, greenAmount, blueAmount): + """ + Set the color of the grid tick marks. + + Parameters + ---------- + redAmount: integer + A nonnegative integer in [0,255]. + greenAmount: integer + A nonnegative integer in [0,255]. + blueAmount: integer + A nonnegative integer in [0,255]. + + Returns + ------- + list + A list of error message(s) if there was a problem setting + the tick color; an empty list otherwise. + """ + result = self.con.cmdTagList("setGridTickColor", + imageView=self.getId(), + redAmount=redAmount, + greenAmount=greenAmount, + blueAmount=blueAmount) + return result From b231eeae55b7752046025b1eba972475c212bf7a Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Mon, 27 Jul 2015 13:14:46 -0600 Subject: [PATCH 21/24] New scripted command: setGridTickThickness() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++ 6 files changed, 74 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 88724527..71ff21de 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1138,6 +1138,11 @@ QStringList Controller::setGridTickColor( int redAmount, int greenAmount, int bl return result; } +QString Controller::setGridTickThickness( int tickThickness ) { + QString result = m_gridControls->setTickThickness( tickThickness ); + return result; +} + void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 1586ed2d..4b09dee7 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -450,6 +450,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QStringList setGridTickColor( int redAmount, int greenAmount, int blueAmount ); + /** + * Set the length of the grid ticks. + * @param tickThickness - a positive integer. + * @return an error message if the tick thickness was not successfully set; + * an empty string otherwise. + */ + QString setGridTickThickness( int tickThickness ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 932ed579..b5f1f182 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1832,3 +1832,29 @@ QStringList ScriptFacade::setGridTickColor( const QString& controlId, int redAmo } return resultList; } + +QStringList ScriptFacade::setGridTickThickness( const QString& controlId, int tickThickness ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridTickThickness( tickThickness ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index e5e83030..12214d57 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -716,6 +716,15 @@ class ScriptFacade: public QObject { */ QStringList setGridTickColor( const QString& controlId, int redAmount, int greenAmount, int blueAmount ); + /** + * Set the length of the grid ticks. + * @param controlId the unique server-side id of an object managing a controller. + * @param tickThickness - a positive integer. + * @return an error message if the tick thickness was not successfully set; + * an empty string otherwise. + */ + QStringList setGridTickThickness( const QString& controlId, int tickThickness ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 977e2a4d..32365a4d 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -553,6 +553,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridTickColor( imageView, redAmount, greenAmount, blueAmount ); } + else if ( cmd == "setgridtickthickness" ) { + QString imageView = args["imageView"].toString(); + int tickThickness = args["tickThickness"].toInt(); + result = m_scriptFacade->setGridTickThickness( imageView, tickThickness ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 7f71e70f..891b4f36 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -1033,3 +1033,23 @@ def setGridTickColor(self, redAmount, greenAmount, blueAmount): greenAmount=greenAmount, blueAmount=blueAmount) return result + + def setGridTickThickness(self, tickThickness): + """ + Set the length of the grid ticks. + + Parameters + ---------- + tickThickness: integer + A positive integer. + + Returns + ------- + list + Return an error message if the tick thickness was not + successfully set; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridTickThickness", + imageView=self.getId(), + tickThickness=tickThickness) + return result From 1e242635c5a7b20314e38f7f1cec744975d8d335 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Mon, 27 Jul 2015 13:49:44 -0600 Subject: [PATCH 22/24] New scripted command: setGridTickTransparency() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 9 +++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 10 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 21 +++++++++++++++ 6 files changed, 77 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 71ff21de..25804290 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1143,6 +1143,11 @@ QString Controller::setGridTickThickness( int tickThickness ) { return result; } +QString Controller::setGridTickTransparency( int transparency ) { + QString result = m_gridControls->setTickTransparency( transparency ); + return result; +} + void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 4b09dee7..16006198 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -458,6 +458,15 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridTickThickness( int tickThickness ); + /** + * Set the transparency of the grid tick marks. + * @param transparency - a nonnegative integer between 0 and 255 with 255 being + * opaque. + * @return an error message if the transparency was not successfully set; an + * empty string otherwise. + */ + QString setGridTickTransparency( int transparency ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index b5f1f182..3ec52f97 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1858,3 +1858,29 @@ QStringList ScriptFacade::setGridTickThickness( const QString& controlId, int ti } return resultList; } + +QStringList ScriptFacade::setGridTickTransparency( const QString& controlId, int transparency ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridTickTransparency( transparency ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 12214d57..425bed6c 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -725,6 +725,16 @@ class ScriptFacade: public QObject { */ QStringList setGridTickThickness( const QString& controlId, int tickThickness ); + /** + * Set the transparency of the grid tick marks. + * @param controlId the unique server-side id of an object managing a controller. + * @param transparency - a nonnegative integer between 0 and 255 with 255 being + * opaque. + * @return an error message if the transparency was not successfully set; an + * empty string otherwise. + */ + QStringList setGridTickTransparency( const QString& controldId, int transparency ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 32365a4d..78bdb45b 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -559,6 +559,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridTickThickness( imageView, tickThickness ); } + else if ( cmd == "setgridticktransparency" ) { + QString imageView = args["imageView"].toString(); + int transparency = args["transparency"].toInt(); + result = m_scriptFacade->setGridTickTransparency( imageView, transparency ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 891b4f36..07140721 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -1053,3 +1053,24 @@ def setGridTickThickness(self, tickThickness): imageView=self.getId(), tickThickness=tickThickness) return result + + def setGridTickTransparency(self, transparency): + """ + Set the transparency of the grid tick marks. + + Parameters + ---------- + transparency: integer + A nonnegative integer between 0 and 255 with 255 being + opaque. + + Returns + ------- + list + An error message if the transparency was not successfully + set; an empty string otherwise. + """ + result = self.con.cmdTagList("setGridTickTransparency", + imageView=self.getId(), + transparency=transparency) + return result From 5aad6e460b146d07112b4314d6d8590d3b78981b Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Mon, 27 Jul 2015 14:20:46 -0600 Subject: [PATCH 23/24] New scripted command: setGridTheme() --- .../cpp/common/Data/Image/Controller.cpp | 5 ++++ Skeleton3/cpp/common/Data/Image/Controller.h | 8 ++++++ .../common/ScriptedClient/ScriptFacade.cpp | 26 +++++++++++++++++++ .../cpp/common/ScriptedClient/ScriptFacade.h | 9 +++++++ .../ScriptedCommandInterpreter.cpp | 6 +++++ Skeleton3/scriptedClient/image.py | 20 ++++++++++++++ 6 files changed, 74 insertions(+) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index 25804290..0c6bfd30 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1148,6 +1148,11 @@ QString Controller::setGridTickTransparency( int transparency ) { return result; } +QString Controller::setGridTheme( const QString& theme ) { + QString result = m_gridControls->setTheme( theme ); + return result; +} + void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index 16006198..cabdfa39 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -467,6 +467,14 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ QString setGridTickTransparency( int transparency ); + /** + * Set the grid canvas theme. + * @param theme - an identifier for a canvas theme. + * @return an error message if the theme was not successfully set; an empty + * string otherwise. + */ + QString setGridTheme( const QString& theme ); + virtual ~Controller(); static const QString CLASS_NAME; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index 3ec52f97..38620ddb 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1884,3 +1884,29 @@ QStringList ScriptFacade::setGridTickTransparency( const QString& controlId, int } return resultList; } + +QStringList ScriptFacade::setGridTheme( const QString& controlId, const QString& theme ) { + QStringList resultList; + ObjectManager* objMan = ObjectManager::objectManager(); + QString id = objMan->parseId( controlId ); + Carta::State::CartaObject* obj = objMan->getObject( id ); + if ( obj != nullptr ){ + Carta::Data::Controller* controller = dynamic_cast(obj); + if ( controller != nullptr ){ + QString result = controller->setGridTheme( theme ); + resultList = QStringList( result ); + } + else { + resultList = QStringList( "error" ); + resultList.append( "An unknown error has occurred." ); + } + } + else { + resultList = QStringList( "error" ); + resultList.append( "The specified image view could not be found." ); + } + if ( resultList.length() == 0 ) { + resultList = QStringList(""); + } + return resultList; +} diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h index 425bed6c..69032cc1 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.h @@ -735,6 +735,15 @@ class ScriptFacade: public QObject { */ QStringList setGridTickTransparency( const QString& controldId, int transparency ); + /** + * Set the grid canvas theme. + * @param controlId the unique server-side id of an object managing a controller. + * @param theme - an identifier for a canvas theme. + * @return an error message if the theme was not successfully set; an empty + * string otherwise. + */ + QStringList setGridTheme( const QString& controlId, const QString& theme ); + /* * Singleton accessor. * @return the unique instance of this object. diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp index 78bdb45b..6a4a2615 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptedCommandInterpreter.cpp @@ -565,6 +565,12 @@ ScriptedCommandInterpreter::tagMessageReceivedCB( TagMessage tm ) result = m_scriptFacade->setGridTickTransparency( imageView, transparency ); } + else if ( cmd == "setgridtheme" ) { + QString imageView = args["imageView"].toString(); + QString theme = args["theme"].toString(); + result = m_scriptFacade->setGridTheme( imageView, theme ); + } + /// commands for testing else if ( cmd == "fakecommand" ) { diff --git a/Skeleton3/scriptedClient/image.py b/Skeleton3/scriptedClient/image.py index 07140721..01fc39f8 100644 --- a/Skeleton3/scriptedClient/image.py +++ b/Skeleton3/scriptedClient/image.py @@ -1074,3 +1074,23 @@ def setGridTickTransparency(self, transparency): imageView=self.getId(), transparency=transparency) return result + + def setGridTheme(self, theme): + """ + Set the canvas theme. + + Parameters + ---------- + theme: string + An identifier for a canvas theme. + + Returns + ------- + list + An error message if the theme was not successfully set; an + empty string otherwise. + """ + result = self.con.cmdTagList("setGridTheme", + imageView=self.getId(), + theme=theme) + return result From 7ae905ea88279b382f56b7cd55932d94ad363f75 Mon Sep 17 00:00:00 2001 From: Jeff Taylor Date: Tue, 28 Jul 2015 16:38:09 -0600 Subject: [PATCH 24/24] Removed GridControl methods from Controller. --- .../cpp/common/Data/Image/Controller.cpp | 109 ---------- Skeleton3/cpp/common/Data/Image/Controller.h | 186 +----------------- .../common/ScriptedClient/ScriptFacade.cpp | 44 ++--- Skeleton3/scriptedClient/cartaview.py | 8 +- 4 files changed, 30 insertions(+), 317 deletions(-) diff --git a/Skeleton3/cpp/common/Data/Image/Controller.cpp b/Skeleton3/cpp/common/Data/Image/Controller.cpp index fb3057e5..78222ffd 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.cpp +++ b/Skeleton3/cpp/common/Data/Image/Controller.cpp @@ -1127,115 +1127,6 @@ QString Controller::setClipValue( double clipVal ) { return result; } -QStringList Controller::setGridAxesColor( int red, int green, int blue ) { - QStringList result = m_gridControls->setAxesColor( red, green, blue ); - return result; -} - -QString Controller::setGridAxesThickness( int thickness ) { - QString result = m_gridControls->setAxesThickness( thickness ); - return result; -} - -QString Controller::setGridAxesTransparency( int transparency ) { - QString result = m_gridControls->setAxesTransparency( transparency ); - return result; -} - -void Controller::setGridApplyAll( bool applyAll ) { - m_gridControls->setApplyAll( applyAll ); -} - -QString Controller::setGridCoordinateSystem( const QString& coordSystem ) { - QString result = m_gridControls->setCoordinateSystem( coordSystem ); - return result; -} - -QString Controller::setGridFontFamily( const QString& fontFamily ) { - QString result = m_gridControls->setFontFamily( fontFamily ); - return result; -} - -QString Controller::setGridFontSize( int fontSize ) { - QString result = m_gridControls->setFontSize( fontSize ); - return result; -} - -QStringList Controller::setGridColor( int redAmount, int greenAmount, int blueAmount ) { - QStringList result = m_gridControls->setGridColor( redAmount, greenAmount, blueAmount ); - return result; -} - -QString Controller::setGridSpacing( double spacing ) { - QString result = m_gridControls->setGridSpacing( spacing ); - return result; -} - -QString Controller::setGridThickness( int thickness ) { - QString result = m_gridControls->setGridThickness( thickness ); - return result; -} - -QString Controller::setGridTransparency( int transparency ) { - QString result = m_gridControls->setGridTransparency( transparency ); - return result; -} - -QStringList Controller::setGridLabelColor( int redAmount, int greenAmount, int blueAmount ) { - QStringList result = m_gridControls->setLabelColor( redAmount, greenAmount, blueAmount ); - return result; -} - -QString Controller::setShowGridAxis( bool showAxis ) { - QString result = m_gridControls->setShowAxis( showAxis ); - return result; -} - -QString Controller::setShowGridCoordinateSystem( bool showCoordinateSystem ) { - QString result = m_gridControls->setShowCoordinateSystem( showCoordinateSystem ); - return result; -} - -QString Controller::setShowGridLines( bool showGridLines ) { - QString result = m_gridControls->setShowGridLines( showGridLines ); - return result; -} - -QString Controller::setShowGridInternalLabels( bool showInternalLabels ) { - QString result = m_gridControls->setShowInternalLabels( showInternalLabels ); - return result; -} - -QString Controller::setShowGridStatistics( bool showStatistics ) { - QString result = m_gridControls->setShowStatistics( showStatistics ); - return result; -} - -QString Controller::setShowGridTicks( bool showTicks ) { - QString result = m_gridControls->setShowTicks( showTicks ); - return result; -} - -QStringList Controller::setGridTickColor( int redAmount, int greenAmount, int blueAmount ) { - QStringList result = m_gridControls->setTickColor( redAmount, greenAmount, blueAmount ); - return result; -} - -QString Controller::setGridTickThickness( int tickThickness ) { - QString result = m_gridControls->setTickThickness( tickThickness ); - return result; -} - -QString Controller::setGridTickTransparency( int transparency ) { - QString result = m_gridControls->setTickTransparency( transparency ); - return result; -} - -QString Controller::setGridTheme( const QString& theme ) { - QString result = m_gridControls->setTheme( theme ); - return result; -} - void Controller::_viewResize( const QSize& newSize ){ for ( int i = 0; i < m_datas.size(); i++ ){ m_datas[i]->_viewResize( newSize ); diff --git a/Skeleton3/cpp/common/Data/Image/Controller.h b/Skeleton3/cpp/common/Data/Image/Controller.h index d05951d8..a8ddfbe1 100755 --- a/Skeleton3/cpp/common/Data/Image/Controller.h +++ b/Skeleton3/cpp/common/Data/Image/Controller.h @@ -300,187 +300,9 @@ class Controller: public QObject, public Carta::State::CartaObject, public IColo */ void resetState( const QString& state ); - /** - * Set the grid axes color. - * @param redAmount - an integer in [0, 255] indicating the amount of red. - * @param greenAmount an integer in [0,255] indicating the amount of green. - * @param blueAmount - an integer in [0,255] indicating the amount of blue. - * @return a list of errors or an empty list if the color was successfully set. - */ - QStringList setGridAxesColor( int redAmount, int greenAmount, int blueAmount ); - - /** - * Set grid axis thickness. - * @param thickness - a positive integer. - * @return an error message if the thickness could not be set or an empty string - * if the thickness was successfully set. - */ - QString setGridAxesThickness( int thickness ); - - /** - * Set the grid axis transparency. - * @param transparency - a nonnegative integer between 0 and 255, with 255 opaque. - * @return an error message if the transparency could not be set or an empty string - * if it was successfully set. - */ - QString setGridAxesTransparency( int transparency ); - - /** - * Set whether or not grid control settings should apply to all images on the set. - * @param applyAll - true if the settings apply to all images on the stack; - * false otherwise. - */ - void setGridApplyAll( bool applyAll ); - - /** - * Set the grid coordinate system. - * @param coordSystem - an identifier for a grid coordinate system. - * @return an error message if there was a problem setting the coordinate system; - * an empty string otherwise. - */ - QString setGridCoordinateSystem( const QString& coordSystem ); - - /** - * Set the font family used for grid labels. - * @param fontFamily - an identifier for a font family. - * @return an error message if there was a problem setting the font family; - * an empty string otherwise. - */ - QString setGridFontFamily( const QString& fontFamily ); - - /** - * Set the font size used for grid labels. - * @param fontSize - an identifier for a font point size. - * @return an error message if there was a problem setting the font point size; - * an empty string otherwise. - */ - QString setGridFontSize( int fontSize ); - - /** - * Set the grid color. - * @param redAmount - an integer in [0, 255] indicating the amount of red. - * @param greenAmount an integer in [0,255] indicating the amount of green. - * @param blueAmount - an integer in [0,255] indicating the amount of blue. - * @return a list of errors or an empty list if the color was successfully set. - */ - QStringList setGridColor( int redAmount, int greenAmount, int blueAmount ); - - /** - * Set the spacing between grid lines. - * @param spacing - the grid spacing in [0,1] with 1 having the least amount of spacing. - * @return an error message if there was a problem setting the grid spacing; an empty - * string otherwise. - */ - QString setGridSpacing( double spacing ); - - /** - * Set the thickness of the grid lines. - * @param thickness -a positive integer. - * @return an error message if there was a problem setting the grid line thickness; an empty - * string otherwise. - */ - QString setGridThickness( int thickness ); - - /** - * Set the transparency of the grid. - * @param transparency - the amount of transparency in [0,255] with 255 completely opaque. - * @return an error message if there was a problem setting the transparency; an empty - * string otherwise. - */ - QString setGridTransparency( int transparency ); - - /** - * Set the color of grid labels color. - * @param redAmount - an integer in [0, 255] indicating the amount of red. - * @param greenAmount an integer in [0,255] indicating the amount of green. - * @param blueAmount - an integer in [0,255] indicating the amount of blue. - * @return a list of errors or an empty list if the color was successfully set. - */ - QStringList setGridLabelColor( int redAmount, int greenAmount, int blueAmount ); - - /** - * Set whether or not the grid axes should be shown. - * @param showAxis - true if the axes should be shown; false otherwise. - * @return an error message if there was a problem changing the visibility of the - * axes; an empty string otherwise. - */ - QString setShowGridAxis( bool showAxis ); - - /** - * Set whether or not the grid coordinate system should be visible. - * @param showCoordinateSystem - true if the coordinate system should be shown; - * false otherwise. - * @return an error message if there was a problem setting the coordinate system; - * an empty string otherwise. - */ - QString setShowGridCoordinateSystem( bool showCoordinateSystem ); - - /** - * Set whether or not the grid lines should be shown. - * @param showGridLines - true if the grid lines should be shown; false otherwise. - * @return an error message if there was a problem changing the visibility of the - * grid; an empty string otherwise. - */ - QString setShowGridLines( bool showGridLines ); - - /** - * Set whether or not the grid axis should be internal or external. - * @param showInternalLabels - true if the axes should be internal; false otherwise. - * @return an error message if there was a problem setting the axes internal/external; - * false otherwise. - */ - QString setShowGridInternalLabels( bool showInternalLabels ); - - /** - * Sets whether or not cursor position image statistics should be shown. - * @param showStatistics - true if cursor statistics should be shown; false otherwise. - * @return an error message if there was a problem hiding/showing cursor statistics; - * an empty string otherwise. - */ - QString setShowGridStatistics( bool showStatistics ); - - /** - * Set whether or not to show grid axis ticks. - * @param showTicks - true if the grid axis ticks should be shown; false otherwise. - * @return an error message if there was a problem setting the visibility of grid axis - * ticks; and empty string otherwise. - */ - QString setShowGridTicks( bool showTicks ); - - /** - * Set the color of the grid tick marks. - * @param redAmount - a nonnegative integer in [0,255]. - * @param greenAmount - a nonnegative integer in [0,255]. - * @param blueAmount - a nonnegative integer in [0,255]. - * @return a list of error message(s) if there was a problem setting the tick - * color; an empty list otherwise. - */ - QStringList setGridTickColor( int redAmount, int greenAmount, int blueAmount ); - - /** - * Set the length of the grid ticks. - * @param tickThickness - a positive integer. - * @return an error message if the tick thickness was not successfully set; - * an empty string otherwise. - */ - QString setGridTickThickness( int tickThickness ); - - /** - * Set the transparency of the grid tick marks. - * @param transparency - a nonnegative integer between 0 and 255 with 255 being - * opaque. - * @return an error message if the transparency was not successfully set; an - * empty string otherwise. - */ - QString setGridTickTransparency( int transparency ); - - /** - * Set the grid canvas theme. - * @param theme - an identifier for a canvas theme. - * @return an error message if the theme was not successfully set; an empty - * string otherwise. - */ - QString setGridTheme( const QString& theme ); + std::shared_ptr getGridControls() { + return m_gridControls; + } virtual ~Controller(); @@ -586,7 +408,7 @@ private slots: //Data View std::shared_ptr m_view; - std::unique_ptr m_gridControls; + std::shared_ptr m_gridControls; std::unique_ptr m_settings; diff --git a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp index b130ad00..5cbb1336 100644 --- a/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp +++ b/Skeleton3/cpp/common/ScriptedClient/ScriptFacade.cpp @@ -1422,7 +1422,7 @@ QStringList ScriptFacade::setGridAxesColor( const QString& controlId, int red, i if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - resultList = controller->setGridAxesColor( red, green, blue ); + resultList = controller->getGridControls()->setAxesColor( red, green, blue ); } else { resultList = QStringList( "error" ); @@ -1447,7 +1447,7 @@ QStringList ScriptFacade::setGridAxesThickness( const QString& controlId, int th if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridAxesThickness( thickness ); + QString result = controller->getGridControls()->setAxesThickness( thickness ); resultList = QStringList( result ); } else { @@ -1473,7 +1473,7 @@ QStringList ScriptFacade::setGridAxesTransparency( const QString& controlId, int if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridAxesTransparency( transparency ); + QString result = controller->getGridControls()->setAxesTransparency( transparency ); resultList = QStringList( result ); } else { @@ -1499,7 +1499,7 @@ QStringList ScriptFacade::setGridApplyAll( const QString& controlId, bool applyA if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - controller->setGridApplyAll( applyAll ); + controller->getGridControls()->setApplyAll( applyAll ); } else { resultList = QStringList( "error" ); @@ -1521,7 +1521,7 @@ QStringList ScriptFacade::setGridCoordinateSystem( const QString& controlId, con if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridCoordinateSystem( coordSystem ); + QString result = controller->getGridControls()->setCoordinateSystem( coordSystem ); resultList = QStringList( result ); } else { @@ -1547,7 +1547,7 @@ QStringList ScriptFacade::setGridFontFamily( const QString& controlId, const QSt if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridFontFamily( fontFamily ); + QString result = controller->getGridControls()->setFontFamily( fontFamily ); resultList = QStringList( result ); } else { @@ -1573,7 +1573,7 @@ QStringList ScriptFacade::setGridFontSize( const QString& controlId, int fontSiz if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridFontSize( fontSize ); + QString result = controller->getGridControls()->setFontSize( fontSize ); resultList = QStringList( result ); } else { @@ -1599,7 +1599,7 @@ QStringList ScriptFacade::setGridColor( const QString& controlId, int redAmount, if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - resultList = controller->setGridColor( redAmount, greenAmount, blueAmount ); + resultList = controller->getGridControls()->setGridColor( redAmount, greenAmount, blueAmount ); } else { resultList = QStringList( "error" ); @@ -1624,7 +1624,7 @@ QStringList ScriptFacade::setGridSpacing( const QString& controlId, double spaci if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridSpacing( spacing ); + QString result = controller->getGridControls()->setGridSpacing( spacing ); resultList = QStringList( result ); } else { @@ -1650,7 +1650,7 @@ QStringList ScriptFacade::setGridThickness( const QString& controlId, int thickn if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridThickness( thickness ); + QString result = controller->getGridControls()->setGridThickness( thickness ); resultList = QStringList( result ); } else { @@ -1677,7 +1677,7 @@ QStringList ScriptFacade::setGridTransparency( const QString& controlId, int tra if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridTransparency( transparency ); + QString result = controller->getGridControls()->setGridTransparency( transparency ); resultList = QStringList( result ); } else { @@ -1703,7 +1703,7 @@ QStringList ScriptFacade::setGridLabelColor( const QString& controlId, int redAm if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - resultList = controller->setGridLabelColor( redAmount, greenAmount, blueAmount ); + resultList = controller->getGridControls()->setLabelColor( redAmount, greenAmount, blueAmount ); } else { resultList = QStringList( "error" ); @@ -1728,7 +1728,7 @@ QStringList ScriptFacade::setShowGridAxis( const QString& controlId, bool showAx if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setShowGridAxis( showAxis ); + QString result = controller->getGridControls()->setShowAxis( showAxis ); resultList = QStringList( result ); } else { @@ -1751,7 +1751,7 @@ QStringList ScriptFacade::setShowGridCoordinateSystem( const QString& controlId, if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setShowGridCoordinateSystem( showCoordinateSystem ); + QString result = controller->getGridControls()->setShowCoordinateSystem( showCoordinateSystem ); resultList = QStringList( result ); } else { @@ -1774,7 +1774,7 @@ QStringList ScriptFacade::setShowGridLines( const QString& controlId, bool showG if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setShowGridLines( showGridLines ); + QString result = controller->getGridControls()->setShowGridLines( showGridLines ); resultList = QStringList( result ); } else { @@ -1797,7 +1797,7 @@ QStringList ScriptFacade::setShowGridInternalLabels( const QString& controlId, b if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setShowGridInternalLabels( showInternalLabels ); + QString result = controller->getGridControls()->setShowInternalLabels( showInternalLabels ); resultList = QStringList( result ); } else { @@ -1820,7 +1820,7 @@ QStringList ScriptFacade::setShowGridStatistics( const QString& controlId, bool if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setShowGridStatistics( showStatistics ); + QString result = controller->getGridControls()->setShowStatistics( showStatistics ); resultList = QStringList( result ); } else { @@ -1843,7 +1843,7 @@ QStringList ScriptFacade::setShowGridTicks( const QString& controlId, bool showT if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setShowGridTicks( showTicks ); + QString result = controller->getGridControls()->setShowTicks( showTicks ); resultList = QStringList( result ); } else { @@ -1866,7 +1866,7 @@ QStringList ScriptFacade::setGridTickColor( const QString& controlId, int redAmo if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - resultList = controller->setGridTickColor( redAmount, greenAmount, blueAmount ); + resultList = controller->getGridControls()->setTickColor( redAmount, greenAmount, blueAmount ); } else { resultList = QStringList( "error" ); @@ -1891,7 +1891,7 @@ QStringList ScriptFacade::setGridTickThickness( const QString& controlId, int ti if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridTickThickness( tickThickness ); + QString result = controller->getGridControls()->setTickThickness( tickThickness ); resultList = QStringList( result ); } else { @@ -1917,7 +1917,7 @@ QStringList ScriptFacade::setGridTickTransparency( const QString& controlId, int if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridTickTransparency( transparency ); + QString result = controller->getGridControls()->setTickTransparency( transparency ); resultList = QStringList( result ); } else { @@ -1943,7 +1943,7 @@ QStringList ScriptFacade::setGridTheme( const QString& controlId, const QString& if ( obj != nullptr ){ Carta::Data::Controller* controller = dynamic_cast(obj); if ( controller != nullptr ){ - QString result = controller->setGridTheme( theme ); + QString result = controller->getGridControls()->setTheme( theme ); resultList = QStringList( result ); } else { diff --git a/Skeleton3/scriptedClient/cartaview.py b/Skeleton3/scriptedClient/cartaview.py index e5d73cfc..9b61368c 100644 --- a/Skeleton3/scriptedClient/cartaview.py +++ b/Skeleton3/scriptedClient/cartaview.py @@ -43,8 +43,8 @@ def addLink(self, imageView): Returns ------- list - An error message if there was a problem adding the link; empty - otherwise. + An error message if there was a problem adding the link; + empty otherwise. """ result = self.con.cmdTagList("addLink", sourceView=self.getId(), destView=imageView.getId()) @@ -64,8 +64,8 @@ def removeLink(self, imageView): Returns ------- list - An error message if there was a problem removing the link; empty - otherwise. + An error message if there was a problem removing the link; + empty otherwise. """ result = self.con.cmdTagList("removeLink", sourceView=self.getId(), destView=imageView.getId())