Maria globe client/Advanced map settings/3D settings code sample: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
(Created page with "== Main window == <source lang="xml"> . . . <GroupBox Header="3D Settings" IsEnabled="{Binding MapViewModel.Is3DMode}" > <Grid > <Grid.RowDefinitions>...")
 
No edit summary
Line 119: Line 119:
. . .
. . .
</source>
</source>


== Map view model ==
== Map view model ==
Line 125: Line 127:


<source lang="csharp">
<source lang="csharp">
. . .
private IGlobeMapViewModel _globeMapViewModel;
private bool _autoFollow;
. . .
. . .
public ICommand IncreaseYawCmnd { get { return new DelegateCommand(OnIncreaseCameraYaw); } }
public ICommand IncreaseYawCmnd { get { return new DelegateCommand(OnIncreaseCameraYaw); } }
Line 145: Line 150:
public ICommand IncreaseTargetPosLonCmnd { get { return new DelegateCommand(OnIncreaseTargetPosLon, CanModTargetPosition); } }
public ICommand IncreaseTargetPosLonCmnd { get { return new DelegateCommand(OnIncreaseTargetPosLon, CanModTargetPosition); } }
public ICommand DecreaseTargetPosLonCmnd { get { return new DelegateCommand(OnDecreaseTargetPosLon, CanModTargetPosition); } }
public ICommand DecreaseTargetPosLonCmnd { get { return new DelegateCommand(OnDecreaseTargetPosLon, CanModTargetPosition); } }
public bool Autofollow
{
    get { return _autoFollow; }
    set
    {
        _autoFollow = value;
        RefreshTargetAndCameraValues();
    }
}


private void OnIncreaseCameraYaw(object obj) { CameraYaw += 1; }
private void OnIncreaseCameraYaw(object obj) { CameraYaw += 1; }
Line 184: Line 178:
     get
     get
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
             return GlobeMapViewModel.Globe3DViewModel.CameraControl.Yaw;
             return _globeMapViewModel.Globe3DViewModel.CameraControl.Yaw;
         return 0;
         return 0;
     }
     }
     set
     set
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         {
         {
             GlobeMapViewModel.Globe3DViewModel.CameraControl.Yaw = value;
             _globeMapViewModel.Globe3DViewModel.CameraControl.Yaw = value;
         }
         }


Line 203: Line 197:
     get
     get
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
             return GlobeMapViewModel.Globe3DViewModel.CameraControl.Roll;
             return _globeMapViewModel.Globe3DViewModel.CameraControl.Roll;
         return 0;
         return 0;
     }
     }
     set
     set
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         {
         {
             GlobeMapViewModel.Globe3DViewModel.CameraControl.Roll = value;
             _globeMapViewModel.Globe3DViewModel.CameraControl.Roll = value;
         }
         }


Line 222: Line 216:
     get
     get
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
             return GlobeMapViewModel.Globe3DViewModel.CameraControl.Pitch;
             return _globeMapViewModel.Globe3DViewModel.CameraControl.Pitch;
         return 0;
         return 0;
     }
     }
     set
     set
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         {
         {
             GlobeMapViewModel.Globe3DViewModel.CameraControl.Pitch = value;
             _globeMapViewModel.Globe3DViewModel.CameraControl.Pitch = value;
         }
         }


Line 243: Line 237:
     get
     get
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
             return GlobeMapViewModel.Globe3DViewModel.CameraControl.TargetPos;
             return _globeMapViewModel.Globe3DViewModel.CameraControl.TargetPos;


         return GeoPos.InvalidPos;
         return GeoPos.InvalidPos;
Line 250: Line 244:
     set
     set
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         {
         {
             GlobeMapViewModel.Globe3DViewModel.CameraControl.TargetPos = value;
             _globeMapViewModel.Globe3DViewModel.CameraControl.TargetPos = value;
         }
         }


Line 263: Line 257:
     get
     get
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
             return GlobeMapViewModel.Globe3DViewModel.CameraControl.TargetAltitude;
             return _globeMapViewModel.Globe3DViewModel.CameraControl.TargetAltitude;
         return 0;
         return 0;
     }
     }
     set
     set
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         {
         {
             GlobeMapViewModel.Globe3DViewModel.CameraControl.TargetAltitude = value;
             _globeMapViewModel.Globe3DViewModel.CameraControl.TargetAltitude = value;
         }
         }


