private void PerformPostFade(ImageOverlay imageOverlay, System.Action completion)
        {
            Color targetColor            = color;
            Color targetColorTransparent = targetColor;

            targetColorTransparent.a = 0f;

            // Fade out the image overlay.
            Routine fadeOutOverlay = new Routine(postFadeSettings.duration, 0f, UpdateMode);

            fadeOutOverlay.Run((progress01) =>
            {
                float easedProgress01 = postFadeSettings.curve.Evaluate(progress01);
                imageOverlay.Color    = Color.LerpUnclamped(targetColor,
                                                            targetColorTransparent,
                                                            easedProgress01);
            }, () =>
            {
                // Post-fade is complete. Destroy the image overlay.
                Destroy(imageOverlay.gameObject);

                // Call the completion action.
                completion();
            });
        }
Esempio n. 2
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                ImageOverlay imageOverlay = value as ImageOverlay;
                if (imageOverlay != null)
                {
                    if (imageOverlay.Image == null)
                    {
                        return("(none)");
                    }
                    else
                    {
                        return("(set)");
                    }
                }
                TextOverlay textOverlay = value as TextOverlay;
                if (textOverlay != null)
                {
                    if (String.IsNullOrEmpty(textOverlay.Text))
                    {
                        return("(none)");
                    }
                    else
                    {
                        return("(set)");
                    }
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Esempio n. 3
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         ImageOverlay overlay = value as ImageOverlay;
         if (overlay != null)
         {
             if (overlay.Image == null)
             {
                 return("(none)");
             }
             return("(set)");
         }
         TextOverlay overlay2 = value as TextOverlay;
         if (overlay2 != null)
         {
             if (string.IsNullOrEmpty(overlay2.Text))
             {
                 return("(none)");
             }
             return("(set)");
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
        public override void AnimateTransitionForInitialCanvasController(
            CanvasControllerTransitionContext transitionContext)
        {
            /*
             *  We implement different behaviour for transitions involving the
             *  initial canvas controller.
             */

            // Create an image overlay.
            ImageOverlay imageOverlay = new ImageOverlay();

            if (transitionContext.isUpstream)
            {
                /*
                 *  When dismissing an initial canvas controller we modify the
                 *  post-fade to fade to nothing.
                 */

                // Set the image overlay to transparent color.
                Color targetColorTransparent = color;
                targetColorTransparent.a = 0f;
                imageOverlay.Color       = targetColorTransparent;

                // Add the overlay to the source content.
                var source = transitionContext.sourceCanvasController;
                imageOverlay.SetParent(source.content);

                // Perform pre fade.
                PerformPreFade(imageOverlay, () =>
                {
                    // Pre-fade is complete. Set the source content to inactive and
                    // move the overlay to its parent (the canvas).
                    imageOverlay.SetParent(source.CanvasRectTransform());
                    source.ContentActive = false;

                    // Perform post-fade and complete transition on completion.
                    PerformPostFade(imageOverlay, transitionContext.CompleteTransition);
                });
            }
            else
            {
                /*
                 *  When presenting an initial canvas controller we skip the 'pre-fade'
                 *  and begin immediately at the transition color.
                 */

                // Set image overlay to the transition color immediately.
                imageOverlay.Color = color;

                // Add the overlay to the destination content.
                var destination = transitionContext.destinationCanvasController;
                imageOverlay.SetParent(destination.content);

                // Perform post-fade and complete transition on completion.
                PerformPostFade(imageOverlay, transitionContext.CompleteTransition);
            }
        }
Esempio n. 5
0
 private void ribbonButton39_Click(object sender, EventArgs e)
 {
     if (imageOverlayCN == null)
     {
         imageOverlayCN = new ImageOverlay();
         imageOverlayCN.setImageSrc("../data/flagCN.png");
         imageOverlayCN.setBounds(100, 35.0, 110.0, 40.0);
         m_earthRoot.addChild(imageOverlayCN);
     }
 }
        private async void Initialize()
        {
            // This sample is only supported in x64 on UWP.
            if (!Environment.Is64BitProcess)
            {
                await new MessageDialog2("This sample is only supported for UWP in x64. Run the sample viewer in x64 to use this sample.", "Error").ShowAsync();
                return;
            }

            // Create the scene.
            MySceneView.Scene = new Scene(new Basemap(new Uri("https://www.arcgis.com/home/item.html?id=1970c1995b8f44749f4b9b6e81b5ba45")));

            // Create an envelope for the imagery.
            var pointForFrame   = new MapPoint(-120.0724273439448, 35.131016955536694, SpatialReferences.Wgs84);
            var pacificEnvelope = new Envelope(pointForFrame, 15.09589635986124, -14.3770441522488);

            // Create a camera, looking at the pacific southwest sector.
            var observationPoint = new MapPoint(-116.621, 24.7773, 856977, SpatialReferences.Wgs84);
            var camera           = new Camera(observationPoint, 353.994, 48.5495, 0);

            // Set the viewpoint of the scene to this camera.
            var pacificViewpoint = new Viewpoint(observationPoint, camera);

            MySceneView.Scene.InitialViewpoint = pacificViewpoint;

            // Create an image overlay and add it ot the scene..
            _imageOverlay = new ImageOverlay();
            MySceneView.ImageOverlays.Add(_imageOverlay);

            // Create an array of the image filepaths.
            var imageFolder = Path.Combine(DataManager.GetDataFolder("9465e8c02b294c69bdb42de056a23ab1"), "PacificSouthWest");

            string[] imagePaths = Directory.GetFiles(imageFolder);

            // The paths need to be sorted alphabetically on some file systems.
            Array.Sort(imagePaths);

            // Create all of the image frames using the filepaths and the envelope.
            _images = imagePaths.Select(path => new ImageFrame(new Uri(path), pacificEnvelope)).ToArray();

            // Create new Timer and set the timeout interval to approximately 15 image frames per second.
            _timer = new Timer(AnimateOverlay);
            _timer.Change(0, 1000 / 15);

            // Populate the combobox for selecting speed.
            SpeedComboBox.ItemsSource   = new string[] { "Slow", "Medium", "Fast" };
            SpeedComboBox.SelectedIndex = 0;

            // Set an event to stop the animation when the sample is unloaded.
            Unloaded += (s, e) =>
            {
                _animationStopped = true;
                _timer.Dispose();
            };
        }
        private void BtImageLogoAdd_Click(object sender, EventArgs e)
        {
            var dlg = new ImageLogoSettingsDialog();

            var name   = dlg.GenerateNewEffectName(this._player);
            var effect = new ImageOverlay(name);

            this._player.Video_Overlays_Add(effect);
            lbImageLogos.Items.Add(effect.Name);

            dlg.Fill(effect);
            dlg.ShowDialog(this);
            dlg.Dispose();
        }
        private void PerformPreFade(ImageOverlay imageOverlay, System.Action completion)
        {
            Color targetColor            = color;
            Color targetColorTransparent = targetColor;

            targetColorTransparent.a = 0f;

            // Fade in the image overlay.
            Routine fadeInOverlay = new Routine(preFadeSettings.duration, 0f, UpdateMode);

            fadeInOverlay.Run((progress01) =>
            {
                float easedProgress01 = preFadeSettings.curve.Evaluate(progress01);
                imageOverlay.Color    = Color.LerpUnclamped(targetColorTransparent,
                                                            targetColor,
                                                            easedProgress01);
            }, completion);
        }
Esempio n. 9
0
        private void Initialize()
        {
            // Create the scene.
            _mySceneView.Scene = new Scene(new Basemap(new Uri("https://www.arcgis.com/home/item.html?id=1970c1995b8f44749f4b9b6e81b5ba45")));

            // Create an envelope for the imagery.
            var pointForFrame   = new MapPoint(-120.0724273439448, 35.131016955536694, SpatialReferences.Wgs84);
            var pacificEnvelope = new Envelope(pointForFrame, 15.09589635986124, -14.3770441522488);

            // Create a camera, looking at the pacific southwest sector.
            var observationPoint = new MapPoint(-116.621, 24.7773, 856977, SpatialReferences.Wgs84);
            var camera           = new Camera(observationPoint, 353.994, 48.5495, 0);

            // Set the viewpoint of the scene to this camera.
            var pacificViewpoint = new Viewpoint(observationPoint, camera);

            _mySceneView.Scene.InitialViewpoint = pacificViewpoint;

            // Create an image overlay and add it ot the scene..
            _imageOverlay = new ImageOverlay();
            _mySceneView.ImageOverlays.Add(_imageOverlay);

            // Create an array of the image filepaths.
            var imageFolder = Path.Combine(DataManager.GetDataFolder("9465e8c02b294c69bdb42de056a23ab1"), "PacificSouthWest");

            string[] imagePaths = Directory.GetFiles(imageFolder);

            // The paths need to be sorted alphabetically on some file systems.
            Array.Sort(imagePaths);

            // Create all of the image frames using the filepaths and the envelope.
            _images = imagePaths.Select(path => new ImageFrame(new Uri(path), pacificEnvelope)).Take(120).ToArray();

            // Create new Timer and set the timeout interval to approximately 15 image frames per second.
            _timer = new Timer(AnimateOverlay);
            _timer.Change(0, 1000 / 15);

            // Populate the spinner for selecting speed.
            _speedSpinner.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, new string[] { "Slow", "Medium", "Fast" });
            _speedSpinner.SetSelection(0);
        }
        public override void AnimateTransition(CanvasControllerTransitionContext transitionContext)
        {
            // Set the destination content inactive.
            var destination = transitionContext.destinationCanvasController;

            destination.ContentActive = false;

            // Create an image overlay.
            ImageOverlay imageOverlay = new ImageOverlay();

            // Set the image overlay to transparent color.
            Color targetColorTransparent = color;

            targetColorTransparent.a = 0f;
            imageOverlay.Color       = targetColorTransparent;

            // Add the overlay to the source content.
            var source = transitionContext.sourceCanvasController;

            imageOverlay.SetParent(source.content);

            // Perform pre-fade.
            PerformPreFade(imageOverlay, () =>
            {
                // Pre-fade is complete. Move the image overlay to the destination canvas.
                var destinationContent = destination.content;
                imageOverlay.SetParent(destinationContent);

                // Make the source inactive and the destination active.
                source.ContentActive      = false;
                destination.ContentActive = true;

                // Perform post-fade and complete transition on completion.
                PerformPostFade(imageOverlay, transitionContext.CompleteTransition);
            });
        }
Esempio n. 11
0
        /// <summary>
        /// Gets the cache file path based on a set of parameters
        /// </summary>
        private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, ImageOutputFormat format, ImageOverlay? overlay, int percentPlayed, string backgroundColor)
        {
            var filename = originalPath;

            filename += "width=" + outputSize.Width;

            filename += "height=" + outputSize.Height;

            filename += "quality=" + quality;

            filename += "datemodified=" + dateModified.Ticks;

            if (format != ImageOutputFormat.Original)
            {
                filename += "f=" + format;
            }

            if (overlay.HasValue)
            {
                filename += "o=" + overlay.Value;
                filename += "p=" + percentPlayed;
            }

            if (!string.IsNullOrEmpty(backgroundColor))
            {
                filename += "b=" + backgroundColor;
            }

            return GetCachePath(_resizedImageCachePath, filename, Path.GetExtension(originalPath));
        }
