public LocationSourceRecorder(LocationSource locationSource, Boolean pause)
        {
            this.updateInterval = Properties.Settings.Default.locationUpdateInterval;
            Debug.WriteLine("UpdateInterval: " + updateInterval);
            this.Pause = pause;
            this.locationSource = locationSource;
            this.locationSource.Attach(this);

            if (!Directory.Exists(Properties.Settings.Default.userTrackFolder))
            {
                Directory.CreateDirectory(Properties.Settings.Default.userTrackFolder);
            }

            this.xmlWriter = new XmlTextWriter(Properties.Settings.Default.userTrackFolder + locationSource.Id + ".xml", System.Text.Encoding.UTF8);
            this.xmlWriter.Formatting = Formatting.Indented;
            this.xmlWriter.WriteStartDocument(false);
            this.xmlWriter.WriteComment("locationSourceId: " + locationSource.Id);
            this.xmlWriter.WriteComment("locationSourceName: " + locationSource.Name);
            this.xmlWriter.WriteStartElement("gpx");
            this.xmlWriter.WriteAttributeString("version", "1.1");
            this.xmlWriter.WriteAttributeString("creator", "PresenceSimulator");
            this.xmlWriter.WriteStartElement("trk");
            this.xmlWriter.WriteStartElement("trkseg");
            this.xmlWriter.Flush();
        }
Example #2
0
        public LocationSource createLocationSource(string name, Discriminator discriminator)
        {
            LocationSource user = new LocationSource(name, discriminator);

            this.LocationSources.Add(user);
            return(user);
        }
Example #3
0
 public void deleteLocationSource(LocationSource locationSource)
 {
     if (this.locationSources.Contains(locationSource))
     {
         locationSource.Delete();
         this.locationSources.Remove(locationSource);
     }
 }
 public void deleteLocationSource(LocationSource locationSource)
 {
     if (this.locationSources.Contains(locationSource))
     {
         locationSource.Delete();
         this.locationSources.Remove(locationSource);
     }
 }
        public LocationSourceMapMarker(LocationSource user)
            : base(user.LatLng)
        {
            this.locationSource = user;

            this.OuterPen = new Pen(Color.Black, 2);
            this.InnerBrush = new SolidBrush(Color.Gray);
            this.Text = user.Name;
            this.TextFont = new Font("Arial", 15, FontStyle.Bold);
            this.TextBrush = Brushes.DarkMagenta;
            this.Offset = new System.Drawing.Point(-Size.Width / 2, -Size.Height / 2);
        }
        public LocationSourcePlayer(LocationSource user, String path)
        {
            this.user = user;
            try
            {
                track = new XPathDocument(path);
            }
            catch (XmlException xmlEcxeption)
            {
                throw xmlEcxeption;
            }

            trackNav = track.CreateNavigator();

            // extract user name from second comment
            String userNameComment = trackNav.SelectSingleNode("comment()[2]").ToString();
            String userName = userNameComment.Substring(20);
            this.user.Name = userName;

            this.setupTrkptIterator();
        }
        public LocationSourceFormView(LocationSource locationSource, Panel parent)
        {
            this.locationSource = locationSource;
            this.parent = parent;

            this.container = new GroupBox();
            this.container.Width = this.parent.Width - 25;
            this.container.Height = 159;
            parent.Controls.Add(container);

            Label nameLabel = new Label();
            nameLabel.Text = "Name:";
            nameLabel.Location = new System.Drawing.Point(5,14);
            nameLabel.AutoSize = true;
            container.Controls.Add(nameLabel);

            TextBox nameInput = new TextBox();
            nameInput.Text = this.locationSource.Name;
            nameInput.Width = 85;
            nameInput.Location = new System.Drawing.Point(45, 12);
            container.Controls.Add(nameInput);
            nameInput.TextChanged += delegate { this.locationSource.Name = nameInput.Text; };

            Label latLabel = new Label();
            latLabel.Text = "Lat:";
            latLabel.Location = new System.Drawing.Point(5, 40);
            latLabel.AutoSize = true;
            container.Controls.Add(latLabel);

            lat = new Label();
            lat.Text = "unknown";
            lat.Location = new System.Drawing.Point(45, 40);
            lat.Width = 85;
            lat.Height = 13;
            container.Controls.Add(lat);

            Label lngLabel = new Label();
            lngLabel.Text = "Lng:";
            lngLabel.Location = new System.Drawing.Point(5, 60);
            lngLabel.AutoSize = true;
            container.Controls.Add(lngLabel);

            lng = new Label();
            lng.Text = "unknown";
            lng.Location = new System.Drawing.Point(45, 60);
            lng.Width = 85;
            lng.Height = 13;
            container.Controls.Add(lng);

            Control discriControl = this.locationSource.Discri.GetControl();
            discriControl.Size = new System.Drawing.Size(50, 50);
            discriControl.Location = new System.Drawing.Point(45, 77);
            container.Controls.Add(discriControl);

            Button removeLocationSource = new Button();
            removeLocationSource.Text = "Remove";
            removeLocationSource.Location = new System.Drawing.Point(5, 130);
            removeLocationSource.Width = 127;
            removeLocationSource.Click += delegate { new DeleteLocationSourceCommand(this.locationSource).execute(); };
            container.Controls.Add(removeLocationSource);
        }
 public DeleteLocationSourceCommand(LocationSource locationSource)
 {
     this.locationSource = locationSource;
 }
