Quintiq file version 2.0
#parent: GISComponent
Response OnDetermineObjectCharacteristics (
  StockingPointUnit object
) id:Response_GISComponent_OnDetermineObjectCharacteristics_308
{
  #keys: '[110880.6.659185673]'
  Body:
  [*
    // Show stocking point unit (GIS 2.0)
    // MODELING HANDLE to switch to PTV: Change the srsMap variable to create a SRS of PTV map
    
    selectedunit := guard( object.Unit().GIS_UnitAddress().GIS_UnitGeocodeResult().Selected(), null( LibGIS_GeocodedAddress ) );
    selectedsp   := guard( object.StockingPoint_MP().GIS_StockingPointAddress().GIS_StockingPointGeocodeResult().Selected(), null( LibGIS_GeocodedAddress ) );
    
    if( not isnull( selectedsp ) and not isnull( selectedunit ) )
    {
      // Unable to retrieve SRS from GIS Component as this response is triggered before the SRS value of GIS Component has a value.
      // Presumably the SRS value is set after this response is called. Therefore the SRS value has to be hard-coded.
      //srsMap   := SpatialReferenceSystem::CreateFromWKT( GISComponentOSMMap.SpatialReferenceSystemWKT() );
      srsMap   := SpatialReferenceSystem::CreateFromEPSG( 3857 );
      srsunit     := SpatialReferenceSystem::CreateFromWKT( selectedunit.SRS() );
      unitcoor    := GIS2DCoordinate::Create( selectedunit.X(), selectedunit.Y() );
      unitmapCoor := GIS2DCoordinateConverter::Convert( srsunit, unitcoor, srsMap );
    
      srssp := SpatialReferenceSystem::CreateFromWKT( selectedsp.SRS() );
      spcoor := GIS2DCoordinate::Create( selectedsp.X(), selectedsp.Y() );
      spmapcoor := GIS2DCoordinateConverter::Convert( srssp, spcoor, srsMap );
    
      creator.AddLine( unitmapCoor.X(), unitmapCoor.Y(), spmapcoor.X(), spmapcoor.Y() );
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_GISComponent_OnDetermineObjectCharacteristics'
}
