Beispiel #1
0
        public SensorEditForm(StateItem item)
        {
            _item = (WSNSensorItem)item;

            InitializeComponent();

            txtSensorName.Text = _item.Name;

            foreach (SensorType type in Enum.GetValues(typeof(SensorType)))
            {
                this.cmbSensorType.Items.Add(type.ToString());
                if (type == _item.NodeType)
                {
                    this.cmbSensorType.SelectedItem = type.ToString();
                }
            }

            foreach (SensorMode mode in Enum.GetValues(typeof(SensorMode)))
            {
                this.cmbSensorMode.Items.Add(mode.ToString());
                if (mode == _item.NodeMode)
                {
                    this.cmbSensorMode.SelectedItem = mode.ToString();
                }
            }
            if (this.cmbSensorMode.SelectedIndex < 0)
            {
                this.cmbSensorMode.SelectedIndex = (int)SensorMode.Normal;
            }

            //loadTransitionGuardControl(false);
        }
Beispiel #2
0
        public PNModelHelper(string fileName, LTSCanvas canvas)
        {
            _fileName = fileName;

            // get the sensors list
            _sensors = new List <WSNSensorItem>();
            foreach (LTSCanvas.CanvasItemData item in canvas.itemsList)
            {
                if ((item.Item is WSNSensorItem) == false)
                {
                    continue;
                }
                WSNSensorItem add = (WSNSensorItem)item.Item;
                add.locateX = item.Item.X / 120; //kkk
                add.locateY = item.Item.Y / 120;

                if (minX == 0 || add.locateX < minX)
                {
                    minX = add.locateX;
                }
                if (minY == 0 || add.locateY < minY)
                {
                    minY = add.locateY;
                }
                _sensors.Add(add);//
            }

            // get the channels list
            _channels = new List <WSNSensorChannel>();
            foreach (Route route in canvas.diagramRouter.routes)
            {
                if ((route is WSNSensorChannel) == false)
                {
                    continue;
                }
                _channels.Add((WSNSensorChannel)route);
            }
            initXML();
        }