Hello, I recently upgraded to ThinkGeo 5.0 and noticed that the Map.ClientZoomLevelScales array and the function Map.SyncClientZoomLevels( ) are noted as "deprecated".
Up until now, I had set up my ThinkGeo map as follows:
protected void Generate_Map( )
{
double StartScale = 55000000;
for ( int i = 0; i < 20; ++i )
{
Map.ClientZoomLevelScales[i] = double.Parse( String.Format( "{0:G2}", StartScale / Math.Pow( 1.5, i ) ) );
}
// ...
// Create myLayer and define myAreaStyle (NOT SHOWN)
// ...
CustomZoomLevels_Initialize( myLayer );
myLayer.ZoomLevelSet.CustomZoomLevels[0].DefaultAreaStyle = myAreaStyle;
CustomZoomLevels_Apply( myLayer, 0, 19 );
}
protected void CustomZoomLevels_Initialize( FeatureLayer featureLayer )
{
foreach ( double scale in Map.ClientZoomLevelScales )
{
featureLayer.ZoomLevelSet.CustomZoomLevels.Add( new ZoomLevel( scale ) );
}
}
protected void CustomZoomLevels_Apply( FeatureLayer featureLayer, int zoomLevelStart, int zoomLevelEnd )
{
if ( zoomLevelEnd <= zoomLevelStart )
{
return;
}
ZoomLevelSet zoomLevelSet = featureLayer.ZoomLevelSet;
for ( int i = zoomLevelStart + 1; i <= zoomLevelEnd; ++i )
{
if ( i > ( zoomLevelSet.CustomZoomLevels.Count - 1 ) || i < 0 )
{
continue;
}
foreach ( ThinkGeo.MapSuite.Core.Style style in zoomLevelSet.CustomZoomLevels[zoomLevelStart].CustomStyles )
{
zoomLevelSet.CustomZoomLevels[i].CustomStyles.Add( style );
}
zoomLevelSet.CustomZoomLevels[i].DefaultAreaStyle = zoomLevelSet.CustomZoomLevels[zoomLevelStart].DefaultAreaStyle;
zoomLevelSet.CustomZoomLevels[i].DefaultLineStyle = zoomLevelSet.CustomZoomLevels[zoomLevelStart].DefaultLineStyle;
zoomLevelSet.CustomZoomLevels[i].DefaultPointStyle = zoomLevelSet.CustomZoomLevels[zoomLevelStart].DefaultPointStyle;
zoomLevelSet.CustomZoomLevels[i].DefaultTextStyle = zoomLevelSet.CustomZoomLevels[zoomLevelStart].DefaultTextStyle;
}
}
My question now is... what is the best way to implement this? Is it better to NOT use CustomZoomLevels, and simply set Layer.ZoomLevelSet.ZoomLevel01.Scale, especially because I only need 20 zoom levels. How do we set the ClientZoomLevelScales now that they are deprecated? Would like to know the optimal way of doing this.