00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef SIMPLEVIEWS_H__ 00011 #define SIMPLEVIEWS_H__ 00012 00013 #include "AppConfig.h" 00014 00015 class Layer; 00016 class View; 00017 00018 #ifdef __cplusplus 00019 extern "C" 00020 { 00021 #endif 00022 /** \addtogroup simple_api */ 00023 /*@{*/ 00024 00025 /** 00026 * @file SimpleViews.h 00027 * This file contains API utilities for accessing views and layers. 00028 */ 00029 00030 /// Layers 00031 /////////////////// 00032 00033 /** 00034 * Get a Layer given an identifying name. 00035 * 00036 * @param pName 00037 * The name of a view and optional layer. First, the name will be checked as a session id. 00038 * Next, the view name is checked against all views. 00039 * If a | is present, the name after is used 00040 * to obtain a Layer with the given name. If no view name is specified, the active view is 00041 * used. If no layer name is specified, the behavior depends on the value of pType. If the type is a 00042 * RasterLayer, the primary RasterLayer will be the default. If another type is specified, the active layer 00043 * is the default if it is the correct type, otherwise the top-most layer of the proper type is specified. 00044 * @param pType 00045 * If not \c NULL or empty, a Layer of this type will be returned. See TypeConverter for valid type names. 00046 * @return A pointer to the requested Layer or \c NULL if the layer is not found. 00047 * If the layer is not found, getLastError() may be queried for information on the error. 00048 */ 00049 EXPORT_SYMBOL Layer* getLayer(const char* pName, const char* pType); 00050 00051 /** 00052 * Permanently destroy a Layer. 00053 * 00054 * Suitable for use as a cleanup callback. 00055 * 00056 * @param pLayer 00057 * The Layer to destroy. 00058 * No error checking is performed on this value and a \c NULL will cause a NOOP. 00059 */ 00060 EXPORT_SYMBOL void destroyLayer(Layer* pLayer); 00061 00062 /** 00063 * Get the name of the given Layer. 00064 * 00065 * @param pLayer 00066 * The Layer to query. 00067 * @param pName 00068 * Buffer to store the name. This will be \c NULL terminated. 00069 * @param nameSize 00070 * The size of the buffer. If the name is too long, an error will be set. 00071 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00072 * @return the actual length of the name. 00073 */ 00074 EXPORT_SYMBOL uint32_t getLayerName(Layer* pLayer, char* pName, uint32_t nameSize); 00075 00076 /** 00077 * Get the type name of the given Layer. 00078 * 00079 * This uses the XML encoding of LayerType. 00080 * 00081 * @param pLayer 00082 * The Layer to query. 00083 * @param pType 00084 * Buffer to store the type. This will be \c NULL terminated. 00085 * @param typeSize 00086 * The size of the buffer. If the type is too long, an error will be set. 00087 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00088 * @return the actual length of the type. 00089 */ 00090 EXPORT_SYMBOL uint32_t getLayerType(Layer* pLayer, char* pType, uint32_t typeSize); 00091 00092 /** 00093 * Get the DataElement displayed by a Layer. 00094 * 00095 * @param pLayer 00096 * The Layer to query. 00097 * @return The DataElement displayed by the Layer or \c NULL on error. 00098 */ 00099 EXPORT_SYMBOL DataElement* getLayerElement(Layer* pLayer); 00100 00101 /** 00102 * Get the View which contains a Layer. 00103 * 00104 * @param pLayer 00105 * The Layer to query. 00106 * @return The View which contains the Layer or \c NULL on error. 00107 */ 00108 EXPORT_SYMBOL View* getLayerView(Layer* pLayer); 00109 00110 /** 00111 * Get the scale and offset factors for a Layer. 00112 * 00113 * @param pLayer 00114 * The Layer to query. 00115 * @param pScaleX 00116 * Output parameter which will contain the scale factor in the X direction. 00117 * May be \c NULL if this value is not needed. 00118 * @param pScaleY 00119 * Output parameter which will contain the scale factor in the Y direction. 00120 * May be \c NULL if this value is not needed. 00121 * @param pOffsetX 00122 * Output parameter which will contain the offset in the X direction. 00123 * May be \c NULL if this value is not needed. 00124 * @param pOffsetY 00125 * Output parameter which will contain the offset in the Y direction. 00126 * May be \c NULL if this value is not needed. 00127 * @return Zero on success, non-zero on error. 00128 */ 00129 EXPORT_SYMBOL int getLayerScaleOffset(Layer* pLayer, double* pScaleX, double* pScaleY, 00130 double* pOffsetX, double* pOffsetY); 00131 00132 /** 00133 * Set the scale and offset factors for a Layer. 00134 * 00135 * @param pLayer 00136 * The Layer to mutate. 00137 * @param scaleX 00138 * The new scale factor in the X direction. 00139 * If this is NaN, the value will not be changed. 00140 * @param scaleY 00141 * The new scale factor in the Y direction. 00142 * If this is NaN, the value will not be changed. 00143 * @param offsetX 00144 * The new offset in the X direction. 00145 * If this is NaN, the value will not be changed. 00146 * @param offsetY 00147 * The new offset in the Y direction. 00148 * If this is NaN, the value will not be changed. 00149 * @return Zero on success, non-zero on error. 00150 */ 00151 EXPORT_SYMBOL int setLayerScaleOffset(Layer* pLayer, double scaleX, double scaleY, double offsetX, double offsetY); 00152 00153 /** 00154 * Is the layer displayed? 00155 * 00156 * @param pLayer 00157 * The Layer to access. Must be contained in a SpatialDataView. 00158 * @return Zero if the layer is hidden, non-zero if the layer is shown. getLastError() 00159 * must be called for error status. 00160 */ 00161 EXPORT_SYMBOL int isLayerDisplayed(Layer* pLayer); 00162 00163 /** 00164 * Shown/hide a Layer. 00165 * 00166 * This will do nothing and return with no error if the requested state 00167 * equals the current state. 00168 * 00169 * @param pLayer 00170 * The Layer to mutate. Must be contained in a SpatialDataView. 00171 * @param displayed 00172 * If non-zero, the Layer will be shown, if zero it will be hidden. 00173 * @return Zero on success, non-zero on error. 00174 */ 00175 EXPORT_SYMBOL int setLayerDisplayed(Layer* pLayer, int displayed); 00176 00177 /** 00178 * Derive a new Layer and add it to the Layer's View. 00179 * 00180 * If the new Layer type is the same as the current type, a copy is made. 00181 * 00182 * @param pLayer 00183 * The Layer to derive. Must be contained in a SpatialDataView. 00184 * @param pName 00185 * The name for the new Layer. If this is \c NULL, the new Layer will have the same name. 00186 * @param pType 00187 * The new \c NULL terminated Layer type name. This uses the XML encoding for LayerType. 00188 * @return \c NULL on error or the new Layer handle. 00189 */ 00190 EXPORT_SYMBOL Layer* deriveLayer(Layer* pLayer, const char* pName, const char* pType); 00191 00192 /** 00193 * Convert a Layer to a different Layer type. 00194 * 00195 * This actually creates a new Layer of the given type with the 00196 * same DataElement. 00197 * 00198 * @param pLayer 00199 * The Layer to convert. Must be contained in a SpatialDataView. 00200 * This handle will be invalid after a successful return from convertLayer() 00201 * @param pType 00202 * The new \c NULL terminated Layer type name. This uses the XML encoding for LayerType. 00203 * @return \c NULL on error or the new Layer handle. 00204 */ 00205 EXPORT_SYMBOL Layer* convertLayer(Layer* pLayer, const char* pType); 00206 00207 /** 00208 * Is the Layer active? 00209 * 00210 * @param pLayer 00211 * The Layer to query. Must be contained in a SpatialDataView. 00212 * @return Non-zero if active, zero otherwise. 00213 */ 00214 EXPORT_SYMBOL int isLayerActive(Layer* pLayer); 00215 00216 /** 00217 * Make the specified Layer active. 00218 * 00219 * @param pLayer 00220 * The Layer to activate. Must be contained in a SpatialDataView. 00221 * @return Zero on success, non-zero on error. 00222 */ 00223 EXPORT_SYMBOL int activateLayer(Layer* pLayer); 00224 00225 /** 00226 * Get the display order of a Layer. 00227 * 00228 * @param pLayer 00229 * The Layer to access. Must be in a SpatialDataView. 00230 * @return the display index of the Layer. 0 may indicate an error, 00231 * getLastError() should be checked 00232 */ 00233 EXPORT_SYMBOL uint32_t getLayerDisplayIndex(Layer* pLayer); 00234 00235 /** 00236 * Set the display order of a Layer. 00237 * 00238 * @param pLayer 00239 * The Layer to mutate. Must be in a SpatialDataView. 00240 * @param newIndex 00241 * The new zero based index of the Layer. 00242 * @return non-zero on error or zero on success. 00243 */ 00244 EXPORT_SYMBOL int setLayerDisplayIndex(Layer* pLayer, uint32_t newIndex); 00245 00246 /// Threshold Layers 00247 ////////////////////// 00248 00249 /** 00250 * Descriptor for threshold layer parameters. 00251 */ 00252 struct ThresholdLayerInfo 00253 { 00254 double firstThreshold; /**< The first threshold value in the specified regionUnits. */ 00255 double secondThreshold; /**< The second threshold value in the specified regionUnits. 00256 Certain pass area values ignore the second threshold */ 00257 uint32_t passArea; /**< The pass area. 0 -> Below 1st threshold value. 00258 1 -> Above 1st threshold value. 00259 2 -> Between 1st and 2nd threshold values. 00260 3 -> Everywhere except between 1st and 2nd threshold values. */ 00261 uint32_t regionUnits; /**< Define the units for the threshold values. 00262 0 -> Raw values, 1 -> Percentage, 2 -> Percentile, 3 -> Std dev. */ 00263 }; 00264 00265 /** 00266 * Get the threshold properties 00267 * 00268 * @param pLayer 00269 * A threshold Layer to query. 00270 * @param pInfo 00271 * Structure containing the threshold parameters. Must not be \c NULL. 00272 * @return non-zero on error or zero on success. 00273 */ 00274 EXPORT_SYMBOL int getThresholdLayerInfo(Layer* pLayer, struct ThresholdLayerInfo* pInfo); 00275 00276 /** 00277 * Set the threshold properties 00278 * 00279 * @param pLayer 00280 * A threshold Layer to mutate. 00281 * @param pInfo 00282 * Structure containing the threshold parameters. Must not be \c NULL. 00283 * @return non-zero on error or zero on success. 00284 */ 00285 EXPORT_SYMBOL int setThresholdLayerInfo(Layer* pLayer, struct ThresholdLayerInfo* pInfo); 00286 00287 /// Pseudocolor Layers 00288 ////////////////////// 00289 00290 /** 00291 * Get the number of pseudocolor classes attached to a PseudocolorLayer. 00292 * 00293 * @param pLayer 00294 * A PseudocolorLayer to access. 00295 * @return the number of classes. A zero may indicate an error, getLastError() should be queried. 00296 */ 00297 EXPORT_SYMBOL uint32_t getPseudocolorClassCount(Layer* pLayer); 00298 00299 /** 00300 * Get the pseudocolor class id for a given index. 00301 * 00302 * @param pLayer 00303 * A PseudocolorLayer to access. 00304 * @param index 00305 * The zero based index to query. 00306 * @return The pseudocolor class ID or -1 on error. 00307 */ 00308 EXPORT_SYMBOL int32_t getPseudocolorClassId(Layer* pLayer, uint32_t index); 00309 00310 /** 00311 * Get the name of the given pseudocolor class. 00312 * 00313 * @param pLayer 00314 * The PseudocolorLayer to query. 00315 * @param id 00316 * The pseudocolor class id to query. 00317 * @param pName 00318 * Buffer to store the name. This will be \c NULL terminated. 00319 * @param nameSize 00320 * The size of the buffer. If the name is too long, an error will be set. 00321 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00322 * @return the actual length of the name. 00323 */ 00324 EXPORT_SYMBOL uint32_t getPseudocolorClassName(Layer* pLayer, int32_t id, char* pName, uint32_t nameSize); 00325 00326 /** 00327 * Get the value of the given pseudocolor class. 00328 * 00329 * @param pLayer 00330 * The PseudocolorLayer to query. 00331 * @param id 00332 * The pseudocolor class id to query. 00333 * @return the value of the pseudocolor class. A zero may indicate an error, getLastError() should be queried. 00334 */ 00335 EXPORT_SYMBOL int32_t getPseudocolorClassValue(Layer* pLayer, int32_t id); 00336 00337 /** 00338 * Get the color of a given pseudocolor class. 00339 * 00340 * @param pLayer 00341 * The PseudocolorLayer to query. 00342 * @param id 00343 * The pseudocolor class id to query. 00344 * @return the color of the pseudocolor class. This is a 4 byte value in native endian. 00345 * Red Green Blue Alpha ordering. A zero may indicate an error, getLastError() should be queried. 00346 */ 00347 EXPORT_SYMBOL uint32_t getPseudocolorClassColor(Layer* pLayer, int32_t id); 00348 00349 /** 00350 * Is the pseudocolor class displayed? 00351 * 00352 * @param pLayer 00353 * The PseudocolorLayer to query. 00354 * @param id 00355 * The pseudocolor class id to query. 00356 * @return Non-zero if the class is displayed, zero if it is not displayed 00357 * or on error, getLastError() should be queried. 00358 */ 00359 EXPORT_SYMBOL int isPseudocolorClassDisplayed(Layer* pLayer, int32_t id); 00360 00361 /** 00362 * Add a new pseudocolor class. 00363 * 00364 * If the new class should be uninitialized, all parameters except pLayer must be \c NULL. 00365 * The new class should be initialized, all parameters must be non-\c NULL. 00366 * 00367 * @param pLayer 00368 * The PseudocolorLayer to mutate. 00369 * @param pName 00370 * If not \c NULL, the \c NULL terminated name for the new class. 00371 * @param pValue 00372 * If not \c NULL, the value for the new class. 00373 * @param pColor 00374 * If not \c NULL, the color for the new class. See setPseudocolorClassColor() for this value's encoding. 00375 * @param pDisplayed 00376 * If not \c NULL, set the display state of the new class. Zero will be hidden, non-zero will be displayed. 00377 * @return The pseudocolor class id for the new class or -1 on error. 00378 */ 00379 EXPORT_SYMBOL int32_t addPseudocolorClass(Layer* pLayer, const char* pName, 00380 int32_t* pValue, uint32_t* pColor, int* pDisplayed); 00381 00382 /** 00383 * Set the name of the given pseudocolor class. 00384 * 00385 * @param pLayer 00386 * The PseudocolorLayer to mutate. 00387 * @param id 00388 * The pseudocolor class id to mutate. 00389 * @param pName 00390 * The \c NULL terminated name for the pseudocolor class 00391 * @return Zero on success or non-zero on error. 00392 */ 00393 EXPORT_SYMBOL int setPseudocolorClassName(Layer* pLayer, int32_t id, const char* pName); 00394 00395 /** 00396 * Set the value of the given pseudocolor class. 00397 * 00398 * @param pLayer 00399 * The PseudocolorLayer to mutate. 00400 * @param id 00401 * The pseudocolor class id to mutate. 00402 * @param value 00403 * The value for the pseudocolor class. 00404 * @return Zero on success or non-zero on error. 00405 */ 00406 EXPORT_SYMBOL int setPseudocolorClassValue(Layer* pLayer, int32_t id, int32_t value); 00407 00408 /** 00409 * Set the color of a given pseudocolor class. 00410 * 00411 * @param pLayer 00412 * The PseudocolorLayer to mutate. 00413 * @param id 00414 * The pseudocolor class id to mutate. 00415 * @param color 00416 8 The color for the pseudocolor class. This is a 4 byte value in native endian. 00417 * Red Green Blue Alpha ordering. 00418 * @return Zero on success or non-zero on error. 00419 */ 00420 EXPORT_SYMBOL int setPseudocolorClassColor(Layer* pLayer, int32_t id, uint32_t color); 00421 00422 /** 00423 * Show or hide the pseudocolor class. 00424 * 00425 * @param pLayer 00426 * The PseudocolorLayer to mutate. 00427 * @param id 00428 * The pseudocolor class id to mutate. 00429 * @param display 00430 * Non-zero to display the class, zero to hide the class. 00431 * @return Zero on success or non-zero on error. 00432 */ 00433 EXPORT_SYMBOL int setPseudocolorClassDisplayed(Layer* pLayer, int32_t id, int display); 00434 00435 /// Raster Layers 00436 /////////////////// 00437 00438 /** 00439 * Descriptor for raster layer stretch parameters. 00440 */ 00441 struct RasterLayerStretchInfo 00442 { 00443 double lowerStretch; /**< The first stretch value */ 00444 double upperStretch; /**< The second stretch value. */ 00445 uint32_t stretchType; /**< Stretch type enum. 0 -> linear, 1 -> logarithmic, 00446 2 -> exponential, 3 -> histogram equalization */ 00447 uint32_t stretchUnits; /**< Define the units for the stretch values. 00448 Identical to threshold layer RegionUnits */ 00449 }; 00450 00451 /** 00452 * Get the raster stretch properties 00453 * 00454 * @param pLayer 00455 * A RasterLayer to query. 00456 * @param channel 00457 * The raster channel to query. 00458 * 0 -> gray, 1 -> red, 2 -> green, 3 -> blue 00459 * @param pInfo 00460 * Structure containing the raster stretch parameters. Must not be \c NULL. 00461 * @return non-zero on error or zero on success. 00462 */ 00463 EXPORT_SYMBOL int getRasterLayerStretchInfo(Layer* pLayer, uint32_t channel, struct RasterLayerStretchInfo* pInfo); 00464 00465 /** 00466 * Set the raster stretch properties 00467 * 00468 * @param pLayer 00469 * A RasterLayer to mutate. 00470 * @param channel 00471 * The raster channel to mutate. 00472 * 0 -> gray, 1 -> red, 2 -> green, 3 -> blue 00473 * @param pInfo 00474 * Structure containing the raster stretch parameters. Must not be \c NULL. 00475 * @return non-zero on error or zero on success. 00476 */ 00477 EXPORT_SYMBOL int setRasterLayerStretchInfo(Layer* pLayer, uint32_t channel, struct RasterLayerStretchInfo* pInfo); 00478 00479 /** 00480 * Get the complex component displayed in a RasterLayer. 00481 * 00482 * @param pLayer 00483 * A RasterLayer to query. 00484 * @return the complex component. 0 -> magnitude, 1 -> phase, 2 -> in-phase, 3 -> quadrature. 00485 * Any other value indicates an error. 00486 */ 00487 EXPORT_SYMBOL uint32_t getRasterLayerComplexComponent(Layer* pLayer); 00488 00489 /** 00490 * Set the complex component displayed in a RasterLayer. 00491 * 00492 * @param pLayer 00493 * A RasterLayer to mutate. 00494 * @param component 00495 * The complex component. 0 -> magnitude, 1 -> phase, 2 -> in-phase, 3 -> quadrature. 00496 * @return Non-zero on error, zero on success. 00497 */ 00498 EXPORT_SYMBOL int setRasterLayerComplexComponent(Layer* pLayer, uint32_t component); 00499 00500 /** 00501 * Get the name of the displayed colormap. 00502 * 00503 * A colormap is used when the RasterLayer is in grayscale/colormap/indexed mode. 00504 * The name may be the name of an internal colormap or a full path to a colormap file. 00505 * 00506 * @param pLayer 00507 * The RasterLayer to query. 00508 * @param pName 00509 * Buffer to store the name. This will be \c NULL terminated. 00510 * @param nameSize 00511 * The size of the buffer. If the name is too long, an error will be set. 00512 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00513 * @return the actual length of the name. 00514 */ 00515 EXPORT_SYMBOL uint32_t getRasterLayerColormapName(Layer* pLayer, char* pName, uint32_t nameSize); 00516 00517 /** 00518 * Set the displayed colormap. 00519 * 00520 * A colormap is used when the RasterLayer is in grayscale/colormap/indexed mode. 00521 * The name may be the name of an internal colormap or a full path to a colormap file. 00522 * 00523 * @param pLayer 00524 * The RasterLayer to mutate. 00525 * @param pName 00526 * \c NULL terminate name or full pathname of the colormap to display. 00527 * @return Zero on success or non-zero on error. 00528 */ 00529 EXPORT_SYMBOL int setRasterLayerColormapName(Layer* pLayer, const char* pName); 00530 00531 /** 00532 * Get the displayed colormap values. 00533 * 00534 * A colormap is used when the RasterLayer is in grayscale/colormap/indexed mode. 00535 * 00536 * @param pLayer 00537 * The RasterLayer to query. 00538 * @param pColormap 00539 * An array of 256 x 32-bit unsigned integers. Each integer represents an RGBA 00540 * color quad where red is the high order byte and alpha is the low order byte. 00541 * Encoding is in native endian. The must not be \c NULL. 00542 * @return Zero on success or non-zero on error. 00543 */ 00544 EXPORT_SYMBOL int getRasterLayerColormapValues(Layer* pLayer, uint32_t* pColormap); 00545 00546 /** 00547 * Set the displayed colormap values. 00548 * 00549 * A colormap is used when the RasterLayer is in grayscale/colormap/indexed mode. 00550 * 00551 * @param pLayer 00552 * The RasterLayer to mutate. 00553 * @param pName 00554 * The \c NULL terminate name for the new colormap. If this is \c NULL, no name will be 00555 * associated with the new colormap. 00556 * @param pColormap 00557 * An array of 256 x 32-bit unsigned integers. Each integer represents an RGBA 00558 * color quad where red is the high order byte and alpha is the low order byte. 00559 * Encoding is in native endian. The must not be \c NULL. 00560 * @return Zero on success or non-zero on error. 00561 */ 00562 EXPORT_SYMBOL int setRasterLayerColormapValues(Layer* pLayer, const char* pName, uint32_t* pColormap); 00563 00564 /** 00565 * Get the display mode of a RasterLayer. 00566 * 00567 * @param pLayer 00568 * A RasterLayer to query. 00569 * @return A zero if the display is grayscale/colormap/indexed or a non-zero if the display is RGB. 00570 */ 00571 EXPORT_SYMBOL int isRasterLayerRgbDisplayed(Layer* pLayer); 00572 00573 /** 00574 * Set the display mode of a RasterLayer. 00575 * 00576 * @param pLayer 00577 * A RasterLayer to mutate. 00578 * @param rgb 00579 * A zero to set the display to grayscale/colormap/indexed or a non-zero to set the display to RGB. 00580 * @return Zero on success or non-zero on error. 00581 */ 00582 EXPORT_SYMBOL int setRasterLayerRgbDisplayed(Layer* pLayer, int rgb); 00583 00584 /** 00585 * Get the displayed elements and bands of a RasterLayer. 00586 * 00587 * @param pLayer 00588 * A RasterLayer to query. 00589 * @param channel 00590 * The color channel. 0 -> gray/index, 1 -> red, 2 -> green, 3 -> blue 00591 * @param pElement 00592 * Output argument containing the RasterElement displayed in the channel. Ignore if \c NULL. 00593 * @return The active band number displayed in the channel. 00594 * Zero may indicate an error, getLastError() should be checked. 00595 */ 00596 EXPORT_SYMBOL uint32_t getRasterLayerDisplayedBand(Layer* pLayer, uint32_t channel, DataElement** pElement); 00597 00598 /** 00599 * Set the displayed elements and bands of a RasterLayer. 00600 * 00601 * @param pLayer 00602 * A RasterLayer to mutate. 00603 * @param channel 00604 * The color channel. 0 -> gray/index, 1 -> red, 2 -> green, 3 -> blue 00605 * @param band 00606 * The active band number to display. 00607 * @param pElement 00608 * The RasterElement to display in the channel. If \c NULL, the currently displayed 00609 * element will be maintained. 00610 * @return Zero on success or non-zero on error. 00611 */ 00612 EXPORT_SYMBOL int setRasterLayerDisplayedBand(Layer* pLayer, uint32_t channel, uint32_t band, DataElement* pElement); 00613 00614 /** 00615 * Raster statistics structure. 00616 */ 00617 struct RasterStatistics 00618 { 00619 double min; /**< minimum value in the layer */ 00620 double max; /**< maximum value in the layer */ 00621 double mean; /**< mean value in the layer */ 00622 double stddev; /**< standard deviation of values in the layer */ 00623 double* pHistogramCenters; /**< array of 256 histogram center values. This is a borrowed reference. */ 00624 unsigned int* pHistogramCounts; /**< array of 256 histogram counts. This is a borrowed reference. 00625 Note that this is not a sized data type so the current sizeof(unsigned int) 00626 must be known to use this. In most cases, this should be known. */ 00627 double* pPercentiles; /**< array of 1001 percentile boundaries. This is a borrowed reference. */ 00628 uint32_t resolution; /**< the calculation resolution. Represents the increment of the row and column 00629 counters used to calculate the statistics */ 00630 }; 00631 00632 /** 00633 * The raster statistics for a RasterLayer. 00634 * 00635 * @param pLayer 00636 * A RasterLayer to query. 00637 * @param channel 00638 * The color channel. 0 -> gray/index, 1 -> red, 2 -> green, 3 -> blue 00639 * @param component 00640 * The complex component to query. This should be 0 for non-complex data types. 00641 * 0 -> magnitude, 1 -> phase, 2 -> in-phase, 3 -> quadrature. 00642 * @param pStatistics 00643 * Output parameter for the statistics. Arrays in this structure are borrowed 00644 * references and may change when statistics are recalculated. A copy should be 00645 * made if these will be used long term. 00646 * @return Zero if successful or non-zero on error. 00647 */ 00648 EXPORT_SYMBOL int getRasterLayerStatistics(Layer* pLayer, uint32_t channel, 00649 uint32_t component, struct RasterStatistics* pStatistics); 00650 00651 /** 00652 * Is the RasterLayer rendered on the GPU? 00653 * 00654 * @param pLayer 00655 * A RasterLayer to query. 00656 * @return Zero if CPU rendering is active, non-zero if GPU rendering is active. 00657 * Zero may be returned on error, getLastError() should be checked. 00658 */ 00659 EXPORT_SYMBOL int getRasterLayerGpuEnabled(Layer* pLayer); 00660 00661 /** 00662 * Set the RasterLayer render target. 00663 * 00664 * @param pLayer 00665 * A RasterLayer to query. 00666 * @param gpu 00667 * Zero to enable CPU rendering, non-zero to enable GPU rendering. 00668 * @return Zero on success or non-zero on error. SIMPLE_OTHER_FAILURE indicates GPU rendering is not supported. 00669 */ 00670 EXPORT_SYMBOL int setRasterLayerGpuEnabled(Layer* pLayer, int gpu); 00671 00672 /** 00673 * Query the number of filters supported by a RasterLayer. 00674 * 00675 * @param pLayer 00676 * A RasterLayer to query. 00677 * @param enabled 00678 * If zero, query all supported filters. If non-zero, query enabled filters. 00679 * @return The number of filters. A zero may indicate an error so getLastError() should be checked. 00680 */ 00681 EXPORT_SYMBOL uint32_t getRasterLayerFilterCount(Layer* pLayer, int enabled); 00682 00683 /** 00684 * Query the name of the filter with a given index. 00685 * 00686 * @param pLayer 00687 * A RasterLayer to query. 00688 * @param index 00689 * The filter index to query. 00690 * @param enabled 00691 * If zero, query all supported filters. If non-zero, query enabled filters. 00692 * @param pName 00693 * Buffer to store the name. This will be \c NULL terminated. 00694 * @param nameSize 00695 * The size of the buffer. If the name is too long, an error will be set. 00696 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00697 * @return the actual length of the name. 00698 */ 00699 EXPORT_SYMBOL uint32_t getRasterLayerFilterName(Layer* pLayer, uint32_t index, 00700 int enabled, char* pName, uint32_t nameSize); 00701 00702 /** 00703 * Enable the specified filters. 00704 * 00705 * @param pLayer 00706 * A RasterLayer to mutate. 00707 * @param count 00708 * The number of filters in the array. 00709 * @param pFilters 00710 * Array of \c NULL terminated filter names of length \c count. This may be \c NULL iff \c count is 0. 00711 * @return Zero if successful or non-zero on error. 00712 */ 00713 EXPORT_SYMBOL int setRasterLayerFilters(Layer* pLayer, uint32_t count, const char** pFilters); 00714 00715 /** 00716 * Reset a feedback filter. 00717 * 00718 * @param pLayer 00719 * A RasterLayer to mutate. 00720 * @param pFilterName 00721 * The \c NULL terminated name of the filter to mutate. If this filter 00722 * is not a feedback filter, nothing occurs and no error is generated. 00723 * @return Zero if successful or non-zero on error. 00724 */ 00725 EXPORT_SYMBOL int resetRasterLayerFilter(Layer* pLayer, const char* pFilterName); 00726 00727 /** 00728 * Freeze or unfreeze a feedback filter. 00729 * 00730 * @param pLayer 00731 * A RasterLayer to mutate. 00732 * @param pFilterName 00733 * The \c NULL terminated name of the filter to mutate. If this filter 00734 * is not a feedback filter, nothing occurs and no error is generated. 00735 * @param freeze 00736 * If zero unfreeze the filter or if non-zero freeze the filter. 00737 * @return Zero if successful or non-zero on error. 00738 */ 00739 EXPORT_SYMBOL int setRasterLayerFilterFrozen(Layer* pLayer, const char* pFilterName, int freeze); 00740 00741 /// Views 00742 /////////////////// 00743 00744 /** 00745 * Get a View given an identifying name. 00746 * 00747 * @param pName 00748 * The name of the view. First the name will be checked as a session id. 00749 * Next the view name is checked against all views. If a | delimited is present, the first 00750 * item is used as the name. This way, a Layer name specifier may be passed to obtain the 00751 * View that will contain that layer. 00752 * @param pType 00753 * If not \c NULL or empty, a View of this type will be returned. See TypeConverter for valid type names. 00754 * @return A pointer to the requested View or \c NULL if the view is not found. 00755 * If the view is not found, getLastError() may be queried for information on the error. 00756 * @see getLayer() 00757 */ 00758 EXPORT_SYMBOL View* getView(const char* pName, const char* pType); 00759 00760 /** 00761 * Create a new View. 00762 * 00763 * @param pName 00764 * \c NULL terminated name for the View. 00765 * @param pType 00766 * \c NULL terminated type for the View. 00767 * This uses the XML encoding of ViewType. 00768 * @param pElement 00769 * If not \c NULL, this DataElement will be used as the 00770 * primary DataElement for the new View. If the View type 00771 * does not need a primary DataElement, this will be ignored. 00772 * Currently, only SpatialDataView requires a primary DataElement 00773 * which must be a RasterElement. 00774 * @return The new View handle or \c NULL if an error occurred. 00775 */ 00776 EXPORT_SYMBOL View* createView(const char* pName, const char* pType, DataElement* pElement); 00777 00778 /** 00779 * Permanently destroy a View. 00780 * 00781 * Suitable for use as a cleanup callback. 00782 * 00783 * @param pView 00784 * The View to destroy. 00785 * No error checking is performed on this value and a \c NULL will cause a NOOP. 00786 */ 00787 EXPORT_SYMBOL void destroyView(View* pView); 00788 00789 /** 00790 * Get the name of the given View. 00791 * 00792 * @param pView 00793 * The View to query. 00794 * @param pName 00795 * Buffer to store the name. This will be \c NULL terminated. 00796 * @param nameSize 00797 * The size of the buffer. If the name is too long, an error will be set. 00798 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00799 * @return the actual length of the name. 00800 */ 00801 EXPORT_SYMBOL uint32_t getViewName(View* pView, char* pName, uint32_t nameSize); 00802 00803 /** 00804 * Set the name of the given View. 00805 * 00806 * @param pView 00807 * The View to mutate. 00808 * @param pName 00809 * The new \c NULL terminated name 00810 * @return Zero if successful, non-zero on error. 00811 */ 00812 EXPORT_SYMBOL int setViewName(View* pView, const char* pName); 00813 00814 /** 00815 * Get the type name of the given View. 00816 * 00817 * This uses the XML encoding of ViewType. 00818 * 00819 * @param pView 00820 * The View to query. 00821 * @param pType 00822 * Buffer to store the type. This will be \c NULL terminated. 00823 * @param typeSize 00824 * The size of the buffer. If the type is too long, an error will be set. 00825 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00826 * @return the actual length of the type. 00827 */ 00828 EXPORT_SYMBOL uint32_t getViewType(View* pView, char* pType, uint32_t typeSize); 00829 00830 /** 00831 * Access the primary RasterElement. 00832 * 00833 * @param pView 00834 * The View to query. This must be a SpatialDataView. 00835 * @return the primary RasterElement or \c NULL if an error occurred. 00836 */ 00837 EXPORT_SYMBOL DataElement* getViewPrimaryRasterElement(View* pView); 00838 00839 /** 00840 * Create a new Layer in a View. 00841 * 00842 * @param pView 00843 * The View which will contain the new Layer. This must be a SpatialDataView. 00844 * @param pElement 00845 * The DataElement which will be displayed by the Layer. 00846 * @param pType 00847 * The \c NULL terminated type for the new Layer. Must not be \c NULL. 00848 * @param pName 00849 * The \c NULL terminated name for the new Layer. If this is \c NULL, the name 00850 * of pElement will be used. 00851 * @return the new Layer or \c NULL if an error occurred. 00852 */ 00853 EXPORT_SYMBOL Layer* createLayer(View* pView, DataElement* pElement, const char* pType, const char* pName); 00854 00855 /** 00856 * Get the number of layers in a View. 00857 * 00858 * @param pView 00859 * The View to query. This must be a SpatialDataView. 00860 * @return The number of Layers in the View. A zero may represent an error. getLastError() should be checked. 00861 */ 00862 EXPORT_SYMBOL uint32_t getViewLayerCount(View* pView); 00863 00864 /** 00865 * Get a Layer by index from a View. 00866 * 00867 * @param pView 00868 * The View to query. This must be a SpatialDataView. 00869 * @param index 00870 * The zero based index of the Layer to query. 00871 * @return the Layer at index or \c NULL on error. 00872 */ 00873 EXPORT_SYMBOL Layer* getViewLayer(View* pView, uint32_t index); 00874 00875 /*@}*/ 00876 #ifdef __cplusplus 00877 } 00878 #endif 00879 00880 #endif