File: vtkKWApplicationPro.h

package info (click to toggle)
volview 3.4-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 25,204 kB
  • sloc: cpp: 132,585; ansic: 11,612; tcl: 236; sh: 64; makefile: 25; xml: 8
file content (216 lines) | stat: -rw-r--r-- 6,997 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*=========================================================================

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/VolViewCopyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkKWApplicationPro - the application class with licensing support.
// .SECTION Description
// A subclass of vtkKWApplication that provides licensing support

#ifndef __vtkKWApplicationPro_h
#define __vtkKWApplicationPro_h

#include "vtkKWApplication.h"

class vtkImageData;

class VTK_EXPORT vtkKWApplicationPro : public vtkKWApplication
{
public:
  static vtkKWApplicationPro* New();
  vtkTypeRevisionMacro(vtkKWApplicationPro,vtkKWApplication);
  void PrintSelf(ostream& os, vtkIndent indent);
  
  // Description:
  // Start running the main application.
  virtual void Start() { this->Superclass::Start(); }
  virtual void Start(int argc, char *argv[]);

  // Description:
  // Query if the application is allowed to run, given the current
  // licensing scheme, or the expiration date, etc.
  virtual int IsAllowedToRun();

  // Description:
  // Invoke the registration wizard. 
  // Return 1 if the application is ready to run according to the
  // current license requirement, 0 otherwise (or Cancel())
  virtual int InvokeRegistrationWizard(vtkKWWindowBase *masterWin);

  // Description:
  // Set/Get the purchase URL, i.e. the web address where the application
  // can be purchased manually.
  vtkSetStringMacro(PurchaseURL);
  vtkGetStringMacro(PurchaseURL);

  // Description:
  // Set/Get the name of the company providing the application. 
  // Default to: Kitware.
  vtkSetStringMacro(CompanyName);
  vtkGetStringMacro(CompanyName);

  // Description:
  // Set/Get the way to contact the company providing the application,
  // for sales-related question or support question. 
  // Sales default to: kitware@kitware.com or phone number/fax.
  // Support default to: support@kitware.com or phone number/fax.
  vtkSetStringMacro(CompanySalesContact);
  vtkGetStringMacro(CompanySalesContact);
  vtkSetStringMacro(CompanySupportContact);
  vtkGetStringMacro(CompanySupportContact);

  // Description:
  // Set/Get the primary copyright holder. They will show in the 
  // "About" dialog box, on top of all other copyrights notice.
  vtkSetStringMacro(PrimaryCopyright);
  vtkGetStringMacro(PrimaryCopyright);

  // Description:
  // Set/Get if the application is run in a testing mode.
  //BTX
  vtkBooleanMacro(TestingMode, int);
  vtkSetMacro(TestingMode, int);
  vtkGetMacro(TestingMode, int);
  //ETX

  // Description:
  // Set/Get if the application should use GPU rendering.
  // Windows that create any 3D views (and vtkKWVolumeWidget) should make
  // sure they propagate that setting to their volume rendering mapper.
  // They should also listen to the UseGPURenderingChangedEvent.
  vtkBooleanMacro(UseGPURendering, int);
  virtual void SetUseGPURendering(int);
  vtkGetMacro(UseGPURendering, int);

  // Description:
  // Set an expiration time (in secs. since Epoch, or as a YYYY-MM-DD HH:MM:SS
  // string; MM (1-12), DD (1-31), HH (0-23).
  // Check if the app has expired.
  //BTX
  virtual void SetExpireTime(double);
  vtkGetMacro(ExpireTime, double);
  virtual void SetExpireTime(const char *str);
  //ETX
  virtual int HasExpired();

  // Description:
  // Get/Set the internal character encoding of the application.
  virtual void SetCharacterEncoding(int val);

  // Description:
  // Log a message.  The logging mechanism is application specific,
  // for KWAppplicationPro, it is non-existent.
  virtual void LogMessage(const char * ) {}

  // Description:
  // Initialize Tcl/Tk
  // Return NULL on error (eventually provides an ostream where detailed
  // error messages will be stored).
  //BTX
  static Tcl_Interp *InitializeTcl(int argc, char *argv[], ostream *err = 0);
  //ETX

  // Description:
  // Set/Get the Flickr application key, shared secret and authentication
  // token.
  //BTX
  vtkSetStringMacro(FlickrApplicationKey);
  vtkGetStringMacro(FlickrApplicationKey);
  vtkSetStringMacro(FlickrSharedSecret);
  vtkGetStringMacro(FlickrSharedSecret);
  vtkSetStringMacro(FlickrAuthenticationToken);
  vtkGetStringMacro(FlickrAuthenticationToken);
  //ETX

  // Descrition:
  // Save/Retrieve the application settings to/from registry.
  // Do not call that method before the application name is known and the
  // proper registry level set (if any).
  virtual void RestoreApplicationSettingsFromRegistry();
  virtual void SaveApplicationSettingsToRegistry();

  // Description:
  // Add system information to a stream.
  // Will be used to report system info in the About dialog, or the Feedback
  // email...
  virtual void AddSystemInformation(ostream &);
  
  // Description:
  // Some constants
  //BTX
  static const char *FlickrRegSubKey;
  static const char *FlickrApplicationKeyRegKey;
  static const char *FlickrSharedSecretRegKey;
  static const char *FlickrAuthenticationTokenRegKey;
  static const char *UseGPURenderingRegKey;
  //ETX

  // Description:
  // Event list
  //BTX
  enum
  {
    UseGPURenderingChangedEvent = 25000
  };
  //ETX

protected:
  vtkKWApplicationPro();
  ~vtkKWApplicationPro();

  // Description:
  // Give a change to the application to parse the command-line arguments
  // and set some variables accordingly. Subclasses that do not intend
  // to call their super's Start(argc, argv) should make sure they
  // call their super's ParseCommandLineArguments.
  virtual void ParseCommandLineArguments(int argc, char *argv[]);

  int TestingMode;
  int UseGPURendering;

  double ExpireTime;

  // Description:
  // Cleanup before exit.
  virtual void PrepareForDelete();

  virtual void AddAboutText(ostream &);
  virtual void AddAboutCopyrights(ostream &);

  char *PrimaryCopyright;
  char *PurchaseURL;
  char *CompanyName;
  char *CompanySalesContact;
  char *CompanySupportContact;

  char *FlickrApplicationKey;
  char *FlickrSharedSecret;
  char *FlickrAuthenticationToken;

  // Description:
  // Send image to Flickr
  virtual int SendImageToFlickr(vtkImageData *img,
                                const char *api_key,
                                const char *shared_secret,
                                const char *auth_token,
                                const char *title,
                                const char *description,
                                const char *tags,
                                int is_public);

  // Description:
  // Send screenshot to Flickr
  virtual int SendScreenshotToFlickr();

private:
  vtkKWApplicationPro(const vtkKWApplicationPro&); // Not implemented
  void operator=(const vtkKWApplicationPro&); // Not implemented
};

#endif