Esempio n. 1
0
        public void updateMarker(object sender, MarkerEventArgs args)
        {
            // Do not draw if the marker's wasn't previously found
            if (!args.EventMarker.PreviousData.Present)
                return;

            // Draw a segment on our canvas between the marker and where it was previously found
            MarkerEventData data = args.EventData;
            //pen.Color = Color.FromArgb(128, data.ColorAvg.R, data.ColorAvg.G, data.ColorAvg.B);
            //pen.Width = data.Area / 60;
            //p1.X = (data.X - data.DX);
            //p1.Y = (data.Y - data.DY);
            p2.X = data.X;
            p2.Y = data.Y;

            //p3.X = (int)(data.X / (float)cameraWidth * displayWidth);
            //p3.Y = (int)(data.Y / (float)cameraHeight * displayHeight);
            //canvasGFX.DrawLine(pen, p1, p2);
            canvasGFX.Clear(Color.Transparent);

            if (DateTime.Now.Ticks - pics.sTime.Ticks > pic.Delay)
            {
                pic = pics.getPicAutoPlus();
            }
            canvasGFX.DrawImage(pic.Img, new Rectangle(p2, pic.Img.Size));
        }
Esempio n. 2
0
        public void updateMarker(object sender, MarkerEventArgs args)
        {
            // Do not draw if the marker's wasn't previously found
            if (!args.EventMarker.PreviousData.Present)
            {
                return;
            }

            // Draw a segment on our canvas between the marker and where it was previously found
            MarkerEventData data = args.EventData;

            //pen.Color = Color.FromArgb(128, data.ColorAvg.R, data.ColorAvg.G, data.ColorAvg.B);
            //pen.Width = data.Area / 60;
            //p1.X = (data.X - data.DX);
            //p1.Y = (data.Y - data.DY);
            p2.X = data.X;
            p2.Y = data.Y;

            //p3.X = (int)(data.X / (float)cameraWidth * displayWidth);
            //p3.Y = (int)(data.Y / (float)cameraHeight * displayHeight);
            //canvasGFX.DrawLine(pen, p1, p2);
            canvasGFX.Clear(Color.Transparent);

            if (DateTime.Now.Ticks - pics.sTime.Ticks > pic.Delay)
            {
                pic = pics.getPicAutoPlus();
            }
            canvasGFX.DrawImage(pic.Img, new Rectangle(p2, pic.Img.Size));
        }
 /// <summary>
 /// Event Handler from the selected marker in the Marker Mode
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void OnMarkerUpdate(object sender, MarkerEventArgs args)
 {
     try
     {
         this.BeginInvoke(new Action<MarkerEventData>(UpdateMarkerDataInUI), new object[] { args.EventData });
     }
     catch { } // TODO: fix this
 }
        public void updateSecondaryMarker(object sender, MarkerEventArgs args)
        {
            // Set the upper-right point
            _destPoints[1].X = (int)(args.EventData.X * _displayScale);
            _destPoints[1].Y = (int)(args.EventData.Y * _displayScale);

            // Recalculate the upper-left point
            recalculateTransformation();
        }
 public void updateMarker(object sender, MarkerEventArgs args)
 {
     // Determine which player owns the updated marker
     for (int i = 0; i < _players.Count; i++)
     {
         if (args.EventMarker == _players[i].marker)
         {
             _players[i].update(args.EventData.X * _displayScale, args.EventData.Y * _displayScale);
         }
     }
 }
        public void updateMarker(object sender, MarkerEventArgs args)
        {
            // Do not draw if the marker's wasn't previously found
            if (!args.EventMarker.PreviousData.Present)
            {
                return;
            }

            // Draw a segment on our canvas between the marker and where it was previously found
            MarkerEventData data = args.EventData;

            _pen.Color = Color.FromArgb(128, data.ColorAvg.R, data.ColorAvg.G, data.ColorAvg.B);
            _pen.Width = data.Area / 60;
            _p1.X      = (data.X - data.DX);
            _p1.Y      = (data.Y - data.DY);
            _p2.X      = data.X;
            _p2.Y      = data.Y;
            _canvasGFX.DrawLine(_pen, _p1, _p2);
        }
 private void events_MarkerDropped(MarkerEventArgs ea)
 {
     UpdateMarkerList();
 }
