Application Setup: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→) |
||
Line 23: | Line 23: | ||
var symbolRequestProcessor = new SymbolRequestProcessor(SymbolPointServiceClient); | var symbolRequestProcessor = new SymbolRequestProcessor(SymbolPointServiceClient); | ||
// Create some layers | |||
var mapLayer = new MapLayer(geoControlViewModel, geoDataManager); | var mapLayer = new MapLayer(geoControlViewModel, geoDataManager); | ||
var gridLayer = new GridLayer(geoControlViewModel); | var gridLayer = new GridLayer(geoControlViewModel); | ||
Line 29: | Line 29: | ||
</source> | </source> | ||
== MariaApplication singleton == | == MariaApplication singleton == |
Revision as of 15:15, 26 February 2025
The following is an overview of which classes need to be set up before adding any layers to the geo controls.
Complete example (2D)
// 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.
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);
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();
}