DYT/Tool/OpenSceneGraph-3.6.5/include/osgEarth/MapModelChange

73 lines
2.8 KiB
Plaintext
Raw Normal View History

2024-12-24 23:49:36 +00:00
/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_MAP_MODEL_CHANGE_H
#define OSGEARTH_MAP_MODEL_CHANGE_H 1
#include <osgEarth/Common>
#include <osgEarth/Revisioning>
#include <osgEarth/ImageLayer>
#include <osgEarth/ElevationLayer>
#include <osgEarth/ModelLayer>
#include <osgEarth/TerrainConstraintLayer>
namespace osgEarth
{
/**
* Conveys atomic change actions to the map data model.
*/
struct MapModelChange /* no export, header-only */
{
enum ActionType
{
BEGIN_BATCH_UPDATE, // signals the start of multiple changes
END_BATCH_UPDATE, // signals the end of multiple changes
ADD_LAYER,
REMOVE_LAYER,
MOVE_LAYER,
OPEN_LAYER,
CLOSE_LAYER,
UNSPECIFIED
};
MapModelChange() : _action(UNSPECIFIED), _firstIndex(0), _secondIndex(0) { }
MapModelChange( ActionType action, Revision mapModeRev, Layer* layer =0L, int firstIndex =-1, int secondIndex =-1 )
: _action(action), _layer(layer), _modelRevision(mapModeRev), _firstIndex(firstIndex), _secondIndex(secondIndex) { }
const ActionType& getAction() const { return _action; }
const Revision& getRevision() const { return _modelRevision; }
int getFirstIndex() const { return _firstIndex; }
int getSecondIndex() const { return _secondIndex; }
Layer* getLayer() const { return _layer.get(); }
ImageLayer* getImageLayer() const { return dynamic_cast<ImageLayer*>(_layer.get()); }
ElevationLayer* getElevationLayer() const { return dynamic_cast<ElevationLayer*>(_layer.get()); }
ModelLayer* getModelLayer() const { return dynamic_cast<ModelLayer*>(_layer.get()); }
TerrainConstraintLayer* getConstraintLayer() const { return dynamic_cast<TerrainConstraintLayer*>(_layer.get()); }
private:
ActionType _action;
osg::ref_ptr<Layer> _layer;
Revision _modelRevision;
int _firstIndex, _secondIndex;
};
}
#endif // OSGEARTH_MAP_MODEL_CHANGE_H