Esempio n. 8
0
 /// <summary>
 /// Handles the cursor changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleCursorChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("CursorChanged", e);
 }
Esempio n. 9
0
        void m_OnChange(object sender, MarkerEventArgs e)
        {
            updatelabelMLocation(new Point(e.EventData.X * _ratioScreenCameraWidth, e.EventData.Y * _ratioScreenCameraHeight));
            Cursor.Position = new Point(labelM.Location.X - 1, labelM.Location.Y - 1);

            //What is NoN?
            //If the N marker is not present, the mouse will left click.
            //handSign_NoN();

            //NAMASTE (everyone requires this except menuDemo)
            if (!menuDemo && handSign_Menu())
            {
                RunMenuGesture(new EventArgs());
            }

            //...............Specific........................

            //TEST Demo  (no need of NoN)
            if (testDemo)
            {
                PainterForm_MouseMove(0, labelM.Location.X, labelM.Location.Y);
                PainterForm_MouseMove(1, labelN.Location.X, labelN.Location.Y);
                PainterForm_MouseMove(2, labelO.Location.X, labelO.Location.Y);
                PainterForm_MouseMove(3, labelP.Location.X, labelP.Location.Y);
            }

            //MAP Demo
            else if (mapDemo)
            {
                handSign_NoN();
                mapDemo_OnChange();
            }

            //PHOTO Demo  (no need of NoN)
            else if (photoDemo && handSign_TakePicture())
            {
                photo_clicked = true;
                RunPhotoGesture(new EventArgs());
            }

            //PRVIEW Demo
            else if (previewDemo)
            {
                updateImageM(this, e);
                if (handSign_PreviewTrigger())
                {
                    //buttonGalleryDemo_Click(this, new EventArgs());
                    RunGalleryDemo(new EventArgs());
                }
            }

            //NEWSPAPER Demo (no need of NoN)
            else if (newspaperDemo)
            {
                newspaperDemo_OnChange();
            }

            //.................no need of anything.................

            //GLOBE DEMO (no need of NoN)
            //WEATHER Demo (no need of NoN)
            //BOOK Demo (no need of NoN)
            //CLOCK Demo (no need of NoN)

            else if (globeDemo || weatherDemo || bookDemo || clockDemo)
            {
                //do nothing
            }

            //....................NoN.........................

            //DRAW Demo
            //GALLERY Demo
            //MAIL Demo
            //STOCK Demo
            //EFFECTS Demo
            //MENU Demo
            //GESTURE Demo

            else
            {
                handSign_NoN();
            }
        }
 private void events_MarkerCollected(MarkerEventArgs ea)
 {
     RestartTimer();
 }
Esempio n. 11
0
 /// <summary>
 /// Handles the double click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleDoubleClick(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("DoubleClick", e);
 }
Esempio n. 12
0
 /// <summary>
 /// Prints the event.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void PrintEvent(string name, MarkerEventArgs e)
 {
     lbEvents.Items.Add(
         string.Format("{0} event was fired by marker [index: {1}] at position [lat: {2}, lng: {3}].",
             name, e.Index, e.Position.Latitude, e.Position.Longitude));
 }
