void Update() { ++lostCount_; if (lostCount_ > 120) { MarkerManager.Remove(data_); } UpdateInterpolation(); if (!isInitialized_) { transform.localPosition = rawPos_; transform.localRotation = Quaternion.AngleAxis(currentAngle_ * Mathf.Rad2Deg, Vector3.down); isInitialized_ = true; } else { transform.localPosition += (rawPos_ - transform.localPosition) * filter; var from = transform.localRotation; var to = Quaternion.AngleAxis(currentAngle_ * Mathf.Rad2Deg, Vector3.down); if (to.eulerAngles.y - from.eulerAngles.y >= 180) { from *= Quaternion.Euler(Vector3.up * 360); } if (to.eulerAngles.y - from.eulerAngles.y <= -180) { from *= Quaternion.Euler(-Vector3.up * 360); } transform.localRotation = Quaternion.Slerp(from, to, filter); } }
private void AddManagers() { var annotationManager = new MarkerManager(_nativeMap, _customMap); var routeManager = new RouteManager(_nativeMap, _customMap, annotationManager); _mapManager = new MapManager(_customMap, annotationManager, routeManager); }
protected virtual void CheckIfDetectedMarkers() { if (ids == null) { return; } int count = 0; if (ids.Length > 0 && OnMarkersDetected != null) { for (int i = 0; i < ids.Length; i++) { if (!MarkerManager.IsMarkerRegistered(ids[i])) { count++; } } if (count == ids.Length) { return; } OnMarkersDetected.Invoke(ids); } }
/// <summary> /// /// </summary> private void OnMarkerChanged(ScintillaControl sci, Int32 line) { if (sci != this.editor && sci != this.editor2) { return; } if (line == -1) // all markers cleared { this.bookmarks.Clear(); ButtonManager.UpdateFlaggedButtons(); return; } Boolean hadBookmark = this.bookmarks.Contains(line); Boolean hasBookmark = MarkerManager.HasMarker(sci, 0, line); if (hadBookmark != hasBookmark) // any change? { if (!hadBookmark && hasBookmark) { this.bookmarks.Add(line); } else if (hadBookmark && !hasBookmark) { this.bookmarks.Remove(line); } ButtonManager.UpdateFlaggedButtons(); } }
private void Dialog_mGo(object sender, OnGoEventArgs e) { int index = e.Position; Parkinglot parkinglot = mParkinglots[index]; LatLng parkingPosition = new LatLng(parkinglot.lat, parkinglot.lng); LatLng clientPosition = DeviceManager.GetClientLocation(locationProvider, currentLocation); mMarkerParking = MarkerManager.CreateMarker(parkingPosition, parkinglot.name, parkinglot.id + ":" + parkinglot.address, BitmapDescriptorFactory.HueRed); mMarkerUser = MarkerManager.CreateUserPosition(clientPosition); if (mMap != null) { mMap.AddMarker(mMarkerParking); mMap.AddMarker(mMarkerUser); // Sete el Info Windows mMap.SetInfoWindowAdapter(this); // Agregarle Eventos a la Info Window // La Info Window solo puede contener eventos que involucren a TODA la ventana // No a componentes internos mMap.SetOnInfoWindowClickListener(this); RouteToDestination(clientPosition, parkingPosition); } }
void Start() { liftPos = transform.FindChild("LiftPos").transform; throwPos = transform.FindChild("ThrowPos").transform; marker = transform.GetComponentInChildren <MarkerManager>(); }
void Start() { if (Instance == null) { Instance = this; } }
public void MoveWithClick() { if (PauseManager.isPaused || PauseManager.isInteracting) { return; } if (Input.GetMouseButtonDown(0)) { Camera camera = IsometricCamera.Camera; RaycastHit hit; Ray ray = camera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 100.0f)) { //NavMeshAgent agent = GetComponent<NavMeshAgent>(); //agent.SetDestination(hit.point); NavMeshHit navHit; int walkableMask = 1 << NavMesh.GetAreaFromName("Walkable"); if (NavMesh.SamplePosition(hit.point, out navHit, 1.0f, walkableMask)) { NavMeshAgent agent = GetComponent <NavMeshAgent>(); agent.SetDestination(hit.point); MarkerManager.GenerateMarker(hit.point + new Vector3(0, 0.1f, 0), Quaternion.identity); } } } }
protected override void CheckIfDetectedMarkers() { base.CheckIfDetectedMarkers(); for (int i = 0; i < ids.Length; i++) { Cv2.CornerSubPix(grayedImg, corners[i], new Size(5, 5), new Size(-1, -1), TermCriteria.Both(30, 0.1)); if (!MarkerManager.IsMarkerRegistered(ids[i])) { continue; } MarkerBehaviour m = MarkerManager.GetMarker(ids[i]); if (!allDetectedMarkers.ContainsKey(ids[i])) { m.OnMarkerDetected.Invoke(); allDetectedMarkers.Add(m.GetMarkerID(), m); } // m.UpdateMarker(img.Cols, img.Rows, corners[i], rejectedImgPoints[i]); m.UpdateMarker(corners[i], calibrationData.GetCameraMatrix(), calibrationData.GetDistortionCoefficients(), grayedImg); } }
/// <summary> /// Reloads an editable document /// </summary> public void Reload(Boolean showQuestion) { if (!this.IsEditable) { return; } if (showQuestion) { String dlgTitle = TextHelper.GetString("Title.ConfirmDialog"); String message = TextHelper.GetString("Info.AreYouSureToReload"); if (MessageBox.Show(Globals.MainForm, message, " " + dlgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } Globals.MainForm.ReloadingDocument = true; Int32 position = this.SciControl.CurrentPos; TextEvent te = new TextEvent(EventType.FileReload, this.FileName); EventManager.DispatchEvent(Globals.MainForm, te); if (!te.Handled) { EncodingFileInfo info = FileHelper.GetEncodingFileInfo(this.FileName); if (info.CodePage == -1) { Globals.MainForm.ReloadingDocument = false; return; // If the files is locked, stop. } Encoding encoding = Encoding.GetEncoding(info.CodePage); this.SciControl.IsReadOnly = false; this.SciControl.Encoding = encoding; this.SciControl.Text = info.Contents; this.SciControl.IsReadOnly = FileHelper.FileIsReadOnly(this.FileName); this.SciControl.SetSel(position, position); this.SciControl.EmptyUndoBuffer(); int lineCount = SciControl.LineCount; foreach (var lineNum in this.bookmarks) { if (lineNum < 0) { continue; } if (lineNum >= lineCount) { if (!MarkerManager.HasMarker(SciControl, 0, lineCount - 1)) { MarkerManager.ToggleMarker(SciControl, 0, lineCount - 1); } } else { MarkerManager.ToggleMarker(SciControl, 0, lineNum); } } this.InitBookmarks(); this.fileInfo = new FileInfo(this.FileName); } Globals.MainForm.OnDocumentReload(this); }
// Use this for initialization void Start() { manager = GameObject.Find("MarkerManager").GetComponent <MarkerManager> (); for (int i = 0; i < 30; i++) { slowdownSpeedChangeQueue.Enqueue(flatSpeed); } }
public Session(string _seshKey) { Utils.DebugLine($"Session Created! [{_seshKey}]", "CSession"); MarkerManager = new MarkerManager(); SessionKey = _seshKey; new BlipChange(); }
// Basically tank controls public void MoveAndRotateCharacterWithKeys() { bool isRunning = false; float runSpeed = walkSpeed * runSpeedMultiplier; // Get move quantity based on delta time and speed float moveSpeed = baseMoveSpeed * (isRunning ? runSpeed : walkSpeed); moveSpeed = PauseManager.isPaused ? 0 : moveSpeed; // Get user input float horizontal = Input.GetAxis("Horizontal"); float vertical = Input.GetAxis("Vertical"); // Use animation if input exists if (vertical != 0.0f || horizontal != 0.0f) { agent.isStopped = true; MarkerManager.DeleteMarker(); if (animator != null) { animator.SetBool("Walk", true); } } else { if (animator != null) { animator.SetBool("Walk", false); } } // Translate character Vector3 cameraDir = IsometricCamera.instance.cameraDirection; Vector3 verticalMove = IsometricCamera.Camera.transform.forward * Mathf.Abs(vertical) * -Mathf.Sign(cameraDir.z); Vector3 hortizonalMove = IsometricCamera.Camera.transform.right * Mathf.Abs(horizontal) * Mathf.Sign(cameraDir.x); verticalMove.y = 0; verticalMove.x = 0; hortizonalMove.y = 0; hortizonalMove.x = 0; Vector3 moveVector = verticalMove + hortizonalMove; transform.Translate(moveVector.normalized * moveSpeed * Time.deltaTime); // Rotate character Vector3 dir = IsometricCamera.Camera.transform.forward * vertical + IsometricCamera.Camera.transform.right * horizontal; dir.y = 0; transform.LookAt(dir + transform.position); // Use Left Shift to Toggle Running if (Input.GetKeyDown(KeyCode.LeftShift)) { isRunning = !isRunning; } }
private void AddManagers() { var annotationManager = new MarkerManager(_nativeMap, _customMap); var routeManager = new RouteManager(_nativeMap, _customMap, annotationManager); var responderManager = new ResponderManager(_nativeMap, _customMap, routeManager, annotationManager); var heatMapManager = new HeatMapManager(_androidMapView, _nativeMap, _customMap); _mapManager = new MapManager(_customMap, annotationManager, routeManager, responderManager, heatMapManager); }
void Start() { GameObject streamObject = GameObject.Find("FlightDataStorage"); dataStream = streamObject.GetComponent <FlightDataStorage>(); GameObject markerObject = GameObject.Find("MarkerManager"); markerManager = markerObject.GetComponent <MarkerManager>(); }
private void button4_Click(object sender, EventArgs e) //check align { if (!h**o.isEmpty()) { CvInvoke.Imshow("aligned img", MarkerManager.getAlignedImage((((Mat)ib.Image).ToImage <Bgr, byte>()), this.h**o)); } }
protected override void CheckIfDetectedMarkers() { base.CheckIfDetectedMarkers(); for (int i = 0; i < ids.Length; i++) { Cv2.CornerSubPix(grayedImg, corners[i], new Size(5, 5), new Size(-1, -1), TermCriteria.Both(30, 0.1)); if (!MarkerManager.IsMarkerRegistered(ids[i])) { continue; } MarkerBehaviour m = MarkerManager.GetMarker(ids[i]); if (!allDetectedMarkers.ContainsKey(ids[i])) { Debug.Log("FOUND MARKER: " + m.GetMarkerID()); m.OnMarkerDetected.Invoke(); allDetectedMarkers.Add(m.GetMarkerID(), m); } float rotZ = 0; switch (Screen.orientation) { case ScreenOrientation.Portrait: rotZ = 90; break; case ScreenOrientation.LandscapeLeft: rotZ = 180; break; case ScreenOrientation.LandscapeRight: rotZ = 0; break; case ScreenOrientation.PortraitUpsideDown: rotZ = -90; break; } if (!UseCustomCalibration) { cameraManager.TryGetIntrinsics(out cameraIntrinsics); m.UpdateMarker(corners[i], cameraIntrinsics, grayedImg, Vector3.forward * rotZ); } else { m.UpdateMarker(corners[i], calibrationData.GetCameraMatrix(), calibrationData.GetDistortionCoefficients(), grayedImg, Vector3.forward * rotZ); } } }
public ClusterManager(Context context, GoogleMap map, MarkerManager markerManager) { mMap = map; mMarkerManager = markerManager; mClusterMarkers = markerManager.newCollection(); mMarkers = markerManager.newCollection(); mRenderer = new DefaultClusterRenderer <T>(context, map, this); mAlgorithm = new PreCachingAlgorithmDecorator <T>(new NonHierarchicalDistanceBasedAlgorithm <T>()); mClusterTask = new ClusterTask(this); mRenderer.onAdd(); }
/// <summary> /// Creates a new Map /// </summary> private Map() { _isMiniMap = false; EventPublisher = new Publisher(this); MarkerManager = new MarkerManager(); Manipulators = new ManipulatorManagerController(this); _toolTip = JanusControls.CreateTooltip(); SetTooltipProperties(); }
public Session InitializeSession(Character _selectedCharacter) { Utils.DebugLine("Initializing Session!", "CSession"); SelectedCharacter = _selectedCharacter; MarkerManager.TurnConfigToMarkers(ConfigManager.MarkerConfig); InventoryManager = new InventoryManager(_selectedCharacter); return(this); }
/// <summary> /// Checks the bookmarks when document is active. /// </summary> public void InitBookmarks() { this.bookmarks.Clear(); for (Int32 i = 0; i < editor.LineCount; i++) { if (MarkerManager.HasMarker(SciControl, 0, i)) { this.bookmarks.Add(i); } } }
void Update() { if (Input.GetKeyDown(rankingDebugKey)) { var markers = MarkerManager.GetMarkerObjects(); if (markers.Count == 0) { return; } Ranking.Post(1000, markers[0]); } }
private void DeleteItem(int _ID) { // Execute delete func. bool childIds = new MarkerManager().DeleteCarsMarker(_ID, ClientSession.Current.IP); if (childIds) // deleted. { lblError.Text = Resources.AdminResources_en.SuccessDelete; // success deleted. } else { lblError.Text = Resources.AdminResources_en.ErrorDelete; } }
void Awake() { if (instance != null) { Destroy(gameObject); return; } instance = this; input = new PlayerInput(); MarkerManager.Init(); }
public static void Init() { if (instance != null) { return; } instance = new MarkerManager(); instance.registerMarkBehaviour = new List <VuMarkBehaviour>(); instance.markManager = TrackerManager.Instance.GetStateManager().GetVuMarkManager(); instance.markManager.RegisterVuMarkBehaviourDetectedCallback(instance.MarkFond); instance.markManager.RegisterVuMarkLostCallback(instance.TargetLost); }
private void ShowMarkerInformation(int Id) { var result = new MarkerManager().GetCarsMarkerDetails(Id); if (result != null) { //hfID.Value = result.MarkersID.ToString(); txtNameAr.Text = result.MarkerNameAr; txtNameEn.Text = result.MarkerNameEn; txtPriority.Text = result.Priority.ToString(); cbActive.Checked = (bool)result.Active; } // }
IEnumerator FinishGameSequence() { GlobalGUI.SetText("Finish!"); yield return(new WaitForSeconds(3f)); GlobalGUI.SetText("Your Score is..."); yield return(new WaitForSeconds(2f)); GlobalGUI.SetText(Score.Get().ToString()); yield return(new WaitForSeconds(5f)); var markers = MarkerManager.GetMarkerObjects(); if (markers.Count == 0) { while (markers.Count == 0) { GlobalGUI.SetText("Please Put LITTAI button!"); yield return(new WaitForSeconds(1f)); markers = MarkerManager.GetMarkerObjects(); } } yield return(new WaitForSeconds(1f)); try { bool isHit = false; foreach (var marker in markers) { if (marker) { Ranking.Post(Score.Get(), markers[0].gameObject); isHit = true; break; } } Debug.LogError("No Marker..."); } catch (System.Exception e) { Debug.LogError(e.Message); } GlobalGUI.SetText("Thank you for playing!"); GlobalGUI.ShowBgmRefer(true); yield return(new WaitForSeconds(6f)); Restart(); }
protected void Page_Load(object sender, EventArgs e) { GMap1.setCenter(new GLatLng(41, 3), 3); GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMarker m1 = new GMarker(new GLatLng(41, 3)); MarkerManager mManager = new MarkerManager(); mManager.Add(m1, 2); List <GMarker> mks = new List <GMarker>(); List <GInfoWindow> iws = new List <GInfoWindow>(); Random r = new Random(); double ir1, ir2; GMarker mkr; for (int i = 0; i < 10; i++) { ir1 = (double)r.Next(40) / 10.0 - 2.0; ir2 = (double)r.Next(40) / 10.0 - 2.0; mkr = new GMarker(m1.point + new GLatLng(ir1, ir2)); mks.Add(mkr); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){alert('" + i + "');}")); } for (int i = 0; i < 5; i++) { ir1 = (double)r.Next(40) / 20.0 - 1; ir2 = (double)r.Next(40) / 20.0 - 1; mkr = new GMarker(m1.point + new GLatLng(ir1, ir2)); GInfoWindow window = new GInfoWindow(mkr, i.ToString()); iws.Add(window); } mManager.Add(mks, 6, 8); mManager.Add(iws, 7, 8); GMap1.markerManager = mManager; }
void Awake() { if (!instance) { instance = this; } if (!GameObject.Find("EffectContainer")) { effectContainer = new GameObject("EffectContainer").transform; effectContainer.parent = transform; } else { effectContainer = GameObject.Find("EffectContainer").transform; } }
protected void Page_Load(object sender, EventArgs e) { GMap1.setCenter(new GLatLng(41, 3), 3); GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMarker m1 = new GMarker(new GLatLng(41, 3)); MarkerManager mManager = new MarkerManager(); mManager.Add(m1, 2); List<GMarker> mks = new List<GMarker>(); List<GInfoWindow> iws = new List<GInfoWindow>(); Random r = new Random(); double ir1, ir2; GMarker mkr; for (int i = 0; i < 10; i++) { ir1 = (double)r.Next(40) / 10.0 - 2.0; ir2 = (double)r.Next(40) / 10.0 - 2.0; mkr = new GMarker(m1.point + new GLatLng(ir1, ir2)); mks.Add(mkr); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){alert('" + i + "');}")); } for (int i = 0; i < 5; i++) { ir1 = (double)r.Next(40) / 20.0 - 1; ir2 = (double)r.Next(40) / 20.0 - 1; mkr = new GMarker(m1.point + new GLatLng(ir1, ir2)); GInfoWindow window = new GInfoWindow(mkr, i.ToString()); iws.Add(window); } mManager.Add(mks, 6, 8); mManager.Add(iws, 7, 8); GMap1.markerManager = mManager; }
void Awake() { //Make sure this is in fact the only instance (Singleton pattern) if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); GetMarkersAndNormalizedPositions(); PlaceMarkersOnMesh(m_meshFilterMap); }
protected void Page_Load(object sender, EventArgs e) { if (Session["uname"] == null) { Response.Redirect("Index.aspx"); } string id = Request.QueryString["id"]; double lat = 0, lon = 0; // SELECT Cab.Cab_ID, CabLocations.Latitude, CabLocations.Longitude FROM Cab INNER JOIN CabLocations ON Cab.Cab_ID=CabLocations.Cab_ID WHERE Cab.Cab_RegNo = 'VY-702'; DataTable dt = new DataTable(); SqlConnection connection = new SqlConnection(@"Data Source=WALEED-PC;Initial Catalog=Cab9;Integrated Security=True"); connection.Open(); SqlCommand sqlCmd = new SqlCommand("SELECT Cab.Cab_ID, CabLocations.Latitude, CabLocations.Longitude FROM Cab INNER JOIN CabLocations ON Cab.Cab_ID=CabLocations.Cab_ID WHERE Cab.Cab_RegNo = '" + id + "'", connection); SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd); sqlDa.Fill(dt); if (dt.Rows.Count > 0) { lat = Convert.ToDouble(dt.Rows[0]["Latitude"]); lon = Convert.ToDouble(dt.Rows[0]["Longitude"]); } connection.Close(); GLatLng latlng = new GLatLng(lat, lon); GMapType.GTypes mType = GMapType.GTypes.Normal; GMap1.setCenter(latlng, 15, mType); /////////////////////////////////////////////// GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMarker m1 = new GMarker(new GLatLng(lat, lon)); MarkerManager mManager = new MarkerManager(); mManager.Add(m1, 10); List<GMarker> mks = new List<GMarker>(); List<GInfoWindow> iws = new List<GInfoWindow>(); Random r = new Random(); GMarker mkr; for (int i = 0; i < 5; i++) { double ir1 = r.Next(40) / 10.0 - 2.0; double ir2 = r.Next(40) / 10.0 - 2.0; mkr = new GMarker(m1.point + new GLatLng(lat, lon)); mks.Add(mkr); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){alert('" + i + "');}")); } for (int i = 0; i < 5; i++) { double ir1 = r.Next(40) / 20.0 - 1; double ir2 = r.Next(40) / 20.0 - 1; mkr = new GMarker(m1.point + new GLatLng(lat, lon)); GInfoWindow window = new GInfoWindow(mkr, i.ToString()); iws.Add(window); } mManager.Add(mks, 5, 6); mManager.Add(iws, 7, 8); GMap1.markerManager = mManager; /////////////////////////////////////////////////////////////////// string cab = ""; DataTable dt1 = new DataTable(); SqlConnection connection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection1"].ConnectionString.ToString()); connection1.Open(); SqlCommand sqlCmd1 = new SqlCommand("Select Cab_ID from Cab where Cab_RegistrationNumber='" + id + "'", connection1); SqlDataAdapter sqlDa1 = new SqlDataAdapter(sqlCmd); sqlDa.Fill(dt1); if (dt.Rows.Count > 0) { cab = dt.Rows[0]["Cab_ID"].ToString(); } connection.Close(); ///////////////////////////////////////////////////////////////// DataTable dt2 = new DataTable(); SqlConnection connection2 = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection1"].ConnectionString.ToString()); connection2.Open(); SqlCommand sqlCmd2 = new SqlCommand("Select SUM([Booking_Fare]) As Total from Booking where Cab_ID='" + cab + "'", connection2); SqlDataAdapter sqlDa2 = new SqlDataAdapter(sqlCmd2); sqlDa2.Fill(dt2); string fare = ""; if (dt2.Rows.Count > 0) { fare = dt2.Rows[0]["Total"].ToString(); } ASPxGaugeControl1.Value = fare; connection.Close(); /////////////////////////////////////////////////////////////////////////////////////////////////////// //SELECT DISTINCT([Booking_Source]), COUNT([Booking_Source]) FROM [Booking] GROUP BY Booking_Source SqlDataSource1.SelectCommand = "SELECT DISTINCT([Booking_Source]), COUNT([Booking_Source]) FROM [Booking] where Cab_ID='" + cab + "' GROUP BY Booking_Source "; SqlDataSource2.SelectCommand = "SELECT DISTINCT([Booking_Destination]), COUNT([Booking_Destination]) FROM [Booking] where Cab_ID='" + cab + "' GROUP BY Booking_Destination "; }
private void showMap() { GridView gv = new GridView(); gv.DataSource = SqlDataSource1; gv.DataBind(); int start = displayTable.PageIndex * 10; string sMapKey = ConfigurationManager.AppSettings["googlemaps.subgurim.net"]; GeoCode geoCode; GLatLng gLatLng = null; GMarker oMarker; string sStreetAddress; MarkerManager mManager = new MarkerManager(); GMap1.Add(new GMapUI()); for (int i = 0; i < Math.Min(10, gv.Rows.Count - displayTable.PageIndex * 10); i++) { sStreetAddress = gv.Rows[start].Cells[2].Text + ", " + gv.Rows[start].Cells[6].Text + ", " + gv.Rows[start].Cells[7].Text; geoCode = GMap.geoCodeRequest(sStreetAddress, sMapKey); gLatLng = new GLatLng(geoCode.Placemark.coordinates.lat, geoCode.Placemark.coordinates.lng); oMarker = new GMarker(gLatLng); GInfoWindow window = new GInfoWindow(oMarker, gv.Rows[start].Cells[1].Text, false, GListener.Event.mouseover); mManager.Add(oMarker, 0); mManager.Add(window, 0); start += 1; } GMap1.markerManager = mManager; GMap1.setCenter(gLatLng, 10, Subgurim.Controles.GMapType.GTypes.Normal); GMap1.enableHookMouseWheelToZoom = true; }
protected void ddlStopList_SelectedIndexChanged(object sender, EventArgs e) { MarkerManager mManager = new MarkerManager(); double lat = 0.0; double longi = 0.0; if (ddlStopList.SelectedValue == "All Stops") { //select all stops create the marker and event //to show its info var stops = from s in JUTCLinq.Stops select s; foreach (var s in stops) { lat = s.Lattitude; longi = s.Longitude; GMarker mkr = new GMarker(new GLatLng(lat, longi)); //GMap1.addGMarker(mkr); mManager.Add(mkr,10); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){prompt('Stop #: " + s.StopNo + ", Location: " + s.Location + ", Coordinates:" + "','" + s.Lattitude + "," + s.Longitude + "');" + "var hc = document.getElementById('hidCoords');" + "hc.value = '" + s.Lattitude + "," + s.Longitude + "';" + "var hsn = document.getElementById('hidStopNo');" + "hsn.value = '" + s.Lattitude + "," + s.Longitude + "';" + "var hsl = document.getElementById('hidStopsList');" + "hsl.value += '" + s.StopNo + ",';" + "}")); } } else { //select stoplist for specified route var stops = from s in JUTCLinq.Routes where s.RouteNo == ddlStopList.SelectedValue select s; string routelist = " "; //get routestops foreach (var s in stops) { routelist = s.RouteStops; } //parse route stops list string[] stopsArr = routelist.Split(','); //travers array and select each stop foreach(string stp in stopsArr) { var stops2 = from s2 in JUTCLinq.Stops where s2.StopNo == stp select s2; //for each stop select the row and create the marker //and event to show its info foreach (var s2 in stops2) { lat = s2.Lattitude; longi = s2.Longitude; GMarker mkr = new GMarker(new GLatLng(lat, longi)); mManager.Add(mkr, 10); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){prompt('Stop #: " + s2.StopNo + ", Location: " + s2.Location + ", Coordinates:" + "','" + s2.Lattitude + "," + s2.Longitude + "');" + "var hc = document.getElementById('hidCoords');" + "hc.value = '" + s2.Lattitude + "," + s2.Longitude + "';" + "var hsn = document.getElementById('hidStopNo');" + "hsn.value = '" + s2.Lattitude + "," + s2.Longitude + "';" + "var hsl = document.getElementById('hidStopsList');" + "hsl.value += '" + s2.StopNo + ",';" + "}")); } } } GMap1.markerManager = mManager; }
protected void Page_Load(object sender, EventArgs e) { MarkerManager mManager = new MarkerManager(); double lat = 0.0; double longi = 0.0; //reset listeners, necessary for marker listener to work between postback GMap1.resetListeners(); //Create default marker GIcon icon = new GIcon(); icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; icon.iconSize = new GSize(20, 28); icon.shadowSize = new GSize(30, 28); icon.iconAnchor = new GPoint(10, 18); icon.infoWindowAnchor = new GPoint(5, 1); GMap1.mapType = GMapType.GTypes.Hybrid; GMarkerOptions mOpts = new GMarkerOptions(); mOpts.clickable = false; mOpts.icon = icon; //GMap1.GZoom = 3; //set zoom level GMap1.Key = ConfigurationSettings.AppSettings["GoogleMapKey"]; GMap1.enableDragging = true; GMap1.enableGoogleBar = false; GMap1.Language = "en"; GMap1.BackColor = Color.White; //GMap1.enableHookMouseWheelToZoom = true; GMap1.enableGKeyboardHandler = true; //Add built-in control for selecting map type GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl)); //Add built-in control for zoom and pan //GMap1.addControl(new GControl(GControl.preBuilt.SmallZoomControl3D)); GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl3D)); //Custom cursor GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text); GMap1.addCustomCursor(customCursor); //Mark centre with a "+" GControl control = new GControl(GControl.extraBuilt.MarkCenter); //Adds a textbox which gives the coordinates of the last click GMap1.addControl(new GControl(GControl.extraBuilt.TextualOnClickCoordinatesControl, new GControlPosition(GControlPosition.position.Bottom_Right))); //Add all stops to GMAP var stops = from s in JUTCLinq.Stops select s; foreach (var s in stops) { lat = s.Lattitude; longi = s.Longitude; GMarker mkr = new GMarker(new GLatLng(lat, longi)); //GMap1.addGMarker(mkr); mManager.Add(mkr, 10); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){prompt('Stop #: " + s.StopNo + ", Location: " + s.Location + ", Coordinates:" + "','" + s.Lattitude + "," + s.Longitude + "');" + "var hsn = document.getElementById('hidStopNo');" + "hsn.value = '" + s.StopNo + "';" + "}")); } GMap1.markerManager = mManager; if (!IsPostBack) { GMap1.setCenter(hwttc, 18); } }