Beispiel #1
0
		/// <summary>
		/// Do the work: function that actualy do the work
		/// </summary>
		/// <param name="source"></param>
		/// <returns></returns>
		public override Sardauscan.Core.ScanData DoTask(Sardauscan.Core.ScanData source)
		{
			// try somthing simple change Texture colors to RED
			Sardauscan.Core.ScanData returndata = new Sardauscan.Core.ScanData(source.Count);
			Status = eTaskStatus.Working;
			// avoid using foreach for multithreading 
			// cycle the scan line
			for (int scanlines = 0; scanlines < source.Count; scanlines++)
			{
				Sardauscan.Core.ScanLine oldLine = source[scanlines];
				// create a new line
				Sardauscan.Core.ScanLine newLine = new Sardauscan.Core.ScanLine(oldLine.LaserID,oldLine.Count);
				// copy the render type
				newLine.DisplayAsLine = oldLine.DisplayAsLine;
				// cycle the points
				for(int pointIndex = 0;pointIndex < oldLine.Count; pointIndex++)
				{
					Sardauscan.Core.Geometry.Point3D oldPoint = oldLine[pointIndex];
					// Add a new point3d to the new scanline
					newLine.Add( new Sardauscan.Core.Geometry.Point3D(oldPoint.Position,oldPoint.Normal,Color.Red));
				}
				// Add the ne scanline to the result
				returndata.Add(newLine);

				// update the viewer
				UpdatePercent((int)((100 * scanlines) / source.Count), returndata);
			}
			Status = eTaskStatus.Finished;
			return returndata;
		}
Beispiel #2
0
        public override Sardauscan.Core.ScanData DoTask(Sardauscan.Core.ScanData source)
        {
            if (!HardwareAvailable)
                throw new Exception(string.Format("HardWare missing : TURNTABLE:{0} LASER:{1} CAMERA:{2}", HardwarePresentTrace(TurnTable), HardwarePresentTrace(Laser), HardwarePresentTrace(Camera)));

            double RotationStep = (double)Math.Round(360.0 / (NumberOfGrab-1), 2);
            ScanData ret = new ScanData();
            UpdatePercent(0, ret);

            TurnTable.InitialiseRotation();
            Laser.TurnAll(false);
            int index = 0;    
            for (double currentAngle = 0; currentAngle < 360f; currentAngle += RotationStep)
            {
                if (this.CancelPending) return ret;
                Bitmap imgoff = GetCapture();
                string path = Path.Combine(Folder, string.Format("capture{0}.jpg", ++index,(int)currentAngle));
                imgoff.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);

                int percent = (int)((currentAngle / 360f) * 100f);
                UpdatePercent(percent, ret);
                TurnTable.Rotate(currentAngle, false);
                Thread.Sleep(1000);
            }

            return null;
        }