/// <summary>
        /// Handle mouse click
        /// </summary>
        public override bool PerformSelectionAction(DrawArgs drawArgs)
        {
            ImageOverlay previousSelected = SelectedOverlay;

            if (SelectedOverlay != null)
            {
                // Let the selected layer handle the click first.
                if (SelectedOverlay.PerformSelectionAction(drawArgs))
                {
                    return(true);
                }
            }

            foreach (RenderableObject ro in ChildObjects)
            {
                if (!ro.IsOn || !ro.isSelectable)
                {
                    continue;
                }

                if (ro == previousSelected)
                {
                    continue;
                }

                if (ro.PerformSelectionAction(drawArgs))
                {
                    return(true);
                }
            }
            return(false);
        }
        public ImageOverlayDialog(ImageOverlay overlay)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            SelectedOverlay = overlay;
        }
        /// <summary>
        /// Display the properties dialog
        /// </summary>
        public void ShowProperties(ImageOverlay ro)
        {
            if (properties != null)
            {
                properties.Dispose();
            }

            properties      = new ImageOverlayDialog(ro);
            properties.Icon = ParentApplication.Icon;
            properties.Show();
        }
        /// <summary>
        /// Creates a new image layer and adds to our overlay list
        /// </summary>
        public void AddImage(object sender, EventArgs e)
        {
            //MessageBox.Show("add image");
            ImageOverlay io = new ImageOverlay();

            io.Name        = "New Image";
            io.Url         = defaultImage;
            io.FitToScreen = true;
            Add(io);
            SelectedOverlay = io;
            Menu_Properties(this, EventArgs.Empty);
        }
        /// <summary>
        /// Deserialize overlay
        /// </summary>
        public static ImageOverlay FromString(string line)
        {
            string[] fields = line.Split('\t');
            if (fields.Length != 7)
            {
                return(null);
            }

            ImageOverlay io = new ImageOverlay();

            io.name    = fields[0];
            io.Url     = fields[1];
            io.MinLat  = float.Parse(fields[2], CultureInfo.InvariantCulture);
            io.MaxLat  = float.Parse(fields[3], CultureInfo.InvariantCulture);
            io.MinLon  = float.Parse(fields[4], CultureInfo.InvariantCulture);
            io.MaxLon  = float.Parse(fields[5], CultureInfo.InvariantCulture);
            io.Opacity = byte.Parse(fields[6], CultureInfo.InvariantCulture);
            return(io);
        }
 void Load()
 {
     if (!File.Exists(SaveFilePath))
     {
         return;
     }
     using (StreamReader sr = File.OpenText(SaveFilePath))
     {
         while (true)
         {
             string line = sr.ReadLine();
             if (line == null)
             {
                 break;
             }
             ImageOverlay io = ImageOverlay.FromString(line);
             //MessageBox.Show(line);
             if (io != null)
             {
                 Add(io);
             }
         }
     }
 }
示例#7
0
		public ImageOverlayDialog( ImageOverlay overlay )
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			SelectedOverlay = overlay;
		}
示例#8
0
		/// <summary>
		/// Deserialize overlay
		/// </summary>
		public static ImageOverlay FromString(string line)
		{
			string[] fields = line.Split('\t');
			if(fields.Length!=7)
				return null;

			ImageOverlay io = new ImageOverlay();
			io.name = fields[0];
			io.Url = fields[1];
			io.MinLat = float.Parse( fields[2], CultureInfo.InvariantCulture);
			io.MaxLat = float.Parse( fields[3], CultureInfo.InvariantCulture);
			io.MinLon = float.Parse( fields[4], CultureInfo.InvariantCulture);
			io.MaxLon = float.Parse( fields[5], CultureInfo.InvariantCulture);
			io.Opacity = byte.Parse( fields[6], CultureInfo.InvariantCulture);
			return io;
		}
示例#9
0
		/// <summary>
		/// Display the properties dialog
		/// </summary>
		public void ShowProperties( ImageOverlay ro)
		{
			if(properties!=null)
				properties.Dispose();

			properties = new ImageOverlayDialog(ro);
			properties.Icon = ParentApplication.Icon;
			properties.Show();
		}
示例#10
0
		/// <summary>
		/// Creates a new image layer and adds to our overlay list
		/// </summary>
		public void AddImage( object sender, EventArgs e )
		{
			//MessageBox.Show("add image");
			ImageOverlay io = new ImageOverlay();
			
			io.Name = "New Image";
			io.Url = defaultImage;
			io.FitToScreen = true;
			Add(io);
			SelectedOverlay = io;
			Menu_Properties(this, EventArgs.Empty);
		}