Beispiel #1
0
        void GPSTrackedShapeAdded(ShapeInformation info, DrawAction sender)
        {
            // wir brauchen den Service ja nur einmal in Anspruch nehmen
            sender.ShapeAdded -= GPSTrackedShapeAdded;

            this.gpsTrackingList.AddLast(info);
        }
Beispiel #2
0
        public void trackCurrentPosition()
        {
            // have we to filter the positon?
            if (config.GPSTrackingDiscardSamePositions)	{
                foreach (ShapeInformation shpInfo in gpsTrackingList) {
                    // check if we can discard this point
                    // we have to add the h_value since the TODO below is still to be done
                    if (   (Math.Abs(shpInfo.iShapeInf.CenterX - currentPositon.r_value) < nearlyZero)
                        && (Math.Abs(shpInfo.iShapeInf.CenterY + currentPositon.h_value) < nearlyZero) )
                        return;
                }
            }

            // TODO: The "-" in front of currentPosition.h_value is actually wrong - but there is a bug
            // in the model, so that one needs to pass the negative variable - FIX THIS
            DrawAction action = new DrawAction(MapPanel.AbsolutZoom, currentPositon.r_value, -currentPositon.h_value, this);
            action.ShapeAdded += new DrawAction.ShapeAddedDelegate(GPSTrackedShapeAdded);

            if (PerformAction(action)) {
                setStatusTimed("Neuen Wegpunkt (GPS) gesetzt!", 2000);
                OnWaypointAdded();
            } else {
                // delete the event handler, it is not needed anymore
                action.ShapeAdded -= GPSTrackedShapeAdded;
                setStatusTimed("Wegpunkt (GPS): Nicht gesetzt (Fehler)", 3000);
            }
        }