dtDAL::Map Class Reference

Holds the map information and all of the actor proxies. More...

#include <map.h>

List of all members.

Public Types

enum  PlaceableFilter { Placeable, NotPlaceable, Either }

Public Member Functions

const std::string & GetName () const
 
Returns:
the mName of the map.

const std::string & GetSavedName () const
 
Returns:
the mName of the map when it was last saved/originally created.

void SetName (const std::string &newName)
 Sets the maps mName.
const std::string & GetFileName () const
 
Returns:
the file mName the map was saved to.

const std::string & GetDescription () const
 
Returns:
The map description.

void SetDescription (const std::string &newDescription)
 Sets the description text.
const std::string & GetAuthor () const
 
Returns:
The map's author.

void SetAuthor (const std::string &newAuthor)
 Sets the map's author.
const std::string & GetPathNodeFileName () const
 
Returns:
The name of the file containing waypoints or pathnodes

void SetPathNodeFileName (const std::string &newFilename)
 Sets the name of the file used for loading and saving pathnodes.
bool GetCreateNavMesh () const
 
Returns:
whether or not we will create a navmesh on map save

void SetCreateNavMesh (bool pNavMesh)
 Sets whether or not we create a NavMesh on save used with waypoints.
const std::string & GetComment () const
 
Returns:
The map comments.

void SetComment (const std::string &newComment)
 Sets the comments.
const std::string & GetCopyright () const
 
Returns:
the copyright information for the map.

void SetCopyright (const std::string &newCopyright)
 Sets the copyright information.
const std::string & GetCreateDateTime () const
 
Returns:
the date and time the map was created as a UTC formatted string.

void SetCreateDateTime (const std::string &newCreateDateTime)
 Sets the create date time for map based on the first time it was saved.
ActorProxyGetProxyById (const dtCore::UniqueId &id)
 Searches all open maps to find the proxy with the given unique id.
template<typename ProxyType>
void GetProxyById (const dtCore::UniqueId &id, ProxyType *&proxy)
 Templated version of GetProxyById that takes a pointer to the desired type and assigns it by dynamic casting to the that type.
const ActorProxyGetProxyById (const dtCore::UniqueId &id) const
 Searches all open maps to find the proxy with the given unique id.
template<typename ProxyType>
void GetProxyById (const dtCore::UniqueId &id, const ProxyType *&proxy) const
 Templated version of GetProxyById that takes a pointer to the desired type and assigns it by dynamic casting to the that type.
void FindProxies (std::vector< dtCore::RefPtr< ActorProxy > > &container, const std::string &name, const std::string &category=std::string(""), const std::string &typeName=std::string(""), const std::string &className=std::string(""), PlaceableFilter placeable=Either)
 non-const search for proxies.
void FindProxies (std::vector< dtCore::RefPtr< const ActorProxy > > &container, const std::string &name, const std::string &category=std::string(""), const std::string &typeName=std::string(""), const std::string &className=std::string(""), PlaceableFilter placeable=Either) const
 Const version of find for methods that may need to find a proxy only to read values.
const std::map
< dtCore::UniqueId,
dtCore::RefPtr< ActorProxy > > & 
GetAllProxies () const
 
Returns:
a vector of ref pointers to the all the proxies in the map.

void GetAllProxies (std::vector< dtCore::RefPtr< ActorProxy > > &container)
 
Returns:
fills a vector with ref pointers to all the proxies in the map.

void AddProxy (ActorProxy &proxy)
 Adds a new proxy to the map.
bool RemoveProxy (const ActorProxy &proxy)
 Removes a proxy.
void ClearProxies ()
 Clear all the proxies from the map.
const std::set< std::string > & GetProxyActorClasses () const
 
Returns:
a set of all the names of the classes the proxies in this map wrap or inherit from.

void RebuildProxyActorClassSet () const
 rebuilds the list of classes of the actor proxies since items are not removed when proxies are not removed.
bool IsModified () const
 
Returns:
true if this map has been modified since it was loaded.

void SetModified (bool val)
 Sets the map modified status.
bool HasLoadingErrors ()
const std::vector< std::string > & GetMissingLibraries ()
const std::set< std::string > & GetMissingActorTypes ()
const std::map< std::string,
std::string > & 
GetLibraryVersionMap () const
 
Returns:
a map of library mNames mapped to their version numbers.

const std::vector< std::string > & GetAllLibraries () const
 
Returns:
A list of library mNames in the order they should be loaded.

bool HasLibrary (const std::string &mName) const
 
Parameters:
mName the mName of the library.

const std::string GetLibraryVersion (const std::string &mName) const
 
