Transform DXF coordinates on the canvas to geographic coordinates
pysaman
10/9/2017 12:30 PM


Hello . I Imported a DXF file using the Cadillib library inside the WPF program Written With C#. Then I turned it into a XAML file by XAMLExporter. I showed XAML file in Canvas. XAMLExporter uses a 4dimensional matrix for mapping. The question is, what method should I use to look at the UTM coordinates of the Canvas by moving the mouse? This is my Code : public void ExportToXaml(DxfModel model, string filename) GraphicsConfig graphicsConfig = GraphicsConfig.WhiteBackgroundCorrectForBackColor; 
Wout
10/9/2017 12:38 PM


So you need to transform back? You can do that by using the inverse of the projection matrix: call method Matrix4D.GetInverse().  Wout 
pysaman
10/10/2017 7:46 PM


OK.The problem is somewhat solved. But this gives a twodimensional coordinate. Is there a way to get 3D coordinates. Given that I have a transfer matrix. 
Wout
10/10/2017 7:52 PM


You can feed a 3D point (x, y, 0) into the Transform method, and you'll get out a 3D point, but the original 0 zcoordinate is pretty much arbitrary.  Wout 
pysaman
10/11/2017 5:22 AM


I dumped the DXF file into a DxfModel object, and my map has no path Over each other. Code: DxfModel model = null; try { string extension = SysIO.Path.GetExtension("MinMap.dxf"); model = String.Compare(extension, ".dwg", StringComparison.OrdinalIgnoreCase) == 0 ? DwgReader.Read("MinMap.dxf") : DxfReader.Read("MinMap.dxf"); boundsCalculator = new BoundsCalculator(); boundsCalculator.GetBounds(model); bounds = boundsCalculator.Bounds; } ExportToXaml(model, "MineMap.xaml"); 
Wout
10/11/2017 8:18 AM


I really don't understand your question. What do you mean by "read Z coordinates inside the model, given that we have twodimensional coordinates?"  Wout 
pysaman
10/15/2017 8:59 PM


I'm sorry. The basic idea is that we want to work with a DXF file in WPF. Since CadLib does not work with WPF 3D, we have to use other tricks. One way was to turn the DXF file into XAML and work with xaml Pathes. But the problem is that we only have twodimensional coordinates, while in addition to X and Y, we need to Z. The whole thing we need to Z is when the mouse is along the paths, we show the threedimensional coordinates of that point . Is there no other way? 