private void FormsMap_AddedPosition(object sender, NewPositionEventArgs e)
 {
     if (_isMapReady == true && routeCoordinates.Count() > 0 && e.ShowPath == true && routeCoordinates.Last() is Position lastPos)
     {
         if (NativeMap != null)
         {
             var polylineOptions = new PolylineOptions();
             polylineOptions.InvokeColor(_mapLineColor);
             polylineOptions.Add(new LatLng(lastPos.Latitude, lastPos.Longitude));
             polylineOptions.Add(new LatLng(e.Position.Latitude, e.Position.Longitude));
             NativeMap.AddPolyline(polylineOptions);
         }
     }
     routeCoordinates.Add(e.Position);
 }
Ejemplo n.º 2
0
        private void PointerModule_NewPosition(object sender, NewPositionEventArgs e)
        {
            this.p = e.Position;

            int col = (int)Math.Round((double)(p.x * (float)xRes));

            // Do we need a new image?
            if ((col < this.lastCol)||(this.bmdb==null))
            {
                try
                {
                    // Get a new image
                    Bitmap orig = this.AcquisitionModule.GetImage();
                    // Now resize it so that it's height is equal to yRes
                    Bitmap resized = this.ResizeBitmap(orig);
                    Bitmap greyscale = this.ToGreyscale(resized);
                    // Save this resized bitmap for posterity
                    //string tmpPath = Path.GetTempFileName();
                    //resized.Save(tmpPath);
                    //Console.WriteLine("frame saved to {0}", tmpPath);
                    //this.bm = resized;
                    this.bmdb = this.ImageToBytes(greyscale);
                }
                catch (NoDataYetException ndye)
                {
                    Console.Write(ndye.Message);
                }
            }

            if ((this.bmdb != null)&&(this.lastCol!=col))
            {
                // Now read a column
                //for (int i = 0; i < yRes; i++)
                //{
                //    byte[] pixel = new byte[2];
                //    pixel[0] = this.bmdb[0, col, i];
                //    pixel[1] = this.bmdb[1, col, i];
                //    int pixelVal = BitConverter.ToInt16(pixel, 0);

                //    float pixelValProp = (float)pixelVal / 256f;
                //    this.Outputs[i].Amplitude = pixelValProp;
                //}
            }

            this.lastCol = col;
        }
Ejemplo n.º 3
0
 private void PointerModule_NewPosition(object sender, NewPositionEventArgs e)
 {
     this.Coordinates = e.Position;
     this.Process();
 }