Mapper  0.9.0
API documentation
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenOrienteering::MapPartUndoStep Class Reference

A map part undo step handles addition, deletion and renaming of map parts. More...

#include <map_part_undo.h>

Inheritance diagram for OpenOrienteering::MapPartUndoStep:
Inheritance graph
[legend]
Collaboration diagram for OpenOrienteering::MapPartUndoStep:
Collaboration graph
[legend]

Public Types

enum  MapPartChange { AddMapPart = 1, RemoveMapPart = 2, ModifyMapPart = 3, UndefinedChange = 0 }
 Types of map part changes. More...
 
- Public Types inherited from OpenOrienteering::UndoStep
enum  Type {
  ReplaceObjectsUndoStepType = 0, DeleteObjectsUndoStepType = 1, AddObjectsUndoStepType = 2, SwitchSymbolUndoStepType = 3,
  SwitchDashesUndoStepType = 4, CombinedUndoStepType = 5, ValidNoOpUndoStepType = 6, ObjectTagsUndoStepType = 7,
  MapPartUndoStepType = 8, SwitchPartUndoStepTypeV0 = 9, SwitchPartUndoStepType = 10, InvalidUndoStepType = 999
}
 Types of undo steps for identification. More...
 
typedef std::set< int > PartSet
 A set of integers referring to parts. More...
 
typedef std::set< Object * > ObjectSet
 A set of pointers to objects. More...
 

Public Member Functions

 MapPartUndoStep (Map *map, MapPartChange change, const MapPart *part)
 Constructs a particular undo step for the given part. More...
 
 MapPartUndoStep (Map *map, MapPartChange change, int index)
 Constructs a particular undo step for the part specified by index. More...
 
 MapPartUndoStep (Map *map)
 Constructs an incomplete undo step of type UndefinedChange. More...
 
 ~MapPartUndoStep () override
 
bool isValid () const override
 Returns true unless this step's type is UndefinedChange. More...
 
UndoStepundo () override
 Undoes the action and returns a new UndoStep. More...
 
bool getModifiedParts (PartSet &out) const override
 Adds the list of the step's modified parts to the container provided by out. More...
 
void getModifiedObjects (int part_index, ObjectSet &out) const override
 Adds the list of the step's modified objects to the container provided by out. More...
 
- Public Member Functions inherited from OpenOrienteering::UndoStep
 UndoStep (Type type, Map *map)
 Constructs an undo step having the given type. More...
 
 UndoStep (const UndoStep &)=delete
 
 UndoStep (UndoStep &&)=delete
 
virtual ~UndoStep ()
 Destructor. More...
 
UndoStepoperator= (const UndoStep &)=delete
 
UndoStepoperator= (UndoStep &&)=delete
 
Type getType () const
 Returns the type of the undo step. More...
 
void save (QXmlStreamWriter &xml) const
 Saves the undo step to the stream in xml format. More...
 

Protected Member Functions

void saveImpl (QXmlStreamWriter &xml) const override
 Saves undo properties to the the xml stream. More...
 
void loadImpl (QXmlStreamReader &xml, SymbolDictionary &symbol_dict) override
 Loads undo properties from the the xml stream. More...
 

Protected Attributes

MapPartChange change
 
int index
 
QString name
 
- Protected Attributes inherited from OpenOrienteering::UndoStep
Type const type
 The type of the undo step. More...
 
Map *const map
 The map this undo step belongs. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenOrienteering::UndoStep
static UndoStepgetUndoStepForType (Type type, Map *map)
 Constructs an undo step of the given type. More...
 
static UndoStepload (QXmlStreamReader &xml, Map *map, SymbolDictionary &symbol_dict)
 Loads the undo step from the stream in xml format. More...
 

Detailed Description

A map part undo step handles addition, deletion and renaming of map parts.

Member Enumeration Documentation

◆ MapPartChange

Types of map part changes.

Enumerator
AddMapPart 
RemoveMapPart 
ModifyMapPart 
UndefinedChange 

Constructor & Destructor Documentation

◆ MapPartUndoStep() [1/3]

OpenOrienteering::MapPartUndoStep::MapPartUndoStep ( Map map,
MapPartChange  change,
const MapPart part 
)

Constructs a particular undo step for the given part.

◆ MapPartUndoStep() [2/3]

OpenOrienteering::MapPartUndoStep::MapPartUndoStep ( Map map,
MapPartChange  change,
int  index 
)

Constructs a particular undo step for the part specified by index.

◆ MapPartUndoStep() [3/3]

OpenOrienteering::MapPartUndoStep::MapPartUndoStep ( Map map)

Constructs an incomplete undo step of type UndefinedChange.

This is to be used with loadImpl().

◆ ~MapPartUndoStep()

OpenOrienteering::MapPartUndoStep::~MapPartUndoStep ( )
override

Member Function Documentation

◆ getModifiedObjects()

void OpenOrienteering::MapPartUndoStep::getModifiedObjects ( int  part_index,
ObjectSet out 
) const
overridevirtual

Adds the list of the step's modified objects to the container provided by out.

Only objects which belong to the given part are dealt with.

The default implementation does nothing.

Reimplemented from OpenOrienteering::UndoStep.

◆ getModifiedParts()

bool OpenOrienteering::MapPartUndoStep::getModifiedParts ( PartSet out) const
overridevirtual

Adds the list of the step's modified parts to the container provided by out.

The default implementation does nothing and returns false.

Returns
True if there are parts (and objects!) modified by this undo step, false otherwise.

Reimplemented from OpenOrienteering::UndoStep.

◆ isValid()

bool OpenOrienteering::MapPartUndoStep::isValid ( ) const
overridevirtual

Returns true unless this step's type is UndefinedChange.

Reimplemented from OpenOrienteering::UndoStep.

◆ loadImpl()

void OpenOrienteering::MapPartUndoStep::loadImpl ( QXmlStreamReader xml,
SymbolDictionary symbol_dict 
)
overrideprotectedvirtual

Loads undo properties from the the xml stream.

Implementations in derived classes shall first check the element's name for one of their own elements, and otherwise call the parent class' implementation.

Reimplemented from OpenOrienteering::UndoStep.

◆ saveImpl()

void OpenOrienteering::MapPartUndoStep::saveImpl ( QXmlStreamWriter xml) const
overrideprotectedvirtual

Saves undo properties to the the xml stream.

Implementations in derived classes shall first call the parent class' implementation, and then start a new element for additional properties.

Reimplemented from OpenOrienteering::UndoStep.

◆ undo()

UndoStep * OpenOrienteering::MapPartUndoStep::undo ( )
overridevirtual

Undoes the action and returns a new UndoStep.

The returned UndoStep can redo the action again.

Implements OpenOrienteering::UndoStep.

Member Data Documentation

◆ change

MapPartChange OpenOrienteering::MapPartUndoStep::change
protected

◆ index

int OpenOrienteering::MapPartUndoStep::index
protected

◆ name

QString OpenOrienteering::MapPartUndoStep::name
protected

The documentation for this class was generated from the following files: