Draw object layer

From Maria GDK Wiki
Revision as of 14:54, 2 April 2025 by Ths (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

(GDK5 Specific)

This page details the setup of the Maria DrawObjectLayer.

There are three main components to know about here:

DrawObjectSystemFactory

This class is responsible for setting up the entire draw object subsystem. You should only have one of these in any application. This class gives access to the common resources through the *CommonResources* property. It is also able to create new DrawObjectLayers and DrawObjectLayerResources.

The DrawObjectSystemFactory depends on a SymbolRequestProcessor for generating point symbols in all draw object layers. The symbol request processor should be shared between draw object layers and other layers that use the symbol point service, such as the track layer.

DrawObjectCommonResources

Interface to all the common components that are shared between all draw object layers. For example the GeoObjectClientStores, MilSymMapper, etc.

DrawObjectLayerResources

These are objects that are required for each draw object layer, such as DrawObjectStore, Styling, etc. If you have an application that needs to produce draw objects, but not necessarily present them in a map, you can create a DrawObjectLayerResources object with no DrawObjectLayer functionality.

DrawObjectLayer

The DrawObjectLayer contains a DrawObjectLayerResources instance as well as all the layer specific features that are needed to display and interact with draw objects.

Example

   // Symbol service client and symbol processor is shared between different layers.
   SymbolPointServiceClient = new SymbolPointServiceClient(bindingFactory.NewFromConfigurationFile("SymbolPointService"), endpointAddressFactory.NewFromConfigurationFile("SymbolPointService"), 1000);
   _symbolRequestProcessor = new SymbolRequestProcessor(SymbolPointServiceClient);

   ....

   // There should be only one draw object system factory in the application.
   _drawObjectSystemFactory = new DrawObjectSystemFactory(_symbolRequestProcessor);
   
   // Common draw object resources, may be used throughout the application.
   _drawObjectCommon = _drawObjectSystemFactory.CommonResources;

   // Connect to GeoObject service, if necessary. 
   _drawObjectCommon.GeoObjectClientStores.ConnectToService(new Uri("http://localhost:5097"));
            
   // Create a draw object layer with an in-memory store.
   var storeInfo = new StoreInfo() { Id = "InMemory", IsInProcessStore = true };
   _drawObjectLayer = _drawObjectSystemFactory.CreateLayer(GeoControlViewModel, storeInfo);