Hi Howard,
Thanks for your help.
I have few more questions
Configuration 1 : I have 20 zoomlevels.
What I did, I changed the scale for each level of zoom.
I did that for the zoomlevel for the control wpfMap and for each layers.
internal static void CustomScaleZoomLevel(ZoomLevelSet zoomLv)
{
zoomLv.ZoomLevel01.Scale = Math.Round(ConstantsMap.CURRENTEXTENDDFAULT_FR, 10);
zoomLv.ZoomLevel02.Scale = Math.Round(zoomLv.ZoomLevel01.Scale / 2, 10);
zoomLv.ZoomLevel03.Scale = Math.Round(zoomLv.ZoomLevel02.Scale / 2, 10);
zoomLv.ZoomLevel04.Scale = Math.Round(zoomLv.ZoomLevel03.Scale / 2, 10);
zoomLv.ZoomLevel05.Scale = Math.Round(zoomLv.ZoomLevel04.Scale / 2, 10);
zoomLv.ZoomLevel06.Scale = Math.Round(zoomLv.ZoomLevel05.Scale / 2, 10);
zoomLv.ZoomLevel07.Scale = Math.Round(zoomLv.ZoomLevel06.Scale / 2, 10);
zoomLv.ZoomLevel08.Scale = Math.Round(zoomLv.ZoomLevel07.Scale / 2, 10);
zoomLv.ZoomLevel09.Scale = Math.Round(zoomLv.ZoomLevel08.Scale / 2, 10);
zoomLv.ZoomLevel10.Scale = Math.Round(zoomLv.ZoomLevel09.Scale / 2, 10);
zoomLv.ZoomLevel11.Scale = Math.Round(zoomLv.ZoomLevel10.Scale / 2, 10);
zoomLv.ZoomLevel12.Scale = Math.Round(zoomLv.ZoomLevel11.Scale / 2, 10);
zoomLv.ZoomLevel13.Scale = Math.Round(zoomLv.ZoomLevel12.Scale / 2, 10);
zoomLv.ZoomLevel14.Scale = Math.Round(zoomLv.ZoomLevel13.Scale / 2, 10);
zoomLv.ZoomLevel15.Scale = Math.Round(zoomLv.ZoomLevel14.Scale / 2, 10);
zoomLv.ZoomLevel16.Scale = Math.Round(zoomLv.ZoomLevel15.Scale / 2, 10);
zoomLv.ZoomLevel17.Scale = Math.Round(zoomLv.ZoomLevel16.Scale / 2, 10);
zoomLv.ZoomLevel18.Scale = Math.Round(zoomLv.ZoomLevel17.Scale / 2, 10);
zoomLv.ZoomLevel19.Scale = Math.Round(zoomLv.ZoomLevel18.Scale / 2, 10);
zoomLv.ZoomLevel20.Scale = Math.Round(zoomLv.ZoomLevel19.Scale / 2, 10);
}
I would be used customZoomLevel with 20 levels ( zoomLevelCount = 20)
internal static ZoomLevelSet CustomizeZoomLevel(double maxScale, int zoomLevelCount)
{
// zoom level count is zero doesn't make sense.
if (zoomLevelCount == 0) throw new NotSupportedException();
ZoomLevelSet customZoomLevelSet = new ZoomLevelSet();
for (int i = 0; i < zoomLevelCount; i++)
{
double tempScale = maxScale / Math.Pow(2, i);
customZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(tempScale));
}
return customZoomLevelSet;
}
The both methods are equals ?
The advantage of the first method (CustomScaleZoomLevel) is with the customStyle, I can use ApplyUntilZoomLevel
zleDtOccup.ZoomLevel10.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level11 ;
zleDtOccup.ZoomLevel10.CustomStyles.Add(AreaStyles.CreateHatchStyle(GeoHatchStyle.Cross, GeoColor.FromArgb(150, GeoColor.StandardColors.Black), GeoColor.StandardColors.Transparent,
GeoColor.StandardColors.Black, 1, LineDashStyle.Solid, 0, 0));
zleDtOccup.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
zleDtOccup.ZoomLevel12.CustomStyles.Add(AreaStyles.CreateHatchStyle(GeoHatchStyle.Cross, GeoColor.FromArgb(150, GeoColor.StandardColors.Black), GeoColor.StandardColors.Transparent,
GeoColor.StandardColors.Black, 1, LineDashStyle.Solid, 0, 0));
zleDtOccup.ZoomLevel12.CustomStyles.Add(tolerancePointStyle);
But with the customZoomLevel, I can't use ApplyUntilZoomLevel so I have to define the custom styles for each level .... ?
Configuration 2 : I have 17 levels.
So I can do if i use defaultZoom
internal static void CustomScaleZoomLevel(ZoomLevelSet zoomLv)
{
zoomLv.ZoomLevel01.Scale = Math.Round(ConstantsMap.CURRENTEXTENDDFAULT_FR, 10);
zoomLv.ZoomLevel02.Scale = Math.Round(zoomLv.ZoomLevel01.Scale / 2, 10);
zoomLv.ZoomLevel03.Scale = Math.Round(zoomLv.ZoomLevel02.Scale / 2, 10);
zoomLv.ZoomLevel04.Scale = Math.Round(zoomLv.ZoomLevel03.Scale / 2, 10);
zoomLv.ZoomLevel05.Scale = Math.Round(zoomLv.ZoomLevel04.Scale / 2, 10);
zoomLv.ZoomLevel06.Scale = Math.Round(zoomLv.ZoomLevel05.Scale / 2, 10);
zoomLv.ZoomLevel07.Scale = Math.Round(zoomLv.ZoomLevel06.Scale / 2, 10);
zoomLv.ZoomLevel08.Scale = Math.Round(zoomLv.ZoomLevel07.Scale / 2, 10);
zoomLv.ZoomLevel09.Scale = Math.Round(zoomLv.ZoomLevel08.Scale / 2, 10);
zoomLv.ZoomLevel10.Scale = Math.Round(zoomLv.ZoomLevel09.Scale / 2, 10);
zoomLv.ZoomLevel11.Scale = Math.Round(zoomLv.ZoomLevel10.Scale / 2, 10);
zoomLv.ZoomLevel12.Scale = Math.Round(zoomLv.ZoomLevel11.Scale / 2, 10);
zoomLv.ZoomLevel13.Scale = Math.Round(zoomLv.ZoomLevel12.Scale / 2, 10);
zoomLv.ZoomLevel14.Scale = Math.Round(zoomLv.ZoomLevel13.Scale / 2, 10);
zoomLv.ZoomLevel15.Scale = Math.Round(zoomLv.ZoomLevel14.Scale / 2, 10);
zoomLv.ZoomLevel16.Scale = Math.Round(zoomLv.ZoomLevel15.Scale / 2, 10);
zoomLv.ZoomLevel17.Scale = Math.Round(zoomLv.ZoomLevel16.Scale / 2, 10);
zoomLv.ZoomLevel18.Scale = 0;
zoomLv.ZoomLevel19.Scale = 0;
zoomLv.ZoomLevel20.Scale = 0;
With customZoomLevel (zoomLevelCount = 17)
internal static ZoomLevelSet CustomizeZoomLevel(double maxScale, int zoomLevelCount)
{
// zoom level count is zero doesn't make sense.
if (zoomLevelCount == 0) throw new NotSupportedException();
ZoomLevelSet customZoomLevelSet = new ZoomLevelSet();
for (int i = 0; i < zoomLevelCount; i++)
{
double tempScale = maxScale / Math.Pow(2, i);
customZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(tempScale));
}
return customZoomLevelSet;
}
In this case, as you say the pan zoom bar will adjust its height depending on the custom zoom. But with the method CustomScaleZoomLevel, the pan zoom bar adjust its height on 20 levels.
So both methods have their advantages and inconveniences.
The use of ZoomDefault (ZoomLevel01, ZoomLevel02, etc ....) or a custom zoom depends on our needs or is there a method that you recommand ?
Thanks a lot for your help.
Regards.
Steph.