288 lines
6.9 KiB
C#
288 lines
6.9 KiB
C#
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace SafeMobileLib
|
|
{
|
|
|
|
public enum MapTYPE
|
|
{
|
|
Google = 1,
|
|
ArcGis = 2
|
|
}
|
|
|
|
public class UserReportTime
|
|
{
|
|
public int UserID { get; set; }
|
|
public string UserName { get; set; }
|
|
public int HH {get; set; }
|
|
public int MM { get; set; }
|
|
public bool ReportExecuted { get; set; }
|
|
}
|
|
|
|
public enum job_ticketing_date
|
|
{
|
|
created = 0,
|
|
started,
|
|
ended,
|
|
dueDate,
|
|
lastUpdate
|
|
}
|
|
|
|
public enum rep_type
|
|
{
|
|
RFID = 0,
|
|
GEOFENC,
|
|
SPEED,
|
|
EMERG,
|
|
LAND,
|
|
LOG,
|
|
ENDOFDAY,
|
|
STOP,
|
|
IDLE,
|
|
FLEET,
|
|
SMSRECIVE,
|
|
SMSSEND,
|
|
CALLRECIVE,
|
|
CALLSEND,
|
|
TELEMETRY_ALARM,
|
|
TELEMETRY_EVENT,
|
|
HIST,
|
|
ALLALARM,
|
|
SMS_LOCATION,
|
|
JOB_TICKETING
|
|
};
|
|
|
|
public enum car_state_e
|
|
{
|
|
CAR_RUNNING = 0,
|
|
CAR_START,
|
|
CAR_STOP,
|
|
CAR_HW
|
|
};
|
|
|
|
public class PositionData
|
|
{
|
|
public Int32 ReportingInterval { get; set; }
|
|
public Double Lat { get; set; }
|
|
public Double Lng { get; set; }
|
|
public String Address { get; set; }
|
|
public Int32 TimeGMT { get; set; }
|
|
public car_state_e Type { get; set; } // 0 = no name 1= stop 2 = road distance
|
|
public Int32 Speed { get; set; }
|
|
|
|
public PositionData(Double _lat, Double _lng, String _address, Int32 _timeGMT, car_state_e _type, Int32 _speed)
|
|
{
|
|
Lat = _lat;
|
|
Lng = _lng;
|
|
Address = _address;
|
|
TimeGMT = _timeGMT;
|
|
Type = _type;
|
|
Speed = _speed;
|
|
}
|
|
|
|
public PositionData()
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
public class LatLngZoom
|
|
{
|
|
public Double Lat { get; set; }
|
|
public Double Lng { get; set; }
|
|
public Int32 ZoomLevel { get; set; }
|
|
|
|
public LatLngZoom()
|
|
{
|
|
Lat = 0;
|
|
Lng = 0;
|
|
ZoomLevel = 2;
|
|
}
|
|
}
|
|
|
|
public class ONOFFData
|
|
{
|
|
public String Name { get; set; }
|
|
public String Time { get; set; }
|
|
public String Status { get; set; }
|
|
public Double lat { get; set; }
|
|
public Double lng { get; set; }
|
|
public Int32 sc_id { get; set; }
|
|
public Int32 timeGMT { get; set; }
|
|
}
|
|
|
|
public class SpeedData
|
|
{
|
|
public String Name { get; set; }
|
|
public String Speed { get; set; }
|
|
public String Time { get; set; }
|
|
public String Data { get; set; }
|
|
public String Address { get; set; }
|
|
public Int32 sc_id { get; set; }
|
|
public Int32 timeGMT { get; set; }
|
|
public Double lat { get; set; }
|
|
public Double lng { get; set; }
|
|
}
|
|
|
|
public class SMS_Location
|
|
{
|
|
public String Name { get; set; }
|
|
public String Time { get; set; }
|
|
public String Data { get; set; }
|
|
public String Address { get; set; }
|
|
public String Text_mess { get; set; }
|
|
public Int32 sc_id { get; set; }
|
|
public Int32 timeGMT { get; set; }
|
|
public Double lat { get; set; }
|
|
public Double lng { get; set; }
|
|
}
|
|
|
|
public class FleetData
|
|
{
|
|
public String Name { get; set; }
|
|
public String Distance { get; set; }
|
|
public String Trips { get; set; }
|
|
public String Start { get; set; }
|
|
public String Stop { get; set; }
|
|
}
|
|
|
|
public class ChartData
|
|
{
|
|
public String Type { get; set; }
|
|
public int Value { get; set; }
|
|
public ChartData(string _tip, int _numar)
|
|
{
|
|
Type = _tip;
|
|
Value = _numar;
|
|
}
|
|
public ChartData()
|
|
{
|
|
Type = "";
|
|
Value = 0;
|
|
}
|
|
}
|
|
|
|
public class LandData
|
|
{
|
|
public String Name { get; set; }
|
|
public String LandName { get; set; }
|
|
public String Time { get; set; }
|
|
public String LandType { get; set; }
|
|
}
|
|
|
|
public class EndOfDayData
|
|
{
|
|
public String Trip { get; set; }
|
|
public String StartTime { get; set; }
|
|
public String StopTime { get; set; }
|
|
public String StartAddress { get; set; }
|
|
public String StopAddress { get; set; }
|
|
public String Distance { get; set; }
|
|
}
|
|
|
|
public class StopData
|
|
{
|
|
public String Data { get; set; }
|
|
public String Time { get; set; }
|
|
public String Location { get; set; }
|
|
public String Duration { get; set; }
|
|
public Int32 timeGMT = 0;
|
|
public Double unique_id = 0;
|
|
public Int32 unit_sc_id { get; set;}
|
|
public String unit_name { get; set; }
|
|
}
|
|
|
|
public class FleetIdandPos
|
|
{
|
|
public String Name;
|
|
public ArrayList Position;
|
|
}
|
|
|
|
public class Stops
|
|
{
|
|
public String name;
|
|
public Int32 start, stop;
|
|
public Double lat, lng;
|
|
public string address;
|
|
public car_state_e type;
|
|
public Stops()
|
|
{
|
|
name = "";
|
|
}
|
|
}
|
|
|
|
public class AddrAndID
|
|
{
|
|
public String Address = "";
|
|
public Int32 ID = 0;
|
|
public Int32 mapPointID = 0;
|
|
public Double LAT = 0;
|
|
public Double LNG = 0;
|
|
public Int32 step = 0;
|
|
public String Name = "";
|
|
public AddrAndID(Int32 _ID, Double _LAT, Double _LNG)
|
|
{
|
|
ID = _ID;
|
|
LAT = _LAT;
|
|
LNG = _LNG;
|
|
Name = "";
|
|
step = 0;
|
|
mapPointID = 0;
|
|
}
|
|
|
|
public AddrAndID(String _Name, Double _LAT, Double _LNG)
|
|
{
|
|
ID = 0;
|
|
LAT = _LAT;
|
|
LNG = _LNG;
|
|
Name = _Name;
|
|
step = 0;
|
|
mapPointID = 0;
|
|
}
|
|
|
|
public AddrAndID(String _Name, Int32 _mapPointID, Double _LAT, Double _LNG)
|
|
{
|
|
ID = 0;
|
|
LAT = _LAT;
|
|
LNG = _LNG;
|
|
Name = _Name;
|
|
step = 0;
|
|
mapPointID = _mapPointID;
|
|
}
|
|
|
|
public AddrAndID(AddrAndID _instanta)
|
|
{
|
|
ID = _instanta.ID;
|
|
LAT = _instanta.LAT;
|
|
LNG = _instanta.LNG;
|
|
Name = _instanta.Name;
|
|
step = 0;
|
|
mapPointID = _instanta.mapPointID;
|
|
}
|
|
}
|
|
|
|
public class DistanceCalc
|
|
{
|
|
private Double Lat, Lng, Lat2, Lng2;
|
|
public DistanceCalc(Double _lat, Double _lng, Double _lat2, Double _lng2)
|
|
{
|
|
Lat = _lat;
|
|
Lng = _lng;
|
|
Lat2 = _lat2;
|
|
Lng2 = _lng2;
|
|
}
|
|
|
|
public double GetDistance()
|
|
{
|
|
double pi = 3.1415926535897932384626433832795;
|
|
double rad = 180 / pi;
|
|
double dist = (3958 * pi * Math.Sqrt((Lat2 - Lat) * (Lat2 - Lat) + Math.Cos(Lat2 / rad) * Math.Cos(Lat / rad) * (Lng2 - Lng) * (Lng2 - Lng)) / 180);
|
|
return Math.Round(((dist * 1.609344) * 1000)) / 1000;
|
|
}
|
|
}
|
|
}
|