Milsymbol Mapping: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
()
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
=== Get Mapped SIDC from SIDC ===
=== Get Mapped SIDC from SIDC ===
<source lang="c#">
<source lang="c#">
var factory = new DrawObjectCommonFactory();
var resources= new DrawObjectCommonResources(...);


// Get APP6D sidc from MIL-STD-2525C SIDC
// Get APP6D sidc from MIL-STD-2525C sidc
var id_d = factory.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("TACGRP.C2GM.DEF.ARS.BTLPSN", Mapping.MilSymType.APP6D);
var id_d = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("TACGRP.C2GM.DEF.ARS.BTLPSN", Mapping.MilSymType.APP6D);
 
// Get APP6D sidc from MIL-STD-2525C sidc, where sidc is generalized to find nearest APP6D sidc
var id_d = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("TACGRP.C2GM.DEF.ARS.BTLPSN", true, Mapping.MilSymType.APP6D);


// Get MIL-STD-2525C sidc from APP6D sidc
// Get MIL-STD-2525C sidc from APP6D sidc
var id_c = factory.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("30002500001512000000", Mapping.MilSymType.MILSTD2525C);
var id_c = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("30002500001512000000", Mapping.MilSymType.MILSTD2525C);
 
// Get MIL-STD-2525C sidc from APP6D sidc, where sidc is generalized to find nearest MIL-STD-2525C sidc
var id_c = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("30002500001512000000", true, Mapping.MilSymType.MILSTD2525C);
 
// Get APP6D sidc from 15 character MIL-STD-2525C sidc
var id_d = resources.MilSymMapper.MapAPP6CToAPP6D("SUGPUSTA--A----");
 
// Get APP6D sidc from 15 character MIL-STD-2525C sidc, where sidc is generalized to find nearest APP6D sidc
var id_d = resources.MilSymMapper.MapAPP6CToAPP6D("S*GCIUEF--H****", true);
 
// Get 15 character MIL-STD-2525C sidc from APP6D sidc
var id_c = resources.MilSymMapper.MapAPP6DToAPP6C("10030100001101040000");
 
// Get 15 character MIL-STD-2525C sidc from APP6D sidc, where sidc is generalized to find nearest MIL-STD-2525C sidc
var id_c = resources.MilSymMapper.MapAPP6DToAPP6C("10001000001622000000", true);
 
</source>
</source>


=== Get Mapped TypeId from SIDC ===
=== Get Mapped TypeId from SIDC ===
<source lang="c#">
<source lang="c#">
var factory = new DrawObjectCommonFactory();
var resources= new DrawObjectCommonResources(...);


// Get APP6D TypeId from MIL-STD-2525C sidc
// Get APP6D TypeId from MIL-STD-2525C sidc
var typeId_d = factory.MilSymMapper.GetDrawObjectTypeId("TACGRP.C2GM.DEF.ARS.BTLPSN", Mapping.MilSymType.APP6D);
var typeId_d = resources.MilSymMapper.GetTypeId("TACGRP.C2GM.DEF.ARS.BTLPSN", Mapping.MilSymType.APP6D);
 
// Get APP6D TypeId from MIL-STD-2525C sidc, where sidc is generalized to find nearest APP6D sidc
var typeId_d = resources.MilSymMapper.GetTypeId("TACGRP.C2GM.DEF.ARS.BTLPSN", true, Mapping.MilSymType.APP6D);


// Get MIL-STD-2525C TypeId from APP6D sidc
// Get MIL-STD-2525C TypeId from APP6D sidc
var typeId_c = factory.MilSymMapper.GetDrawObjectTypeId("30002500001512000000", Mapping.MilSymType.MILSTD2525C);
var typeId_c = resources.MilSymMapper.GetTypeId("30002500001512000000", Mapping.MilSymType.MILSTD2525C);
 
// Get MIL-STD-2525C TypeId from APP6D sidc, where sidc is generalized to find nearest MIL-STD-2525C sidc
var typeId_c = resources.MilSymMapper.GetTypeId("30002500001512000000", true, Mapping.MilSymType.MILSTD2525C);
</source>
</source>


=== Get Mapped SIDC from TypeId ===
=== Get Mapped SIDC from TypeId ===
<source lang="c#">
<source lang="c#">
var factory = new DrawObjectCommonFactory();
var resources= new DrawObjectCommonResources(...);


// Get APP6D sidc from TypeId
// Get APP6D sidc from TypeId
var id_d = factory.MilSymMapper.GetMilSymSIDCFromTypeId(new Guid("88784e27-c8d4-46d8-a72f-4fc433c759ee"), Mapping.MilSymType.APP6D);
var id_d = resources.MilSymMapper.GetMilSymSIDCFromTypeId(new Guid("88784e27-c8d4-46d8-a72f-4fc433c759ee"), Mapping.MilSymType.APP6D);


