Convert XAML to ShapeFile or SqlGeometry formats
I have some XAML based diagrams that consist of Paths embedded in Canvas objects e.g.
<Canvas x:Name="c1" Width="55.2533" Height="18.2933" Canvas.Left="194.606" Canvas.Top="194.131">
<Path x:Name="Path_5" Width="8.02666" Height="13.44" Canvas.Left="0" Canvas.Top="0.559998" Stretch="Fill" Fill="#FF000000" Data="......etc"/>
</Canvas>
Is there a way/tool to convert the XAML to either a ShapeFile or SqlGeometry data? I need to convert as I want to display the graphic in a third party map control that only binds to ShapeFiles or SqlGeometry data.
开发者_Go百科Any help would be appreciated.
The first thing to do would be to extract the path points. Then you need to produce your shape.
GETTING POINTS: this stackoverflow answer describes altering a shape, but you see how to get the points from a path.
BUILDING SHAPE:
Cant' use SqlGeometry with Silverlight:
I think part of the answer is you can't go to SqlGeometry directly in silverlight. Your example is using Microsoft.SqlServer.Types, which was not built for the silverlight runtime. If you were going to a service it would be no problem, the service could use the full .NET framework an you can use the path points to build a well-known-text string, and then go directly to a sqlGeometry using
SqlGeometry newGeom = SqlGeometry.STGeomFromText(wktstring, srid).MakeValid();
Best best is to try to create a shapefile
I'm afraid I can't help you with creating a shapefile, sorry. Haven't used them much.
精彩评论