Finally I found a way around this. I do not understand why but it appears that setting the feature layers Mode-property to "OnDemand" somehow stops the layer from showing properly on the clone map/printmap. And this even if Where-property is later set (which according to documentation should make the mode "Snapshot"). But, since I don't think I have any problem with a "Snapshot"-mode, the problem is solved, as far as I am concerned. Cant' really remember why we decided to set it to "OnDemand" in the first place...
Regards,
Samuli
I added a branch with a fix for the dynamiclayerinfos issue.
Concerning the pircturemarkersymbols, I would need a repro case.
Thanks
After some testing it seems the problem is somewhere else in my application. I added the same FeatureLayers to the original sample and there was no problem. Now I just have to figure out what could cause this difference. Any ideas would be welcome...
Dear Dominique,
I'm using this sample in my application and otherwise it works very nicely but there is some problem with layers using PictureMarkerSymbols. They don't show on the cloned map and the symbols are also not drawn on the printable legend. Is this a bug or just something wrong with my setup? Have you ever tested with PictureMarkerSymbols? I'm using the latest version of the arcgis-samples-silverlight (from Esri/arcgis-samples-silverlight · GitHub ).
By the way, I noticed the same for ArcGISDynamicMapServiceLayers constructed with DynamicLayerInfos, but this is maybe not so suprising...
Thanks,
Hi Paul,Sorry I didn't port my print sample to the Javascript API. The sample is very related to the .net API and not easy to port to Javascript as it is.Bonne chance.
But as soon as you open the print preview, the legend in it does not match want you see currently in the application. Is there a way to at least show the legend as you see it before pressing the print preview button?
the legend shown in the preview does not match the legend in its current state of the application.
[INDENT]hai,am using silverlight with microsoft visual web developer 2010 express, how to retrieve the following errorNo best type found for implicitly-typed array [/INDENT]
Dominique,Is there any way i can provide interface for the user to select the page layout and page size on the print window.
<!-- Header --> <StackPanel Background="{TemplateBinding Background}" Grid.Row="0" Grid.ColumnSpan="2"> <TextBlock Text="{Binding Title, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center" FontSize="12" Visibility="{Binding Title, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource toVisibility}}" /> </StackPanel> <!-- Body--> <StackPanel Grid.Row="1" Grid.Column="0"> <TextBlock TextWrapping="Wrap" Loaded="WirtReportText_Loaded" FontSize="14" Margin="5"/> </StackPanel> <StackPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Orientation="Horizontal"> <Image Height="100" Width="50" Source="/wirt1.0;component/Images/IDNRlogo1.png" /> <Image Height="100" Width="200" Source="/wirt1.0;component/Images/DIRT_logo.png" /> </StackPanel> <Grid Grid.Row="1" Grid.Column="1"> <!-- Map--> <esri:Map x:Name="PrintMap" IsLogoVisible="False" controls:CloneMap.Map="{TemplateBinding Map}" controls:SurrogateBinder.OverviewMapPrinter="{Binding RelativeSource={RelativeSource TemplatedParent}}"> </esri:Map>
I was wondering if when you pick landscape in the printer properties if it would stretch or if it would leave the size of the map as is.
<controls:MapPrinter x:Name="mapPrinter" Map="{Binding ElementName=MyMap}" Locale="fr" Title="Tour de France 2010" IsScaleFixed="True" Scale="2000000"/>
You can use the standard SaveFileDialog provided by Silverlight. Note that for security reason, the SaveFileDialog can only be shown in response to an user initiated event (a button should be OK then).
But the user seems to want to omit this scale stuff. So shifted my attention to implement other functions.
So can I have another button similar to this one to open a standard windows SaveFile dialog?
Actually I don't have 'PreparePages' function...so the scale doesn't get any value and it doesn't work I guess.
controls:MapPrinterDialog x:Name="MapPrinterDialog" Background="White" Width="350" Height="400" Style="{StaticResource MyMapPrinterDialogStyle}" Visibility="Collapsed" > <controls:MapPrinter x:Name="mapPrinterWithDialog" Map="{Binding ElementName=MyMap}" Style="{StaticResource WithLegend}" Title="WIRT" Loaded="mapPrinterWithDialog_Loaded"/> <!--IsScaleFixed="True" Scale="2000000"--> <!--IsActive="{Binding ElementName=PrintBtn }"--> </controls:MapPrinterDialog> <controls:MapPrinterIndicator MapPrinter="{Binding ElementName=mapPrinter}" />
private void mapPrinterWithDialog_Loaded(object sender, RoutedEventArgs e) { MapPrinter mapPrinterWithDialog = sender as MapPrinter; double mapHeight = MyMap.ActualHeight; double mapWidth = MyMap.ActualWidth; Envelope printExtent = mapPrinterWithDialog.PrintExtent; var mapSize = new Size(mapPrinterWithDialog.RotateMap ? mapHeight : mapWidth, mapPrinterWithDialog.RotateMap ? mapWidth : mapHeight); var mapUnit = mapPrinterWithDialog.MapUnits; bool isWebMercator = (mapPrinterWithDialog.Map != null && mapPrinterWithDialog.Map.SpatialReference != null && (mapPrinterWithDialog.Map.SpatialReference.WKID == 102100 || mapPrinterWithDialog.Map.SpatialReference.WKID == 102113 || mapPrinterWithDialog.Map.SpatialReference.WKID == 3857)); double ratioScaleResolution = RatioScaleResolution(mapUnit, printExtent.GetCenter().Y, isWebMercator); double scale = mapPrinterWithDialog.Scale; double printResolution; printResolution = Math.Max(printExtent.Width / mapSize.Width, printExtent.Height / mapSize.Height); scale = ratioScaleResolution * printResolution; if (scale != mapPrinterWithDialog.Scale) mapPrinterWithDialog.Scale = scale; } private static double RatioScaleResolution(MapUnit mapUnit, double yCenter, bool isWebMercator) { double ratio; int dpi = 96; double toRadians = 0.017453292519943295769236907684886; double earthRadius = 6378137; //Earth radius in meters (defaults to WGS84 / GRS80) double degreeDist = earthRadius * toRadians;// distance of 1 degree at equator in meters if (isWebMercator) { // Transform yCenter from web mercator to decimal degree yCenter = Math.Min(Math.Max(yCenter, -20037508.3427892), 20037508.3427892); var point = new MapPoint(0, yCenter); yCenter = point.WebMercatorToGeographic().Y; ratio = Math.Cos(yCenter * toRadians) * dpi * 39.37; // 39.37 = MapUnit.Meters/MapUnit.Inches } else if (mapUnit == MapUnit.DecimalDegrees || mapUnit == MapUnit.Undefined) { if (Math.Abs(yCenter) > 90) ratio = 0.0; else ratio = Math.Cos(yCenter * toRadians) * degreeDist * dpi * 39.37; } else { ratio = (double)dpi * (int)mapUnit / (int)MapUnit.Inches; } return ratio; }
Text="{Binding Scale, RelativeSource={RelativeSource TemplatedParent}, StringFormat='1 : {0:F0} '}"
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.