public INodeModel CreateNodeModel(int lineId,
                                          int nodeId)
        {
            INodeModel nodeModel = NodeModel.Unknown;

            ILine line = m_NodeIdHelper.GetLine(lineId);

            if ( line == null )
            {
                return nodeModel;
            }

            bool isForwardNode = m_NodeIdHelper.IsForwardNode(nodeId);

            double x = isForwardNode
                           ? line.X1
                           : line.X2;
            double y = isForwardNode
                           ? line.Y1
                           : line.Y2;
            Angle angle = isForwardNode
                              ? line.AngleToXAxis
                              : line.AngleToXAxis + Angle.For180Degrees;

            nodeModel = new NodeModel(nodeId,
                                      x,
                                      y,
                                      angle);

            return nodeModel;
        }
 public void Setup()
 {
     m_Model = new NodeModel(1,
                             2.0,
                             3.0,
                             Angle.For45Degrees);
 }
Beispiel #3
0
        internal IEnumerable <INodeModel> CreateNodeModels([NotNull] ILine line)
        {
            var models = new List <INodeModel>();

            int id = line.Id == 0
                         ? line.Id
                         : line.Id * 2;

            var start = new NodeModel(id,
                                      line.X1,
                                      line.Y1,
                                      line.AngleToXAxis);
            var finish = new NodeModel(id + 1,
                                       line.X2,
                                       line.Y2,
                                       line.AngleToXAxis);

            models.Add(start);
            models.Add(finish);

            return models;
        }