1 : /******************************************************************************
2 : * $Id: gdalallvalidmaskband.cpp 15044 2008-07-26 12:04:05Z rouault $
3 : *
4 : * Project: GDAL Core
5 : * Purpose: Implementation of GDALAllValidMaskBand, a class implementing all
6 : * a default 'all valid' band mask.
7 : * Author: Frank Warmerdam, warmerdam@pobox.com
8 : *
9 : ******************************************************************************
10 : * Copyright (c) 2007, Frank Warmerdam
11 : *
12 : * Permission is hereby granted, free of charge, to any person obtaining a
13 : * copy of this software and associated documentation files (the "Software"),
14 : * to deal in the Software without restriction, including without limitation
15 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 : * and/or sell copies of the Software, and to permit persons to whom the
17 : * Software is furnished to do so, subject to the following conditions:
18 : *
19 : * The above copyright notice and this permission notice shall be included
20 : * in all copies or substantial portions of the Software.
21 : *
22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 : * DEALINGS IN THE SOFTWARE.
29 : ****************************************************************************/
30 :
31 : #include "gdal_priv.h"
32 :
33 : CPL_CVSID("$Id: gdalallvalidmaskband.cpp 15044 2008-07-26 12:04:05Z rouault $");
34 :
35 : /************************************************************************/
36 : /* GDALAllValidMaskBand() */
37 : /************************************************************************/
38 :
39 360 : GDALAllValidMaskBand::GDALAllValidMaskBand( GDALRasterBand *poParent )
40 :
41 : {
42 360 : poDS = NULL;
43 360 : nBand = 0;
44 :
45 360 : nRasterXSize = poParent->GetXSize();
46 360 : nRasterYSize = poParent->GetYSize();
47 :
48 360 : eDataType = GDT_Byte;
49 360 : poParent->GetBlockSize( &nBlockXSize, &nBlockYSize );
50 360 : }
51 :
52 : /************************************************************************/
53 : /* ~GDALAllValidMaskBand() */
54 : /************************************************************************/
55 :
56 720 : GDALAllValidMaskBand::~GDALAllValidMaskBand()
57 :
58 : {
59 720 : }
60 :
61 : /************************************************************************/
62 : /* IReadBlock() */
63 : /************************************************************************/
64 :
65 152 : CPLErr GDALAllValidMaskBand::IReadBlock( int nXBlockOff, int nYBlockOff,
66 : void * pImage )
67 :
68 : {
69 152 : memset( pImage, 255, nBlockXSize * nBlockYSize );
70 :
71 152 : return CE_None;
72 : }
73 :
74 : /************************************************************************/
75 : /* GetMaskBand() */
76 : /************************************************************************/
77 :
78 0 : GDALRasterBand *GDALAllValidMaskBand::GetMaskBand()
79 :
80 : {
81 0 : return this;
82 : }
83 :
84 : /************************************************************************/
85 : /* GetMaskFlags() */
86 : /************************************************************************/
87 :
88 0 : int GDALAllValidMaskBand::GetMaskFlags()
89 :
90 : {
91 0 : return GMF_ALL_VALID;
92 : }
|