using System.Drawing; using System.Drawing.Drawing2D; using Nevron.Diagram; using Nevron.GraphicsCore; namespace SupportProject { public class CondensorShape : NCompositeShape, INPoints { #region Constructors public CondensorShape() { CreateGeometry(); CreatePorts(); } #endregion #region INPoints public NPointF[] Points { get { return m_Points; } set { } } public int PointsCount { get { return m_Points.Length; } } public NPointF GetPointAt(int index) { // Use the scene transform to convert the model point to // a point in scene coordinates NPointF point = m_Points[index]; return SceneTransform.TransformPoint(point); } public NPointInfo GetPointInfo(int index) { return new NPointInfo(PointType.GeometryBasePoint); } public void SetPointAt(int index, NPointF point) { } #endregion #region Implementation private void CreateGeometry() { m_Points = new NPointF[] { new NPointF(230, 145), new NPointF(150, 145), new NPointF(200, 170), new NPointF(150, 195), new NPointF(230, 195), new NPointF(135, 130), new NPointF(175, 130), new NPointF(215, 130), new NPointF(215, 210), new NPointF(175, 210), new NPointF(135, 210) }; GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.StartFigure(); PointF[] points = new PointF[] { m_Points[0].ToPointF(), m_Points[1].ToPointF(), m_Points[2].ToPointF(), m_Points[3].ToPointF(), m_Points[4].ToPointF() }; graphicsPath.AddLines(points); Primitives.AddChild(new NCustomPath(graphicsPath, PathType.ClosedFigure)); NPointF[] points2 = new NPointF[] { m_Points[5], m_Points[6], m_Points[7], m_Points[8], m_Points[9], m_Points[10] }; NPolygonPath exterior = new NPolygonPath(points2); Primitives.AddChild(exterior); UpdateModelBounds(); } private void CreatePorts() { NCompositeShape dg = new NCompositeShape(); base.CreateShapeElements(ShapeElementsMask.Ports); /*NBoundsPort boundsPort1 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.BottomLeft); Condensor.Ports.AddChild(boundsPort1); NBoundsPort boundsPort2 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.BottomCenter); Condensor.Ports.AddChild(boundsPort2); NBoundsPort boundsPort3 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.BottomRight); Condensor.Ports.AddChild(boundsPort3); NBoundsPort boundsPort4 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.MiddleLeft); Condensor.Ports.AddChild(boundsPort4); NBoundsPort boundsPort5 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.MiddleRight); Condensor.Ports.AddChild(boundsPort5); NBoundsPort boundsPort6 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.TopCenter); Condensor.Ports.AddChild(boundsPort6); NBoundsPort boundsPort7 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.TopLeft); Condensor.Ports.AddChild(boundsPort7); NBoundsPort boundsPort8 = new NBoundsPort(Condensor.UniqueId, ContentAlignment.TopRight); Condensor.Ports.AddChild(boundsPort8);*/ NPointPort pointPort1 = new NPointPort(PointIndexMode.Custom, 0); Ports.AddChild(pointPort1); NPointPort pointPort2 = new NPointPort(PointIndexMode.Custom, 4); Ports.AddChild(pointPort2); NPointPort pointPort3 = new NPointPort(PointIndexMode.Custom, 6); Ports.AddChild(pointPort3); NPointPort pointPort4 = new NPointPort(PointIndexMode.Custom, 9); Ports.AddChild(pointPort4); } #endregion #region Fields private NPointF[] m_Points; #endregion } }