Esempio n. 13
0
 /// <summary>
 /// Handles the visible changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleVisibleChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("VisibleChanged", e);
 }
        public void updateSingleMarker(object sender, MarkerEventArgs args)
        {
            // Calculate baseline area (running avg) for the first _MaxSampleFrameCount frames
            if (_sampleFrameCount < _MaxSampleFrameCount)
            {
                _baselineArea = (_sampleFrameCount++ == 0) ? args.EventData.Area : (_baselineArea + args.EventData.Area) / 2;
            }

            _markerPos.X = (int)(args.EventData.X * _displayScale);
            _markerPos.Y = (int)(args.EventData.Y * _displayScale);

            // Translate x & y coords to have an origin of the image center (opposite directions)
            int x = _captureWidth / 2 - args.EventData.X;
            int y = _captureHeight / 2 - args.EventData.Y;

            // In the null area, we can change the zoom
            if ((Math.Abs(x) < _NullRadius) && (Math.Abs(y) < _NullRadius))
            {
                // Set the velocity center to zero
                _velocityCenter.X = 0;
                _velocityCenter.Y = 0;

                // Find new velocity scale by adding new acceleration value; then cap at min/max values
                _velocityScale += (args.EventData.Area - _baselineArea) / (100F * _baselineArea);
                _velocityScale  = (float)(Math.Max(Math.Min(_velocityScale, _MaxVelocityScale), -_MaxVelocityScale));

                // Cap the scale to reasonable values
                if ((_currentScale >= _MaxScale && _velocityScale > 0) ||
                    (_currentScale <= _MinScale && _velocityScale < 0))
                {
                    _velocityScale = 0;
                }

                // Apply the scale velocity
                _currentScale += _velocityScale;
            }
            else // Outside the null area, pan around
            {
                // Find the new velocities by adding new acceleration values or slowing (in per-axis null area)
                _velocityCenter.X = (Math.Abs(x) < _NullRadius) ? _velocityCenter.X * .9F : _velocityCenter.X + x / (float)_captureWidth;
                _velocityCenter.Y = (Math.Abs(y) < _NullRadius) ? _velocityCenter.Y * .9F : _velocityCenter.Y + y / (float)_captureHeight;

                // Find the new center
                _currentCenter.X += (int)_velocityCenter.X;
                _currentCenter.Y += (int)_velocityCenter.Y;

                // Make sure the image doesn't easily go off screen
                if (_currentCenter.X > (_imageWidth * _currentScale) / 2 && _velocityCenter.X > 0)
                {
                    _velocityCenter.X *= .9F;
                }
                if (_currentCenter.X < _displayWidth - (_imageWidth * _currentScale) / 2 && _velocityCenter.X < 0)
                {
                    _velocityCenter.X *= .9F;
                }
                if (_currentCenter.Y > (_imageHeight * _currentScale) / 2 && _velocityCenter.Y > 0)
                {
                    _velocityCenter.Y *= .9F;
                }
                if (_currentCenter.Y < _displayHeight - (_imageHeight * _currentScale) / 2 && _velocityCenter.Y < 0)
                {
                    _velocityCenter.Y *= .9F;
                }
            }
        }
Esempio n. 15
0
 /// <summary>
 /// Handles the Z index changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleZIndexChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("ZIndexChanged", e);
 }
Esempio n. 16
0
 /// <summary>
 /// Handles the draggable changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleDraggableChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("DraggableChanged", e);
 }
Esempio n. 17
0
 /// <summary>
 /// Handles the drag end.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleDragEnd(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("DragEnd", e);
 }
Esempio n. 18
0
 /// <summary>
 /// Handles the double click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleDoubleClick(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("DoubleClick", e);
 }
Esempio n. 19
0
 /// <summary>
 /// Handles the position changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandlePositionChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("PositionChanged", e);
 }
 private void events_MarkerCollected(MarkerEventArgs ea)
 {
     RestartTimer();
 }
Esempio n. 21
0
 /// <summary>
 /// Handles the animation changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleAnimationChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("AnimationChanged", e);
 }
Esempio n. 22
0
 /// <summary>
 /// Handles the shadow changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleShadowChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("ShadowChanged", e);
 }
Esempio n. 23
0
 /// <summary>
 /// Handles the Z index changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleZIndexChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("ZIndexChanged", e);
 }