Parameters:
mName the mName of the library to query.

void InsertLibrary (unsigned pos, const std::string &mName, const std::string &version)
 Inserts a library with the given mName at the given position.
void AddLibrary (const std::string &mName, const std::string &version)
 This will add the given library to the map.
bool RemoveLibrary (const std::string &mName)
 Removes a library by mName.
 Map (const std::string &filemName, const std::string &mName=std::string(""))
 Creates a new map.
ActorProxyGetEnvironmentActor ()
 Returns the environment actor of this map or NULL if no environment is set.
const ActorProxyGetEnvironmentActor () const
 const version of the above function Returns the environment actor of this map or NULL if no environment is set
GameEventManagerGetEventManager ()
 
Returns:
the GameEventManager that holds the game events for this map.

const GameEventManagerGetEventManager () const
 
Returns:
as const the GameEventManager that holds the game events for this map.

void SetEnvironmentActor (ActorProxy *envActor)
 Sets the environment actor on this map.

Static Public Member Functions

static bool WildMatch (const std::string &sWild, const std::string &sString)
 Matches a string against wildcard string.

Static Public Attributes

static const std::string MAP_FILE_EXTENSION

Protected Member Functions

void SetFileName (const std::string &newFileName)
 Assigns the file name this map should be saved to.
void SetSavedName (const std::string &newSavedName)
 Assigns the saved map name.
void ClearModified ()
 Clears the modified flag on this map and clears the lists of missing libraries and actor types.
void AddMissingLibraries (const std::vector< std::string > &libs)
 Adds a vector of library mNames to the list of libraries that could not be loaded when this map was read from a save file.
void AddMissingActorTypes (const std::set< std::string > &types)
 Adds a set of actor types to the set of types that could not be created when this map was loaded from a save file.
virtual ~Map ()

Friends

class Project

Classes

class  MapGameEvents


Detailed Description

Holds the map information and all of the actor proxies.

Note:
you may not create a new map. Call Project::createMap(...)
See also:
Project

Member Enumeration Documentation

enum dtDAL::Map::PlaceableFilter

Enumerator:
Placeable 
NotPlaceable 
Either 


Constructor & Destructor Documentation

dtDAL::Map::Map ( const std::string &  filemName,
const std::string &  mName = std::string("") 
)

Creates a new map.

Parameters:
filemName the filemName to use to save the map. If the extension is left off, it will be added.
mName the mName to give the map.

dtDAL::Map::~Map (  )  [protected, virtual]


Member Function Documentation

const std::string& dtDAL::Map::GetName (  )  const [inline]

Returns:
the mName of the map.

const std::string& dtDAL::Map::GetSavedName (  )  const [inline]

Returns:
the mName of the map when it was last saved/originally created.

void dtDAL::Map::SetName ( const std::string &  newName  )  [inline]

Sets the maps mName.

Parameters:
newmName the mName to assign

const std::string& dtDAL::Map::GetFileName (  )  const [inline]

Returns:
the file mName the map was saved to.

const std::string& dtDAL::Map::GetDescription (  )  const [inline]

Returns:
The map description.

This is intended to be a short description.

void dtDAL::Map::SetDescription ( const std::string &  newDescription  )  [inline]

Sets the description text.

Parameters:
newDescription the new text.

const std::string& dtDAL::Map::GetAuthor (  )  const [inline]

Returns:
The map's author.

void dtDAL::Map::SetAuthor ( const std::string &  newAuthor  )  [inline]

Sets the map's author.

Parameters:
newAuthor the author's mName.

const std::string& dtDAL::Map::GetPathNodeFileName (  )  const [inline]

Returns:
The name of the file containing waypoints or pathnodes

void dtDAL::Map::SetPathNodeFileName ( const std::string &  newFilename  )  [inline]

Sets the name of the file used for loading and saving pathnodes.

Parameters:
newFilename the new filename.

bool dtDAL::Map::GetCreateNavMesh (  )  const [inline]

Returns:
whether or not we will create a navmesh on map save

void dtDAL::Map::SetCreateNavMesh ( bool  pNavMesh  )  [inline]

Sets whether or not we create a NavMesh on save used with waypoints.

const std::string& dtDAL::Map::GetComment (  )  const [inline]

Returns:
The map comments.

This is intended to be the long comments.

void dtDAL::Map::SetComment ( const std::string &  newComment  )  [inline]

Sets the comments.

Parameters:
newComment the new comment text.

const std::string& dtDAL::Map::GetCopyright (  )  const [inline]

Returns:
the copyright information for the map.

