001 package com.google.gwt.maps.client.events.kmlmouse;
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.layers.KmlFeatureData;
009
010 public class KmlMouseMapEvent extends MapEvent<KmlMouseMapHandler, KmlMouseMapEvent> {
011
012 public static Type<KmlMouseMapHandler> TYPE = new Type<KmlMouseMapHandler>();
013
014 public KmlMouseMapEvent(Properties properties) {
015 super(properties);
016 }
017
018 @Override
019 public com.google.gwt.event.shared.GwtEvent.Type<KmlMouseMapHandler> getAssociatedType() {
020 return TYPE;
021 }
022
023 @Override
024 protected void dispatch(KmlMouseMapHandler handler) {
025 handler.onEvent(this);
026 }
027
028 /**
029 * get A KmlFeatureData object, containing information about the clicked feature.
030 */
031 public KmlFeatureData getFeatureData() {
032 KmlFeatureData featureData = null;
033 try {
034 featureData = (KmlFeatureData) properties.getObject("featureData");
035 } catch (TypeException e) {
036 e.printStackTrace();
037 }
038 return featureData;
039 }
040
041 /**
042 * get The position at which to anchor an infowindow on the clicked feature.
043 */
044 public LatLng getLatLng() {
045 LatLng latLng = null;
046 try {
047 latLng = (LatLng) properties.getObject("latLng");
048 } catch (TypeException e) {
049 e.printStackTrace();
050 }
051 return latLng;
052 }
053
054 /**
055 * get The offset to apply to an infowindow anchored on the clicked feature.
056 */
057 public Size getPixelOffset() {
058 Size pixelOffset = null;
059 try {
060 pixelOffset = (Size) properties.getObject("pixelOffset");
061 } catch (TypeException e) {
062 e.printStackTrace();
063 }
064 return pixelOffset;
065 }
066
067 }