Line 282: Line 276:
     get
     get
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
             return GlobeMapViewModel.Globe3DViewModel.CameraControl.FollowGround;
             return _globeMapViewModel.Globe3DViewModel.CameraControl.FollowGround;
         return true;
         return true;
     }
     }
     set
     set
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         {
         {
             GlobeMapViewModel.Globe3DViewModel.CameraControl.FollowGround = value;
             _globeMapViewModel.Globe3DViewModel.CameraControl.FollowGround = value;
         }
         }


Line 301: Line 295:
     get
     get
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
             return GlobeMapViewModel.Globe3DViewModel.CameraControl.TargetDistance;
             return _globeMapViewModel.Globe3DViewModel.CameraControl.TargetDistance;
         return 0;
         return 0;
     }
     }
     set
     set
     {
     {
         if (GlobeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
         {
         {
             GlobeMapViewModel.Globe3DViewModel.CameraControl.TargetDistance = value;
             _globeMapViewModel.Globe3DViewModel.CameraControl.TargetDistance = value;
         }
         }


Line 316: Line 310:
}
}
. . .
. . .
public bool Autofollow
{
    get { return _autoFollow; }
    set
    {
        _autoFollow = value;
        RefreshTargetAndCameraValues();
    }
}
public void SetGlobeMapViewModel(IGlobeMapViewModel globeMapViewModel)
{
    _globeMapViewModel = globeMapViewModel;         
    _globeMapViewModel.Globe3DViewModel.CameraControl.AfterPan += OnModeOrSettingsChanged;
    _globeMapViewModel.Globe3DViewModel.CameraControl.TargetDistanceChanged += OnModeOrSettingsChanged;
    _globeMapViewModel.Globe3DViewModel.CameraControl.TargetPosChanged += OnModeOrSettingsChanged;
    _globeMapViewModel.Globe3DViewModel.CameraControl.OrientationChanged += OnModeOrSettingsChanged;
    _globeMapViewModel.Entered2DMode += OnModeOrSettingsChanged;
    _globeMapViewModel.Entered3DMode += OnModeOrSettingsChanged;
}
private void OnModeOrSettingsChanged(object sender, EventArgs args)
{
    RefreshTargetAndCameraValues();
}
private void RefreshTargetAndCameraValues()
private void RefreshTargetAndCameraValues()
{  
{  
Line 335: Line 356:
== Main view model ==
== Main view model ==


Update '''''MapViewModel.Autofollow''''' when auto follow has changed!
From '''''MainViewModel''''', share the content of the GlobeMapViewModel and IsAutoFollowActive parameters with '''''MapViewModel'''' when updated.


<source lang="c#">
<source lang="c#">
. . .
. . .
private IGlobeMapViewModel _globeMapViewModel;
. . .
public IGlobeMapViewModel GlobeMapViewModel
{
    get { return _globeMapViewModel; }
    set
    {
        _globeMapViewModel = value;
        if (value != null)
        {
            MapViewModel.SetGlobeMapViewModel( _globeMapViewModel);
        }
    }
}
public bool IsAutoFollowActive
public bool IsAutoFollowActive
{
{
Line 347: Line 384:
             GlobeMapViewModel.AutoFollow.TargetItem = null;
             GlobeMapViewModel.AutoFollow.TargetItem = null;


        MapViewModel.Autofollow = IsAutoFollowActive;
         NotifyPropertyChanged(() => IsAutoFollowActive);
         NotifyPropertyChanged(() => IsAutoFollowActive);
         NotifyPropertyChanged(() => AutoFollowItemName);
         NotifyPropertyChanged(() => AutoFollowItemName);
        MapViewModel.Autofollow = IsAutoFollowActive;
     }
     }
}
}
. . .
. . .
</source>
</source>

Revision as of 18:36, 3 October 2019

Main window

. . .
<GroupBox Header="3D Settings" 
          IsEnabled="{Binding MapViewModel.Is3DMode}" >
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4"
               Content="Camera" FontWeight="DemiBold" />
        
        <Label Grid.Row="1" Grid.Column="0" 
               Content="Yaw"   />
        <TextBox Grid.Row="1" Grid.Column="1" Margin="3" Width="60"
                 Text="{Binding MapViewModel.CameraYaw, StringFormat=N2}" TextAlignment="Right"                            
                 IsReadOnly="True"/>
        <RepeatButton Grid.Row="1" Grid.Column="2" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="+" 
                      Command="{Binding MapViewModel.IncreaseYawCmnd}"/>
        <RepeatButton Grid.Row="1" Grid.Column="3" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="-" 
                      Command="{Binding MapViewModel.DecreaseYawCmnd}"/>
        
        <Label Grid.Row="2" Grid.Column="0"
               Content="Roll" />
        <TextBox Grid.Row="2" Grid.Column="1" Margin="3" Width="60"
                 Text="{Binding MapViewModel.CameraRoll, StringFormat=N2}" TextAlignment="Right" 
                 IsReadOnly="True"/>
        <RepeatButton Grid.Row="2" Grid.Column="2" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="+" 
                      Command="{Binding MapViewModel.IncreaseRollCmnd}"/>
        <RepeatButton Grid.Row="2" Grid.Column="3" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="-" 
                      Command="{Binding MapViewModel.DecreaseRollCmnd}"/>
        
        <Label Grid.Row="3" Grid.Column="0"
               Content="Pitch" />
        <TextBox Grid.Row="3" Grid.Column="1" Margin="3" Width="60"
                 Text="{Binding MapViewModel.CameraPitch, StringFormat=N2}" TextAlignment="Right" 
                 IsReadOnly="True"/>
        <RepeatButton Grid.Row="3" Grid.Column="2" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="+" 
                      Command="{Binding MapViewModel.IncreasePitchCmnd}"/>
        <RepeatButton Grid.Row="3" Grid.Column="3" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="-" 
                      Command="{Binding MapViewModel.DecreasePitchCmnd}"/>

        <Label Grid.Row="4" Grid.Column="0"
               Content="Target" FontWeight="DemiBold" />
        <CheckBox Grid.Row="4"  Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center" Margin="3" 
                  Content="Follow ground"
                  IsChecked="{Binding MapViewModel.FollowGround}"/>

        <Label Grid.Row="5" Grid.Column="0"
               Content="Altitude" />
        <TextBox Grid.Row="5" Grid.Column="1" Margin="3" Width="60"
                 Text="{Binding MapViewModel.TargetAltitude, StringFormat=N0}" TextAlignment="Right" 
                 IsReadOnly="True"/>
        <RepeatButton Grid.Row="5" Grid.Column="2" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="+" 
                      Command="{Binding MapViewModel.IncreaseTargetAltitudeCmnd}"/>
        <RepeatButton Grid.Row="5" Grid.Column="3" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="-" 
                      Command="{Binding MapViewModel.DecreaseTargetAltitudeCmnd}"/>
        
        <Label Grid.Row="6" Grid.Column="0"
               Content="Distance" />
        <TextBox Grid.Row="6" Grid.Column="1" Margin="3" Width="60"
                 Text="{Binding MapViewModel.TargetDistance, StringFormat=N0}" TextAlignment="Right" 
                 IsReadOnly="True"/>
        <RepeatButton Grid.Row="6" Grid.Column="2" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="+" 
                      Command="{Binding MapViewModel.IncreaseTargetDistanceCmnd}"/>
        <RepeatButton Grid.Row="6" Grid.Column="3" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="-" 
                      Command="{Binding MapViewModel.DecreaseTargetDistanceCmnd}"/>

        <Label Grid.Row="7" Grid.Column="0"
               Content="Position" />
        <TextBox Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" Margin="3"                              
                 Text="{Binding MapViewModel.TargetPosText, Mode=OneWay}" TextAlignment="Right" 
                 IsReadOnly="True"/>
        <Label Grid.Row="8" Grid.Column="1"
               Content="Latitude"/>
        <RepeatButton Grid.Row="8" Grid.Column="2" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="+" 
                      Command="{Binding MapViewModel.IncreaseTargetPosLatCmnd}"/>
        <RepeatButton Grid.Row="8" Grid.Column="3" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="-" 
                      Command="{Binding MapViewModel.DecreaseTargetPosLatCmnd}"/>

        <Label Grid.Row="9" Grid.Column="1"
               Content="Longitude"/>
        <RepeatButton Grid.Row="9" Grid.Column="2" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="+" 
                      Command="{Binding MapViewModel.IncreaseTargetPosLonCmnd}"/>
        <RepeatButton Grid.Row="9" Grid.Column="3" Width="12" Margin="3" HorizontalAlignment="Center"
                      Content="-" 
                      Command="{Binding MapViewModel.DecreaseTargetPosLonCmnd}"/>
    </Grid>
</GroupBox>
. . .


Map view model

In MapViewModel add:

. . .
private IGlobeMapViewModel _globeMapViewModel;
private bool _autoFollow;
. . .
public ICommand IncreaseYawCmnd { get { return new DelegateCommand(OnIncreaseCameraYaw); } }
public ICommand DecreaseYawCmnd { get { return new DelegateCommand(OnDecreaseCameraYaw); } }

public ICommand IncreaseRollCmnd { get { return new DelegateCommand(OnIncreaseCameraRoll); } }
public ICommand DecreaseRollCmnd { get { return new DelegateCommand(OnDecreaseCameraRoll); } }

public ICommand IncreasePitchCmnd { get { return new DelegateCommand(OnIncreaseCameraPitch); } }
public ICommand DecreasePitchCmnd { get { return new DelegateCommand(OnDecreaseCameraPitch); } }

public ICommand IncreaseTargetDistanceCmnd { get { return new DelegateCommand(OnIncreaseTargetDistance); } }
public ICommand DecreaseTargetDistanceCmnd { get { return new DelegateCommand(OnDecreaseTargetDistance); } }

public ICommand IncreaseTargetAltitudeCmnd { get { return new DelegateCommand(OnIncreaseTargetAlttitude, CanModTargetAltitude); } }
public ICommand DecreaseTargetAltitudeCmnd { get { return new DelegateCommand(OnDecreaseTargetAltitide, CanModTargetAltitude); } }

public ICommand IncreaseTargetPosLatCmnd { get { return new DelegateCommand(OnIncreaseTargetPosLat, CanModTargetPosition); } }
public ICommand DecreaseTargetPosLatCmnd { get { return new DelegateCommand(OnDecreaseTargetPosLat, CanModTargetPosition); } }
public ICommand IncreaseTargetPosLonCmnd { get { return new DelegateCommand(OnIncreaseTargetPosLon, CanModTargetPosition); } }
public ICommand DecreaseTargetPosLonCmnd { get { return new DelegateCommand(OnDecreaseTargetPosLon, CanModTargetPosition); } }

private void OnIncreaseCameraYaw(object obj) { CameraYaw += 1; }
private void OnDecreaseCameraYaw(object obj) { CameraYaw -= 1; }

private void OnIncreaseCameraRoll(object obj) { CameraRoll += 1; }
private void OnDecreaseCameraRoll(object obj) { CameraRoll -= 1; }

private void OnIncreaseCameraPitch(object obj) { CameraPitch += 1; }
private void OnDecreaseCameraPitch(object obj) { CameraPitch -= 1; }

private void OnIncreaseTargetAlttitude(object obj) { TargetAltitude += 10; }
private void OnDecreaseTargetAltitide(object obj) { TargetAltitude -= 10; }

private void OnIncreaseTargetPosLat(object obj) { TargetPos = new GeoPos(TargetPos.Lat + (1.0 / (60 * 60)), TargetPos.Lon ); }
private void OnDecreaseTargetPosLat(object obj) { TargetPos = new GeoPos(TargetPos.Lat - (1.0 / (60 * 60)), TargetPos.Lon ); }
private void OnIncreaseTargetPosLon(object obj) { TargetPos = new GeoPos(TargetPos.Lat, TargetPos.Lon + (1.0 / (60 * 60))); }
private void OnDecreaseTargetPosLon(object obj) { TargetPos = new GeoPos(TargetPos.Lat, TargetPos.Lon - (1.0 / (60 * 60))); }

private bool CanModTargetAltitude(object obj) { return !FollowGround && !Autofollow; }
private bool CanModTargetPosition(object obj) { return !Autofollow; }

private void OnIncreaseTargetDistance(object obj) { TargetDistance += 10; }
private void OnDecreaseTargetDistance(object obj) { TargetDistance -= 10; }

public double CameraYaw
{
    get
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
            return _globeMapViewModel.Globe3DViewModel.CameraControl.Yaw;
        return 0;
    }
    set
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
        {
            _globeMapViewModel.Globe3DViewModel.CameraControl.Yaw = value;
        }

        NotifyPropertyChanged(() => CameraYaw);
    }
}

