예제 #1
0
        public void Execute(IVectorImageProvider imageProvider)
        {
            WktLoaderDialog wktDlg = new WktLoaderDialog();

            if (wktDlg.ShowDialog() == DialogResult.OK)
            {
                string filename = wktDlg.WktFileName;
                if (File.Exists(filename))
                {
                    if (filename.ToLower().EndsWith("wkb"))
                    {
                        WkbReader wkb = new WkbReader(File.ReadAllText(filename));
                        wkb.LoadIntoImage(imageProvider.CurrImage, wktDlg.FlipYAxis);
                    }
                    else
                    {
                        WktReader.ReadFile(imageProvider.LayeredVectorImage, filename, wktDlg.ScaleDivider, wktDlg.FlipYAxis, wktDlg.IncermentalCoordinates);
                    }
                }

                if (wktDlg.WktFreeText.Length > 1)
                {
                    if (IsHexString(wktDlg.WktFreeText))
                    {
                        WkbReader wkb = new WkbReader(wktDlg.WktFreeText);
                        wkb.LoadIntoImage(imageProvider.CurrImage, wktDlg.FlipYAxis);
                    }
                    else
                    {
                        WktReader.ReadText(imageProvider.LayeredVectorImage, wktDlg.WktFreeText, wktDlg.ScaleDivider, wktDlg.FlipYAxis, wktDlg.IncermentalCoordinates);
                    }
                }
            }
            wktDlg.Dispose();
        }