001 package com.google.gwt.maps.client.events.panoramiomouse;
002
003 import com.google.gwt.ajaxloader.client.Properties;
004 import com.google.gwt.ajaxloader.client.Properties.TypeException;
005 import com.google.gwt.maps.client.base.LatLng;
006 import com.google.gwt.maps.client.base.Size;
007 import com.google.gwt.maps.client.events.MapEvent;
008 import com.google.gwt.maps.client.panoramiolib.PanoramioFeature;
009
010 public class PanoramioMouseMapEvent extends MapEvent<PanoramioMouseMapHandler, PanoramioMouseMapEvent> {
011
012 public static Type<PanoramioMouseMapHandler> TYPE = new Type<PanoramioMouseMapHandler>();
013
014 public PanoramioMouseMapEvent(Properties properties) {
015 super(properties);
016 }
017
018 @Override
019 public com.google.gwt.event.shared.GwtEvent.Type<PanoramioMouseMapHandler> getAssociatedType() {
020 return TYPE;
021 }
022
023 @Override
024 protected void dispatch(PanoramioMouseMapHandler handler) {
025 handler.onEvent(this);
026 }
027
028 /**
029 * A PanoramioFeature object containing information about the clicked feature.
030 * @return {@link PanoramioFeature}
031 */
032 public PanoramioFeature getFeatureDetails() {
033 PanoramioFeature feature = null;
034 try {
035 feature = (PanoramioFeature) properties.getObject("featureDetails");
036 } catch (TypeException e) {
037 e.printStackTrace();
038 }
039 return feature ;
040 }
041
042 /**
043 * Pre-rendered HTML content, as placed in the infowindow by the default UI.
044 */
045 public String getInfoWindowHtml() {
046 String infoWindowHtml = null;
047 try {
048 infoWindowHtml = properties.getString("infoWindowHtml");
049 } catch (TypeException e) {
050 e.printStackTrace();
051 }
052 return infoWindowHtml;
053 }
054
055 /**
056 * The position at which to anchor an infowindow on the clicked feature.
057 * @return {@link LatLng}
058 */
059 public LatLng getLatLng() {
060 LatLng latLng = null;
061 try {
062 latLng = (LatLng) properties.getObject("latLng");
063 } catch (TypeException e) {
064 e.printStackTrace();
065 }
066 return latLng;
067 }
068
069 /**
070 * gets The offset to apply to an infowindow anchored on the clicked feature.
071 */
072 public Size getPixelOffset() {
073 Size pixelOffset = null;
074 try {
075 pixelOffset = (Size) properties.getObject("pixelOffset");
076 } catch (TypeException e) {
077 e.printStackTrace();
078 }
079 return pixelOffset;
080 }
081
082 }