yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Quintiq file version 2.0
#parent: GISComponent
Response OnDetermineObjectCharacteristics (
  LaneLeg object
) id:Response_GISComponent_OnDetermineObjectCharacteristics_174
{
  #keys: '[110994.0.2145854231]'
  Body:
  [*
    // Show lane legs (GIS 2.0)
    // MODELING HANDLE to switch to PTV: Change the srsMap variable to create a SRS of PTV map
    
    orileg := guard( object.AsOriginStockingPointLeg().StockingPoint_MP().GIS_StockingPointAddress().GIS_StockingPointGeocodeResult().Selected(), null( LibGIS_GeocodedAddress ) );
    destleg := guard( object.AsDestinationStockingPointLeg().StockingPoint_MP().GIS_StockingPointAddress().GIS_StockingPointGeocodeResult().Selected(), null( LibGIS_GeocodedAddress ) );
    
    if( not isnull( destleg ) and not isnull( orileg ) )
    {
      // 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( orileg.SRS() );
      unitcoor    := GIS2DCoordinate::Create( orileg.X(), orileg.Y() );
      unitmapCoor := GIS2DCoordinateConverter::Convert( srsunit, unitcoor, srsMap );
    
      srssp := SpatialReferenceSystem::CreateFromWKT( destleg.SRS() );
      spcoor := GIS2DCoordinate::Create( destleg.X(), destleg.Y() );
      spmapcoor := GIS2DCoordinateConverter::Convert( srssp, spcoor, srsMap );
    
      creator.AddLine( unitmapCoor.X(), unitmapCoor.Y(), spmapcoor.X(), spmapcoor.Y() );
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_GISComponent_OnDetermineObjectCharacteristics'
}