using System; using System.Collections; using System.Windows.Forms; using System.Resources; using MapGoogle; using Telerik.WinControls; using System.Collections.Generic; using SafeMobileLib; using ESRI.ArcGIS.EngineCore; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.Controls; using ReportsLibrary; using Newtonsoft.Json; namespace Safedispatch_4_0 { public class MapElement { public Locationx prevPos = null; public Locationx lastPos = null; public Locationx northPole = null; public BusSymbols busSymb; public DataSetx active; public DataSetx hide; public Pushpinx pp; public AxMappointControlx mapControl; public Boolean firstTime = true; public bool isActive; public volatile Boolean vehCompute = false; private Vehicle parent; private MapTYPE typeMapPoint = MapTYPE.Google; public Boolean itemCheck = false; //ARCGIS ELEment public IGraphicTracker m_graphicTracker; public Int32 GISID = -1; public String labelGIS = ""; public Boolean GISSelect = false; public BusSymbolsGIS busSymbGIS; public AxMapControl AxMapGIS = null; public MapElement(AxMappointControlx mapControlParam, BusSymbols busSymbParam, Vehicle _parent, DataSetx _active, DataSetx _hide) { pp = null; mapControl = mapControlParam; busSymb = busSymbParam; isActive = false; parent = _parent; active = _active; hide = _hide; typeMapPoint = MapTYPE.Google; } public MapElement(IGraphicTracker m_graphicTrackerParam, BusSymbolsGIS busSymbParam, Vehicle _parent, AxMapControl AxMapParam) { GISID = -1; m_graphicTracker = m_graphicTrackerParam; busSymbGIS = busSymbParam; isActive = false; parent = _parent; typeMapPoint = MapTYPE.ArcGis; AxMapGIS = AxMapParam; } public bool SetLastLocation() { bool difLocation = false; try { if (((Math.Round(parent.lastLocLAT * 100000) != Math.Round(parent.LAT * 100000)) || (Math.Round(parent.lastLocLNG * 100000) != Math.Round(parent.LNG * 100000)))) { parent.prevLocLNG = parent.lastLocLNG; parent.prevLocLAT = parent.lastLocLAT; parent.lastLocLNG = parent.LNG; parent.lastLocLAT = parent.LAT; difLocation = true; //calculate heading if (parent.vehicleSpeed > 0) { Double dlng = parent.lastLocLNG - parent.prevLocLNG; Double dlat = parent.lastLocLAT - parent.prevLocLAT; Double mdelta_min = -0.00001; Double delta_min = 0.00001; Int32 headcalc = 0; Double blat = 0; Double blng = 0; if ((dlat > mdelta_min) && (dlat < delta_min) && ((mdelta_min < dlng) && dlng < (delta_min))) headcalc = (Int32)parent.heading; else { if ((mdelta_min < dlat) && (dlat < delta_min)) { blng = 1; if (dlng < 0) headcalc = 180; else headcalc = 0; } else { blat = 1; if (dlat > 0) headcalc = 90; else headcalc = 270; } } if ((mdelta_min < dlng) && (dlng < delta_min)) { if (blat == 0) { if (dlat > 0) { if (headcalc == 180) headcalc = 135; if (headcalc == 0) headcalc = 45; } else { if (headcalc == 180) headcalc = 225; if (headcalc == 0) headcalc = 315; } } } else { if (blng == 0) { if (dlng < 0) { if (headcalc == 90) headcalc = 135; if (headcalc == 270) headcalc = 225; } else { if (headcalc == 90) headcalc = 45; if (headcalc == 270) headcalc = 315; } } } SetHeading(headcalc); } } return difLocation; } catch (Exception ex) { SM.Debug("Error on set last location" + ex.ToString()); return false; } } public void SetHeading(Int32 headingParam) { try { parent.heading = headingParam; if (typeMapPoint == MapTYPE.Google) { if (pp != null) { pp.dimPush = 35; if (MainForm2.iconType == IconType.ICONS) pp.Symbol = busSymb.GetSymbolFromOrientationIcon(headingParam, parent.IconID); else if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) pp.Symbol = busSymb.GetSymbolFromOrientationColor(headingParam, SymbolColor.Red); else { if (parent.actual_status == Status_for_tab.GPS_OFF) pp.Symbol = busSymb.GetSymbolFromOrientationColor(headingParam, SymbolColor.Red); //Red else pp.Symbol = busSymb.GetSymbolFromOrientationColor(headingParam, SymbolColor.Green); } } else { if (parent.is_emergency) pp.Symbol = busSymb.GetSymbolFromOrientationIcon(1,6); else pp.Symbol = busSymb.GetSymbolFromOrientationIcon(1, 2); } } } else if (typeMapPoint == MapTYPE.ArcGis) { if (GISID != -1) { if (MainForm2.iconType == IconType.ICONS) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationIcon(headingParam, parent.IconID)); else if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(headingParam, SymbolColor.Red)); else { if (parent.actual_status == Status_for_tab.GPS_OFF) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(headingParam, SymbolColor.Red));//red else m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(headingParam, SymbolColor.Green)); } } else { if (parent.is_emergency) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationIcon(1, 6)); else m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationIcon(1, 2)); } } } } catch (Exception ex) { SM.Debug("Error on vechicle set heading msg:" + ex.ToString()); } } public void Updatelabel(String label,Double lines) { if (label != "") labelGIS = label; if ((lines > 1) && (!GISSelect)) return; m_graphicTracker.SuspendUpdate = true; MainForm2.simpleTextSymbol.YOffset = lines * 10; m_graphicTracker.SetTextSymbol(GISID, MainForm2.simpleTextSymbol); if (label != "") m_graphicTracker.SetLabel(GISID, labelGIS); else m_graphicTracker.SetLabel(GISID, ""); //m_graphicTracker.SetTransparency(GISID, 50); m_graphicTracker.SuspendUpdate = false; } public void UpdateLabelCMD(Boolean withaddres) { if (withaddres) Updatelabel(parent.busName + "\n " + MainForm2.langSpeed + " " + Convert.ToString(parent.GetSpeed()) + MainForm2.Measure + " " + MainForm2.langTime + " " + parent.lastActivityTime.TimeOfDayHHMMLocal() + " \n " + parent.lastAddress+" ", 3.5); else Updatelabel(parent.busName + "\n " + MainForm2.langSpeed + " " + Convert.ToString(parent.GetSpeed()) + MainForm2.Measure + " " + MainForm2.langTime + " " + parent.lastActivityTime.TimeOfDayHHMMLocal() + " ", 2); } public void SetLastPushpin() { if (typeMapPoint == MapTYPE.Google) { prevPos = lastPos; lastPos = mapControl.ActiveMap.GetLocation(parent.LAT, parent.LNG, 10); } } public void DeactivatePushpin() { parent.act_instance--; if (isActive) parent.act_instance--; isActive = false; if (typeMapPoint == MapTYPE.Google) { if (pp != null) { pp.Location = northPole; pp.MoveTo(hide); // parent.lastAddress = ""; } } else if (typeMapPoint == MapTYPE.ArcGis) { m_graphicTracker.Remove(GISID); GISID = -1; } } public void ActivatePushPin() { if (!isActive) parent.act_instance++; isActive = true; //if (!((System.Math.Round(parent.lastLocLAT) == 0) && (System.Math.Round(parent.lastLocLNG) == 0))) { if (typeMapPoint == MapTYPE.Google) { if (pp == null) { lastPos = mapControl.ActiveMap.GetLocation(parent.lastLocLAT, parent.lastLocLNG, 1); northPole = mapControl.ActiveMap.GetLocation(0, 0, 1); pp = mapControl.ActiveMap.AddPushpin(lastPos, parent.busName); pp.dimPush = 35; if (MainForm2.iconType == IconType.ICONS) { pp.Symbol = busSymb.GetSymbolFromOrientationIcon(0, parent.IconID); } else if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) pp.Symbol = busSymb.GetSymbolFromOrientationColor(0, SymbolColor.Red); else { if (parent.actual_status == Status_for_tab.GPS_OFF) pp.Symbol = busSymb.GetSymbolFromOrientationColor(0, SymbolColor.Red); else pp.Symbol = busSymb.GetSymbolFromOrientationColor(0, SymbolColor.Green); } } else { if (parent.is_emergency) pp.Symbol = busSymb.GetSymbolFromOrientationIcon(0, 6); else pp.Symbol = busSymb.GetSymbolFromOrientationIcon(0, 2); } } } #region ARCGIS else if (typeMapPoint == MapTYPE.ArcGis) { try { SM.Debug("ActivePushPin"); IPoint point = new ESRI.ArcGIS.Geometry.Point(); point.PutCoords(parent.lastLocLNG, parent.lastLocLAT); point.SpatialReference = MainForm2.CreateGeoCoordSys(); if (point.X == 0.1 && point.Y == 0.1) return; if (GISID == -1) { SM.Debug("ActivePushPin GIS -1"); if (MainForm2.iconType == IconType.ICONS) GISID = m_graphicTracker.Add(point as IGeometry, busSymbGIS.GetSymbolFromOrientationIcon(0, parent.IconID)); else if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) GISID = m_graphicTracker.Add(point as IGeometry, busSymbGIS.GetSymbolFromOrientationColor(0, SymbolColor.Red)); else { if (parent.actual_status == Status_for_tab.GPS_OFF) GISID = m_graphicTracker.Add(point as IGeometry, busSymbGIS.GetSymbolFromOrientationColor(0, SymbolColor.Red));//red else GISID = m_graphicTracker.Add(point as IGeometry, busSymbGIS.GetSymbolFromOrientationColor(0, SymbolColor.Green)); } } else { if (parent.is_emergency) GISID = m_graphicTracker.Add(point as IGeometry, busSymbGIS.GetSymbolFromOrientationIcon(0, 6)); else GISID = m_graphicTracker.Add(point as IGeometry, busSymbGIS.GetSymbolFromOrientationIcon(0, 2)); } if (MainForm2.Displaywithname) Updatelabel(parent.busName, 1); } else { SM.Debug("ActivePushPin GISID:"+GISID.ToString()); m_graphicTracker.SuspendUpdate = true; m_graphicTracker.SetGeometry(GISID, point as IGeometry); if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(0, SymbolColor.Red)); else { if (parent.actual_status == Status_for_tab.GPS_OFF) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(0, SymbolColor.Red));//red else m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(0, SymbolColor.Green)); } } m_graphicTracker.SuspendUpdate = false; } } catch (Exception ex) { SM.Debug("Error on put ArcGIS simbol to the map:"+ex.ToString()); } } #endregion } if (typeMapPoint == MapTYPE.Google) { if (pp != null) { pp.Location = lastPos; pp.Note = MainForm2.langSpeed + " " + parent.GetSpeed().ToString() + MainForm2.Measure + " " + MainForm2.langTime + " " + parent.lastActivityTime.TimeOfDayHHMMLocal() + "
" + parent.lastAddress.Replace(',', ' '); pp.MoveTo(active); if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) pp.Symbol = busSymb.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Red); else { if (parent.actual_status == Status_for_tab.GPS_OFF) pp.Symbol = busSymb.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Red); else pp.Symbol = busSymb.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Green); } } if (MainForm2.iconType == IconType.EMERG) { if (parent.is_emergency) pp.Symbol = busSymb.GetSymbolFromOrientationIcon(0, 6); else pp.Symbol = busSymb.GetSymbolFromOrientationIcon(0, 2); } } } } public void UpdateSymbol() { try { if (typeMapPoint == MapTYPE.Google) { if (pp != null) { pp.dimPush = 35; if (MainForm2.iconType == IconType.ICONS) { if (parent.is_emergency) pp.Symbol = busSymb.GetSymbolFromOrientationIcon(1, 6); else pp.Symbol = busSymb.GetSymbolFromOrientationIcon(parent.heading, parent.IconID); } else if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) pp.Symbol = busSymb.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Red); else { if (parent.actual_status == Status_for_tab.GPS_OFF) pp.Symbol = busSymb.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Red); else pp.Symbol = busSymb.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Green); } } else { if (parent.is_emergency) pp.Symbol = busSymb.GetSymbolFromOrientationIcon(1, 6); else pp.Symbol = busSymb.GetSymbolFromOrientationIcon(1, 2); } } } else if (typeMapPoint == MapTYPE.ArcGis) { try { if (GISID != -1) { if (MainForm2.iconType == IconType.ICONS) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationIcon(parent.heading, parent.IconID)); else if (MainForm2.iconType == IconType.ARROWS) { if ((parent.actual_status == Status_for_tab.MADEOFF) || (parent.actual_status == Status_for_tab.OFF)) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Red)); else { if (parent.actual_status == Status_for_tab.GPS_OFF) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Red));//red else m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationColor(parent.heading, SymbolColor.Green)); } } else { if (parent.is_emergency) m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationIcon(1, 6)); else m_graphicTracker.SetSymbol(GISID, busSymbGIS.GetSymbolFromOrientationIcon(1, 2)); } } } catch (Exception ex) { SM.Debug("Error on put ArcGIS simbol to the map:" + ex.ToString()); } } } catch (Exception ex) { SM.Debug("Update Symbolx msg:" + ex.ToString()); } } } public class Vehicle { [JsonIgnore] public Int32 IconID = 0; [JsonIgnore] private String iconName; public String IconName { get { return is_emergency ? iconName.Replace(".png", "_emerg.png") :iconName; } set { iconName = value; } } [JsonIgnore] public double lastLocLNG, lastLocLAT, lastLocALT; public double LNG, LAT, ALT; [JsonIgnore] public double prevLocLNG, prevLocLAT, prevLocALT; [JsonIgnore] public ArrayList schRunIcons = null; [JsonIgnore] public ArrayList actRun = null; public String busName = null; public String IMEI = null; [JsonIgnore] public List telemList = null; [JsonIgnore] public TelemetryPOS telemPos = null; public byte vehicleSpeed; [JsonIgnore] private byte DI; [JsonIgnore] private byte DO; [JsonIgnore] public Int32 heading; public Int32 lastActivityTime; public Int32 lastValidPositionTime; [JsonIgnore] public bool majorAlarm, minorAlarm; [JsonIgnore] public String driverPictureLocation = null; public String lastAddress; [JsonIgnore] public String idxGoogle = "0"; [JsonIgnore] private Status_for_tab actualStatus = Status_for_tab.UNKNOW; [JsonIgnore] public Status_for_tab actual_status { get { return actualStatus; } set { // update the previous status with the current actual status previousStatus = actualStatus; // update the current status actualStatus = value; //is_emergency = (value == Status_for_tab.EMERG); } } [JsonIgnore] private Status_for_tab previousStatus = Status_for_tab.UNKNOW; [JsonIgnore] public Status_for_tab PreviousStatus { get { return previousStatus; } set { previousStatus = value; } } [JsonIgnore] public bool selectCenter; [JsonIgnore] public double lastLATAddr = 0; [JsonIgnore] public double lastLNGAddr = 0; [JsonIgnore] public byte Color = 0; //0 - green; 1 - yellow; 2- red; public Int32 sc_id = 0; [JsonIgnore] public Int32 veh_id = 0; [JsonIgnore] public Int32 veh_hist_color = 0; [JsonIgnore] public Int32 gps_interval = 0; [JsonIgnore] public System.Drawing.Color histcolor = System.Drawing.Color.Cyan; [JsonIgnore] public Int32 act_instance = 0; [JsonIgnore] public Boolean RadioEnabled = true; [JsonIgnore] public ArrayList EventLists = new ArrayList(); [JsonIgnore] public String GwandRadioID = "0.0"; [JsonIgnore] private Int32 GPSSteps = 0; [JsonIgnore] public Boolean needAddress = false; [JsonIgnore] public Hashtable MapsHT = null; [JsonIgnore] private MainForm2 parent = null; [JsonIgnore] public Boolean is_stolen = false; [JsonIgnore] public SoundandPopup AlarmSound = null; private Boolean isEmergency; public Boolean is_emergency { get { return (actual_status == Status_for_tab.EMERG); } set { isEmergency = value; } // useless but needed because of legacy code } [JsonIgnore] public Boolean is_displayed = false; [JsonIgnore] public Boolean is_disabled = false; [JsonIgnore] public Boolean is_favorite = false; [JsonIgnore] public Boolean first_live_gps = false; [JsonIgnore] public Group group = null; public Boolean has_voice = false; public Boolean has_text = false; public Boolean inCall = false; public bool hasEmergencyAlert = false; public bool hasZoneAlert = false; public bool hasLoneWorkerAlert = false; public bool hasSpeedAlert = false; public bool hasEmailAlert = false; public bool hasLandmarkAlert = false; public bool hasTelemetryAlert = false; public bool canMakeSipCalls = false; public int sipID = -1; public Vehicle(String busNameParam, String driverPictureLocationParam, Int32 Color_param, Int32 IconID_param, String Imei_param, Int32 sc_id_param, Int32 veh_id_param, Int32 report_int_param, MainForm2 _parent, Boolean is_stolenParam, SoundandPopup _alarmSound) { parent = _parent; lastLocLNG = lastLocLAT = 0; LNG = LAT = 0; prevLocLNG = prevLocLAT = 0; busName = busNameParam; driverPictureLocation = driverPictureLocationParam; schRunIcons = new ArrayList(); sc_id = sc_id_param; IMEI = Imei_param; veh_id = veh_id_param; selectCenter = false; lastAddress = ""; Color = (Byte)Color_param; IconID = IconID_param; MapsHT = new Hashtable(); veh_hist_color = 0; act_instance = 0; gps_interval = report_int_param; telemList = new List(); needAddress = false; is_stolen = is_stolenParam; actual_status = Status_for_tab.UNKNOW; AlarmSound = _alarmSound; is_emergency = false; is_disabled = false; } public delegate void UpdateStatusLiveCallBack(String busname); public delegate void ChangeIconStatusForArrowTypeCallBack(String busname); public delegate void RemoveIconsFromMapCallBack(); public Boolean RemoveFromMap = false; public static String GetString_Status(Status_for_tab actual_status) { String Statusforgrid = "OFF"; switch (actual_status) { case Status_for_tab.DISABLE: Statusforgrid = "Disabled"; break; case Status_for_tab.ENABLE: Statusforgrid = "Enabled"; break; case Status_for_tab.ON: Statusforgrid = "ON"; break; case Status_for_tab.OFF: Statusforgrid = "OFF"; break; case Status_for_tab.GPS_ON: Statusforgrid = "GPS ON"; break; case Status_for_tab.GPS_POOR: Statusforgrid = "GPS POOR"; break; case Status_for_tab.GPS_OFF: Statusforgrid = "GPS OFF"; break; case Status_for_tab.NOGPSFIX: Statusforgrid = "NO GPS FIX"; break; case Status_for_tab.EMERG: Statusforgrid = "EMERGENCY"; break; case Status_for_tab.MADEOFF: Statusforgrid = "MADE OFF"; break; case Status_for_tab.MADEON: Statusforgrid = "MADE ON"; break; } return Statusforgrid; } public void SetARSOFF() { if (MainForm2.iconType == IconType.ARROWS) { parent.Invoke(new ChangeIconStatusForArrowTypeCallBack(MainForm2.ChangeIconStatusForArrowType), busName); } } public void AddNewLive(String TabName, AxMappointControlx mapControlParam, BusSymbols busSymbParam, DataSetx active, DataSetx hide) { MapsHT[TabName] = new MapElement(mapControlParam, busSymbParam, this, active, hide); } public void AddNewLiveGIS(String TabName, IGraphicTracker mapControlParam, BusSymbolsGIS busSymbParam, AxMapControl axmapParam) { MapsHT[TabName] = new MapElement(mapControlParam, busSymbParam, this, axmapParam); } /// /// Sets the address corresponding to the vehicle's last location /// /// public void SetLastAddress(string addressParam) { lastAddress = addressParam; lastLNGAddr = lastLocLNG; lastLATAddr = lastLocLAT; } public void SetIdxGoogle(string idxParam) { idxGoogle = idxParam; } public void CheckPositionInSystem() { if (GwandRadioID == "0.0") { try { DBvehiclesManager db4vehs = new DBvehiclesManager(MainForm2.ServerDBip, MainForm2.Schema, MainForm2.UserDB, MainForm2.PassDB, MainForm2.PortDB); UnitSysPosition tmp = db4vehs.getSystemPosition(sc_id); if (tmp != null) GwandRadioID = tmp.Gw_id + "." + tmp.R_gw_id; } catch (Exception ex) { SM.Debug("Error get from DB position of the station:" + ex.ToString()); } } } /// /// Gets the address corresponding to the vehicle's last location /// /// public string GetLastAddress() { if (needAddress) { return MainForm2.msgRetAddr; } else { if (lastAddress != "") return lastAddress; else return ""; } } public string GetIdxGoogle() { return idxGoogle; } /// /// Sets the vehicle speed /// /// public void SetSpeed(byte speedParam) { vehicleSpeed = speedParam; } /// /// Gets the vehicle speed /// /// public byte GetSpeed() { if (MainForm2.isInMile) return (byte)(vehicleSpeed * 0.621371192); else return vehicleSpeed; } /// /// Sets the time of the last transmission /// /// public void SetTime(Int32 timeParam) { lastActivityTime = timeParam; } /// /// Sets time for last valid gps value [ lat and long not equal to 0] /// /// public void SetValidGPSTime(Int32 timeParam) { lastValidPositionTime = timeParam; } /// /// Sets the time of the last transmission /// /// public void SetTimeFrist(Int32 timeParam) { lastActivityTime = timeParam; } /// /// Sets the vehicle DI /// /// public void SetDI(byte diParam) { DI = diParam; } /// /// Gets the vehicle DI /// /// public byte GetDI() { return DI; } /// /// Sets the vehicle DO /// /// public void SetDO(byte doParam) { DO = doParam; } /// /// Gets the vehicle DO /// /// public byte GetDO() { return DO; } public string GetHeadingDirection() { if (((heading >= 0) && (heading < 11.25)) || ((heading > 348.75) && (heading <= 360))) return "e"; else if ((heading >= 11.25) && (heading < 33.75)) return "ene"; else if ((heading >= 33.75) && (heading < 56.25)) return "ne"; else if ((heading >= 56.25) && (heading < 78.75)) return "nne"; else if ((heading >= 78.75) && (heading < 101.25)) return "n"; else if ((heading >= 101.25) && (heading < 123.75)) return "nnv"; else if ((heading >= 123.75) && (heading < 146.25)) return "nv"; else if ((heading >= 146.25) && (heading < 168.75)) return "vnv"; else if ((heading >= 168.75) && (heading < 191.25)) return "v"; else if ((heading >= 191.25) && (heading < 213.75)) return "vsv"; else if ((heading >= 213.75) && (heading < 236.25)) return "sv"; else if ((heading >= 236.25) && (heading < 258.75)) return "ssv"; else if ((heading >= 258.75) && (heading < 281.25)) return "s"; else if ((heading >= 281.25) && (heading < 303.75)) return "sse"; else if ((heading >= 303.75) && (heading < 326.25)) return "se"; else if ((heading >= 326.25) && (heading < 348.75)) return "ese"; else return "e"; } /// /// Sets the vehicle heading /// /// public void ChangeIcon(Int32 IconIDpar) { try { IconID = IconIDpar; if (MainForm2.iconType == IconType.ICONS) foreach (String obj in MapsHT.Keys) { if (((MapElement)MapsHT[obj]) != null) if (((MapElement)MapsHT[obj]).pp != null) ((MapElement)MapsHT[obj]).pp.Symbol = ((MapElement)MapsHT[obj]).busSymb.GetSymbolFromOrientationIcon(0, IconID); } } catch (Exception ex) { SM.Debug("Erorr on change icon" + ex.ToString()); } } /// /// Gets the vehicle heading /// /// public Int32 GetHeading() { return heading; } public void SetLAT(double param1) { LAT = param1; } public void SetLNG(double param1) { LNG = param1; } public void SetALT(double param1) { ALT = param1; } public void SetLATandLast(double param1) { LAT = param1; lastLocLAT = param1; } public void SetLNGandLast(double param1) { LNG = param1; lastLocLNG = param1; } public void SetALTandLast(double param1) { ALT = param1; lastLocALT = param1; } /// /// Gets the vehicle DO /// /// public Double GetLat() { return LAT; } /// /// Gets the vehicle DO /// /// public Double GetLng() { return LNG; } /// /// Gets the vehicle Altitude /// /// public Double GetAlt() { return ALT; } public override string ToString() { return busName; } } }