Isis 3 Programmer Reference
Strategy.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "Strategy.h"
8
9// Qt library
10#include <QScopedPointer>
11#include <QString>
12#include <QStringList>
13
14// boost library
15#include <boost/foreach.hpp>
16
17// other ISIS
18#include "IException.h"
19#include "GisGeometry.h"
20#include "Progress.h"
21#include "PvlFlatMap.h"
22#include "PvlObject.h"
23#include "Resource.h"
24
25using namespace std;
26
27namespace Isis {
28
33 Strategy::Strategy() : m_globals(), m_definition(new PvlObject("Strategy")),
34 m_name("Strategy"), m_type("Counter"),
35 m_total(0), m_applyDiscarded(false), m_debug(false),
36 m_progress() {
37 }
38
39
47 Strategy::Strategy(const QString &name, const QString &type) :
48 m_globals(),
49 m_definition(new PvlObject(name)),
50 m_name(name), m_type(type), m_total(0),
51 m_applyDiscarded(false), m_debug(false), m_progress() {
52 }
53
54
76 Strategy::Strategy(const PvlObject &definition, const ResourceList &globals) :
77 m_globals(globals), m_definition(new PvlObject(definition)),
78 m_name("Strategy"), m_type("Unknown"),
79 m_total(0), m_applyDiscarded(false), m_debug(false), m_progress() {
81 m_name = parms.get("Name");
82 m_type = parms.get("Type");
83 m_applyDiscarded = toBool(parms.get("ApplyToDiscarded", "false"));
84 m_debug = toBool(parms.get("Debug", "false"));
86 }
87
88
94
95
101 QString Strategy::name() const {
102 return (m_name);
103 }
104
105
111 QString Strategy::type() const {
112 return (m_type);
113 }
114
115
121 void Strategy::setName(const QString &name) {
122 m_name = name;
123 return;
124 }
125
126
133 void Strategy::setType(const QString &type) {
134 m_type = type;
135 return;
136 }
137
138
147
148
159 const ResourceList &globals) const {
160
161#if 0
162 ResourceList v_globals(globals);
163 v_globals.append(myGlobals);
164#else
165 ResourceList v_globals;
166 v_globals.push_back(myGlobals);
167 v_globals.append(globals);
168#endif
169 return ( v_globals );
170 }
171
172
173 const PvlObject &Strategy::getDefinition() const {
174 return (*m_definition);
175 }
176
177
188
189
201 QString Strategy::description() const {
202 if ( m_definition->hasKeyword("Description") ) {
203 return (m_definition->findKeyword("Description")[0]);
204 }
205 else {
206 QString descr = "Strategy::" + name() + " is running a " + type() +
207 " algorithm.";
208 return (descr);
209 }
210 }
211
212
226 return ( apply(resources, getGlobalDefaults()) );
227 }
228
229
243 return ( apply( resource, getGlobalDefaults()) );
244 }
245
246
268 int Strategy::apply(ResourceList &resources, const ResourceList &globals) {
269 return ( applyToResources(resources, globals) );
270 }
271
272
281 int Strategy::apply(SharedResource &resource, const ResourceList &globals) {
282 if ( isDebug() ) {
283 cout << "Empty apply is called...\n";
284 }
285 return (1);
286 }
287
288
294 unsigned int Strategy::totalProcessed() const {
295 return (m_total);
296 }
297
298
304 m_applyDiscarded = true;
305 return;
306 }
307
308
316 return (m_applyDiscarded);
317 }
318
319
325 m_applyDiscarded = false;
326 return;
327 }
328
329
337 int Strategy::applyToResources(ResourceList &resources, const ResourceList &globals) {
338
339 initProgress( ( isApplyToDiscarded() ) ? resources.size() : countActive(resources) );
340
341 int result = 0;
342 BOOST_FOREACH ( SharedResource resource, resources ) {
343 if ( resource->isDiscarded() ) {
344 if (true == isApplyToDiscarded() ) {
345 result += apply(resource, globals);
346 processed();
347 }
348 }
349 else {
350 result += apply(resource, globals);
351 processed();
352 }
353 }
354 return (result);
355 }
356
357
364 unsigned int Strategy::processed() {
365 m_total++;
366 if ( doShowProgress() && !m_progress.isNull() ) {
367 m_progress->CheckStatus();
368 }
369
370 return (m_total);
371 }
372
373
378 m_total = 0;
379 return;
380 }
381
382
392 int Strategy::countActive(const ResourceList &resources) const {
393 return ( resources.size() - countDiscarded(resources) );
394 }
395
396
406 int Strategy::countDiscarded(const ResourceList &resources) const {
407 int n = 0;
408 BOOST_FOREACH ( SharedResource resource, resources ) {
409 if ( resource->isDiscarded() ) { n++; }
410 }
411 return (n);
412 }
413
414
425 const QString &name) const {
426 ResourceList alist;
427 if ( resource->hasAsset(name) ) {
428 QVariant v_asset = resource->asset(name);
429 if ( v_asset.canConvert<ResourceList>() ) {
430 alist = v_asset.value<ResourceList>();
431 }
432 }
433
434 return (alist);
435 }
436
437
450 QString Strategy::findReplacement(const QString &target,
451 const ResourceList &globals,
452 const int &index,
453 const QString &defValue) const {
454 BOOST_FOREACH ( const SharedResource keystore, globals ) {
455 if ( keystore->exists(target) ) {
456 if ( keystore->count(target) > index ) {
457 return (keystore->value(target, index));
458 }
459 }
460 }
461
462 return ( defValue );
463 }
464
465
477 QStringList Strategy::qualifiers(const QString &keyspec,
478 const QString &delimiter) const {
479 QStringList parts = keyspec.split(delimiter);
480 return (parts);
481 }
482
483
496 QString Strategy::scanAndReplace(const QString &input, const QString &target,
497 const QString &replacement) const {
498 QString str(input);
499 str.replace(target, replacement, Qt::CaseInsensitive);
500 return (str);
501 }
502
503
522 QString Strategy::translateKeywordArgs(const QString &keyBase,
523 const ResourceList &globals,
524 const QString &defValue) const {
525
526 // Get keyword configuration from definition
528
529 QStringList idArgs; // Argument replacement list
530 QString value;
531
532 QString keyword = keyBase + "Keyword";
533 if ( keys.exists(keyword) ) {
534 idArgs.push_back(keys.get(keyword));
535 value = keys.get(keyBase, "%1");
536 }
537 else {
538 if ( keys.exists(keyBase + "Args") ) {
539 idArgs = keys.allValues(keyBase + "Args");
540 }
541 value = keys.get(keyBase, defValue);
542 }
543
544 return (processArgs(value, idArgs, globals, defValue));
545 }
546
547
570 QString Strategy::processArgs(const QString &value, const QStringList &argKeys,
571 const ResourceList &globals,
572 const QString &defValue) const {
573
574 QString result = value;
575 int i = argKeys.size();
576 BOOST_REVERSE_FOREACH ( QString arg, argKeys ) {
577 QString target("%"+QString::number(i));
578 result = scanAndReplace(result, target, findReplacement(arg,globals,0,defValue));
579 i--;
580 }
581 return (result);
582 }
583
584
594 const {
596 QStringList keySources = keys.allValues("PropagateKeywords");
597 BOOST_FOREACH ( QString key, keySources ) {
598 if ( source->exists(key) ) {
599 target->add(source->keyword(key));
600 }
601 }
602 return;
603 }
604
605
634 SharedResource &resourceB,
635 const QPair<QString, QString> &keySuffix)
636 const {
637
638 // Create the new resource
639 QString id = resourceA->name() + "_" + resourceB->name();
641
642 // See if user wants to restrict keyword propagation to a list
643 QStringList keySources = PvlFlatMap( getDefinitionMap() ).allValues("PropagateKeywords");
644 if ( !keySources.isEmpty() ) {
645 // Propogate only specified keywords from each Resource
646 BOOST_FOREACH ( QString key, keySources ) {
647 if ( resourceA->exists(key) ) {
648 PvlKeyword keyword(resourceA->keyword(key));
649 keyword.setName(keyword.name().append(keySuffix.first));
650 composite->add(keyword);
651 }
652
653 if ( resourceB->exists(key) ) {
654 PvlKeyword keyword(resourceB->keyword(key));
655 keyword.setName(keyword.name().append(keySuffix.second));
656 composite->add(keyword);
657 }
658 }
659 }
660 else {
661 // Propagate all keys from each source to the composite Resource
662 const PvlFlatMap &rkeysA = resourceA->keys();
663 PvlFlatMap::ConstPvlFlatMapIterator pkeys = rkeysA.begin();
664 while ( rkeysA.constEnd() != pkeys) {
665 PvlKeyword keyword(pkeys.value());
666 keyword.setName(keyword.name().append(keySuffix.first));
667 composite->add(keyword);
668 ++pkeys;
669 }
670
671 const PvlFlatMap &rkeysB = resourceB->keys();
672 pkeys = rkeysB.begin();
673 while ( rkeysB.constEnd() != pkeys) {
674 PvlKeyword keyword(pkeys.value());
675 keyword.setName(keyword.name().append(keySuffix.second));
676 composite->add(keyword);
677 ++pkeys;
678 }
679 }
680 return (composite);
681 }
682
683
705 const ResourceList &globals) const {
707
708 // Assume a specific geometry is present
709 QString geom(keys.get("GisGeometry", ""));
710
711 QString giskey;
712 if ( keys.exists("GisGeometryRef") ) { giskey = keys.get("GisGeometryRef"); }
713 if ( keys.exists("GisGeometryKey") ) { giskey = keys.get("GisGeometryKey"); }
714
715 if ( !giskey.isEmpty() ) {
716 if ( !resource->isNull(giskey) ) {
717 geom = resource->value(giskey);
718
719 // Erase key if requested
720 if ( toBool(keys.get("RemoveGisKeywordAfterImport", "false")) ) {
721 resource->erase(giskey);
722 }
723 }
724 }
725
726 // Got a geometry.
727 if ( !geom.isEmpty() ) {
728
729 // Process arguments Allows creation specialized geometry as well
730 if ( keys.exists("GisGeometryArgs") ) {
731 QStringList args = keys.allValues("GisGeometryArgs");
732 geom = processArgs(geom, args, getGlobals(resource, globals));
733 }
734
735 // Get the type
736 QString gisType = keys.get("GisType");
737 int npoints(0);
738 int npointsOrg(0);
739 double tolerance(0.0);
740
741 // Check for Geometry. May want to remove it after parsing/conversion.
742 // These text geometries tend to be huge and consume lots of memory.
743 if ( !geom.isEmpty() ) {
744
745 QScopedPointer<GisGeometry> geosgeom(new GisGeometry(geom, GisGeometry::type(gisType)));
746 if ( geosgeom.isNull() || !geosgeom->isValid() ) return (false);
747
748 npointsOrg = npoints = geosgeom->points();
749 QString gisTolerance = translateKeywordArgs("GisSimplifyTolerance",
750 getGlobals(resource, globals), "");
751
752 if ( !gisTolerance.isEmpty() ) {
753 tolerance = toDouble(gisTolerance);
754 GisGeometry *simple = geosgeom->simplify(tolerance);
755 if ( 0 != simple ) geosgeom.reset(simple);
756 npoints = geosgeom->points();
757 }
758
759 resource->add(geosgeom.take());
760
761 // Add the geometry point count to the resource if requested
762 QString pointsKey = translateKeywordArgs("GisGeometryPointsKey",
763 getGlobals(resource, globals),
764 "");
765 if ( !pointsKey.isEmpty() ) {
766 resource->add(pointsKey, toString(npoints));
767 resource->add(pointsKey+"Original", toString(npointsOrg));
768 resource->add(pointsKey+"Tolerance", toString(tolerance));
769 }
770
771 // Status if requested
772 if ( isDebug() ) {
773 cout << " " << type() << ":" << name() << " has a geometry with "
774 << npoints << " points!\n";
775 if ( npoints != npointsOrg ) {
776 cout << " Geometry has been simplified/reduced from original "
777 << npointsOrg << " points.\n";
778 }
779 }
780 return (true);
781 }
782 }
783
784 // Report geometry status
785 if ( isDebug() ) {
786 cout << " " << type() << ":" << name() << " does not have a geometry!\n";
787 }
788
789 return (false);
790 }
791
792
801 // Create a list of active resources
802 ResourceList v_active;
803 BOOST_FOREACH ( SharedResource resource, resources ) {
804 if ( !resource->isDiscarded() ) { v_active.append(resource); }
805 }
806 return (v_active);
807 }
808
809
815 void Strategy::activateList(ResourceList &resources) const {
816 BOOST_FOREACH ( SharedResource resource, resources ) {
817 resource->activate();
818 }
819 }
820
821
827 void Strategy::deactivateList(ResourceList &resources) const {
828 BOOST_FOREACH ( SharedResource resource, resources ) {
829 resource->discard();
830 }
831 }
832
833
855 ResourceList v_copy;
856 BOOST_FOREACH ( SharedResource resource, resources ) {
857 v_copy.append(SharedResource(resource->copy()));
858 }
859 return ( v_copy);
860 }
861
862
883 const bool &withAssets) const {
884 ResourceList v_clone;
885 BOOST_FOREACH ( SharedResource resource, resources ) {
886 v_clone.append(SharedResource(resource->clone(resource->name(), withAssets)));
887 }
888 return ( v_clone );
889 }
890
891
930 GisGeometry &geom,
931 const ResourceList &globals) {
932
933 QString method = getDefinitionMap().get("GisMethod", "direct").toLower();
934
935 // The programmer is required to ensure a valid geometry provides the
936 // source of the intersection operation.
937 if ( !geom.isValid() ) {
938 QString mess = type() + ":" + name() +
939 "Cannot apply RTree search to bad geometry.";
940 throw IException(IException::Programmer, mess, _FILEINFO_);
941 }
942
943 // Create a list of active resources only
944 ResourceList v_active = activeList(resources);
945
946 // Use direct computation method
947 ResourceList overlaps;
948 if ( "direct" == method ) {
949 if ( isDebug() ) {
950 cout << "Using direct Geom intersects for " << v_active.size() << " geometries...\n";
951 }
952
953 // Direct intersect computations of overlaps has about the same overhead
954 // of constructing an RTree index and running queries.
955 initProgress(v_active.size());
956 BOOST_FOREACH ( SharedResource resource, v_active ) {
957 if ( resource->hasValidGeometry() ) {
958 if ( geom.intersects( *resource->geometry()) ) {
959 overlaps.append(resource);
960 }
961 }
962 processed();
963 }
964 }
965 else {
966
967 // Use RTree method to get potenital overlappers...
968 if ( isDebug() ) {
969 cout << "Allocating " << v_active.size() << " RTree geometries.\n";
970 }
971 GEOSSTRtree *rtree = GEOSSTRtree_create(v_active.size());
972 if ( !rtree ) {
973 QString mess = "GEOS RTree allocation failed for " +
974 toString(v_active.size()) + " geometries.";
975 throw IException(IException::Programmer, mess, _FILEINFO_);
976 }
977
978 if ( isDebug() ) {
979 cout << "GEOS RTree allocated " << v_active.size() << " geometry entries.\n";
980 }
981
982 // Create and query the RTree geometries calling once for each
983 // strategy::appy(SharedResource &) geometry that intersect the envelope.
984 initProgress(v_active.size());
985 int nvalid = 0;
986 for ( int i = 0 ; i < v_active.size() ; i++ ) {
987 if ( v_active[i]->hasValidGeometry() ) {
988 GEOSSTRtree_insert(rtree, v_active[i]->geometry()->geometry(),
989 &v_active[i]);
990 nvalid++;
991 }
992 processed();
993 }
994
995 // Report number found...
996 if ( isDebug() ) {
997 cout << "Valid Geometries found: " << nvalid << " - running query...\n";
998 }
999
1000 // Run the query
1001 GEOSSTRtree_query(rtree, geom.geometry(), &queryCallback, &overlaps);
1002 GEOSSTRtree_destroy(rtree);
1003 }
1004
1005 if ( isDebug() ) {
1006 cout << "Potential Intersections Found: " << overlaps.size() << "\n";
1007 }
1008
1009
1010 // Now apply all intersected geometries to calling strategy. Note to
1011 // properly reflect the intersected list, we must deactivate the entire
1012 // active list after the query search and activate each one prior to
1013 // applying it in the strategy method, which has the responsibility to
1014 // determine validity, and return the proper Resource list status to the
1015 // next strategy.
1016 deactivateList(v_active);
1017
1018 initProgress(overlaps.size());
1019 int n = 0; // Result count
1020 BOOST_FOREACH ( SharedResource resource, overlaps ) {
1021 resource->activate();
1022 n += apply(resource, globals);
1023 processed();
1024 }
1025
1026
1027 if ( isDebug() ) {
1028 cout << "Total valid Intersections Found: " << n << "\n";
1029 }
1030
1031 return (n);
1032 }
1033
1034
1049 void Strategy::queryCallback(void *item, void *userdata) {
1050 SharedResource *resource = (SharedResource *) item; // Maybe fancy casts?
1051 ResourceList *rlist = (ResourceList *) userdata;
1052 rlist->append(*resource);
1053 return;
1054 }
1055
1056
1063 bool Strategy::isDebug() const {
1064 return ( m_debug );
1065 }
1066
1067
1073 return ( !m_progress.isNull() );
1074 }
1075
1076
1077
1101 bool Strategy::initProgress(const int &nsteps, const QString &text) {
1102
1103 QString p_text = text;
1105 bool status = false;
1106
1107 // Check for initialization
1108 if ( !doShowProgress() ) {
1109 PvlFlatMap p_var( getDefinitionMap() );
1110 if ( toBool(p_var.get("ShowProgress", "false")) ) {
1111 m_progress.reset( new Progress() );
1112 if ( p_text.isEmpty() ) {
1113 p_text = type() + "::" + name();
1114 }
1115 }
1116 }
1117
1118
1119 // No check if progress is requested
1120 if ( doShowProgress() ) {
1121 if ( !p_text.isEmpty() ) m_progress->SetText(p_text);
1122 m_progress->SetMaximumSteps(nsteps);
1123 if ( nsteps > 0 ) m_progress->CheckStatus();
1124 status = true;
1125 }
1126
1127 // Set up for systematic processing
1128 return (status);
1129 }
1130
1131
1132 QStringList Strategy::getObjectList(const PvlObject &source) const {
1133 QStringList objList;
1134 PvlObject::ConstPvlObjectIterator object = source.beginObject();
1135 while ( object != source.endObject() ) {
1136 objList << object->name();
1137 ++object;
1138 }
1139 return (objList);
1140 }
1141
1142
1143} //namespace Isis
Encapsulation class provides support for GEOS-C API.
Definition GisGeometry.h:50
Type type() const
Returns the type (origin) of the geometry.
bool intersects(const GisGeometry &target) const
Computes a new geometry from the intersection of the two geomtries.
const GEOSGeometry * geometry() const
Returns the GEOSGeometry object to extend functionality.
bool isValid() const
Determines validity of the geometry contained in this object.
int points() const
Get number of points in geometry.
GisGeometry * simplify(const double &tolerance) const
Simplify complex or overdetermined geoemtry.
Isis exception class.
Definition IException.h:91
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
Program progress reporter.
Definition Progress.h:42
static PvlConstraints withExcludes(const QStringList &excludes)
Static method to construct a PvlConstraints object from a list of names for the PvlObjects and PvlGro...
Provides a flat map of PvlKeywords.
Definition PvlFlatMap.h:218
QStringList allValues(const QString &key) const
Gets all the values associated with a keyword in the PvlFlatMap.
QString get(const QString &key, const int &index=0) const
Gets the value of a keyword in the PvlFlatMap.
bool exists(const QString &key) const
Determines whether a given keyword exists in the PvlFlatMap.
QMap< QString, PvlKeyword >::const_iterator ConstPvlFlatMapIterator
A const iterator for the underling QMap that PvlFlatMap is built on.
Definition PvlFlatMap.h:222
A single keyword-value pair.
Definition PvlKeyword.h:87
void setName(QString name)
Sets the keyword name.
QString name() const
Returns the keyword name.
Definition PvlKeyword.h:103
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
This class provides a resource of PVL keywords for Strategy classes.
Definition Resource.h:54
static void queryCallback(void *item, void *userdata)
Important GEOS query callback for class and overlap geometry.
QString type() const
Accessor method to get the type of strategy.
Definition Strategy.cpp:111
int apply(ResourceList &resources)
Apply algorithm to resource list.
Definition Strategy.cpp:225
QScopedPointer< Progress > m_progress
Progress percentage monitor.
Definition Strategy.h:222
unsigned int totalProcessed() const
Accessor for the total number of resources processed.
Definition Strategy.cpp:294
QString scanAndReplace(const QString &input, const QString &target, const QString &replacement) const
Performs a case insensitive scan of the input string for a substring matching the target string and r...
Definition Strategy.cpp:496
void propagateKeys(SharedResource &source, SharedResource &target) const
Adds the PVL definition keywords from the source to the target.
Definition Strategy.cpp:593
QString processArgs(const QString &value, const QStringList &argKeys, const ResourceList &globals, const QString &defValue="") const
Processes the given string value using the given argument list, resource and default resource.
Definition Strategy.cpp:570
int countActive(const ResourceList &resources) const
Counts the number of active (i.e.
Definition Strategy.cpp:392
virtual ~Strategy()
Destroys the Strategy object.
Definition Strategy.cpp:92
Strategy()
Constructs default Strategy object of name "Strategy" and type "Counter".
Definition Strategy.cpp:33
void setApplyToDiscarded()
Sets Resource as discarded.
Definition Strategy.cpp:303
SharedResource composite(SharedResource &resourceA, SharedResource &resourceB, const QPair< QString, QString > &keySuffix=qMakePair(QString("A"), QString("B"))) const
Create a composite Resource from a pair by merging keywords.
Definition Strategy.cpp:633
int applyToIntersectedGeometry(ResourceList &resources, GisGeometry &geom, const ResourceList &globals)
Identify and apply Strategy to Resources that intersect a geometry.
Definition Strategy.cpp:929
void deactivateList(ResourceList &resources) const
Deactivate all resources contained in the resource list.
Definition Strategy.cpp:827
PvlFlatMap getDefinitionMap() const
Returns the keyword definitions found in the Strategy object.
Definition Strategy.cpp:185
int countDiscarded(const ResourceList &resources) const
Counts the number of non-active (i.e.
Definition Strategy.cpp:406
QString name() const
Accessor method to get the name of the strategy.
Definition Strategy.cpp:101
bool importGeometry(SharedResource &resource, const ResourceList &globals) const
Imports a geometry from the given resource.
Definition Strategy.cpp:704
ResourceList m_globals
A shared pointer to the global Resource of keywords.
Definition Strategy.h:193
ResourceList getGlobalDefaults() const
Accessor method to get the global defaults.
Definition Strategy.cpp:144
QString m_name
A string containing the name of the strategy.
Definition Strategy.h:204
QString findReplacement(const QString &target, const ResourceList &globals, const int &index=0, const QString &defValue="") const
Find keyword replacement value in globals list.
Definition Strategy.cpp:450
QString description() const
Return description for the strategy.
Definition Strategy.cpp:201
ResourceList assetResourceList(const SharedResource &resource, const QString &name) const
Searches the given resource for an asset with the given name and converts it to a ResourceList,...
Definition Strategy.cpp:424
unsigned int processed()
Increments the total number of resources processed and returns the incremented value.
Definition Strategy.cpp:364
QString m_type
A string containing the type of strategy.
Definition Strategy.h:208
ResourceList copyList(const ResourceList &resources) const
Make a copy of the resource list that is independently managed.
Definition Strategy.cpp:854
int applyToResources(ResourceList &resources, const ResourceList &globals)
Applies the strategy algorithms to the resources in the given list.
Definition Strategy.cpp:337
QString translateKeywordArgs(const QString &value, const ResourceList &globals, const QString &defValue="") const
Translates the arguments of the PVL keyword in the PVL definition object.
Definition Strategy.cpp:522
void setName(const QString &name)
Allow derived strategies to reset name (mostly for default constructors)
Definition Strategy.cpp:121
ResourceList getGlobals(SharedResource &myGlobals, const ResourceList &globals) const
Definition Strategy.cpp:158
ResourceList activeList(ResourceList &resources) const
Get list of all active Resources only - no discarded Resources.
Definition Strategy.cpp:800
QStringList qualifiers(const QString &keyspec, const QString &delimiter="::") const
Splits the given keyspec string into a list using the given delimiter string.
Definition Strategy.cpp:477
void activateList(ResourceList &resources) const
Activate all resources contained in the resource list.
Definition Strategy.cpp:815
void setDoNotApplyToDiscarded()
Disables the general application of Strategy algorithm for all Resources regardless of state.
Definition Strategy.cpp:324
bool doShowProgress() const
ResourceList cloneList(const ResourceList &resources, const bool &withAssets=false) const
Create a clone of a Resource list.
Definition Strategy.cpp:882
bool isApplyToDiscarded() const
Accessor for the apply discarded variable.
Definition Strategy.cpp:315
bool isDebug() const
An accessor method so that inherited classes can determine whether to print debug messages for this o...
void setType(const QString &type)
Allow derived strategies to reset type (mostly for default constructors)
Definition Strategy.cpp:133
bool initProgress(const int &nsteps=0, const QString &text="")
Initializes strategy progress monitor if requested by user.
unsigned int m_total
The total number of resources processed.
Definition Strategy.h:212
SharedPvlObject m_definition
A shared pointer to the PvlObject that defines the strategy.
Definition Strategy.h:199
bool m_applyDiscarded
Indicates whether to apply strategy to discarded resources.
Definition Strategy.h:216
bool m_debug
Indicates whether to print debug messages.
Definition Strategy.h:219
void resetProcessed()
Resets the total number of processed resources to zero.
Definition Strategy.cpp:377
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition IString.cpp:38
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition IString.cpp:149
QSharedPointer< Resource > SharedResource
Defintion of a SharedResource, a shared pointer to a Resource object.
Definition Resource.h:166
Namespace for the standard library.