// Copyright (C) Stichting Deltares 2025. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using Deltares.Geometry; using Deltares.Geometry.Forms; using Deltares.Mathematics; using Deltares.Standard.Forms; namespace Deltares.Dam.Forms { public class SurfaceLineDrawingObject : DrawingObject { private GeometryPointString surfaceLine; /// /// Initializes a new instance of the class. /// public SurfaceLineDrawingObject() { Layer = -20; } /// /// Gets or sets the color. /// /// /// The color. /// public Color Color { get; set; } = Color.Salmon; /// /// Sets the data object. /// /// The data object. public override void SetDataObject(object dataObject) { surfaceLine = (GeometryPointString) dataObject; } /// /// Gets the data object. /// /// public override object GetDataObject() { return surfaceLine; } /// /// override The Draw3D() Method /// /// public override void Draw3D(GraphicsInfo info) { DrawingSupport.SetIEPDraw3D(info.Graphics); DrawingSupport.ColorMaterial3D(Color.CornflowerBlue); DrawingSupport.Brush3D(Color.Black); IList pointList = surfaceLine.Points; DrawingSupport.Pen3D(DashStyle.Solid, 3, Color); for (var curveIndex = 0; curveIndex < pointList.Count - 1; curveIndex++) { var calculatedPoint = new Point3D(); var calculatedPoint1 = new Point3D(); GetScaled3DPoint(info.Projection, pointList[curveIndex].GetPoint3D(), ref calculatedPoint); GetScaled3DPoint(info.Projection, pointList[curveIndex + 1].GetPoint3D(), ref calculatedPoint1); DrawingSupport.Line3D(calculatedPoint, calculatedPoint1); } } } }