Esempio n. 24
0
        // Event handler: A marker, as defined in e.Marker, has been either added (if e.IsNew is true) or deleted (if it is false)
        // Depending on which it is, add or delete the tag from the current counter control's list of tags
        // If its deleted, remove the tag from the current counter control's list of tags
        // Every addition / deletion requires us to:
        // - update the contents of the counter control
        // - update the data held by the image
        // - update the list of markers held by that counter
        // - regenerate the list of markers used by the markableCanvas
        private void MarkableCanvas_RaiseMarkerEvent(object sender, MarkerEventArgs e)
        {
            if (e.IsNew)
            {
                // A marker has been added
                DataEntryCounter currentCounter = this.FindSelectedCounter(); // No counters are selected, so don't mark anything
                if (currentCounter == null)
                {
                    return;
                }
                this.MarkableCanvas_AddMarker(currentCounter, e.Marker);
                return;
            }
            // An existing marker has been deleted.
            DataEntryCounter counter = (DataEntryCounter)this.DataEntryControls.ControlsByDataLabel[e.Marker.DataLabel];

            // Part 1. Decrement the counter only if there is a number in it
            string oldCounterData = counter.Content;
            string newCounterData;

            if (!String.IsNullOrEmpty(oldCounterData))
            {
                int count = Convert.ToInt32(oldCounterData);
                count          = (count == 0) ? 0 : count - 1;  // Make sure its never negative, which could happen if a person manually enters the count
                newCounterData = count.ToString();

                if (!newCounterData.Equals(oldCounterData))
                {
                    // Don't bother updating if the value hasn't changed (i.e., already at a 0 count)
                    // Update the datatable and database with the new counter values
                    this.DataHandler.IsProgrammaticControlUpdate = true;
                    counter.SetContentAndTooltip(newCounterData);
                    this.DataHandler.IsProgrammaticControlUpdate = false;
                    this.DataHandler.FileDatabase.UpdateFile(this.DataHandler.ImageCache.Current.ID, counter.DataLabel, newCounterData);
                }
            }

            // Part 2. Remove the marker in memory and from the database
            // Each marker in the countercoords list reperesents a different control.
            // So just check the first markers's DataLabel in each markersForCounters list to see if it matches the counter's datalabel.
            MarkersForCounter markersForCounter = null;

            foreach (MarkersForCounter markers in this.markersOnCurrentFile)
            {
                // If there are no markers, we don't have to do anything.
                if (markers.Markers.Count == 0)
                {
                    continue;
                }

                // There are no markers associated with this counter
                // if (markers.Markers[0].DataLabel == markers.DataLabel)
                if (markers.Markers[0].DataLabel == e.Marker.DataLabel)
                {
                    // We found the marker counter associated with that control
                    markersForCounter = markers;
                    break;
                }
            }

            // Part 3. Remove the found metatag from the metatagcounter and from the database
            if (markersForCounter != null)
            {
                markersForCounter.RemoveMarker(e.Marker);
                this.Speak(counter.Content); // Speak the current count
                this.DataHandler.FileDatabase.MarkersUpdateMarkerRow(this.DataHandler.ImageCache.Current.ID, markersForCounter);
            }
            this.MarkableCanvas_UpdateMarkers(); // Refresh the Markable Canvas, where it will also delete the markers at the same time
        }
Esempio n. 25
0
 /// <summary>
 /// Handles the cursor changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleCursorChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("CursorChanged", e);
 }
Esempio n. 26
0
 void p_OnChange(object sender, MarkerEventArgs e)
 {
     updatelabelPLocation(new Point(e.EventData.X * _ratioScreenCameraWidth, e.EventData.Y * _ratioScreenCameraHeight));
 }
Esempio n. 27
0
 /// <summary>
 /// Handles the drag end.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleDragEnd(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("DragEnd", e);
 }
Esempio n. 28
0
 public void OnSelectedMarkerUpdate(object sender, MarkerEventArgs args)
 {
     this.BeginInvoke(new Action<MarkerEventData>(UpdateMarkerDataInUI), new object[] { args.EventData });
 }
Esempio n. 29
0
 private void M_OnChange(object sender, MarkerEventArgs e)
 {
 }
Esempio n. 30
0
 /// <summary>
 /// Handles the right click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleRightClick(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("RightClick", e);
 }
