Пример #1
0
 public MeasureLine(uint line, int process)
 {
     this.mLineBeginn 		= line;
     this.mProcess 			= process;
     this.mLineEnd 			= 0;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= MeasurePos.Left;
     this.mCapStyle 			= CapStyle.Inner;
 }
Пример #2
0
 public MeasureEnd(uint fileLine, string name, uint line, int process, MeasurePos placement)
 {
     this.mName 				= name;
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mCapStyle 			= CapStyle.Inner;
     this.mFileLine 			= fileLine;
 }
Пример #3
0
 public MeasureEnd(uint fileLine, uint line, int process)
 {
     this.mName 				= "";
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= MeasurePos.Left;
     this.mCapStyle 			= CapStyle.Inner;
     this.mFileLine 			= fileLine;
 }
Пример #4
0
 public MeasureStop(uint fileLine, string gate, uint line, int process)
 {
     this.mName 				= "";
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mGate 				= gate;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= MeasurePos.Left;
     this.mCapStyle 			= CapStyle.Inner;
     this.mFileLine 			= fileLine;
 }
Пример #5
0
 public MeasureStart(uint fileLine, string name, string gate, uint line, int process, MeasurePos placement, CapStyle style)
 {
     this.mName 			= name;
     this.mLine 			= line;
     this.mProcess 		= process;
     this.mGate 			= gate;
     this.mItemPen 		= new Pen(Color.Black, 1);
     this.mPos 			= placement;
     this.mCapStyle 		= style;
     this.mFileLine 		= fileLine;
 }
Пример #6
0
 public MeasureBeginn(uint fileLine, string name, uint line, int process)
 {
     this.mName 				= name;
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;   //SDL layout
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= MeasurePos.Left;
     this.mCapStyle 			= CapStyle.Inner;
     this.mFileLine 			= fileLine;
 }
