1117 lines
38 KiB
C#
1117 lines
38 KiB
C#
//#define arges
|
|
using System;
|
|
using System.Collections;
|
|
using System.Drawing;
|
|
using System.Threading;
|
|
using Safedispatch_4_0;
|
|
using SafeMobileLib;
|
|
using Dispatcher.maptab;
|
|
|
|
namespace MapGoogle
|
|
{
|
|
//public enum MapTYPE
|
|
//{
|
|
// Google = 1,
|
|
// ArcGis = 2
|
|
//}
|
|
|
|
public enum SymbolColor
|
|
{
|
|
Brown = 1,
|
|
Green = 2,
|
|
Red = 3
|
|
}
|
|
|
|
public enum GeoMapRegionx
|
|
{
|
|
geoMapNorthAmerica = 1,
|
|
geoMapEurope = 2,
|
|
}
|
|
|
|
public enum GeoMapStylex
|
|
{
|
|
geoMapStyleRoad = 0,
|
|
geoMapStyleRoadData = 1,
|
|
geoMapStyleData = 2,
|
|
geoMapStyleTerrain = 3,
|
|
geoMapStylePolitical = 4,
|
|
geoMapStyleNight = 5,
|
|
}
|
|
|
|
public enum GeoDragBehaviorx
|
|
{
|
|
geoDragNone = 0,
|
|
geoDragHand = 1,
|
|
geoDragBox = 2,
|
|
geoDragOther = 3,
|
|
}
|
|
|
|
public enum GeoPointerx
|
|
{
|
|
geoPointerDefault = 0,
|
|
geoPointerArrow = 1,
|
|
geoPointerCrosshair = 2,
|
|
geoPointerIbeam = 3,
|
|
geoPointerSizeNESW = 6,
|
|
geoPointerSizeNS = 7,
|
|
geoPointerSizeNWSE = 8,
|
|
geoPointerSizeWE = 9,
|
|
geoPointerUpArrow = 10,
|
|
geoPointerHourglass = 11,
|
|
geoPointerNoDrop = 12,
|
|
geoPointerArrowHourglass = 13,
|
|
geoPointerArrowQuestion = 14,
|
|
geoPointerSizeAll = 15,
|
|
geoPointerHand = 23,
|
|
}
|
|
|
|
public enum GeoUnitsx
|
|
{
|
|
geoMiles = 0,
|
|
geoKm = 1,
|
|
}
|
|
|
|
public enum GeoBalloonStatex
|
|
{
|
|
geoDisplayNone = 0,
|
|
geoDisplayName = 1,
|
|
geoDisplayBalloon = 2,
|
|
}
|
|
|
|
public enum GeoAutoShapeTypex
|
|
{
|
|
geoShapeRectangle = 1,
|
|
geoShapeOval = 9,
|
|
geoShapeRadius = 1009,
|
|
}
|
|
|
|
public class Toolbarx
|
|
{
|
|
public int Index; //{ get; }
|
|
public string Name; //{ get; }
|
|
public bool Visible; //{ get; set; }
|
|
}
|
|
|
|
public class Toolbarsx : IEnumerable
|
|
{
|
|
private Toolbarx testTlb = new Toolbarx();
|
|
public Toolbarx get_Item(ref object Index)
|
|
{
|
|
return testTlb;
|
|
}
|
|
ArrayList test;
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
return (test as IEnumerable).GetEnumerator();
|
|
}
|
|
}
|
|
|
|
public class PlaceCategoriesx : IEnumerable
|
|
{
|
|
public int Count; //{ get; }
|
|
public PlaceCategoryx get_Item(ref object Index)
|
|
{
|
|
return null;
|
|
}
|
|
ArrayList test;
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
return (test as IEnumerable).GetEnumerator();
|
|
}
|
|
}
|
|
|
|
public class PlaceCategoryx
|
|
{
|
|
public int Index; //{ get; }
|
|
public string Name; //{ get; }
|
|
public bool Visible; //{ get; set; }
|
|
}
|
|
|
|
public class StreetAddressx
|
|
{
|
|
public string City =""; //{ get; }
|
|
public string Region=""; //{ get; }
|
|
public string Street=""; //{ get; }
|
|
public string Value=""; //{ get; }
|
|
}
|
|
|
|
public class Symbolsx : IEnumerable
|
|
{
|
|
private int NextCount = 1;
|
|
private ArrayList symbolsArray = new ArrayList();
|
|
public AxMappointControlx parent;
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return symbolsArray.Count;
|
|
}
|
|
}
|
|
public Symbolx Add(string FileName)
|
|
{
|
|
Symbolx ret = new Symbolx();
|
|
NextCount++;
|
|
ret.ID = (byte)NextCount;
|
|
String[] param = FileName.Split('\\');
|
|
if (param.Length != 0)
|
|
ret.Name = param[param.Length - 1];
|
|
symbolsArray.Add(ret);
|
|
return ret;
|
|
}
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
return (symbolsArray as IEnumerable).GetEnumerator();
|
|
}
|
|
}
|
|
|
|
public class Symbolx
|
|
{
|
|
public short IDpriv;
|
|
public short ID
|
|
{
|
|
get
|
|
{
|
|
return IDpriv;
|
|
}
|
|
set
|
|
{
|
|
IDpriv = value;
|
|
}
|
|
} //{ get; }
|
|
public string Name =""; //{ get; set; }
|
|
public void Delete()
|
|
{
|
|
}
|
|
}
|
|
|
|
public class Recordsetx
|
|
{
|
|
public DataSetx tmpDataset;
|
|
public AxMappointControlx parent;
|
|
public Hashtable PushpinHash=null;
|
|
public int CountHash = -1;
|
|
|
|
public bool EOF
|
|
{
|
|
get
|
|
{
|
|
if (PushpinHash == null)
|
|
return true;
|
|
if (CountHash < (PushpinHash.Keys.Count-1))
|
|
{
|
|
CountHash++;
|
|
int cnt = -1;
|
|
String s = "";
|
|
foreach (String obj in PushpinHash.Keys)
|
|
{
|
|
cnt++;
|
|
if (CountHash == cnt)
|
|
{
|
|
s = obj;
|
|
break;
|
|
}
|
|
}
|
|
Pushpin = (Pushpinx)PushpinHash[s];
|
|
Pushpin.parent = parent;
|
|
return false;
|
|
}
|
|
else
|
|
return true;
|
|
}
|
|
}
|
|
public Pushpinx Pushpin; //{ get; }
|
|
|
|
public void MoveFirst()
|
|
{
|
|
|
|
}
|
|
public void MoveNext()
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
public class DataSetx
|
|
{
|
|
public string Name; //{ get; set; }
|
|
public int RecordCount=0;
|
|
public AxMappointControlx parent =null;
|
|
public Recordsetx RecSet = null;
|
|
public Hashtable Pushpins = new Hashtable();
|
|
public bool zoomin = true;
|
|
public void Delete()
|
|
{
|
|
if (MainForm2.MapType == MapTYPE.Google)
|
|
Pushpins.Clear();
|
|
}
|
|
|
|
public void DisplayPushpinMap()
|
|
{ }
|
|
|
|
public Recordsetx QueryAllRecords()
|
|
{
|
|
Recordsetx tmpRec = new Recordsetx();
|
|
tmpRec.PushpinHash = Pushpins;
|
|
tmpRec.parent = parent;
|
|
return tmpRec;
|
|
}
|
|
|
|
public void Select()
|
|
{ }
|
|
|
|
public static string retname(short txt)
|
|
{
|
|
String s="";
|
|
if (txt > 1)
|
|
{
|
|
s = "fane";
|
|
}
|
|
else
|
|
{
|
|
if (txt == 0) s = "STOP.png";
|
|
else if (txt == 1) s = "PIN.png";
|
|
}
|
|
return s;
|
|
}
|
|
|
|
|
|
public void ZoomTo()
|
|
{
|
|
Utils.WriteLine("Zoom to was called !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
String datasetCMD = "";
|
|
try
|
|
{
|
|
Thread p = new Thread(() =>
|
|
{
|
|
if (MainForm2.MapType == MapTYPE.Google)
|
|
{
|
|
//Console.WriteLine("STEP2.1 Name:" + Name);
|
|
if (!Name.Contains("corners"))
|
|
{
|
|
//Console.WriteLine("STEP2.2 Pushpins Count:" + Pushpins.Keys.Count);
|
|
if (Pushpins.Keys.Count >= 1)
|
|
{
|
|
|
|
ArrayList listKeys = new ArrayList();
|
|
foreach (String obj in Pushpins.Keys)
|
|
listKeys.Add(obj);
|
|
|
|
listKeys.Sort();
|
|
|
|
//Console.WriteLine("STEP2.3 Create setDataset");
|
|
datasetCMD = "setDataset," + Name;
|
|
lock (this)
|
|
{
|
|
int count = 0;
|
|
foreach (String obj in listKeys)
|
|
{
|
|
// break because the pushpins collection was changed in other place
|
|
if (!Pushpins.ContainsKey(obj))
|
|
break;
|
|
|
|
count++;
|
|
Vehicle veh = ((Vehicle)MainForm2.vehicleHT[((Pushpinx)Pushpins[obj]).Name]);
|
|
|
|
if (veh == null)
|
|
{
|
|
// i have a landmark pushpin
|
|
datasetCMD = datasetCMD + "," + MainForm2.FixDoubleLAT(((Pushpinx)Pushpins[obj]).Location.Latitude.ToString()) + ","
|
|
+ MainForm2.FixDoubleLNG(((Pushpinx)Pushpins[obj]).Location.Longitude.ToString()) + ","
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ","
|
|
+ MainForm2.FixComma(((Pushpinx)Pushpins[obj]).Name) + ","
|
|
+ "speed" + ","
|
|
+ "alt" + ","
|
|
+ "address".Replace(',', ' ') + ","
|
|
+ "landmarks/" + ((Pushpinx)Pushpins[obj]).GetSymbName() + ","
|
|
+ "false" + "," + "false" + "," + "false";
|
|
}
|
|
else
|
|
{
|
|
DateTime positionTime = ((veh).lastValidPositionTime.ConvertGMTToLocal()).GetDTFromSeconds();
|
|
|
|
Boolean hasVoice = veh.has_voice;
|
|
Boolean hasText = veh.has_text;
|
|
Boolean isInCall = veh.inCall;
|
|
|
|
int smsLength = SmsUtils.GetMaxNumberOfCharacters(MainForm2.radioType);
|
|
|
|
#region mapCallTimeout
|
|
int mapCallTimeout = 3;
|
|
((Vehicle)MainForm2.vehicleHT[((Pushpinx)Pushpins[obj]).Name]).CheckPositionInSystem();
|
|
string GatewayAndRadioID = ((Vehicle)MainForm2.vehicleHT[((Pushpinx)Pushpins[obj]).Name]).GwandRadioID;
|
|
int gwType = (int)GatewayType.Unknown;
|
|
if (MainForm2.radioGwHT[GatewayAndRadioID] != null)
|
|
{
|
|
if (((RadioGateway)MainForm2.radioGwHT[GatewayAndRadioID]).Type == (int)GatewayType.Broadband || ((RadioGateway)MainForm2.radioGwHT[GatewayAndRadioID]).Type == (int)GatewayType.Tier3Radio)
|
|
{
|
|
mapCallTimeout = MainForm2.MapCallTimeout;
|
|
}
|
|
gwType = ((RadioGateway)MainForm2.radioGwHT[GatewayAndRadioID]).Type;
|
|
smsLength = SmsUtils.GetMaxNumberOfCharacters(gwType);
|
|
}
|
|
#endregion
|
|
|
|
string iconName = ((Pushpinx)Pushpins[obj]).GetSymbName();
|
|
if (veh.is_emergency)
|
|
{
|
|
iconName = iconName.Replace(".png", "_FF79A6_l.png");
|
|
|
|
// check and create emergency icon
|
|
MainForm2.CheckCreateEmergencyIcon(veh.IconID);
|
|
}/*
|
|
else if (MainForm2.Displaywithname)
|
|
{
|
|
iconName = iconName.Replace(".png", "_" + veh.IconID + "_" + veh.sc_id + ".png");
|
|
// check and create emergency icon
|
|
MainForm2.CheckCreateNamedIcon(veh.IconID, veh.busName, veh.sc_id);
|
|
}*/
|
|
|
|
datasetCMD = datasetCMD + ","
|
|
+ MainForm2.FixDoubleLAT(((Pushpinx)Pushpins[obj]).Location.Latitude.ToString()) + ","
|
|
+ MainForm2.FixDoubleLNG(((Pushpinx)Pushpins[obj]).Location.Longitude.ToString()) + ","
|
|
+ positionTime.ToString("yyyy-MM-dd HH:mm:ss") + ","
|
|
+ veh.busName + ","
|
|
+ veh.GetSpeed() + (MainForm2.isInMile ? "mph" : "kph") + ","
|
|
+ veh.GetAlt() + ","
|
|
+ veh.GetLastAddress().Replace(',', ' ') + ","
|
|
//+ ((Pushpinx)Pushpins[obj]).GetSymbName() + ","
|
|
+ iconName + "," + (hasVoice ? mapCallTimeout : 0) + "," + (hasText ? smsLength : 0) + "," + isInCall;
|
|
}
|
|
|
|
// send command if the number of units is 20
|
|
if (count > 20)
|
|
{
|
|
datasetCMD = datasetCMD.Replace(';', ' ');
|
|
if (parent.parLive != null)
|
|
parent.parLive.setdatasetBool = true;
|
|
//parent.mapGoogles.ExecuteScript("window.GWTcallback('showconsole,true');");
|
|
//Console.WriteLine("STEP4 Comanda1:"+datasetCMD);
|
|
Thread.Sleep(1);
|
|
parent.mapGoogles.ExecuteScript("window.GWTcallback('" + datasetCMD + "');");
|
|
//Console.WriteLine("STEP4 Comanda1:"+datasetCMD);
|
|
Thread.Sleep(1);
|
|
/*
|
|
if (zoomin)
|
|
{
|
|
parent.mapGoogles.ExecuteScript("window.GWTcallback('" + "putOnMap,true," + Name + "');");
|
|
//Console.WriteLine("STEP5 Comanda2:" + "putOnMap,true," + Name);
|
|
}
|
|
else
|
|
{
|
|
if (Pushpins.Keys.Count == 1) parent.mapGoogles.ExecuteScript("window.GWTcallback('" + "putOnMap,true," + Name + "');");
|
|
else parent.mapGoogles.ExecuteScript("window.GWTcallback('" + "putOnMap,false," + Name + "');");
|
|
//Console.WriteLine("STEP5 Comanda2:" + "putOnMap,false," + Name);
|
|
}*/
|
|
|
|
datasetCMD = "updateDataset," + Name;
|
|
count = 0;
|
|
Thread.Sleep(3000);
|
|
}
|
|
}
|
|
}
|
|
datasetCMD = datasetCMD.Replace(';', ' ');
|
|
if (parent.parLive != null)
|
|
parent.parLive.setdatasetBool = true;
|
|
//parent.mapGoogles.ExecuteScript("window.GWTcallback('showconsole,true');");
|
|
//Console.WriteLine("STEP4 Comanda1:"+datasetCMD);
|
|
Thread.Sleep(1);
|
|
parent.mapGoogles.ExecuteScript("window.GWTcallback('" + datasetCMD + "');");
|
|
//Console.WriteLine("STEP4 Comanda1:"+datasetCMD);
|
|
Thread.Sleep(1);
|
|
if (zoomin)
|
|
{
|
|
parent.mapGoogles.ExecuteScript("window.GWTcallback('" + "putOnMap,true," + Name + "');");
|
|
//Console.WriteLine("STEP5 Comanda2:" + "putOnMap,true," + Name);
|
|
}
|
|
else
|
|
{
|
|
if (Pushpins.Keys.Count == 1) parent.mapGoogles.ExecuteScript("window.GWTcallback('" + "putOnMap,true," + Name + "');");
|
|
else parent.mapGoogles.ExecuteScript("window.GWTcallback('" + "putOnMap,false," + Name + "');");
|
|
//Console.WriteLine("STEP5 Comanda2:" + "putOnMap,false," + Name);
|
|
}
|
|
|
|
/*
|
|
System.Threading.Thread.Sleep(100);
|
|
parent.mapGoogles.ExecuteScript("window.GWTcallback('" + "removeLabels," + Name + "');");
|
|
|
|
|
|
Thread.Sleep(100);*/
|
|
}
|
|
else
|
|
{
|
|
datasetCMD = "removeDataset," + Name;
|
|
parent.mapGoogles.ExecuteScript("window.GWTcallback('" + datasetCMD + "');");
|
|
Thread.Sleep(1);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
//p.Start();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SM.Debug("Erorr on zoom " + ex.Message + ex.StackTrace);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public class Shapesx : IEnumerable
|
|
{
|
|
public AxMappointControlx parent = null;
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return shapeArray.Count;
|
|
}
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
shapeArray.Clear();
|
|
}
|
|
|
|
public ArrayList shapeArray = new ArrayList();
|
|
private Int32 IdName = 0;
|
|
public Shapex AddDrivetimeZone(Locationx Center, double Time)
|
|
{
|
|
return null;
|
|
}
|
|
public Shapex AddLine(Locationx BeginLocation, Locationx EndLocation)
|
|
{
|
|
Locationx[] tmpPos = new Locationx[2];
|
|
tmpPos[0] = BeginLocation;
|
|
tmpPos[1] = EndLocation;
|
|
Shapex tmp = new Shapex(this);
|
|
tmp.parent = parent;
|
|
if (MainForm2.MapType == MapTYPE.Google)
|
|
{
|
|
try
|
|
{
|
|
parent.cntShape++;
|
|
tmp.Name = "shape" + parent.cntShape.ToString();
|
|
MainForm2.ShapeCMD = "setDataset," + "shape" + parent.cntShape.ToString();
|
|
MainForm2.ShapeCMD = MainForm2.ShapeCMD + ","
|
|
+ MainForm2.FixDoubleLAT(BeginLocation.Latitude.ToString()) + ","
|
|
+ MainForm2.FixDoubleLNG(BeginLocation.Longitude.ToString()) + ","
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",,,,,,false,false,false";
|
|
//MainForm2.ShapeCMD = MainForm2.ShapeCMD + "," + MainForm2.FixDoubleLAT(EndLocation.Latitude.ToString()) + "," + MainForm2.FixDoubleLNG(EndLocation.Longitude.ToString()) + ",,,";
|
|
MainForm2.ShapeCMD = MainForm2.ShapeCMD + "," + MainForm2.FixDoubleLAT(EndLocation.Latitude.ToString()) + "," + MainForm2.FixDoubleLNG(EndLocation.Longitude.ToString()) + ",,,,,,,false,false,false";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SM.Debug("Erorr on zoom " + ex.Message);
|
|
}
|
|
}
|
|
shapeArray.Add(tmp);
|
|
return tmp;
|
|
}
|
|
public Shapex AddPolyline(object ArrayOfLocations)
|
|
{
|
|
Locationx[] tmpPos = (Locationx[])ArrayOfLocations;
|
|
Shapex tmp = new Shapex(this);
|
|
tmp.parent = parent;
|
|
|
|
if (MainForm2.MapType == MapTYPE.Google)
|
|
{
|
|
parent.cntShape++;
|
|
try
|
|
{
|
|
MainForm2.ShapeCMD = "setDataset," + "shape" + parent.cntShape.ToString();
|
|
foreach (Locationx obj in tmpPos)
|
|
{
|
|
MainForm2.ShapeCMD = MainForm2.ShapeCMD + "," + MainForm2.FixDoubleLAT(obj.Latitude.ToString()) + "," + MainForm2.FixDoubleLNG(obj.Longitude.ToString()) +","
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",,,,,,false,false,false";
|
|
}
|
|
tmp.Name = "shape" + parent.cntShape.ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SM.Debug("Erorr on zoom " + ex.Message);
|
|
}
|
|
|
|
shapeArray.Add(tmp);
|
|
}
|
|
return tmp;
|
|
}
|
|
|
|
public Shapex AddShape(GeoAutoShapeTypex Type, Locationx Center, double Width, double Height)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
return (shapeArray as IEnumerable).GetEnumerator();
|
|
}
|
|
}
|
|
|
|
public class Shapex
|
|
{
|
|
public Shapex(Shapesx tmp)
|
|
{
|
|
parent = tmp.parent;
|
|
Line = new LineFormatx(this);
|
|
Fill = new FillFormatx(this);
|
|
}
|
|
public GeoAutoShapeTypex AutoShapeType; //{ get; }
|
|
public FillFormatx Fill; //{ get; }
|
|
public int FontColor; //{ get; set; }
|
|
public double Height; //{ get; set; }
|
|
public LineFormatx Line;
|
|
public bool SizeVisible; //{ get; set; }
|
|
public string Text; //{ get; set; }
|
|
public double Width;
|
|
public int ZOrderPosition; //{ get; set; }
|
|
public int ID = 0;
|
|
|
|
public AxMappointControlx parent = null;
|
|
|
|
private string Nameprv="";
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return Nameprv;
|
|
}
|
|
set
|
|
{
|
|
Nameprv = value;
|
|
}
|
|
}
|
|
|
|
public void Delete()
|
|
{
|
|
|
|
}
|
|
|
|
public void Select()
|
|
{ }
|
|
}
|
|
|
|
public class LineFormatx
|
|
{
|
|
public AxMappointControlx parent = null;
|
|
public LineFormatx(Shapex shapeParam)
|
|
{
|
|
shape = shapeParam;
|
|
parent = shape.parent;
|
|
}
|
|
public Shapex shape;
|
|
public Color color;
|
|
public int ForeColor
|
|
{
|
|
get
|
|
{
|
|
return 1; /// nu citesct nici odata culaore si daca e cred ca e BLACK
|
|
}
|
|
set
|
|
{
|
|
switch (value)
|
|
{
|
|
case 16776960: color = Color.Aqua;
|
|
break;
|
|
case 16711680: color = Color.Blue;
|
|
break;
|
|
case 14822282: color = Color.BlueViolet;
|
|
break;
|
|
case 65407: color = Color.Chartreuse;
|
|
break;
|
|
case 3937500: color = Color.Crimson;
|
|
break;
|
|
case 9109504: color = Color.DarkBlue;
|
|
break;
|
|
case 9109643: color = Color.DarkMagenta;
|
|
break;
|
|
case 13749760: color = Color.DarkTurquoise;
|
|
break;
|
|
case 9639167: color = Color.DeepPink;
|
|
break;
|
|
case 16760576: color = Color.DeepSkyBlue;
|
|
break;
|
|
case 2263842: color = Color.ForestGreen;
|
|
break;
|
|
case 16711935: color = Color.Fuchsia;
|
|
break;
|
|
case 3145645: color = Color.GreenYellow;
|
|
break;
|
|
case 11823615: color = Color.HotPink;
|
|
break;
|
|
case 16436871: color = Color.LightSkyBlue;
|
|
break;
|
|
case 65280: color = Color.Lime;
|
|
break;
|
|
case 17919: color = Color.OrangeRed;
|
|
break;
|
|
case 8388736: color = Color.Purple;
|
|
break;
|
|
case 255: color = Color.Red;
|
|
break;
|
|
case 15453831: color = Color.SkyBlue;
|
|
break;
|
|
case 8388352: color = Color.SpringGreen;
|
|
break;
|
|
case 15631086: color = Color.Violet;
|
|
break;
|
|
}
|
|
if (MainForm2.MapType == MapTYPE.Google)
|
|
{
|
|
parent.ListShapeCMD.Add(MainForm2.ShapeCMD);
|
|
String[] listS = MainForm2.ShapeCMD.Split(',');
|
|
//String PolyCMD = "poly,false," + "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2") + "," + Weight + "," + listS[1];
|
|
String PolyCMD = "poly,true," + "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2") + "," + Weight + "," + listS[1];
|
|
parent.ListShapeCMD.Add(PolyCMD);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool Visible; //{ get; set; }
|
|
private int WeightPrv;
|
|
public int Weight
|
|
{
|
|
get
|
|
{
|
|
return WeightPrv;
|
|
}
|
|
set
|
|
{
|
|
WeightPrv = value;
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public class FillFormatx
|
|
{
|
|
//public int ForeColor; //{ get; set; } // nu il fac ca nu il utilize e la fel ca... culoare de sus
|
|
public FillFormatx(Shapex shapeParam)
|
|
{
|
|
shape = shapeParam;
|
|
}
|
|
public Shapex shape;
|
|
public int ForeColor
|
|
{
|
|
set
|
|
{
|
|
|
|
}
|
|
}
|
|
public bool Visible; //{ get; set; }
|
|
}
|
|
|
|
public class Locationx
|
|
{
|
|
public bool Highlight; //{ get; set; }
|
|
public bool IsHighlightable; //{ get; }
|
|
public double Latitude; //{ get; }
|
|
public double Longitude; //{ get; }
|
|
public string Name; //{ get; }
|
|
public PlaceCategoryx PlaceCategory; //{ get; }
|
|
public StreetAddressx StreetAddress = new StreetAddressx(); //{ get; }
|
|
|
|
public double DistanceTo(Locationx From)
|
|
{
|
|
double pi = 3.1415926535897932384626433832795;
|
|
double rad = 180 / pi;
|
|
double dist = (3958 * pi * Math.Sqrt((Latitude - From.Latitude) * (Latitude - From.Latitude) + Math.Cos(Latitude / rad) * Math.Cos(From.Latitude / rad) * (Longitude - From.Longitude) * (Longitude - From.Longitude)) / 180);
|
|
return Math.Round(((dist * 1.609344) * 1000))/1000;
|
|
}
|
|
public ArrayList FindNearby(double Distance)
|
|
{
|
|
return null;
|
|
}
|
|
public void GoTo()
|
|
{ }
|
|
}
|
|
|
|
public class Pushpinx
|
|
{
|
|
public AxMappointControlx parent=null;
|
|
private GeoBalloonStatex BalloonStatePriv = GeoBalloonStatex.geoDisplayNone;
|
|
public DataSetx ActualDataset = null;
|
|
public int dimPush = 25;
|
|
|
|
public GeoBalloonStatex BalloonState
|
|
{
|
|
get
|
|
{
|
|
return BalloonStatePriv;
|
|
}
|
|
set
|
|
{
|
|
BalloonStatePriv = (GeoBalloonStatex)value;
|
|
}
|
|
}
|
|
|
|
public bool Highlight
|
|
{
|
|
set
|
|
{
|
|
}
|
|
}
|
|
|
|
private string Nameprv;
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return Nameprv;
|
|
}
|
|
set
|
|
{
|
|
Nameprv = value;
|
|
}
|
|
}
|
|
private string Noteprv;
|
|
public Locationx Locationprv;
|
|
|
|
public Locationx Location
|
|
{
|
|
get
|
|
{
|
|
return Locationprv;
|
|
}
|
|
set
|
|
{
|
|
Locationprv = value;
|
|
}
|
|
}
|
|
|
|
|
|
public string Note
|
|
{
|
|
get
|
|
{
|
|
return Noteprv;
|
|
}
|
|
set
|
|
{
|
|
Noteprv = (String)value;
|
|
}
|
|
}
|
|
|
|
private short Symbolprv = -1;
|
|
public short Symbol
|
|
{
|
|
get
|
|
{
|
|
return Symbolprv;
|
|
}
|
|
set
|
|
{
|
|
if (MainForm2.MapType == MapTYPE.Google) Symbolprv = value;
|
|
}
|
|
}
|
|
|
|
public String GetSymbName()
|
|
{
|
|
String s = "";
|
|
if (Symbolprv > 1)
|
|
{
|
|
foreach (Symbolx obj in parent.ActiveMap.Symbols)
|
|
if (obj.ID == Symbolprv)
|
|
{
|
|
s = obj.Name;
|
|
s = s.ToLower();
|
|
s = s.Replace(".ico", ".png");
|
|
s = s.Replace(".bmp", ".png");
|
|
//if ((s.Length > 3) && (s[2] == '_'))
|
|
if(s.Contains("arrow"))
|
|
{
|
|
//s = s.Remove(0, 3);
|
|
s = "images/" + s;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (Symbolprv == 0) s = "STOP.png";
|
|
else if (Symbolprv == 1) s = "PIN.png";
|
|
}
|
|
return s;
|
|
}
|
|
|
|
|
|
public void Delete()
|
|
{
|
|
if (MainForm2.MapType == MapTYPE.Google)
|
|
{
|
|
if (ActualDataset != null)
|
|
{
|
|
ActualDataset.Pushpins.Remove(Name);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Select()
|
|
{
|
|
|
|
}
|
|
|
|
public void MoveTo(DataSetx NewDataSet)
|
|
{
|
|
if (MainForm2.MapType == MapTYPE.Google)
|
|
{
|
|
if ((Math.Round(Locationprv.Latitude) == 0) && (Math.Round(Locationprv.Longitude) == 0)) { ;}
|
|
else
|
|
{
|
|
if (NewDataSet.Pushpins[Name] != null)
|
|
NewDataSet.Pushpins.Remove(Name);
|
|
NewDataSet.Pushpins.Add(Name, this);
|
|
NewDataSet.RecordCount++;
|
|
}
|
|
if ((ActualDataset != null) && (ActualDataset.Name != NewDataSet.Name))
|
|
ActualDataset.Pushpins.Remove(Name);
|
|
ActualDataset = NewDataSet;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
public class DataSetsx : IEnumerable
|
|
{
|
|
public AxMappointControlx parent;
|
|
private ArrayList datasetArray = new ArrayList();
|
|
|
|
public DataSetx AddPushpinSet(string Name)
|
|
{
|
|
DataSetx tmp = new DataSetx();
|
|
tmp.Name = Name;
|
|
tmp.parent = parent;
|
|
datasetArray.Add(tmp);
|
|
return tmp;
|
|
}
|
|
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
return (datasetArray as IEnumerable).GetEnumerator();
|
|
}
|
|
|
|
}
|
|
|
|
public class FindResultsx : IEnumerable
|
|
{
|
|
public ArrayList rezArray= new ArrayList();
|
|
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return rezArray.Count;
|
|
}
|
|
}
|
|
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
return (rezArray as IEnumerable).GetEnumerator();
|
|
}
|
|
}
|
|
|
|
public class Mapx
|
|
{
|
|
public Mapx()
|
|
{
|
|
Application = new Application(this);
|
|
}
|
|
public Application Application =null;
|
|
public double Altitude;
|
|
public DataSetsx DataSets = new DataSetsx();
|
|
public GeoDragBehaviorx DragBehavior; //{ get; set; }
|
|
public Boolean refaddr = true;
|
|
|
|
private Locationx LocationPrv;
|
|
public Locationx Location
|
|
{
|
|
get { return LocationPrv; }
|
|
set
|
|
{
|
|
LocationPrv = value;
|
|
}
|
|
}
|
|
public GeoMapStylex MapStyle; //{ get; set; }
|
|
public PlaceCategoriesx PlaceCategories = new PlaceCategoriesx();
|
|
public bool Saved; //{ get; set; }
|
|
|
|
public Shapesx Shapes = new Shapesx();
|
|
public Symbolsx Symbols = new Symbolsx();
|
|
public AxMappointControlx parent;
|
|
public Pushpinx AddPushpin(Locationx AtLocation, string Name)
|
|
{
|
|
Pushpinx tmpPush = new Pushpinx();
|
|
tmpPush.Location = AtLocation;
|
|
tmpPush.Name = Name;
|
|
tmpPush.parent = parent;
|
|
return tmpPush;
|
|
}
|
|
public double Distance(Locationx StartLocation, Locationx EndLocation)
|
|
{
|
|
return 0;
|
|
}
|
|
public Pushpinx FindPushpin(string Name)
|
|
{
|
|
Pushpinx tmp = null;
|
|
foreach (DataSetx obj in DataSets)
|
|
{
|
|
if (obj.Pushpins[Name] != null)
|
|
{
|
|
tmp = (Pushpinx)obj.Pushpins[Name];
|
|
break;
|
|
}
|
|
}
|
|
return tmp;
|
|
}
|
|
public Locationx GetLocation(double Latitude, double Longitude, double Altitude)
|
|
{
|
|
Locationx tmpLoc = new Locationx();
|
|
tmpLoc.Latitude = Latitude;
|
|
tmpLoc.Longitude = Longitude;
|
|
return tmpLoc;
|
|
}
|
|
|
|
public void GoToLatLong(double Latitude, double Longitude, double Altitude)
|
|
{
|
|
|
|
}
|
|
|
|
public double LocationToX(Locationx Where)
|
|
{
|
|
return Where.Longitude;
|
|
}
|
|
public double LocationToY(Locationx Where)
|
|
{
|
|
return Where.Latitude;
|
|
}
|
|
|
|
public void Save()
|
|
{
|
|
}
|
|
public Locationx XYToLocation(int X, int Y)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public class AxMappointControlx
|
|
{
|
|
public AxMappointControlx(CefSharpChromiumWebBrowser mapGoogleParam, String tabNameParam, int HeightParam, int WidthParam)
|
|
{
|
|
mapGoogles = mapGoogleParam;
|
|
tabName = tabNameParam.Replace(' ','_');
|
|
Height = HeightParam;
|
|
Width = WidthParam;
|
|
addrcmd = "";
|
|
}
|
|
public void UpdatemapGoogles(CefSharpChromiumWebBrowser mapGoogleParam)
|
|
{
|
|
mapGoogles = mapGoogleParam;
|
|
}
|
|
|
|
public ArrayList ListShapeCMD = new ArrayList();
|
|
public int cntShape = 0;
|
|
public String tabName;
|
|
public int Height=100;
|
|
public int Width=100;
|
|
public Double latCenter=0;
|
|
public Double lngCenter=0;
|
|
public int zoom = 12;
|
|
public Mapx ActiveMap;//{ get; }
|
|
// public Boolean PingGoogle = false;
|
|
public String addrcmd = "";
|
|
|
|
public GeoPointerx MousePointer
|
|
{
|
|
set
|
|
{
|
|
}
|
|
}
|
|
public Toolbarsx Toolbars = new Toolbarsx();
|
|
public GeoUnitsx Units
|
|
{
|
|
set { }
|
|
}
|
|
public System.Drawing.Size Size; //{ get; }
|
|
public CefSharpChromiumWebBrowser mapGoogles;
|
|
public String OldCommand="";
|
|
public MainForm2 parent;
|
|
public Safedispatch_4_0.LiveTab parLive;
|
|
public Safedispatch_4_0.HistoryTab parHist;
|
|
|
|
public String contentrep = "";
|
|
public String contentplay = "";
|
|
public Int32 firstRef = 0;
|
|
public System.Windows.Forms.Timer timerRef=null;
|
|
public System.ComponentModel.Container components = new System.ComponentModel.Container();
|
|
|
|
public void RefreshMap(int HeightParam, int WidthParam)
|
|
{
|
|
String safemobileDirPath = System.Windows.Forms.Application.StartupPath.Replace('\\', '/').Replace(" ", "%20");
|
|
safemobileDirPath = safemobileDirPath.Replace("#", "%23");
|
|
|
|
string mapHtmlName = "file:///" + safemobileDirPath + "/resource/" + MainForm2.MapHtmlName;
|
|
|
|
Height = HeightParam;
|
|
Width = WidthParam;
|
|
if (((Width - 20) > 100) && ((Height - 20) > 100))
|
|
{
|
|
try
|
|
{
|
|
if (firstRef < 1) //aici era 2
|
|
{
|
|
SM.Debug("Load data From localDISK 1111111111");
|
|
|
|
|
|
mapGoogles.LoadWebPage(mapHtmlName);
|
|
Utils.WriteLine(mapHtmlName, ConsoleColor.Red);
|
|
firstRef++;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SM.Debug("Intra pe CATCH in LOAD MAP" + ex.ToString());
|
|
if (parLive != null) parLive.maxloadcnt++;
|
|
|
|
mapGoogles.LoadWebPage(mapHtmlName);
|
|
SM.Debug(mapHtmlName);
|
|
}
|
|
}
|
|
}
|
|
|
|
public Mapx NewMap(object template)
|
|
{
|
|
Mapx map = new Mapx();
|
|
map.Shapes.parent = this;
|
|
map.DataSets.parent = this;
|
|
map.parent = this;
|
|
|
|
ActiveMap = map;
|
|
return map;
|
|
}
|
|
public Mapx OpenMap(string fileName)
|
|
{
|
|
return null;
|
|
}
|
|
public void SaveMap()
|
|
{
|
|
}
|
|
public void SaveMapAs(string fileName)
|
|
{
|
|
}
|
|
}
|
|
|
|
public class Application
|
|
{
|
|
public Application(Mapx mapParam)
|
|
{
|
|
ActiveMap = mapParam;
|
|
}
|
|
|
|
public Mapx ActiveMap; //{ get; }
|
|
public void Quit()
|
|
{ }
|
|
}
|
|
} |