public double CameraRoll
{
    get
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
            return _globeMapViewModel.Globe3DViewModel.CameraControl.Roll;
        return 0;
    }
    set
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
        {
            _globeMapViewModel.Globe3DViewModel.CameraControl.Roll = value;
        }

        NotifyPropertyChanged(() => CameraRoll);
    }
}

public double CameraPitch
{
    get
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
            return _globeMapViewModel.Globe3DViewModel.CameraControl.Pitch;
        return 0;
    }
    set
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
        {
            _globeMapViewModel.Globe3DViewModel.CameraControl.Pitch = value;
        }

        NotifyPropertyChanged(() => CameraPitch);
    }
}

public string TargetPosText { get { return TargetPos.ToString(); } }

public GeoPos TargetPos
{
    get
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
            return _globeMapViewModel.Globe3DViewModel.CameraControl.TargetPos;

        return GeoPos.InvalidPos;
    }
    set
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
        {
            _globeMapViewModel.Globe3DViewModel.CameraControl.TargetPos = value;
        }

        RefreshTargetAndCameraValues();
    }
}

public double TargetAltitude
{
    get
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
            return _globeMapViewModel.Globe3DViewModel.CameraControl.TargetAltitude;
        return 0;
    }
    set
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
        {
            _globeMapViewModel.Globe3DViewModel.CameraControl.TargetAltitude = value;
        }

        NotifyPropertyChanged(() => TargetAltitude);
    }
}