Пример #7
0
 public static void RepertoryImage(Graphics drawDestination, MeasurePos pos, CapStyle style)
 {
     float[] pattern = {4f,4f};
     Pen rPen = new Pen(Color.Black);
     PointF[] capPolygon = new PointF[3];
     StringFormat itemStringFormat = new StringFormat();
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     if (pos == MeasurePos.Left){
         itemStringFormat.Alignment = StringAlignment.Near;
         itemStringFormat.LineAlignment = StringAlignment.Far;
         drawDestination.DrawLine(Pens.DarkGray,70,5,70,75);
         if (style == CapStyle.Inner){
             RectangleF itemBox = new RectangleF(21, 50, 49, 10);
             drawDestination.DrawLine(rPen,10,60,70,60);
             capPolygon[0] = new PointF(15, 59);
             capPolygon[1] = new PointF(10, 54);
             capPolygon[2] = new PointF(20, 54);
             drawDestination.DrawPolygon(Pens.Black,capPolygon);
             drawDestination.DrawLine(rPen,15,40,15,54);
             drawDestination.DrawEllipse(Pens.Black, new RectangleF(10,30,10,10));
             drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             itemBox = new RectangleF(22, 30, 48, 10);
             drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
         }
         else{
             RectangleF itemBox = new RectangleF(21, 50, 49, 10);
             drawDestination.DrawLine(rPen,10,60,70,60);
             capPolygon[0] = new PointF(15, 61);
             capPolygon[1] = new PointF(10, 66);
             capPolygon[2] = new PointF(20, 66);
             drawDestination.DrawPolygon(Pens.Black,capPolygon);
             drawDestination.DrawLine(rPen,15,40,15,60);
             drawDestination.DrawEllipse(Pens.Black, new RectangleF(10,30,10,10));
             drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             itemBox = new RectangleF(22, 30, 48, 10);
             drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
         }
     }
     else{
         itemStringFormat.Alignment = StringAlignment.Near;
         itemStringFormat.LineAlignment = StringAlignment.Far;
         drawDestination.DrawLine(Pens.DarkGray,10,5,10,75);
         if (style == CapStyle.Inner){
             RectangleF itemBox = new RectangleF(10, 50, 50, 10);
             drawDestination.DrawLine(rPen,10,60,70,60);
             capPolygon[0] = new PointF(65, 59);
             capPolygon[1] = new PointF(70, 54);
             capPolygon[2] = new PointF(60, 54);
             drawDestination.DrawPolygon(Pens.Black,capPolygon);
             drawDestination.DrawLine(rPen,65,40,65,54);
             drawDestination.DrawEllipse(Pens.Black, new RectangleF(60,30,10,10));
             drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             itemStringFormat.Alignment = StringAlignment.Far;
             itemBox = new RectangleF(20, 30, 40, 10);
             drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
         }
         else{
             RectangleF itemBox = new RectangleF(10, 50, 50, 10);
             drawDestination.DrawLine(rPen,10,60,70,60);
             capPolygon[0] = new PointF(65, 61);
             capPolygon[1] = new PointF(70, 66);
             capPolygon[2] = new PointF(60, 66);
             drawDestination.DrawPolygon(Pens.Black,capPolygon);
             drawDestination.DrawLine(rPen,65,40,65,60);
             drawDestination.DrawEllipse(Pens.Black, new RectangleF(60,30,10,10));
             drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             itemStringFormat.Alignment = StringAlignment.Far;
             itemBox = new RectangleF(20, 30, 40, 10);
             drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
         }
     }
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
Пример #8
0
 public InterpretResult addMeasureStop(uint fileLine, string processName, uint line, string gate, string name, MeasurePos placement)
 {
     Process process;
     IEnumerator enumerator = processes.GetEnumerator();
     bool instanceFound = false;
     for(int i=0;i<processes.Count;i++){
         enumerator.MoveNext();
         process = (Process) enumerator.Current;
         if(process.ProcessName == processName){
             items.Add(new MeasureStop(fileLine, name, gate, line, i,placement));
             instanceFound = true;
             break;
         }
     }
     if (instanceFound==false)
         return InterpretResult.InstanceNotFound;
     mLines = Math.Max(mLines, line);
     return InterpretResult.Ok;
 }
Пример #9
0
 public InterpretResult addMeasureLineBeginn(uint fileLine, uint line, int process, MeasurePos placement, CapStyle style)
 {
     if (process >= processes.Count)
         return InterpretResult.InstanceNotFound;
     IEnumerator enumerator = lines.GetEnumerator();
     for(uint i=0;i<lines.Count;i++){
         enumerator.MoveNext();
         if ( enumerator.Current is MeasureLine)
             if((((MeasureLine) enumerator.Current).LineEnd==0)&&(((MeasureLine) enumerator.Current).Process == process)) return InterpretResult.LineAllreadyExists;
     }
     lines.Add(new MeasureLine(line+1, style, process, placement));
     return InterpretResult.Ok;
 }
Пример #10
0
        public MainWindow()
        {
            InitializeComponent();

            log        = new LogWindow();
            motor      = new MotorDriver[2];
            motor[0]   = new MotorDriver();
            motor[1]   = new MotorDriver();
            sensor     = new SensorBoard();
            joystick   = new Joystick();
            controller = new Controller();
            light      = new Light();
            camera     = new CameraUsb[2];
            camera[0]  = new CameraUsb();
            camera[1]  = new CameraUsb();

            ranking = new RankingControl();
            ranking.SetLog(log);

            // パラメータ読み込み ------------------------------------------------------------

            BtnLoadParam_Click(null, null);

            // --------------------------------------------------
            // カメラ画像にダミーを表示

            System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetEntryAssembly();
            string[] SplPath = myAssembly.Location.Split('\\');
            SplPath[SplPath.Length - 1] = "bird3.jpg";
            string      path = string.Join("\\", SplPath);
            BitmapImage bi   = new BitmapImage();

            bi.BeginInit();
            bi.UriSource = new Uri(path, UriKind.Absolute);
            bi.EndInit();
            image1.Source = bi;
            image2.Source = bi;

            // --------------------------------------------------
            // メーター表示

            //meters.Background = System.Windows.Media.Brushes.Black.Clone();
            //meters.Background.Opacity = 0.5;

            float PwmVal(int n)
            {
                int i = meter_select[n];
                int k = i / 3;
                int j = i % 3;

                return((float)((motor[k].mode[j] == 0) ? motor[k].pwm_ref[j] : motor[k].pwm[j]) / (float)(motor[k].pwmMax));
            }

            float VelVal(int n)
            {
                int i = meter_select[n];
                int k = i / 3;
                int j = i % 3;

                return((float)((motor[k].mode[j] == 0) ? vel[i] : motor[k].vel_ref[j]) / (float)(motor[k].velMax));
            }

            float PosVal(int n)
            {
                int i = meter_select[n];
                int k = i / 3;
                int j = i % 3;

                return(motor[k].pos[j]);
            }

            meters.UpdateDisplayLayout(
                new MeasureObj[] {
                new MeasurePercent(new GetRealValue(delegate() { return(PwmVal(0)); })),
                new MeasurePercent(new GetRealValue(delegate() { return(PwmVal(1)); })),
                new MeasurePercent(new GetRealValue(delegate() { return(PwmVal(2)); })),
                new MeasurePercent(new GetRealValue(delegate() { return(VelVal(0)); })),
                new MeasurePercent(new GetRealValue(delegate() { return(VelVal(1)); })),
                new MeasurePercent(new GetRealValue(delegate() { return(VelVal(2)); })),
                mpos1 = new MeasurePos(new GetRealValue(delegate() { return(PosVal(0)); })),
                mpos2 = new MeasurePos(new GetRealValue(delegate() { return(PosVal(1)); })),
                mpos3 = new MeasurePos(new GetRealValue(delegate() { return(PosVal(2)); })),
                new MeasurePercent(new GetRealValue(delegate() { return((float)(sensor.pot[0] / (float)(sensor.potMax))); })),
                null,
                null
            });

            for (int i = 0; i < meters.meter_controls.Length; i++)
            {
                if (meters.meter_controls[i] != null)
                {
                    meters.meter_controls[i].ThresholdScaleLen = 0.0f;  // スケールは表示しない
                    if (i < 6)
                    {
                        SetMeterLimitsSigned(i, true, -0.85f, true, 0.85f);
                    }
                    else
                    {
                        SetMeterLimitsUnsigned(i, true, 0.10f, true, 0.90f);
                    }
                }
            }

#if false
            string[] titles = new string[] { "+ X", "- X", "+ Y", "- Y", "+ Z", "- Z" };
            for (int i = 0; i < titles.Length; i++)
            {
                meters.labels[i].Content = titles[i];
            }
#endif
            foreach (Label label in meters.labels)
            {
                label.Visibility = Visibility.Hidden;
            }

            // --------------------------------------------------

            //// 操作卓のLEDボタン機能の割り当てはここで行う
            controller.PushButtons = new EnableButton[] { BtnRegister };
            controller.SyncButtons = new EnableButton[] { null, BtnPause, null, BtnStart, null, null, BtnHalt, null, null, null };

            OnMotorChanged();

            // 初期自動接続
            BtnJoystick.Enabled = true;
            BtnMotor1.Enabled   = true;
            BtnMotor2.Enabled   = true;
            BtnSensor.Enabled   = true;
            //BtnCtrl.Enabled = true;
            BtnLight.Enabled = true;

            BtnDispRank.Enabled = true;
            BtnDispAzim.Enabled = true;

            // インターバルタイマ
            DispatcherTimer dispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, param.UpdateInterval);  // in milliseconds
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Start();
        }
Пример #11
0
 public MeasureLine(uint line, CapStyle style, int process, MeasurePos placement)
 {
     this.mLineBeginn 		= line;
     this.mProcess 			= process;
     this.mLineEnd 			= 0;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mCapStyle 			= style;
 }
Пример #12
0
 public MeasureEnd(uint fileLine, uint line, int process, MeasurePos placement, CapStyle style)
 {
     this.mName 				= "";
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mCapStyle 			= style;
     this.mFileLine 			= fileLine;
 }