Application Setup: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
()
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
The following is an overview of which classes need to be set up before adding any layers to the geo controls.
'''(GDK5 Specific)'''
== MariaGeoDataManager ==
This class manages the common structures for geo data in the application. It needs not be a singleton, but usually an application will have only one of these, shared between multiple GeoContols. This class is responsible for:
=== Map service clients ===
The MariaGeoDataManger has clients for map templates, map catalog, and map data services. It also manages the MapServiceResolver which looks up data services based on map queries.
=== Tile cache ===
The Tile Cache is central to all the map layers as well as elevation data. The MariaGeoDataManager also includes methods for accessing and adding custom tiled data providers to
the tile cache manager.
=== Elevation Data ===
The MariaGeoDataManager contains an ElevationDataViewModel as well as an ElevationData interface for making elevation queries. The ElevationDataViewModel controls the active layers in the ElevationData. This ElevationData is used for all common elevation operations in the MapLayer and 3D views, such as elevation shading, elevation profiles etc.
== MariaGeoDataManager3D ==
This class inherits the MariaGeoDataManager and contains additional data structures which are relevant for 3D, such as the 3D model manager for adding 3D models to the layers.
== GeoControlViewModel ==
The GeoControlViewModel is the main hub of all the geo layers. It has the GeoLayerManager which gives access to (among other things) the following:
* Layer List
* Location and scale of the map view (GeoNavigator, GeoContext)
* Interaction tools such as panning and zooming (GeoToolManager)
* Geo Units settings
* Item selection
* Undo/Redo stack.
== MariaApplication singleton ==
== MariaApplication singleton ==


The TPG.GDK.Maria.Common.MariaApplication is a Singleton class which sets up some application wide properties and facilities, such as data paths and logging. This class need not be explicitly instantiated unless you have particular requirements for the input parameters. See the code doc for list of available constructor parameters.
The TPG.GDK.Maria.Common.MariaApplication is a Singleton class which sets up some application wide properties and facilities, such as data paths and logging. This class need not be explicitly instantiated unless you have particular requirements for the input parameters. See the code doc for list of available constructor parameters.


== Application shutdown ==
=== Application shutdown ===


To ensure a clean shutdown you should call MariaApplication.Shutdown() before on application exit. For example:
To ensure a clean shutdown you should call MariaApplication.Shutdown() before on application exit. For example:
Line 21: Line 54:


</source>
</source>
== Example ==
The following is an example of the setup of the main classes, for example in the main view model in your application.
<source lang="c#">
  // Set up service clients.
  IBindingFactory bindingFactory = new BindingFactory();
  IEndpointAddressFactory endpointAddressFactory = new EndpointAddressFactory();
  var mapCatalogServiceClient = new MapCatalogServiceClient(bindingFactory.NewFromConfigurationFile("MapCatalogService"), endpointAddressFactory.NewFromConfigurationFile("MapCatalogService"), 1000);
 
  var mapTemplateServiceClient = new MapTemplateServiceClientFactory(bindingFactory, endpointAddressFactory).New("TemplateService");
  // Set up common data manager with the required service clients. For a 3D application this would be a MariaGeoDataManager3D.
  var geoDataManager = new MariaGeoDataManager(mapCatalogServiceClient, mapTemplateServiceClient);
  // The GeoControlViewModel is the main hub of all geo layer management.
  var geoControlViewModelFactory = new GeoControlViewModelFactory(MariaApplication.Instance.NativeRenderingManager, geoDataManager.TileCacheManager);
  var geoControlViewModel = geoControlViewModelFactory.New();
  // Set up symbol service client and request processing queue.
  var symbolPointServiceClient = new SymbolPointServiceClient(bindingFactory.NewFromConfigurationFile("SymbolPointService"), endpointAddressFactory.NewFromConfigurationFile("SymbolPointService"), 1000);
  var symbolRequestProcessor = new SymbolRequestProcessor(SymbolPointServiceClient);
  // Create some layers
  var mapLayer = new MapLayer(geoControlViewModel, geoDataManager);
  var gridLayer = new GridLayer(geoControlViewModel);
  var trackLayer = new TrackLayer(geoControlViewModel, symbolRequestProcessor);
