Transform DXF coordinates on the canvas to geographic coordinates
![]() 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 4-dimensional 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; |
![]() 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 |
![]() 10/10/2017 7:46 PM
|
---|
OK.The problem is somewhat solved. But this gives a two-dimensional coordinate. Is there a way to get 3D coordinates. Given that I have a transfer matrix. |
![]() 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 z-coordinate is pretty much arbitrary. - Wout |
![]() 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"); |
![]() 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 two-dimensional coordinates?" - Wout |
![]() 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 two-dimensional 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 three-dimensional coordinates of that point . Is there no other way? |