Class AbstractTileFactory
Factories
Factories corresponds to Mapbox Api endpoints for the most part.Terrain factory uses terrain rgb api,
Image factory uses raster image api and vector tile factory uses vector data api.
Only exception to this at the moment is Directions factory, which is a monobehaviour in Drive demo scene
but we’ll probably rework that in the future as well.
Factories do the api calls.They are responsible for reporting progress and logging/reporting any network issue.
They can also keep track of tiles if necessary (i.e.update/refresh data after initial creation)
Factories processes the received data in different ways.
Terrain factories creates the mesh from the received data (or a flat terrain depending the settings)
MapImage factory applies received image to tile game object.
Vector Tile Factory deals with a much more complex and detailed data compared to other two so it doesn’t do the
whole processing itself and uses some subclasses (LayerVisualizers) to do it.
Creating a custom factory is a good idea if you want to fetch raw data and process is in a totally different
custom way, like creating terrain and then cut off water areas from terrain mesh.
Vector Tile factory, for example, is built to be flexible and work with multiple vector layers. But if you
don’t need that all, you can create a custom version of it and process what you need in a much more concrete
and performant way.
Another example here would be custom terrain mesh. Current terrain factories work with a custom sized grid
and apply height data on that. By creating a custom terrain factory, you can have a custom mesh instead of a grid,
optimize and minimize vertex count etc.
Inheritance
ScriptableObject
AbstractTileFactory
Namespace:Mapbox.Unity.MeshGeneration.Factories
Assembly:cs.temp.dll.dll
Syntax
public abstract class AbstractTileFactory : ScriptableObject
Fields
_fileSource
Declaration
protected IFileSource _fileSource
Field Value
Type |
Description |
IFileSource |
|
_options
Declaration
protected LayerProperties _options
Field Value
_tilesWaitingProcessing
Declaration
protected HashSet<UnityTile> _tilesWaitingProcessing
Field Value
_tilesWaitingResponse
Declaration
protected HashSet<UnityTile> _tilesWaitingResponse
Field Value
Properties
Options
Declaration
public LayerProperties Options { get; }
Property Value
Methods
Clear()
Declaration
public virtual void Clear()
Initialize(IFileSource)
Declaration
public virtual void Initialize(IFileSource fileSource)
Parameters
Type |
Name |
Description |
IFileSource |
fileSource |
|
OnErrorOccurred(UnityTile, TileErrorEventArgs)
Declaration
protected virtual void OnErrorOccurred(UnityTile tile, TileErrorEventArgs e)
Parameters
Type |
Name |
Description |
UnityTile |
tile |
|
TileErrorEventArgs |
e |
|
OnErrorOccurred(TileErrorEventArgs)
Declaration
protected virtual void OnErrorOccurred(TileErrorEventArgs e)
Parameters
Type |
Name |
Description |
TileErrorEventArgs |
e |
|
OnInitialized()
Declaration
protected abstract void OnInitialized()
OnPostProcess(UnityTile)
Declaration
protected abstract void OnPostProcess(UnityTile tile)
Parameters
OnRegistered(UnityTile)
Declaration
protected abstract void OnRegistered(UnityTile tile)
Parameters
OnUnbindEvents()
Declaration
protected abstract void OnUnbindEvents()
OnUnregistered(UnityTile)
Declaration
protected abstract void OnUnregistered(UnityTile tile)
Parameters
PostProcess(UnityTile)
Declaration
public virtual void PostProcess(UnityTile tile)
Parameters
Register(UnityTile)
Declaration
public virtual void Register(UnityTile tile)
Parameters
SetOptions(LayerProperties)
Declaration
public virtual void SetOptions(LayerProperties options)
Parameters
UnbindEvents()
Declaration
public virtual void UnbindEvents()
Unregister(UnityTile)
Declaration
public virtual void Unregister(UnityTile tile)
Parameters
UpdateTileFactory(Object, EventArgs)
Declaration
protected virtual void UpdateTileFactory(object sender, EventArgs args)
Parameters
Type |
Name |
Description |
System.Object |
sender |
|
System.EventArgs |
args |
|
UpdateTileProperty(UnityTile, LayerUpdateArgs)
Declaration
public virtual void UpdateTileProperty(UnityTile tile, LayerUpdateArgs updateArgs)
Parameters
Events
OnTileError
Declaration
public event EventHandler<TileErrorEventArgs> OnTileError
Event Type
Type |
Description |
System.EventHandler<TileErrorEventArgs> |
|
TileFactoryHasChanged
Declaration
public event EventHandler TileFactoryHasChanged
Event Type
Type |
Description |
System.EventHandler |
|