Esempio n. 12
0
        /// <summary>
        /// Draws the indicator.
        /// </summary>
        /// <param name="graphics">The graphics.</param>
        /// <param name="imageWidth">Width of the image.</param>
        /// <param name="imageHeight">Height of the image.</param>
        /// <param name="indicator">The indicator.</param>
        /// <param name="percentPlayed">The percent played.</param>
        private void DrawIndicator(Graphics graphics, int imageWidth, int imageHeight, ImageOverlay? indicator, int percentPlayed)
        {
            if (!indicator.HasValue)
            {
                return;
            }

            try
            {
                if (indicator.Value == ImageOverlay.Played)
                {
                    var currentImageSize = new Size(imageWidth, imageHeight);

                    new WatchedIndicatorDrawer().Process(graphics, currentImageSize);
                }
                if (indicator.Value == ImageOverlay.PercentPlayed)
                {
                    var currentImageSize = new Size(imageWidth, imageHeight);

                    new PercentPlayedDrawer().Process(graphics, currentImageSize, percentPlayed);
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error drawing indicator overlay", ex);
            }
        }
Esempio n. 13
0
 private void ribbonButton40_Click(object sender, EventArgs e)
 {
     m_earthRoot.removeChild(imageOverlayCN);
     imageOverlayCN = null;
 }
Esempio n. 14
0
 private void ribbonButton40_Click(object sender, EventArgs e)
 {
     m_earthRoot.removeChild(imageOverlayCN);
     imageOverlayCN = null;
 }
Esempio n. 15
0
 private void ribbonButton39_Click(object sender, EventArgs e)
 {
     if (imageOverlayCN == null)
     {
         imageOverlayCN = new ImageOverlay();
         imageOverlayCN.setImageSrc("../data/flagCN.png");
         imageOverlayCN.setBounds( 100, 35.0, 110.0, 40.0);
         m_earthRoot.addChild(imageOverlayCN);
     }
 }
        static void Main()
        {
            MapFigApplication api = new MapFigApplication("https://studio.mapfig.com", "Za40iR62wtzc8HWs4TgJhNSI8_wRcqMa");


            String mapName = "My Map";
            int mapHeight = 450;
            int mapWidth = 950;
            int mapZoom = 4;
            Point mapCenter = new Point(48.856614, 2.3522219); // Latitude, Longitude
            /*
                * -- Alternative Way --
                * Point p = new Point();
                *	try {
                *		 *
                *		 * get the Latitude/Longitude in array by providing the Address.
                *		 * Throws Exception if the Address is incorrect
                *		 *
                *		mapCenter = p.setLatLng("United States of America"); // Sets the Point(Lat,Lng)
                *	} catch (Exception e) {
                *		// Handle the Exception Here
                *		echo e.Message;
                *	}
                */
            Map map = new Map(mapName, mapHeight, mapWidth, mapZoom, mapCenter);

            /* These are not required unless you want to change something. 
                * the Default value is set weather or not you write them here.
                */
            map.setLayerId(1);  // Default 1 or change it to the account owner's layer ID
            map.setGroupId(0);  // Default 0 or change it to the account owner's layer group ID
            map.setPassword("");  // Default NONE or change it to the Desire Password to protact the Map
            map.setUseCluster(false);  // Default false
            map.setOverlayEnable(false);  // Default false
            map.setOverlayTitle("");  // Default NONE
            map.setOverlayContent("");  // Default NONE
            map.setOverlayBlurb("");  // Default NONE
            map.setLegendEnable(false);  // Default false
            map.setLegendContent("HTML content here");  // Default NONE
            map.setProjectId(0);	// Default 0 or change it to the account owner's project ID
            map.setShowSidebar(true);  // Default true
            map.setShowExport(false);  // Default false
            map.setShowMeasure(false);  // Default false
            map.setShowMinimap(false);  // Default false
            map.setShowSearch(false);  // Default false
            map.setShowFilelayer(false);  // Default false // shows local file upload button
            map.setShowSvg(false);  // Default false
            map.setShowStaticSidebar(false);  // Default false
            map.setStaticSidebarContent("");  // Default NONE
            /* End Map options */


            /* Add Image Overlay */
            String name = "Overlay Title goes here"; // will not be displayed

            Point upperRightCornor = new Point(0.0, 0.0); // Upper Right Cornor Of Overlay Image
            try
            {
                upperRightCornor.setLatLng("Canada");
            }
            catch (Exception e2)
            {
                // TODO Auto-generated catch block
            }

            Point bottomLeftCornor = new Point(0.0, 0.0); // Bottom Left Cornor Of image
            try
            {
                bottomLeftCornor.setLatLng("United State Of America");
            }
            catch (Exception e2)
            {
                // TODO Auto-generated catch block
            }

            String imageUrl = "http://www.YOUR_IMAGE_URL.com/PATH.JPG";
            String popupContent = "<h3>Image Overlay Content here<h3>";

            ImageOverlay imageOverlay1 = new ImageOverlay(name, upperRightCornor, bottomLeftCornor, imageUrl, popupContent); // Create the overlay

            map.addImageOverlay(imageOverlay1); // Add as many overlays as you want

            //map.dropAllImageOverlays(); // If you want to delete all image overlays
            /* End Map options */





            /* Create First Marker */
            Marker marker1 = new Marker(48.856614, 2.3522219000000177); // One Way - provide Latitude/Longitude directly
            /* Properties */
            try
            {
                marker1.setLocation("Paris, France");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            marker1.setDescription("<p>This is where you can write the <strong>HTML</strong> code too</p>");
            /* Advance Properties */
            marker1.setShowGetDirection(false);
            marker1.setShowInfoBox(false);
            marker1.setShowLocationOnPopup(true);
            marker1.setHideLabel(true);
            /* Styling */
            marker1.setMarkerStyle(""); // Default NONE, available options are (user,cog,leaf,home,.....) 
            // Complete list can be found here http://fortawesome.github.io/Font-Awesome/icons/
            marker1.setMarkerColor(""); // Default NONE, available options are 
            // (Red,Blue,Green,Purple,Orange,Darkred,Lightred,Beige,Darkblue,Darkpurple,White,
            //  Pink,Lightblue,Lightgreen,Gray,Black,cadetblue,Brown,Lightgray)




            /* Create Second Marker */
            Marker marker2 = new Marker();

            try
            {
                /*
                    * set the Latitude/Longitude by providing the Address.
                    * Throws Exception if the Latitude/Longitude is incorrect
                    */
                marker2.setLatLng("Germany");
            }
            catch (Exception e)
            {
                // Handle the Exception Here
                Console.WriteLine(e.Message);
            }

            /* Properties */
            //marker2.location = "Germany"; // Here Default location is Set as 
            // "Paris, France". but you can still change it to your desired. 
            // Just uncomment the link and Set the Value
            marker2.setDescription("<p>This is where you can write the <strong>HTML</strong> code too</p>");
            /* Advance Properties */
            marker2.setShowGetDirection(false);
            marker2.setShowInfoBox(false);
            marker2.setShowLocationOnPopup(true);
            marker2.setHideLabel(true);
            /* Styling */
            marker2.setMarkerStyle("home"); // Default NONE, available options are (user,cog,leaf,home,.....) 
            // Complete list can be found here http://fortawesome.github.io/Font-Awesome/icons/
            marker2.setMarkerColor("red"); // Default NONE, available options are 
            // (Red,Blue,Green,Purple,Orange,Darkred,Lightred,Beige,Darkblue,Darkpurple,White,
            //  Pink,Lightblue,Lightgreen,Gray,Black,cadetblue,Brown,Lightgray)






            /* Add Markers to the Map */
            map.addShape(marker1);
            map.addShape(marker2);






            // Save the map and get the MapID if successfully saved
            String response = "";

            try
            {
                response = api.save(map);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            // TODO with Response.
            Console.WriteLine(response);

        }