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