Example #9
0
        public LocationSourceFormView(LocationSource locationSource, Panel parent)
        {
            this.locationSource = locationSource;
            this.parent         = parent;

            this.container        = new GroupBox();
            this.container.Width  = this.parent.Width - 25;
            this.container.Height = 159;
            parent.Controls.Add(container);

            Label nameLabel = new Label();

            nameLabel.Text     = "Name:";
            nameLabel.Location = new System.Drawing.Point(5, 14);
            nameLabel.AutoSize = true;
            container.Controls.Add(nameLabel);

            TextBox nameInput = new TextBox();

            nameInput.Text     = this.locationSource.Name;
            nameInput.Width    = 85;
            nameInput.Location = new System.Drawing.Point(45, 12);
            container.Controls.Add(nameInput);
            nameInput.TextChanged += delegate { this.locationSource.Name = nameInput.Text; };

            Label latLabel = new Label();

            latLabel.Text     = "Lat:";
            latLabel.Location = new System.Drawing.Point(5, 40);
            latLabel.AutoSize = true;
            container.Controls.Add(latLabel);

            lat          = new Label();
            lat.Text     = "unknown";
            lat.Location = new System.Drawing.Point(45, 40);
            lat.Width    = 85;
            lat.Height   = 13;
            container.Controls.Add(lat);

            Label lngLabel = new Label();

            lngLabel.Text     = "Lng:";
            lngLabel.Location = new System.Drawing.Point(5, 60);
            lngLabel.AutoSize = true;
            container.Controls.Add(lngLabel);

            lng          = new Label();
            lng.Text     = "unknown";
            lng.Location = new System.Drawing.Point(45, 60);
            lng.Width    = 85;
            lng.Height   = 13;
            container.Controls.Add(lng);

            Control discriControl = this.locationSource.Discri.GetControl();

            discriControl.Size     = new System.Drawing.Size(50, 50);
            discriControl.Location = new System.Drawing.Point(45, 77);
            container.Controls.Add(discriControl);

            Button removeLocationSource = new Button();

            removeLocationSource.Text     = "Remove";
            removeLocationSource.Location = new System.Drawing.Point(5, 130);
            removeLocationSource.Width    = 127;
            removeLocationSource.Click   += delegate { new DeleteLocationSourceCommand(this.locationSource).execute(); };
            container.Controls.Add(removeLocationSource);
        }
        public LocationSourceTrackForm(LocationSource locationSource, Panel parent, LocationSourcePlayer locationSourcePlayer)
        {
            this.locationSource = locationSource;
            this.parent = parent;
            this.locationSourcePlayer = locationSourcePlayer;

            this.container = new GroupBox();
            this.container.Width = this.parent.Width - 25;
            this.container.Height = 132;
            parent.Controls.Add(container);

            Label nameLabel = new Label();
            nameLabel.Text = "Name:";
            nameLabel.Location = new System.Drawing.Point(5, 14);
            nameLabel.AutoSize = true;
            container.Controls.Add(nameLabel);

            name = new Label();
            name.Text = this.locationSource.Name;
            name.Location = new System.Drawing.Point(45, 14);
            name.AutoSize = true;
            container.Controls.Add(name);

            Label latLabel = new Label();
            latLabel.Text = "Lat:";
            latLabel.Location = new System.Drawing.Point(5, 40);
            latLabel.AutoSize = true;
            container.Controls.Add(latLabel);

            lat = new Label();
            lat.Text = "unknown";
            lat.Location = new System.Drawing.Point(45, 40);
            lat.Width = 85;
            lat.Height = 13;
            container.Controls.Add(lat);

            Label lngLabel = new Label();
            lngLabel.Text = "Lng:";
            lngLabel.Location = new System.Drawing.Point(5, 60);
            lngLabel.AutoSize = true;
            container.Controls.Add(lngLabel);

            lng = new Label();
            lng.Text = "unknown";
            lng.Location = new System.Drawing.Point(45, 60);
            lng.Width = 85;
            lng.Height = 13;
            container.Controls.Add(lng);

            play = new CheckBox();
            play.Appearance = Appearance.Button;
            play.Text = "Play";
            play.Location = new System.Drawing.Point(5, 80);
            play.Width = 40;
            play.Click += delegate
            {
                this.stop.Enabled = true;
                this.stop.Checked = false;
                this.play.Checked = true;
                this.play.Enabled = false;
                this.locationSourcePlayer.Play();
            };
            container.Controls.Add(play);

            pause = new CheckBox();
            pause.Appearance = Appearance.Button;
            pause.Text = "Pause";
            pause.Location = new System.Drawing.Point(46, 80);
            pause.Width = 45;
            pause.Click += delegate
            {
                if (this.pause.Checked)
                    this.locationSourcePlayer.Pause = true;
                else
                    this.locationSourcePlayer.Pause = false;
            };
            container.Controls.Add(pause);

            stop = new CheckBox();
            stop.Appearance = Appearance.Button;
            stop.Checked = true;
            stop.Enabled = false;
            stop.Text = "Stop";
            stop.Location = new System.Drawing.Point(92, 80);
            stop.Width = 40;
            stop.Click += delegate
            {
                this.pressStop();
            };
            container.Controls.Add(stop);

            Button removeUser = new Button();
            removeUser.Text = "Remove Track";
            removeUser.Location = new System.Drawing.Point(5, 103);
            removeUser.Width = 127;
            removeUser.Click += delegate { new DeleteLocationSourceCommand(this.locationSource).execute(); };
            container.Controls.Add(removeUser);

            this.locationSource.Attach(this);
            this.locationSourcePlayer.RegisterUserTrackForm(this);
        }
 public LocationSourceRecorder createUserRecorder(LocationSource user)
 {
     LocationSourceRecorder userRecorder = new LocationSourceRecorder(user, this.pause);
     this.userRecorders.Add(userRecorder);
     return userRecorder;
 }
 public LocationSource createLocationSource(string name, Discriminator discriminator)
 {
     LocationSource user = new LocationSource(name, discriminator);
     this.LocationSources.Add(user);
     return user;
 }