public bool FollowGround
{
    get
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
            return _globeMapViewModel.Globe3DViewModel.CameraControl.FollowGround;
        return true;
    }
    set
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
        {
            _globeMapViewModel.Globe3DViewModel.CameraControl.FollowGround = value;
        }

        NotifyPropertyChanged(() => FollowGround);
    }
}

public double TargetDistance
{
    get
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
            return _globeMapViewModel.Globe3DViewModel.CameraControl.TargetDistance;
        return 0;
    }
    set
    {
        if (_globeMapViewModel?.Globe3DViewModel?.CameraControl != null)
        {
            _globeMapViewModel.Globe3DViewModel.CameraControl.TargetDistance = value;
        }

        NotifyPropertyChanged(() => TargetDistance);
    }
}
. . .
public bool Autofollow
{
    get { return _autoFollow; }
    set
    {
        _autoFollow = value;
        RefreshTargetAndCameraValues();
    }
}

public void SetGlobeMapViewModel(IGlobeMapViewModel globeMapViewModel)
{
    _globeMapViewModel = globeMapViewModel;           

    _globeMapViewModel.Globe3DViewModel.CameraControl.AfterPan += OnModeOrSettingsChanged;
    _globeMapViewModel.Globe3DViewModel.CameraControl.TargetDistanceChanged += OnModeOrSettingsChanged;
    _globeMapViewModel.Globe3DViewModel.CameraControl.TargetPosChanged += OnModeOrSettingsChanged;
    _globeMapViewModel.Globe3DViewModel.CameraControl.OrientationChanged += OnModeOrSettingsChanged;
    _globeMapViewModel.Entered2DMode += OnModeOrSettingsChanged;
    _globeMapViewModel.Entered3DMode += OnModeOrSettingsChanged;
} 

