Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the SampleLayer class
        /// </summary>
        /// <param name="pluginToken">plugin token</param>
        /// <param name="layerTitle">Title to display on layer</param>
        /// <param name="plugin">Title for layer shown in panel on left hand side</param>
        public CreateLayer(PluginToken pluginToken, string layerTitle, TweetHeatPlugin plugin)
            : base(pluginToken)
        {
            // Give the layer a title, is shown above the panel area on the left hand side
            this.Title = layerTitle;
            this.parent = plugin;

            // Handle icon generation requests for the layer (above the panel) and 'map manager'
            this.IconGenerator = new Func<LayerIconContext, UIElement>(this.RenderIcon);

            // Add a new sample panel control
            this.Panel = new SamplePanel();
        }
        /// <summary>
        /// Initializes a new instance of the MapEntitiesLayer class
        /// </summary>
        /// <param name="pluginToken">plugin requirement</param>
        /// <param name="layerTitle">Title shown on layer</param>
        /// <param name="parentPushpinFactoryContract">PushpinFactoryContract from plugin</param>
        public MapEntitiesLayer(PluginToken pluginToken, string layerTitle, TweetHeatPlugin plugin)
            : base(pluginToken)
        {
            // Give the layer a title, is shown above the panel area
            this.Title = layerTitle;
            this.parent = plugin;

            // Handle icon generation requests for the layer(above the panel) and Legend(now 'Map Manager')
            this.IconGenerator = new Func<LayerIconContext, UIElement>(this.RenderIcon);

            // Add the panel
            this.MainPanel = new SamplePanel();
            this.Panel = this.MainPanel;
        }
        /// <summary>
        /// Initialize plugin 
        /// provides initialization information for the plug-in after the import and export contracts have been hooked up
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            // Create a new Layer to hold map entities (i.e. heatmap)
            // this.mainLayer = new CreateLayer(this.Token, "Tweet Heat", this);
            this.mainLayer = new MapEntitiesLayer(this.Token, "Tweet Heat", this);
            ActivateLayer(this.mainLayer);
            heatMap = new HeatMap(DefaultMap);

            // Assign a serialization contract to handle serialization and deserialization
            // request from the Bing Maps site, saving and restoring custom plugin state
            this.LayerSerializationContract = new ConcreteLayerSerializationContract(this.mainLayer);

            // Importing Training Data and training Sentiment Analyzer
            SentimentAnalyzer sentiment = new SentimentAnalyzer();
            sentiment.Train();

            // Setting the static object to the created TweetHeatPlugin object
            pluginObject = this;
        }