Esempio n. 31
0
        void o_OnChange(object sender, MarkerEventArgs e)
        {
            updatelabelOLocation(new Point(e.EventData.X * _ratioScreenCameraWidth, e.EventData.Y * _ratioScreenCameraHeight));

            if (previewDemo)
            {
                updateImageO(this, e);
            }
        }
Esempio n. 32
0
 /// <summary>
 /// Prints the event.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void PrintEvent(string name, MarkerEventArgs e)
 {
     lbEvents.Items.Add(
         string.Format("{0} event was fired by marker [index: {1}] at position [lat: {2}, lng: {3}].",
                       name, e.Index, e.Position.Latitude, e.Position.Longitude));
 }
Esempio n. 33
0
        private void updateImageO(object sender, MarkerEventArgs args)
        {
            // Set the upper-right point
            _destPoints[1].X = (int)(args.EventData.X * _displayScale);
            _destPoints[1].Y = (int)(args.EventData.Y * _displayScale);

            // Recalculate the upper-left point
            recalculateTransformation();
        }
        public void updateMarker(object sender, MarkerEventArgs args)
        {
            MarkerEventData data = args.EventData;

            _xm = data.X;
            _ym = data.Y;

            // Translate x & y coords to have an origin of the image center, and flip Y
            int x = data.X - _captureWidth / 2;
            int y = _captureHeight / 2 - data.Y;

            // Is the marker in our null region?
            if (_nullZone.Contains(new Point(x, y)))
            {
                _hudStringMarkerDir = "Null (Center)";
                _snake.dxm          = _snake.dym = 0;
                return;
            }

            // Get the angle of the point from the center
            // angle: E = 0, W = 180(ccw)/-180(cw)
            int angle = (int)(Math.Atan2(y, x) * 180 / Math.PI);

            // Compare the angle with the diagonals and change the snake direction, ignore double-backing
            if (angle < _angleSW || angle >= _angleNW)
            {
                _hudStringMarkerDir = "Left";
                if (_snake.dx == 1)
                {
                    return;
                }
                _snake.dxm = -1;
                _snake.dym = 0;
            }
            else if (angle < _angleSE)
            {
                _hudStringMarkerDir = "Down";
                if (_snake.dy == -1)
                {
                    return;
                }
                _snake.dxm = 0;
                _snake.dym = 1;
            }
            else if (angle < _angleNE)
            {
                _hudStringMarkerDir = "Right";
                if (_snake.dx == -1)
                {
                    return;
                }
                _snake.dxm = 1;
                _snake.dym = 0;
            }
            else /*if (angle < _angleNW)*/
            {
                _hudStringMarkerDir = "Up";
                if (_snake.dy == 1)
                {
                    return;
                }
                _snake.dxm = 0;
                _snake.dym = -1;
            }
        }
Esempio n. 35
0
 /// <summary>
 /// Handles the mouse up.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleMouseUp(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("MouseUp", e);
 }
Esempio n. 36
0
 /// <summary>
 /// Handles the right click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleRightClick(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("RightClick", e);
 }
 private void events_MarkerCollected(MarkerEventArgs ea)
 {
     UpdateMarkerList();
 }
Esempio n. 38
0
 /// <summary>
 /// Handles the shadow changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Artem.Google.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleShadowChanged(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("ShadowChanged", e);
 }
Esempio n. 39
0
 /// <summary>
 /// Event Handler from the selected marker in the Marker Mode
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void OnSelectedMarkerUpdate(object sender, MarkerEventArgs args)
 {
     this.BeginInvoke(new Action <MarkerEventData>(UpdateMarkerDataInUI), new object[] { args.EventData });
 }
Esempio n. 40
0
 /// <summary>
 /// Handles the mouse up.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Velyo.Google.Map.UI.MarkerEventArgs"/> instance containing the event data.</param>
 protected void HandleMouseUp(object sender, MarkerEventArgs e)
 {
     this.PrintEvent("MouseUp", e);
 }