Arcgis silverlight-6 element layer-meida

1、功能介绍
    This sample demonstrates how to transform and display a media element (video) on a map.  The video placed initially using the ElementLayer.Envelope attached property.  A simple rotation transformation is then used to orient the video to an acceptable location over the base map.  More accurate placement will require a more complex transformation.     

    展示一个media element (video) on a map

 

2、代码详解

MainPage.axml中

代码
< UserControl x:Class = " SilverlightApplication1.MainPage "
    xmlns
= " http://schemas.microsoft.com/winfx/2006/xaml/presentation "
    xmlns:x
= " http://schemas.microsoft.com/winfx/2006/xaml "
    xmlns:d
= " http://schemas.microsoft.com/expression/blend/2008 "
    xmlns:mc
= " http://schemas.openxmlformats.org/markup-compatibility/2006 "
    mc:Ignorable
= " d "
    d:DesignHeight
= " 300 "  d:DesignWidth = " 400 "  xmlns:esri = " http://schemas.esri.com/arcgis/client/2009 " >

    
< Grid x:Name = " LayoutRoot "  Background = " White " >

        
< esri:Map x:Name = " MyMap "  Extent = " -121,32,-113,36 " >
            
< esri:ArcGISTiledMapServiceLayer ID = " StreetMapLayer "  
                    Url
= " http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer " />

            
< esri:ElementLayer ID = " MyMediaLayer "   > //ID=MyMediaLayer
                
< esri:ElementLayer.Children >
                    
<!--  MediaElement source can define relative path from the perspective of the xap file.  -->
                    
< MediaElement xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation "  
                                Source
= " http://serverapps.esri.com/media/scec-shakeout-simulation-rt.wmv //Media地址
                                IsMuted
= " True "  Stretch = " Fill "  MediaEnded = " Media_MediaEnded //无声,stretch模式,media终止时触发的函数
                                esri:ElementLayer.Envelope
= " -120.309183241879,32.3360853442552,-114.543827787924,35.579097787105 " >// meida的位置
                        
< MediaElement.RenderTransform > //meida倾斜一个角度播放
                            
< RotateTransform Angle = " -1.1412502857301 "   />
                        
</ MediaElement.RenderTransform >
                    
</ MediaElement >
                
</ esri:ElementLayer.Children >
            
</ esri:ElementLayer >
        
</ esri:Map >

    
</ Grid >
</ UserControl >

 

 

MainPage.axml.cs中 

 

代码
using  System;
using  System.Collections.Generic;
using  System.Linq;
using  System.Net;
using  System.Windows;
using  System.Windows.Controls;
using  System.Windows.Documents;
using  System.Windows.Input;
using  System.Windows.Media;
using  System.Windows.Media.Animation;
using  System.Windows.Shapes;

namespace  SilverlightApplication1
{
    
public   partial   class  MainPage : UserControl
    {
        
public  MainPage()
        {
            InitializeComponent();
        }

        
private   void  Media_MediaEnded( object  sender, RoutedEventArgs args)
        {
            
//  Repeat play of the video
            MediaElement media  =  sender  as  MediaElement;
            media.Position 
=  TimeSpan.FromSeconds( 0 ) ;/ /从第一秒开始重放
            media.Play();
        }
    }
}

 

 

3、界面见http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MediaLayer

你可能感兴趣的:(silverlight)