00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef PLOTFACTORY_H_
00028 #define PLOTFACTORY_H_
00029
00030 #include <graphics/GenericPlotter/Plot.h>
00031 #include <graphics/GenericPlotter/PlotAnnotation.h>
00032 #include <graphics/GenericPlotter/PlotCanvas.h>
00033 #include <graphics/GenericPlotter/PlotCanvasLayout.h>
00034 #include <graphics/GenericPlotter/PlotData.h>
00035 #include <graphics/GenericPlotter/PlotOperation.h>
00036 #include <graphics/GenericPlotter/PlotOptions.h>
00037 #include <graphics/GenericPlotter/PlotShape.h>
00038 #include <graphics/GenericPlotter/Plotter.h>
00039 #include <graphics/GenericPlotter/PlotTool.h>
00040
00041 #include <utility>
00042
00043 namespace casa {
00044
00045
00046
00047
00048
00049
00050
00051
00052 class PlotFactory {
00053 public:
00054
00055 PlotFactory();
00056
00057
00058 virtual ~PlotFactory();
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 virtual bool canvasHasThreadedDrawing() const = 0;
00069
00070
00071
00072
00073
00074 virtual bool canvasHasCachedLayerDrawing() const = 0;
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 virtual bool canvasHasCachedAxesStack() const = 0;
00085
00086
00087
00088
00089
00090 virtual int execLoop() = 0;
00091
00092
00093 virtual Plotter::Implementation implementation() const = 0;
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 virtual PlotterPtr plotter(const String& windowTitle = "Plotter",
00105 bool showSingleCanvas = true, bool showGUI = true,
00106 int logEventFlags = PlotLogger::NO_EVENTS,
00107 bool smartDelete = true) const = 0;
00108
00109
00110
00111
00112
00113
00114 virtual PlotterPtr plotter(unsigned int nrows, unsigned int ncols,
00115 const String& windowTitle = "Plotter", bool showGUI = true,
00116 int logEventFlags = PlotLogger::NO_EVENTS,
00117 bool smartDelete = true) const = 0;
00118
00119
00120
00121
00122
00123
00124 virtual PlotterPtr plotter(PlotCanvasPtr canvas,
00125 const String& windowTitle = "Plotter", bool showGUI = true,
00126 int logEventFlags = PlotLogger::NO_EVENTS,
00127 bool smartDelete = true);
00128
00129
00130 virtual PlotCanvasPtr canvas(bool smartDelete = true) const = 0;
00131
00132
00133 virtual PlotPanelPtr panel(bool smartDelete = true) const = 0;
00134
00135
00136
00137
00138
00139 virtual PlotButtonPtr button(const String& str, bool isText = true,
00140 bool toggleable = false, bool smartDelete = true) const = 0;
00141
00142
00143
00144 virtual PlotCheckboxPtr checkbox(const String& str,
00145 bool smartDelete = true) const = 0;
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 virtual ScatterPlotPtr scatterPlot(PlotPointDataPtr data,
00158 const String& title = "Scatter Plot",
00159 bool smartDelete = true) const = 0;
00160
00161
00162
00163
00164
00165
00166
00167 virtual MaskedScatterPlotPtr maskedPlot(PlotMaskedPointDataPtr data,
00168 const String& title = "Masked Plot", bool smartDelete= true) const;
00169 virtual ErrorPlotPtr errorPlot(PlotErrorDataPtr data,
00170 const String& title = "Error Plot", bool smartDelete= true) const;
00171 virtual ColoredPlotPtr coloredPlot(PlotBinnedDataPtr data,
00172 const String& title = "Colored Plot", bool smartDelete=true) const;
00173
00174
00175
00176
00177 virtual BarPlotPtr barPlot(PlotPointDataPtr data,
00178 const String& title = "Bar Plot", bool smartDelete= true) const= 0;
00179
00180
00181
00182
00183 virtual BarPlotPtr histogramPlot(PlotSingleDataPtr data,
00184 unsigned int numBins, const String& title = "Histogram Plot",
00185 bool smartDelete = true) const;
00186
00187
00188
00189 virtual RasterPlotPtr rasterPlot(PlotRasterDataPtr data,
00190 const String& title = "Raster Plot",
00191 PlotRasterData::Format format = PlotRasterData::RGB32,
00192 bool smartDelete = true) const = 0;
00193
00194
00195
00196
00197 virtual RasterPlotPtr contourPlot(PlotRasterDataPtr data,
00198 const vector<double>& contours,
00199 const String& title = "Contour Plot",
00200 PlotRasterData::Format format = PlotRasterData::RGB32,
00201 bool smartDelete = true) const;
00202
00203
00204
00205
00206 virtual RasterPlotPtr spectrogramPlot(PlotRasterDataPtr data,
00207 const String& title = "Spectrogram", bool smartDelete= true) const;
00208
00209
00210
00211
00212
00213 virtual RasterPlotPtr contouredSpectrogramPlot(PlotRasterDataPtr data,
00214 const vector<double>& cont,
00215 const String& title = "Spectrogram Contours",
00216 bool smartDelete = true) const;
00217
00218
00219
00220 virtual PlotAnnotationPtr annotation(const String& text,
00221 const PlotCoordinate& coord, bool smartDelete = true) const = 0;
00222
00223
00224
00225
00226 virtual PlotAnnotationPtr annotation(const String& text, double x,
00227 double y, bool smartDelete = true) const;
00228
00229
00230
00231 virtual PlotShapeRectanglePtr shapeRectangle(const PlotCoordinate& upperLeft,
00232 const PlotCoordinate& lowerRight, bool smartDelete= true) const= 0;
00233
00234
00235
00236
00237 virtual PlotShapeRectanglePtr shapeRectangle(double left, double top,
00238 double right, double bottom, bool smartDelete = true) const;
00239
00240
00241
00242 virtual PlotShapeEllipsePtr shapeEllipse(const PlotCoordinate& center,
00243 const PlotCoordinate& radii, bool smartDelete = true) const = 0;
00244
00245
00246
00247 virtual PlotShapeEllipsePtr shapeEllipse(double x, double y,
00248 double xRadius, double yRadius, bool smartDelete = true) const;
00249
00250
00251
00252 virtual PlotShapePolygonPtr shapePolygon(
00253 const vector<PlotCoordinate>& coords,
00254 bool smartDelete = true) const = 0;
00255
00256
00257
00258
00259 virtual PlotShapePolygonPtr shapePolygon(const vector<double>& x,
00260 const vector<double>& y, bool smartDelete = true) const;
00261
00262
00263
00264 virtual PlotShapeLinePtr shapeLine(double location, PlotAxis axis,
00265 bool smartDelete = true) const = 0;
00266
00267
00268
00269 virtual PlotShapeArrowPtr shapeArrow(const PlotCoordinate& from,
00270 const PlotCoordinate& to, PlotShapeArrow::Style fromArrow =
00271 PlotShapeArrow::NOARROW, PlotShapeArrow::Style toArrow =
00272 PlotShapeArrow::V_ARROW, bool smartDelete = true) const = 0;
00273
00274
00275
00276
00277
00278 virtual PlotShapeArrowPtr shapeArrow(double fromX, double fromY,
00279 double toX, double toY, PlotShapeArrow::Style fromArrow =
00280 PlotShapeArrow::NOARROW, PlotShapeArrow::Style toArrow =
00281 PlotShapeArrow::V_ARROW, bool smartDelete = true) const;
00282 virtual PlotShapeArrowPtr shapeLineSegment(const PlotCoordinate& from,
00283 const PlotCoordinate& to, bool smartDelete = true) const;
00284 virtual PlotShapeArrowPtr shapeLineSegment(double fromX, double fromY,
00285 double toX, double toY, bool smartDelete = true) const;
00286
00287
00288
00289
00290 virtual PlotShapePathPtr shapePath(
00291 const vector<PlotCoordinate>& coords,
00292 bool smartDelete = true) const = 0;
00293
00294
00295
00296
00297 virtual PlotShapePathPtr shapePath(const vector<double>& x,
00298 const vector<double>& y, bool smartDelete = true) const;
00299
00300
00301
00302
00303 virtual PlotShapeArcPtr shapeArc(const PlotCoordinate& start,
00304 const PlotCoordinate& widthHeight, int startAngle,
00305 int spanAngle, bool smartDelete = true) const = 0;
00306
00307
00308
00309 virtual PlotPointPtr point(const PlotCoordinate& coord,
00310 bool smartDelete = true) const = 0;
00311
00312
00313
00314
00315
00316 virtual PlotPointPtr point(double x, double y, bool smartDelete=true)const;
00317 virtual PlotPointPtr point(float x, float y, bool smartDelete= true) const;
00318 virtual PlotPointPtr point(int x, int y, bool smartDelete = true) const;
00319 virtual PlotPointPtr point(unsigned int x, unsigned int y,
00320 bool smartDelete = true) const;
00321
00322
00323
00324
00325
00326
00327 virtual PlotColorPtr color(const String& color,
00328 bool smartDelete = true) const = 0;
00329
00330
00331 virtual PlotColorPtr color(const PlotColor& copy,
00332 bool smartDelete = true) const = 0;
00333
00334
00335
00336 virtual PlotColorPtr color(const PlotColorPtr copy,
00337 bool smartDelete = true) const;
00338
00339
00340 virtual vector<String> allNamedColors() const = 0;
00341
00342
00343
00344 virtual PlotFontPtr font(const String& family = "Arial",
00345 double pointSize = 12, const String& color = "000000",
00346 bool bold = false, bool italics = false,
00347 bool underline = false, bool smartDelete = true) const = 0;
00348
00349
00350 virtual PlotFontPtr font(const PlotFont& copy,
00351 bool smartDelete = true) const = 0;
00352
00353
00354
00355 virtual PlotFontPtr font(const PlotFontPtr copy,
00356 bool smartDelete = true) const;
00357
00358
00359
00360 virtual PlotAreaFillPtr areaFill(const String& color,
00361 PlotAreaFill::Pattern pattern = PlotAreaFill::FILL,
00362 bool smartDelete = true) const = 0;
00363
00364
00365 virtual PlotAreaFillPtr areaFill(const PlotAreaFill& copy,
00366 bool smartDelete = true) const = 0;
00367
00368
00369
00370 virtual PlotAreaFillPtr areaFill(const PlotAreaFillPtr copy,
00371 bool smartDelete = true) const;
00372
00373
00374
00375 virtual PlotLinePtr line(const String& color,
00376 PlotLine::Style style = PlotLine::SOLID, double width = 1.0,
00377 bool smartDelete = true) const = 0;
00378
00379
00380 virtual PlotLinePtr line(const PlotLine& copy,
00381 bool smartDelete = true) const = 0;
00382
00383
00384
00385 virtual PlotLinePtr line(const PlotLinePtr copy,
00386 bool smartDelete = true) const;
00387 virtual PlotSymbolPtr createSymbol (const String& descriptor, int size, const String& color,
00388 const String& fillPattern, bool outline );
00389
00390 virtual PlotSymbolPtr symbol(PlotSymbol::Symbol style,
00391 bool smartDelete = true) const = 0;
00392
00393
00394
00395 virtual PlotSymbolPtr symbol(char sym, bool smartDelete = true) const;
00396
00397
00398
00399 virtual PlotSymbolPtr uSymbol(unsigned short unicode,
00400 bool smartDelete = true) const;
00401
00402
00403 virtual PlotSymbolPtr symbol(const PlotSymbol& copy,
00404 bool smartDelete = true) const = 0;
00405
00406
00407
00408 virtual PlotSymbolPtr symbol(const PlotSymbolPtr copy,
00409 bool smartDelete = true) const;
00410
00411
00412
00413
00414
00415
00416 virtual PlotStandardMouseToolGroupPtr standardMouseTools(
00417 ToolCode activeTool = NONE_TOOL,
00418 bool smartDelete = true) const;
00419
00420
00421
00422
00423 virtual PlotStandardMouseToolGroupPtr standardMouseTools(PlotAxis xAxis,
00424 PlotAxis yAxis, PlotCoordinate::System sys,
00425 ToolCode activeTool = NONE_TOOL,
00426 bool smartDelete = true) const;
00427
00428
00429
00430
00431
00432 virtual PlotSelectToolPtr selectTool(bool smartDelete = true) const;
00433 virtual PlotZoomToolPtr zoomTool(bool smartDelete = true) const;
00434 virtual PlotPanToolPtr panTool(bool smartDelete = true) const;
00435 virtual PlotTrackerToolPtr trackerTool(bool smartDelete = true) const;
00436 virtual PlotSelectToolPtr selectTool(PlotAxis xAxis, PlotAxis yAxis,
00437 PlotCoordinate::System system, bool smartDelete = true) const;
00438 virtual PlotZoomToolPtr zoomTool(PlotAxis xAxis, PlotAxis yAxis,
00439 PlotCoordinate::System system, bool smartDelete = true) const;
00440 virtual PlotPanToolPtr panTool(PlotAxis xAxis, PlotAxis yAxis,
00441 PlotCoordinate::System system, bool smartDelete = true) const;
00442 virtual PlotTrackerToolPtr trackerTool(PlotAxis xAxis, PlotAxis yAxis,
00443 PlotCoordinate::System system, bool smartDelete = true) const;
00444
00445
00446
00447
00448
00449
00450 virtual PlotMutexPtr mutex(bool smartDelete = true) const = 0;
00451
00452
00453
00454
00455
00456
00457 #define PF_DATA_DEC(TYPE) \
00458 virtual PlotPointDataPtr data(TYPE *& y, unsigned int n, \
00459 bool shouldDelete = true) const; \
00460 virtual PlotPointDataPtr data(Vector< TYPE >& y, \
00461 bool shouldDelete = false) const; \
00462 virtual PlotPointDataPtr data(vector< TYPE >& y, \
00463 bool shouldDelete = false) const; \
00464 virtual PlotPointDataPtr data(TYPE *& x, TYPE *& y, unsigned int n, \
00465 bool shouldDelete = true) const; \
00466 virtual PlotPointDataPtr data(Vector< TYPE >& x, Vector< TYPE >& y, \
00467 bool shouldDelete = false) const; \
00468 virtual PlotPointDataPtr data(vector< TYPE >& x, vector< TYPE >& y, \
00469 bool shouldDelete = false) const; \
00470 virtual PlotSingleDataPtr singleData(TYPE *& data, unsigned int n, \
00471 bool shouldDelete = true) const; \
00472 virtual PlotSingleDataPtr singleData(Vector< TYPE >& data, \
00473 bool shouldDelete = false) const; \
00474 virtual PlotSingleDataPtr singleData(vector< TYPE >& data, \
00475 bool shouldDelete = false) const; \
00476 virtual PlotPointDataPtr histogramData(TYPE *& data, unsigned int n, \
00477 unsigned int numBins, bool shouldDel = true) const; \
00478 virtual PlotPointDataPtr histogramData(vector< TYPE >& data, \
00479 unsigned int numBins, bool shouldDel = false) const; \
00480 virtual PlotPointDataPtr histogramData(Vector< TYPE >& data, \
00481 unsigned int numBins, bool shouldDel = false) const; \
00482 virtual PlotMaskedPointDataPtr data(TYPE *& x, TYPE*& y, bool*& mask, \
00483 unsigned int n, bool shouldDelete = true) const; \
00484 virtual PlotMaskedPointDataPtr data(Vector< TYPE >& x, Vector< TYPE >& y, \
00485 Vector<bool>& mask, bool shouldDelete = true) const; \
00486 virtual PlotMaskedPointDataPtr data(vector< TYPE >& x, vector< TYPE >& y, \
00487 vector<bool>& mask, bool shouldDelete = true) const; \
00488 virtual PlotErrorDataPtr data(TYPE *& x, TYPE *& y, unsigned int n, \
00489 TYPE xLeftError, TYPE xRightError, TYPE yBottomError, \
00490 TYPE yTopError, bool shouldDelete = true) const; \
00491 virtual PlotErrorDataPtr data(Vector< TYPE >& x, Vector< TYPE >& y, \
00492 TYPE xLeftError, TYPE xRightError, TYPE yBottomError, \
00493 TYPE yTopError, bool shouldDelete = true) const; \
00494 virtual PlotErrorDataPtr data(vector< TYPE >& x, vector< TYPE >& y, \
00495 TYPE xLeftError, TYPE xRightError, TYPE yBottomError, \
00496 TYPE yTopError, bool shouldDelete = true) const; \
00497 virtual PlotErrorDataPtr data(TYPE *& x, TYPE *& y, TYPE *& xLeftError, \
00498 TYPE *& xRightError, TYPE *& yBottomError, TYPE *& yTopError, \
00499 unsigned int n, bool shouldDelete = true) const; \
00500 virtual PlotErrorDataPtr data(Vector< TYPE >& x, Vector< TYPE >& y, \
00501 Vector< TYPE >& xLeftError, Vector< TYPE >& xRightError, \
00502 Vector< TYPE >& yBottomError, Vector< TYPE >& yTopError, \
00503 bool shouldDelete = false) const; \
00504 virtual PlotErrorDataPtr data(vector< TYPE >& x, vector< TYPE >& y, \
00505 vector< TYPE >& xLeftError, vector< TYPE >& xRightError, \
00506 vector< TYPE >& yBottomError, vector< TYPE >& yTopError, \
00507 bool shouldDelete = false) const; \
00508 virtual PlotRasterDataPtr data(Matrix< TYPE >& data, \
00509 bool shouldDelete = false) const; \
00510 virtual PlotRasterDataPtr data(Matrix< TYPE >& data, double fromX, \
00511 double toX, double fromY, double toY, \
00512 bool shouldDelete = false) const;
00513
00514
00515
00516
00517 PF_DATA_DEC(double)
00518
00519
00520
00521
00522
00523 PF_DATA_DEC(float)
00524
00525
00526
00527
00528
00529 PF_DATA_DEC(int)
00530
00531
00532
00533
00534
00535 PF_DATA_DEC(unsigned int)
00536
00537
00538
00539
00540
00541 virtual PlotPointDataPtr histogramData(PlotSingleDataPtr data,
00542 unsigned int numBins) const;
00543 };
00544 typedef CountedPtr<PlotFactory> PlotFactoryPtr;
00545
00546 }
00547
00548 #endif