void dtDAL::Map::SetCopyright ( const std::string &  newCopyright  )  [inline]

Sets the copyright information.

Parameters:
newCopyright the new copyright information.

const std::string& dtDAL::Map::GetCreateDateTime (  )  const [inline]

Returns:
the date and time the map was created as a UTC formatted string.

void dtDAL::Map::SetCreateDateTime ( const std::string &  newCreateDateTime  )  [inline]

Sets the create date time for map based on the first time it was saved.

The value is not validated, but it is expected to be a UTC formatted string.

Parameters:
newCreateDateTime the new create date time value.

ActorProxy * dtDAL::Map::GetProxyById ( const dtCore::UniqueId id  ) 

Searches all open maps to find the proxy with the given unique id.

Parameters:
id the id of the proxy to return.
Returns:
the proxy found or NULL if it was not found. This should be stored in a ref_ptr once received.

template<typename ProxyType>
void dtDAL::Map::GetProxyById ( const dtCore::UniqueId id,
ProxyType *&  proxy 
) [inline]

Templated version of GetProxyById that takes a pointer to the desired type and assigns it by dynamic casting to the that type.

Parameters:
id the id of the actor to find.
proxy Output Parametr. A pointer to a proxy by reference.

const ActorProxy * dtDAL::Map::GetProxyById ( const dtCore::UniqueId id  )  const

Searches all open maps to find the proxy with the given unique id.

Parameters:
id the id of the proxy to return.
Returns:
the proxy found or NULL if it was not found. This should be stored in a ref_ptr once received.

template<typename ProxyType>
void dtDAL::Map::GetProxyById ( const dtCore::UniqueId id,
const ProxyType *&  proxy 
) const [inline]

Templated version of GetProxyById that takes a pointer to the desired type and assigns it by dynamic casting to the that type.

Parameters:
id the id of the actor to find.
proxy Output Parametr. A pointer to a proxy by reference.

void dtDAL::Map::FindProxies ( std::vector< dtCore::RefPtr< ActorProxy > > &  container,
const std::string &  name,
const std::string &  category = std::string(""),
const std::string &  typeName = std::string(""),
const std::string &  className = std::string(""),
PlaceableFilter  placeable = Either 
)

non-const search for proxies.

Parameters:
container The container to fill.
name The name of the proxy to find or empty string to not use the name.
category The category of the proxy to find, this will also find proxies in subcategories. Use empty string to ignore.
typeName The name of the proxy actor type. Use empty string or omit the parameter to ignore the type.
className The name of the actor class to match. It will match this as a superclass.
placeable set to Placeable to search for only proxys that return true for isPlaceable, NonPlaceable for false, or Either for both.

void dtDAL::Map::FindProxies ( std::vector< dtCore::RefPtr< const ActorProxy > > &  container,
const std::string &  name,
const std::string &  category = std::string(""),
const std::string &  typeName = std::string(""),
const std::string &  className = std::string(""),
PlaceableFilter  placeable = Either 
) const

Const version of find for methods that may need to find a proxy only to read values.

Parameters:
container The container to fill, note that it holds const ActorProxy.
name The name of the proxy to find or empty string to not use the name.
category The category of the proxy to find, this will also find proxies in subcategories. Use empty string to ignore.
typeName The name of the proxy actor type. Use empty string or omit the parameter to ignore the type.
className The name of the actor class to match. It will match this as a superclass.
placeable set to Placeable to search for only proxys that return true for isPlaceable, NonPlaceable for false, or Either for both.

const std::map<dtCore::UniqueId, dtCore::RefPtr<ActorProxy> >& dtDAL::Map::GetAllProxies (  )  const [inline]

Returns:
a vector of ref pointers to the all the proxies in the map.

void dtDAL::Map::GetAllProxies ( std::vector< dtCore::RefPtr< ActorProxy > > &  container  )  [inline]

Returns:
fills a vector with ref pointers to all the proxies in the map.

void dtDAL::Map::AddProxy ( ActorProxy proxy  ) 

Adds a new proxy to the map.

Parameters:
proxy the proxy to add.

bool dtDAL::Map::RemoveProxy ( const ActorProxy proxy  ) 

Removes a proxy.

Parameters:
proxy the proxy to remove.
Returns:
true if the proxy passed in was actually removed.

void dtDAL::Map::ClearProxies (  ) 

Clear all the proxies from the map.

const std::set<std::string>& dtDAL::Map::GetProxyActorClasses (  )  const [inline]

Returns:
a set of all the names of the classes the proxies in this map wrap or inherit from.

void dtDAL::Map::RebuildProxyActorClassSet (  )  const

