|
|
Google Bar
An extremely simple way to offer geocoding is using the "GoogleBar" that the GoogleMaps API offers.
Once activated, click on the magnifying glass next to the Google icon that appears on the map and enter an address.
You only need the add the GGoogleBarOptions to the map and use it's properties:
- newStyle: This property indicates the style in use by the GGoogleBar. True by default
- showOnLoad: (Obsolete) Only works for newStyle = false. When set to true, this property displays the search box within the GoogleBar (provided the control is enabled and the map is loaded). By default, the search box within the control is hidden and is only expanded upon clicking the control's magnifying glass.
- linkTarget: This property lets you specify the target for links embedded within the search results of the GoogleBar. The default value, G_GOOGLEBAR_LINK_TARGET_BLANK, specifies that links will open within a new window.
- resultList: This property lets you specify the style of the search result list for the GoogleBar, which may be one of the following: G_GOOGLE_BAR_RESULT_LIST_INLINE (default) places the result list in a table above the search box, G_GOOGLE_BAR_RESULT_LIST_SUPPRESS replaces the list with a set of next/previous buttons, and passing a block- level DOM Element places the list within a container of your choice (typically a <div> element).
- listingTypes: This property specifies the type(s) of search result listings returned and displayed by the GoogleBar. It has 3 options: blended (return all types of results KML, businesses, geocodes, etc), kmlonly (return only results from indexed KML/KMZ/GeoRSS files) y localonly (return only business and geocode results).
- suppressInitialResultSelection: This property suppresses displaying the first result within its own info window upon completion of a search in the GoogleBar (which is the default behavior).
- suppressZoomToBounds: This property suppresses automatic panning and zooming to the set of results upon completion of a search in the GoogleBar. (This property suppresses the default behavior.)
- onIdleCallback: This property specifies a callback function to be invoked when the GoogleBar finishes searching and the search results are dismissed.
- onSearchCompleteCallback: This property specifies a callback function to be invoked when the GoogleBar finishes searching and the search completes. It is passed the GlocalSearch object associated with the search control. This callback function is called before results are placed on the map or into the results list.
- onGenerateMarkerHtmlCallback: This property lets you specify a callback function to be invoked when the info window for a search result marker is opened. The function should be passed a GMarker, generated HTML string, and GlocalSearchResult (in that order) and must return the modified HTML string to be displayed in the info window.
- onMarkersSetCallback: This property lets you specify a callback function to be invoked when the GGoogleBar completes creation of its markers and places them on the map. This function must be passed an array of objects of the form {result: GlocalSearch, marker: GMarker}.
- googleBarAdsOptions: This property indicates the parameters to use for the display of advertising when using the GGoogleBar. Advertising is enabled in the GoogleBar by default. Those parameters are:
- client: Google Adsense clientID.
- channel: (optional) This property specifies the channel number of your Google AdSense for Search account.
- adsafe: (optional) This property specifies the ad "safety" level to use for advertising results on your GGoogleBar.
- language: (optional) This property specifies the language in which to serve advertising results.
- helpSubgurim: of type HelpSubgurimEnum, allows us to define the percentage, from 0% to 100%, of printed advertising corresponds to Subgurim, with the only aim of supporting this project. It's completely optional.
Code.aspx
<cc1:GMap ID="GMap1" runat="server" />
Code.aspx.cs
GGoogleBarOptions googleBarOptions = new GGoogleBarOptions();
googleBarOptions.resultList = GGoogleBarResultListEnum.supress;
googleBarOptions.linkTarget = GGoogleBarLinkTargetEnum._blank;
googleBarOptions.onSearchCompleteCallback = "alert('onSearchCompleteCallback');";
googleBarOptions.onMarkersSetCallback = "alert('onMarkersSetCallback');";
googleBarOptions.googleBarAdsOptions = new GGoogleBarAdsOptions("pub-2713758978561919");
googleBarOptions.googleBarAdsOptions.helpSubgurim=GAdsManager.HelpSubgurimEnum._75percentHelp;
googleBarOptions.googleBarAdsOptions.adsafe = GGoogleBarAdsOptions.AdSafeEnum.off;
GMap1.Add(googleBarOptions);
|