//
// Copyright (C) 2004-2011 by Autodesk, Inc.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of version 2.1 of the GNU Lesser
// General Public License as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef GRIDCOLORHANDLER_H_
#define GRIDCOLORHANDLER_H_
#include "MdfModel.h"
#include "GridColorRule.h"
// Forward declaration.
class Band;
class GridData;
class Color;
class GridColorThemeHandler;
class GridColorBandHandler;
class GridColorBandsHandler;
class GridColorNullHandler;
///
/// Base class to provide the uniform interface for getting the color
/// on each pixel when stylizing the band.
///
class GridColorHandler
{
public:
///
/// Constructor.
///
GridColorHandler();
///
/// Destructor.
///
virtual ~GridColorHandler();
///
/// Function to initialize the GridColorHandler object.
///
///
/// The rules includes the detail info.
///
///
/// The grid that the styles are applied on.
///
///
/// Returns true if it is intialized successfully.
/// Othrewise, returns false.
///
virtual bool Initialize(const MdfModel::RuleCollection *pRules, const GridData *pGrid) = 0;
///
/// Function to get the color on the pixel.
///
///
/// [Out] Stores the result color.
///
///
/// The X axis position of the pixel
///
///
/// The Y axis position of the pixel
///
///
/// Returns true if it gets the corresponding color.
/// Othrewise, returns false.
///
virtual bool GetColor(Color &color, unsigned int x, unsigned int y) = 0;
///
/// Function to clear the data info of the handler.
///
virtual void Clear() = 0;
///
/// Function to create the corresponding color handler according to the different pRules.
///
///
/// The rules includes the detail info.
///
///
/// The grid that the styles are applied on.
///
///
/// Returns the pointer to the new created GridColorHandler.
/// Caller must be responsible to release it.
/// Returns NULL if the handlers fail to initialize.
///
static GridColorHandler* Create(const MdfModel::RuleCollection *pRules, const GridData *pGrid);
///
/// Function to create the GridColorBandHandler.
///
///
/// The rules includes the detail info.
///
///
/// The grid that the styles are applied on.
///
///
/// Returns the pointer to the new created GridColorBandHandler.
/// Caller must be responsible to release it.
/// Returns NULL if the handlers fail to initialize.
///
static GridColorBandHandler* CreateBandHandler(const MdfModel::RuleCollection *pRules, const GridData *pGrid);
///
/// Function to create the GridColorBandsHandler.
///
///
/// The rules includes the detail info.
///
///
/// The grid that the styles are applied on.
///
///
/// Returns the pointer to the new created GridColorBandsHandler.
/// Caller must be responsible to release it.
/// Returns NULL if the handlers fail to initialize.
///
static GridColorBandsHandler* CreateBandsHandler(const MdfModel::RuleCollection *pRules, const GridData *pGrid);
///
/// Function to create the GridColorThemeHandler.
///
///
/// The rules includes the theme info.
///
///
/// The grid that the styles are applied on.
///
///
/// Returns the pointer to the new created GridColorThemeHandler.
/// Caller must be responsible to release it.
/// Returns NULL if the handlers fail to initialize.
///
static GridColorThemeHandler* CreateThemeHandler(const MdfModel::RuleCollection *pRules, const GridData *pGrid);
///
/// Function to create the GridColorNullHandler.
///
///
/// The rules includes the detail info.
///
///
/// The grid that the styles are applied on.
///
///
/// Returns the pointer to the new created GridColorNullHandler.
/// Caller must be responsible to release it.
/// Returns NULL if the handlers fail to initialize.
///
static GridColorNullHandler* CreateNullHandler(const MdfModel::RuleCollection *pRules, const GridData *pGrid);
};
#endif