public NMapCalloutOverlayView(Context context, NMapOverlay itemOverlay, NMapOverlayItem item, Rect itemBounds) : base(context) { mOverlayItem = item; mItemBounds = itemBounds; mOnClickListener = null; mItemOverlay = itemOverlay; int px = 0; int py = (int)(mItemBounds.Height() * mOverlayItem.AnchorYRatio); NMapView.LayoutParams lp = new NMapView.LayoutParams(NMapView.LayoutParams.WrapContent, NMapView.LayoutParams.WrapContent, mOverlayItem.Point, px, -py, NMapView.LayoutParams.BottomCenter); this.LayoutParameters = lp; mMarginX = NMapResourceProvider.ToPixelFromDIP(CALLOUT_MARGIN_X); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here if (USE_XML_LAYOUT) { SetContentView(Resource.Layout.Main); mMapView = FindViewById <NMapView>(Resource.Id.mapView); } else { // create map view mMapView = new NMapView(this); // create parent view to rotate map view mMapContainerView = new MapContainerView(this, this); mMapContainerView.AddView(mMapView); // set the activity content to the parent view SetContentView(mMapContainerView); } // set a registered Client Id for Open MapViewer Library mMapView.SetClientId(CLIENT_ID); // initialize map view mMapView.Clickable = true; mMapView.Enabled = true; mMapView.Focusable = true; mMapView.FocusableInTouchMode = true; mMapView.RequestFocus(); // register listener for map state changes //mMapView.SetOnMapStateChangeListener(onMapViewStateChangeListener); mMapView.MapInitHandler += OnMapInit; mMapView.AnimationStateChange += OnAnimationStateChange; mMapView.MapCenterChange += OnMapCenterChange; mMapView.ZoomLevelChange += OnZoomLevelChage; //mMapView.MapCenterChangeFine += OnMapCenterChangeFine; //mMapView.SetOnMapViewTouchEventListener(onMapViewTouchEventListener); //이벤트 방식으로 구현시 약한 결합을 지원하므로 좀더 유연하게 핸드러를 구현할 수 있음(필요시에만 구현) //mMapView.LongPress += OnLongPress; //mMapView.LongPressCanceled += OnLongPressCanceled; //mMapView.SingleTapUp += OnSingleTapUp; //mMapView.TouchDown += OnTouchDown; //mMapView.TouchUp += OnTouchUp; //mMapView.Scroll += OnScroll; mMapView.SetOnMapViewDelegate(this); // use map controller to zoom in/out, pan and set map center, zoom level etc. mMapController = mMapView.MapController; // use built in zoom controls var lp = new NMapView.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, NMapView.LayoutParams.BottomRight); mMapView.SetBuiltInZoomControls(true, lp); // create resource provider mMapViewerResourceProvider = new NMapViewerResourceProvider(this); // set data provider listener //base.SetMapDataProviderListener(onDataProviderListener); base.MapDataProvider += OnReverseGeocoderResponse; // create overlay manager mOverlayManager = new NMapOverlayManager(this, mMapView, mMapViewerResourceProvider); // register callout overlay listener to customize it. mOverlayManager.SetOnCalloutOverlayListener(this); // register callout overlay view listener to customize it. //mOverlayManager.SetOnCalloutOverlayViewListener(onCalloutOverlayViewListener); mOverlayManager.CalloutOverlayViewEvent = OnCreateCalloutOverlayView; // location manager mMapLocationManager = new NMapLocationManager(this); //mMapLocationManager.SetOnLocationChangeListener(onMyLocationChangeListener); mMapLocationManager.LocationChanged += OnLocationChanged; mMapLocationManager.LocationUnavailableArea += OnLocationUnablableArea; mMapLocationManager.LocationUpdateTimeout += OnLocationUpdateTimeout; // compass manager mMapCompassManager = new NMapCompassManager(this); // create my location overlay mMyLocationOverlay = mOverlayManager.CreateMyLocationOverlay(mMapLocationManager, mMapCompassManager); }