// Get MIL-STD-2525C sidc from TypeId
// Get MIL-STD-2525C sidc from TypeId
var id_c = factory.MilSymMapper.GetMilSymSIDCFromTypeId(new Guid("88784e27-c8d4-46d8-a72f-4fc433c759ee"), Mapping.MilSymType.MILSTD2525C);
var id_c = resources.MilSymMapper.GetMilSymSIDCFromTypeId(new Guid("88784e27-c8d4-46d8-a72f-4fc433c759ee"), Mapping.MilSymType.MILSTD2525C);
</source>
</source>


Line 42: Line 67:
var mappingDrawObjectTypeXmlParser = new MappingDrawObjectTypeXmlParser();
var mappingDrawObjectTypeXmlParser = new MappingDrawObjectTypeXmlParser();
var mappingDrawObjectTypeLoader = new MappingDrawObjectTypeLoader(mappingDrawObjectTypeXmlParser);
var mappingDrawObjectTypeLoader = new MappingDrawObjectTypeLoader(mappingDrawObjectTypeXmlParser);
var activesymbolset = "APP6D";
var milSymMapper = new MilSymMapper(mappingDrawObjectTypeLoader);
var milSymMapper = new MilSymMapper(mappingDrawObjectTypeLoader, activesymbolset);
</source>
</source>


Line 49: Line 73:


Some objects cannot be mapped directly between APP6D and MIL-STD2525C. Either because the primitive representation of the objects are not compatible or because the objects are not present in both versions.
Some objects cannot be mapped directly between APP6D and MIL-STD2525C. Either because the primitive representation of the objects are not compatible or because the objects are not present in both versions.
To handle this, the configuration file MilSymVersionMappings.json (located in the Data folder of the application output), sets up how these objects (SIDCs) should be mapped.
To handle this, the configuration file MilSymVersionMappings.json (located in the Data folder of the application output), sets up how these objects (SIDCs) should be mapped.  
 
The file is divided into two sections:
 
*HierarchyCodeMappings, for mapping a 20 digit APP6D SIDC to a MARIA GDK 4 draw object (MIL-STD2525C) hierarchy code, and vice versa
*SymbolCodeMappings, for mapping a 20 digit APP6D SIDC to a 15 character MIL-STD2525C SIDC, and vice versa


Entries in the configuration file looks like this:
Entries in each section of the configuration file looks like this:


<source lang="json">
<source lang="json">
Line 67: Line 96:


{| class="wikitable"
{| class="wikitable"
! Name
!Name
! Description
!Description
|-
|-
| '''SourceVersion'''
| '''SourceVersion'''
| Version to map from.
|Version to map from.
|-
|-
| '''TargetVersion'''
| '''TargetVersion'''  
| Version to map to.
|Version to map to.
|-
|-
| '''Name'''
|'''Name'''
| Name of object (for readability only, does not affect mapping).
|Name of object (for readability only, does not affect mapping).
|-
|-
| '''Source'''
|'''Source'''
| SIDC to map from.
|SIDC to map from.
|-
|-
| '''Target'''
|'''Target'''
| SIDC to map to.
|SIDC to map to.
|-
|-
| '''ObjectType'''
|'''ObjectType'''
| Primitive type of object (for readability only, does not affect mapping).
|Primitive type of object (for readability only, does not affect mapping).
|}
|}



Latest revision as of 14:12, 20 May 2025

Milsymbol Mapping

The "MilSymMapper" class provides methods for mapping draw object SIDC and TypeId between the milsymbol versions: APP6D, MIL-STD-2525D, and MIL-STD-2525C.

Examples of Usage

These examples maps the Battle Position type.

Get Mapped SIDC from SIDC

var resources= new DrawObjectCommonResources(...);

// Get APP6D sidc from MIL-STD-2525C sidc
var id_d = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("TACGRP.C2GM.DEF.ARS.BTLPSN", Mapping.MilSymType.APP6D);

// Get APP6D sidc from MIL-STD-2525C sidc, where sidc is generalized to find nearest APP6D sidc
var id_d = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("TACGRP.C2GM.DEF.ARS.BTLPSN", true, Mapping.MilSymType.APP6D);

// Get MIL-STD-2525C sidc from APP6D sidc
var id_c = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("30002500001512000000", Mapping.MilSymType.MILSTD2525C);

