|
| 1 | +/*************************************************************************** |
| 2 | + * Copyright (C) 2007 by Tim Sutton * |
| 3 | + * tim@linfiniti.com * |
| 4 | + * * |
| 5 | + * This program is free software; you can redistribute it and/or modify * |
| 6 | + * it under the terms of the GNU General Public License as published by * |
| 7 | + * the Free Software Foundation; either version 2 of the License, or * |
| 8 | + * (at your option) any later version. * |
| 9 | + * * |
| 10 | + * This program is distributed in the hope that it will be useful, * |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | + * GNU General Public License for more details. * |
| 14 | + * * |
| 15 | + * You should have received a copy of the GNU General Public License * |
| 16 | + * along with this program; if not, write to the * |
| 17 | + * Free Software Foundation, Inc., * |
| 18 | + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | + ***************************************************************************/ |
| 20 | + |
| 21 | + |
| 22 | +#include "omgtipfactory.h" |
| 23 | +#include <QTime> |
| 24 | +//for rand & srand |
| 25 | +#include <cstdlib> |
| 26 | + |
| 27 | + |
| 28 | +OmgTipFactory::OmgTipFactory() : QObject() |
| 29 | +{ |
| 30 | + // Im just doing this in a simple way so |
| 31 | + // its easy for translators...later |
| 32 | + // it its worth the time Ill move this data |
| 33 | + // into a sqlite database... |
| 34 | + OmgTip myTip; |
| 35 | + myTip.setTitle(tr("openModeller is open source")); |
| 36 | + myTip.setContent(tr("openModeller is open source software." |
| 37 | + " This means that the software source code can be freely viewed " |
| 38 | + " and modified. The GPL places a restriction that any modifications " |
| 39 | + " you make must be made available to the openModeller project, and " |
| 40 | + " that you can not create a new version of openModeller under a " |
| 41 | + " 'closed source' license. Visit <a href=\"http://openModeller.sf.net\">" |
| 42 | + " the openModeller home page (http://openModeller.sf.net)</a> for more" |
| 43 | + " information.")); |
| 44 | + addGenericTip(myTip); |
| 45 | + // |
| 46 | + myTip.setTitle(tr("openModeller Publications")); |
| 47 | + myTip.setContent(tr("If you write a scientific paper or any other article" |
| 48 | + " that refers to openModeller we would love to include your work" |
| 49 | + " in the references section of " |
| 50 | + " the openModeller home page (http://openModeller.sf.net).</a>" |
| 51 | + )); |
| 52 | + addGenericTip(myTip); |
| 53 | + myTip.setTitle(tr("Become an openModeller Desktop translator")); |
| 54 | + myTip.setContent(tr("Would you like to see openModeller Desktop" |
| 55 | + " in your native language? We are looking for more translators" |
| 56 | + " and would appreciate your help! The translation process is " |
| 57 | + " fairly straight forward - instructions are available in the " |
| 58 | + " resources section of " |
| 59 | + " the openModeller home page (http://openModeller.sf.net).</a>" |
| 60 | + )); |
| 61 | + addGuiTip(myTip); |
| 62 | + myTip.setTitle(tr("openModeller Mailing lists")); |
| 63 | + myTip.setContent(tr("If you need help using openModeller Desktop" |
| 64 | + " we have a mailing list where users help each other with issues" |
| 65 | + " related to niche modelling and using openModeller Desktop." |
| 66 | + " Details on how to subscribe are in the resources section of" |
| 67 | + " the openModeller home page (http://openModeller.sf.net).</a>" |
| 68 | + )); |
| 69 | + addGuiTip(myTip); |
| 70 | + myTip.setTitle(tr("Is it 'modelling' or 'modeling'?")); |
| 71 | + myTip.setContent(tr("Both spellings are correct. For openModeller" |
| 72 | + " we use the former spelling." |
| 73 | + )); |
| 74 | + addGenericTip(myTip); |
| 75 | + myTip.setTitle(tr("How do I refer to openModeller?")); |
| 76 | + myTip.setContent(tr("openModeller is spelled with a lower case" |
| 77 | + " 'o' at the start of the word - even if its the beginning" |
| 78 | + " of a sentance. We have various subprojects of the openModeller " |
| 79 | + " project and it will help to avoid confusion if you refer to each by" |
| 80 | + " its name:" |
| 81 | + "<ul>" |
| 82 | + "<li>openModeller Library - this is the C++ library that contains" |
| 83 | + " the core logic for carrying out niche modelling" |
| 84 | + "<li>openModeller Console - these are a collection of command" |
| 85 | + " line tools that allow you to run niche models from a unix or" |
| 86 | + " DOS shell, or from a scripting environment." |
| 87 | + "<li>openModeller Web Service - The openModeller Web Service" |
| 88 | + " allows for remote execution of niche models." |
| 89 | + "<li>openModeller Desktop - the openModeller Desktop provides" |
| 90 | + " a graphical user interface for the openModeller Library. It" |
| 91 | + " also includes the capability to run models using the" |
| 92 | + " openModeller Web Service (though this is still considered" |
| 93 | + " experimental)." |
| 94 | + "</ul>" |
| 95 | + )); |
| 96 | + addGenericTip(myTip); |
| 97 | + myTip.setTitle(tr("How can I improve model execution times?")); |
| 98 | + myTip.setContent(tr("Model processing time is typically determined by" |
| 99 | + "<ul>" |
| 100 | + "<li>the algorithm you select,</li>" |
| 101 | + "<li>the number, extents and spatial resolution of your format and environmental layers,</li>" |
| 102 | + "<li>the number of cells excluded by your mask (if any),</li>" |
| 103 | + "<li>in some cases the number of presence and absence points (e.g. distance algs),</li>" |
| 104 | + "<li>the speed of the computer the model is running on (CPU, disk access etc).</li>" |
| 105 | + "</ul>" |
| 106 | + "So if you want to improve model processing times you need to adjust " |
| 107 | + "one of these variables. One thing noticed quite commonly is that people " |
| 108 | + "use extremely high resolution datasets that often carry little " |
| 109 | + "additional information over lower resolution equivalents. For example " |
| 110 | + "interpolating widely dispersed weather station data to produce a 50cm " |
| 111 | + "raster probably carries little additional value over for example using " |
| 112 | + "10m2 pixels.<br>" |
| 113 | + "Another area of performance improvement you can look at is " |
| 114 | + "preselecting environmental variables using techniques such as Chi " |
| 115 | + "Square test. Future versions of openModeller will integrate the ability " |
| 116 | + "to do this type of preselection." |
| 117 | + )); |
| 118 | + addGenericTip(myTip); |
| 119 | + /* Template for adding more tips |
| 120 | + myTip.setTitle(tr("")); |
| 121 | + myTip.setContent(tr("" |
| 122 | + )); |
| 123 | + addGenericTip(myTip); |
| 124 | + */ |
| 125 | +} |
| 126 | + |
| 127 | +OmgTipFactory::~OmgTipFactory() |
| 128 | +{ |
| 129 | + |
| 130 | +} |
| 131 | +//private helper method |
| 132 | +void OmgTipFactory::addGuiTip(OmgTip theTip) |
| 133 | +{ |
| 134 | + mGuiTips << theTip; |
| 135 | + mAllTips << theTip; |
| 136 | +} |
| 137 | +//private helper method |
| 138 | +void OmgTipFactory::addGenericTip(OmgTip theTip) |
| 139 | +{ |
| 140 | + mGenericTips << theTip; |
| 141 | + mAllTips << theTip; |
| 142 | +} |
| 143 | +OmgTip OmgTipFactory::getTip() |
| 144 | +{ |
| 145 | + srand(QTime::currentTime().msec()); |
| 146 | + int myRand = rand(); |
| 147 | + int myValue = static_cast<int> (myRand % mAllTips.count()); //range [0,(count-1)] |
| 148 | + OmgTip myTip = mAllTips.at(myValue); |
| 149 | + return myTip; |
| 150 | +} |
| 151 | +OmgTip OmgTipFactory::getTip(int thePosition) |
| 152 | +{ |
| 153 | + OmgTip myTip = mAllTips.at(thePosition); |
| 154 | + return myTip; |
| 155 | +} |
| 156 | +OmgTip OmgTipFactory::getGenericTip() |
| 157 | +{ |
| 158 | + srand(QTime::currentTime().msec()); |
| 159 | + int myRand = rand(); |
| 160 | + int myValue = static_cast<int> (myRand % mGenericTips.count()); //range [0,(count-1)] |
| 161 | + OmgTip myTip = mGenericTips.at(myValue); |
| 162 | + return myTip; |
| 163 | +} |
| 164 | +OmgTip OmgTipFactory::getGuiTip() |
| 165 | +{ |
| 166 | + srand(QTime::currentTime().msec()); |
| 167 | + int myRand = rand(); |
| 168 | + int myValue = static_cast<int> (myRand % mGuiTips.count()); //range [0,(count-1)] |
| 169 | + OmgTip myTip = mGuiTips.at(myValue); |
| 170 | + return myTip; |
| 171 | +} |
| 172 | +int OmgTipFactory::randomNumber(int theMax) |
| 173 | +{ |
| 174 | + return 0; |
| 175 | +} |
| 176 | + |
0 commit comments