rebuilds the list of classes of the actor proxies since items are not removed when proxies are not removed.

Call this after a large number of proxies has been removed.

bool dtDAL::Map::IsModified (  )  const [inline]

Returns:
true if this map has been modified since it was loaded.

void dtDAL::Map::SetModified ( bool  val  )  [inline]

Sets the map modified status.

Parameters:
val True modified, false otherwise.

bool dtDAL::Map::HasLoadingErrors (  )  [inline]

const std::vector<std::string>& dtDAL::Map::GetMissingLibraries (  )  [inline]

const std::set<std::string>& dtDAL::Map::GetMissingActorTypes (  )  [inline]

const std::map<std::string, std::string>& dtDAL::Map::GetLibraryVersionMap (  )  const [inline]

Returns:
a map of library mNames mapped to their version numbers.

These are the libraries the map depends on.

const std::vector<std::string>& dtDAL::Map::GetAllLibraries (  )  const [inline]

Returns:
A list of library mNames in the order they should be loaded.

bool dtDAL::Map::HasLibrary ( const std::string &  mName  )  const [inline]

Parameters:
mName the mName of the library.

Returns:
true if this map loads the given library.

const std::string dtDAL::Map::GetLibraryVersion ( const std::string &  mName  )  const [inline]

Parameters:
mName the mName of the library to query.

Returns:
the version of the library passed in or "" if that library is not referenced by the map.

void dtDAL::Map::InsertLibrary ( unsigned  pos,
const std::string &  mName,
const std::string &  version 
)

Inserts a library with the given mName at the given position.

If a library of the given mName is already in the map, the version will be updated and the order adjusted to match the iterator.

Parameters:
pos the position to place the library.
mName the mName of the library
version the version string of the library.

void dtDAL::Map::AddLibrary ( const std::string &  mName,
const std::string &  version 
)

This will add the given library to the map.

If a library by the given mName is already in the map, the library will be placed at the end and the version will be update to the one given.

Parameters:
mName the mName of the library.
version the version string of the library.

bool dtDAL::Map::RemoveLibrary ( const std::string &  mName  ) 

Removes a library by mName.

Parameters:
mName the mName of the library to remove.
Returns:
true or false if an item was actually removed.

bool dtDAL::Map::WildMatch ( const std::string &  sWild,
const std::string &  sString 
) [static]

Matches a string against wildcard string.

"*" matches anything. "?" matches any single character.

Parameters:
sWild the string with wildcards to match with.
sString the string to check.
Returns:
true or false if sString matches or doesn't match the wildcard.

ActorProxy* dtDAL::Map::GetEnvironmentActor (  )  [inline]

Returns the environment actor of this map or NULL if no environment is set.

Returns:
A pointer to the environment actor or NULL

const ActorProxy* dtDAL::Map::GetEnvironmentActor (  )  const [inline]

const version of the above function Returns the environment actor of this map or NULL if no environment is set

Returns:
A pointer to the environment actor or NULL

GameEventManager & dtDAL::Map::GetEventManager (  ) 

Returns:
the GameEventManager that holds the game events for this map.

const GameEventManager & dtDAL::Map::GetEventManager (  )  const

Returns:
as const the GameEventManager that holds the game events for this map.

void dtDAL::Map::SetEnvironmentActor ( ActorProxy envActor  ) 

Sets the environment actor on this map.

Parameters:
envActor The new environment actor to set

void dtDAL::Map::SetFileName ( const std::string &  newFileName  )  [protected]

Assigns the file name this map should be saved to.

It should not have an extension.

Parameters:
newFileName the new file name.

void dtDAL::Map::SetSavedName ( const std::string &  newSavedName  )  [inline, protected]

Assigns the saved map name.

This is used as an override when loading backup copies of maps since they may have had the name changed and need this set.

Parameters:
newSavedname the new file name.

void dtDAL::Map::ClearModified (  )  [protected]

Clears the modified flag on this map and clears the lists of missing libraries and actor types.

void dtDAL::Map::AddMissingLibraries ( const std::vector< std::string > &  libs  )  [protected]

Adds a vector of library mNames to the list of libraries that could not be loaded when this map was read from a save file.

Parameters:
libs the libraries to add.

void dtDAL::Map::AddMissingActorTypes ( const std::set< std::string > &  types  )  [protected]

Adds a set of actor types to the set of types that could not be created when this map was loaded from a save file.

Parameters:
types the types to add.


Friends And Related Function Documentation

friend class Project [friend]


Member Data Documentation

const std::string dtDAL::Map::MAP_FILE_EXTENSION [static]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008