// Get MIL-STD-2525C sidc from APP6D sidc, where sidc is generalized to find nearest MIL-STD-2525C sidc
var id_c = resources.MilSymMapper.GetMilSymSIDCFromMilSymSIDC("30002500001512000000", true, Mapping.MilSymType.MILSTD2525C);

// Get APP6D sidc from 15 character MIL-STD-2525C sidc
 var id_d = resources.MilSymMapper.MapAPP6CToAPP6D("SUGPUSTA--A----");

// Get APP6D sidc from 15 character MIL-STD-2525C sidc, where sidc is generalized to find nearest APP6D sidc
 var id_d = resources.MilSymMapper.MapAPP6CToAPP6D("S*GCIUEF--H****", true);

// Get 15 character MIL-STD-2525C sidc from APP6D sidc 
 var id_c = resources.MilSymMapper.MapAPP6DToAPP6C("10030100001101040000");

// Get 15 character MIL-STD-2525C sidc from APP6D sidc, where sidc is generalized to find nearest MIL-STD-2525C sidc
 var id_c = resources.MilSymMapper.MapAPP6DToAPP6C("10001000001622000000", true);

Get Mapped TypeId from SIDC

var resources= new DrawObjectCommonResources(...);

// Get APP6D TypeId from MIL-STD-2525C sidc
var typeId_d = resources.MilSymMapper.GetTypeId("TACGRP.C2GM.DEF.ARS.BTLPSN", Mapping.MilSymType.APP6D);

// Get APP6D TypeId from MIL-STD-2525C sidc, where sidc is generalized to find nearest APP6D sidc
var typeId_d = resources.MilSymMapper.GetTypeId("TACGRP.C2GM.DEF.ARS.BTLPSN", true, Mapping.MilSymType.APP6D);

// Get MIL-STD-2525C TypeId from APP6D sidc
var typeId_c = resources.MilSymMapper.GetTypeId("30002500001512000000", Mapping.MilSymType.MILSTD2525C);

// Get MIL-STD-2525C TypeId from APP6D sidc, where sidc is generalized to find nearest MIL-STD-2525C sidc
var typeId_c = resources.MilSymMapper.GetTypeId("30002500001512000000", true, Mapping.MilSymType.MILSTD2525C);

Get Mapped SIDC from TypeId

var resources= new DrawObjectCommonResources(...);

// Get APP6D sidc from TypeId
var id_d = resources.MilSymMapper.GetMilSymSIDCFromTypeId(new Guid("88784e27-c8d4-46d8-a72f-4fc433c759ee"), Mapping.MilSymType.APP6D);

// Get MIL-STD-2525C sidc from TypeId
var id_c = resources.MilSymMapper.GetMilSymSIDCFromTypeId(new Guid("88784e27-c8d4-46d8-a72f-4fc433c759ee"), Mapping.MilSymType.MILSTD2525C);

How to Create MilSymMapper Without Factory

var mappingDrawObjectTypeXmlParser = new MappingDrawObjectTypeXmlParser();
var mappingDrawObjectTypeLoader = new MappingDrawObjectTypeLoader(mappingDrawObjectTypeXmlParser);
var milSymMapper = new MilSymMapper(mappingDrawObjectTypeLoader);

Handling Mismatches Between APP6D and MIL-STD2525C

Some objects cannot be mapped directly between APP6D and MIL-STD2525C. Either because the primitive representation of the objects are not compatible or because the objects are not present in both versions. To handle this, the configuration file MilSymVersionMappings.json (located in the Data folder of the application output), sets up how these objects (SIDCs) should be mapped.

The file is divided into two sections:

  • HierarchyCodeMappings, for mapping a 20 digit APP6D SIDC to a MARIA GDK 4 draw object (MIL-STD2525C) hierarchy code, and vice versa
  • SymbolCodeMappings, for mapping a 20 digit APP6D SIDC to a 15 character MIL-STD2525C SIDC, and vice versa

Entries in each section of the configuration file looks like this:

{
      "SourceVersion": "APP6D",
      "TargetVersion": "MILSTD2525C",
      "Name": "Minimum Safe Distance Zones",
      "Source": "30002500002721000000",
      "Target": "GENERIC.ELLIPSE",
      "ObjectType": "MultiFanArea"
}

The values in an entry are:

Name Description
SourceVersion Version to map from.
TargetVersion Version to map to.
Name Name of object (for readability only, does not affect mapping).
Source SIDC to map from.
Target SIDC to map to.
ObjectType Primitive type of object (for readability only, does not affect mapping).

The entries in the configuration file can be edited to whatever is the best match for the client application, as long as the primitive representation of the objects are compatible.