</source>


[[Category:Creating applications]]
[[Category:Creating applications]]
[[Category:GDK5]]

Latest revision as of 14:45, 27 February 2025

The following is an overview of which classes need to be set up before adding any layers to the geo controls.

(GDK5 Specific)

MariaGeoDataManager

This class manages the common structures for geo data in the application. It needs not be a singleton, but usually an application will have only one of these, shared between multiple GeoContols. This class is responsible for:

Map service clients

The MariaGeoDataManger has clients for map templates, map catalog, and map data services. It also manages the MapServiceResolver which looks up data services based on map queries.

Tile cache

The Tile Cache is central to all the map layers as well as elevation data. The MariaGeoDataManager also includes methods for accessing and adding custom tiled data providers to the tile cache manager.

Elevation Data

The MariaGeoDataManager contains an ElevationDataViewModel as well as an ElevationData interface for making elevation queries. The ElevationDataViewModel controls the active layers in the ElevationData. This ElevationData is used for all common elevation operations in the MapLayer and 3D views, such as elevation shading, elevation profiles etc.

MariaGeoDataManager3D

This class inherits the MariaGeoDataManager and contains additional data structures which are relevant for 3D, such as the 3D model manager for adding 3D models to the layers.

GeoControlViewModel

The GeoControlViewModel is the main hub of all the geo layers. It has the GeoLayerManager which gives access to (among other things) the following:

  • Layer List
  • Location and scale of the map view (GeoNavigator, GeoContext)
  • Interaction tools such as panning and zooming (GeoToolManager)
  • Geo Units settings
  • Item selection
  • Undo/Redo stack.

MariaApplication singleton

The TPG.GDK.Maria.Common.MariaApplication is a Singleton class which sets up some application wide properties and facilities, such as data paths and logging. This class need not be explicitly instantiated unless you have particular requirements for the input parameters. See the code doc for list of available constructor parameters.

Application shutdown

To ensure a clean shutdown you should call MariaApplication.Shutdown() before on application exit. For example:

        public ICommand ExitCommand
        {
            get { return new DelegateCommand(x => ApplicationShutdown()); }
        }

        private void ApplicationShutdown()
        {
            MariaApplication.Instance.Shutdown();
            Application.Current.Shutdown();
        }

Example

The following is an example of the setup of the main classes, for example in the main view model in your application.

   // Set up service clients.
   IBindingFactory bindingFactory = new BindingFactory();
   IEndpointAddressFactory endpointAddressFactory = new EndpointAddressFactory();

   var mapCatalogServiceClient = new MapCatalogServiceClient(bindingFactory.NewFromConfigurationFile("MapCatalogService"), endpointAddressFactory.NewFromConfigurationFile("MapCatalogService"), 1000);
   
   var mapTemplateServiceClient = new MapTemplateServiceClientFactory(bindingFactory, endpointAddressFactory).New("TemplateService");

   // Set up common data manager with the required service clients. For a 3D application this would be a MariaGeoDataManager3D.
   var geoDataManager = new MariaGeoDataManager(mapCatalogServiceClient, mapTemplateServiceClient);

   // The GeoControlViewModel is the main hub of all geo layer management.
   var geoControlViewModelFactory = new GeoControlViewModelFactory(MariaApplication.Instance.NativeRenderingManager, geoDataManager.TileCacheManager);
   var geoControlViewModel = geoControlViewModelFactory.New();

   // Set up symbol service client and request processing queue.
   var symbolPointServiceClient = new SymbolPointServiceClient(bindingFactory.NewFromConfigurationFile("SymbolPointService"), endpointAddressFactory.NewFromConfigurationFile("SymbolPointService"), 1000);
   var symbolRequestProcessor = new SymbolRequestProcessor(SymbolPointServiceClient);

   // Create some layers
   var mapLayer = new MapLayer(geoControlViewModel, geoDataManager);
   var gridLayer = new GridLayer(geoControlViewModel);			
   var trackLayer = new TrackLayer(geoControlViewModel, symbolRequestProcessor);