private void RefreshComponentsValues() { retb_widthWindow.Value = AcadTools.DoubleToFormattedString( _searchWindowSize.Width); retb_heightWindow.Value = AcadTools.DoubleToFormattedString( _searchWindowSize.Height); }
} //button public void GenerateDataXmlFile( string fileName, Func <Vector3d> getFactPositionNoizeAddition = null) { bool factPossEnabled = true; if (getFactPositionNoizeAddition == null) { getFactPositionNoizeAddition = () => new Vector3d(); factPossEnabled = false; } var pluginSettings = PluginSettings.GetInstance(); var sectionMaxSize = pluginSettings.SectionMaxSize; var sectionsData = RoadSectionParametersExtractor .ExtractSectionsData(sectionMaxSize); Func <double, double, string> CoordsToString = (x, y) => String.Format("{0} {1}", AcadTools.DoubleToFormattedString(x), AcadTools.DoubleToFormattedString(y)); Func <Point3d, Point3d, int, XElement> GetPointElement = (projPos, factPos, number) => new XElement( "point", new XElement( "proj_position", CoordsToString(projPos.X, projPos.Y)), new XElement( "fact_position", CoordsToString(factPos.X, factPos.Y)), new XElement("number", number)); var extractedSectionDataDoc = new XDocument( new XElement( "road_sections", new XAttribute("fact_enabled", factPossEnabled), sectionsData .Select(sd => new XElement( "road_section", new XElement( "staEq", AcadTools.DoubleToFormattedString( RoadSectionParametersExtractor.GetStationFromPointBlock(sd.AxisPoint))), new XElement( "origin", CoordsToString( AcadTools.GetBlockPosition(sd.AxisPoint).X, AcadTools.GetBlockPosition(sd.HeightPoint).Y)), new XElement("origin_height", AcadTools.DoubleToFormattedString( RoadSectionParametersExtractor.GetHeightFromPointBlock(sd.HeightPoint))), new XElement( "red_points", sd.RedPoints .Select(redPoint => GetPointElement( AcadTools.GetBlockPosition(redPoint), AcadTools.GetBlockPosition(redPoint) + getFactPositionNoizeAddition(), RoadSectionParametersExtractor.GetPointNumberFromPointBlock(redPoint)))), new XElement( "black_points", sd.BlackPoints .Select(blackPoint => GetPointElement( AcadTools.GetBlockPosition(blackPoint), AcadTools.GetBlockPosition(blackPoint) + getFactPositionNoizeAddition(), RoadSectionParametersExtractor.GetPointNumberFromPointBlock(blackPoint)))) )))); extractedSectionDataDoc.Save(fileName); }