private void OnModeOrSettingsChanged(object sender, EventArgs args)
{
    RefreshTargetAndCameraValues();
}

private void RefreshTargetAndCameraValues()
{ 
    NotifyPropertyChanged(() => FollowGround);
    NotifyPropertyChanged(() => Autofollow);

    NotifyPropertyChanged(() => CameraPitch);
    NotifyPropertyChanged(() => CameraRoll);
    NotifyPropertyChanged(() => CameraYaw);

    NotifyPropertyChanged(() => TargetAltitude);
    NotifyPropertyChanged(() => TargetPos);
    NotifyPropertyChanged(() => TargetPosText);
    NotifyPropertyChanged(() => TargetDistance);
}
. . .

Main view model

From MainViewModel, share the content of the GlobeMapViewModel and IsAutoFollowActive parameters with MapViewModel' when updated.

. . .
private IGlobeMapViewModel _globeMapViewModel;
. . .
public IGlobeMapViewModel GlobeMapViewModel
{
    get { return _globeMapViewModel; }
    set
    {
        _globeMapViewModel = value;

        if (value != null)
        {
            MapViewModel.SetGlobeMapViewModel( _globeMapViewModel);
        }
    }
}

public bool IsAutoFollowActive
{
   . . .
    set
    {
        if (!(value && GlobeMapViewModel.AutoFollow.FollowSelectedItem()))
            GlobeMapViewModel.AutoFollow.TargetItem = null;

        NotifyPropertyChanged(() => IsAutoFollowActive);
        NotifyPropertyChanged(() => AutoFollowItemName);

        MapViewModel.Autofollow = IsAutoFollowActive;
    }
}
. . .