Commit 634c9abe authored by 潘栩锋's avatar 潘栩锋 🚴

整理 FOBJ 代理,多余的删除

parent e93197eb
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Collections.ObjectModel;
using Misc;
using FObjBase;
using FLY.Thick.Base.IService;
using FLY.Thick.Base.OBJ_INTERFACE;
using FLY.Thick.Base.Common;
namespace FLY.Thick.Base.Client
{
public class BoltMapServiceClient:FObj, IBoltMapService
{
IFConn mConn;
UInt32 mServerID;
public BoltMapServiceClient()
{
mServerID = BOLTMAP_OBJ_INTERFACE.ID;
}
#region BoltMapService
private int firstboltno;
public int FirstBoltNo
{
get
{
return firstboltno;
}
set
{
if (firstboltno != value)
{
firstboltno = value;
NotifyPropertyChanged("FirstBoltNo");
}
}
}
private ObservableCollection<Range> bolts = new ObservableCollection<Range>();
public ObservableCollection<Range> Bolts
{
get { return bolts; }
}
#region 只用于描述 Bolts,没什么用
private int lastboltno;
/// <summary>
/// 最后一个分区号
/// </summary>
public int LastBoltNo
{
get
{
return lastboltno;
}
protected set
{
if (lastboltno != value)
{
lastboltno = value;
NotifyPropertyChanged("LastBoltNo");
}
}
}
private int boltinterval;
/// <summary>
/// 平均分区间隔
/// </summary>
public int BoltInterval
{
get
{
return boltinterval;
}
set
{
if (boltinterval != value)
{
boltinterval = value;
NotifyPropertyChanged("BoltInterval");
}
}
}
private int boltwidth;
/// <summary>
/// 平均分区宽度
/// </summary>
public int BoltWidth
{
get
{
return boltwidth;
}
protected set
{
if (boltwidth != value)
{
boltwidth = value;
NotifyPropertyChanged("BoltWidth");
}
}
}
private int posbegin;
/// <summary>
/// 脉冲范围 开始
/// </summary>
public int PosBegin
{
get
{
return posbegin;
}
protected set
{
if (posbegin != value)
{
posbegin = value;
NotifyPropertyChanged("PosBegin");
}
}
}
private int posend;
/// <summary>
/// 脉冲范围 结束
/// </summary>
public int PosEnd
{
get
{
return posend;
}
protected set
{
if (posend != value)
{
posend = value;
NotifyPropertyChanged("PosEnd");
}
}
}
#endregion
#endregion
#region INotifyPropertyChanged 成员
protected void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
public event ActiveEventHandler ActiveEvent;
private BORDER_TYPE bordertype;
/// <summary>
/// 找边界,边界类型
/// </summary>
public BORDER_TYPE BorderType
{
get { return bordertype; }
set
{
if (bordertype != value)
{
bordertype = value;
NotifyPropertyChanged("BorderType");
}
}
}
private int borderboltno_b;
/// <summary>
/// 开始边界分区号
/// </summary>
public int BorderBoltNo_B
{
get { return borderboltno_b; }
set
{
if (borderboltno_b != value)
{
borderboltno_b = value;
NotifyPropertyChanged("BorderBoltNo_B");
}
}
}
private int borderboltno_e;
/// <summary>
/// 结束边界分区号
/// </summary>
public int BorderBoltNo_E
{
get { return borderboltno_e; }
set
{
if (borderboltno_e != value)
{
borderboltno_e = value;
NotifyPropertyChanged("BorderBoltNo_E");
}
}
}
private int borderboltno_mid;
/// <summary>
/// 边界分区号 中间
/// </summary>
public int BorderBoltNo_M
{
get { return borderboltno_mid; }
set
{
if (borderboltno_mid != value)
{
borderboltno_mid = value;
NotifyPropertyChanged("BorderBoltNo_Mid");
}
}
}
private int smooth;
public int Smooth
{
get { return smooth; }
set
{
if (smooth != value)
{
smooth = value;
NotifyPropertyChanged("Smooth");
}
}
}
/// <summary>
/// 转DataTable
/// </summary>
/// <param name="dt"></param>
public void Bolts2DataTable(DataTable dt)
{
dt.Clear();
dt.Columns.Clear();
dt.Columns.Add(new DataColumn("No", typeof(int)));
dt.Columns.Add(new DataColumn("Begin", Type.GetType("System.Int32")));
dt.Columns.Add(new DataColumn("End", Type.GetType("System.Int32")));
for (int i = 0; i < Bolts.Count; i++)
{
DataRow dr = dt.NewRow();
dr["No"] = FirstBoltNo + i;
dr["Begin"] = Bolts[i].Begin;
dr["End"] = Bolts[i].End;
dt.Rows.Add(dr);
}
}
public void Apply()
{
BOLTMAP_OBJ_INTERFACE.Pack_Params p = new BOLTMAP_OBJ_INTERFACE.Pack_Params();
p.boltNo1st = FirstBoltNo;
p.bolts = (from c in Bolts select new Range() { Begin = c.Begin, End = c.End }).ToArray();
CurrObjSys.SetValueEx(
mConn, mServerID, ID,
BOLTMAP_OBJ_INTERFACE.SET_PARAMS,
p.ToBytes());
}
public void ApplyBorder()
{
CurrObjSys.SetValueEx(
mConn, mServerID, ID,
BOLTMAP_OBJ_INTERFACE.SET_BORDERPARAMS,
new BOLTMAP_OBJ_INTERFACE.Pack_BorderParams()
{
bordertype = BorderType,
borderboltno_b = BorderBoltNo_B,
borderboltno_e = BorderBoltNo_E,
smooth = Smooth
}.ToBytes()
);
}
public override void Dispose()
{
CurrObjSys.ObjRemove(
this, mConn);
}
public override void ConnectNotify(IFConn from)
{
mConn = from;
if (from.IsConnected)
{
//获取所有数据,设置推送
CurrObjSys.GetValueEx(
mConn, mServerID, ID,
BOLTMAP_OBJ_INTERFACE.GET_PARAMS);
CurrObjSys.GetValueEx(
mConn, mServerID, ID,
BOLTMAP_OBJ_INTERFACE.GET_BORDERPARAMS);
CurrObjSys.GetValueEx(
mConn, mServerID, ID,
BOLTMAP_OBJ_INTERFACE.GET_BOLTSINFO);
CurrObjSys.SenseConfigEx(
mConn, mServerID, ID, 0xffffffff,
SENSE_CONFIG.ADD);
}
}
public override void PushGetValue(IFConn from, uint srcid, ushort memid, byte[] infodata)
{
switch (memid)
{
case BOLTMAP_OBJ_INTERFACE.GET_PARAMS:
{
BOLTMAP_OBJ_INTERFACE.Pack_Params p = new BOLTMAP_OBJ_INTERFACE.Pack_Params();
if (p.TryParse(infodata))
{
FirstBoltNo = p.boltNo1st;
Bolts.Clear();
foreach (var c in p.bolts)
{
Bolts.Add(
new Range() { Begin = c.Begin,
End = c.End });
}
}
if (ActiveEvent != null)
{
ActiveEvent(this);
}
} break;
case BOLTMAP_OBJ_INTERFACE.GET_BORDERPARAMS:
{
BOLTMAP_OBJ_INTERFACE.Pack_BorderParams p = new BOLTMAP_OBJ_INTERFACE.Pack_BorderParams();
if (!p.TryParse(infodata))
break;
BorderType = p.bordertype;
BorderBoltNo_B = p.borderboltno_b;
BorderBoltNo_E = p.borderboltno_e;
Smooth = p.smooth;
} break;
case BOLTMAP_OBJ_INTERFACE.GET_BOLTSINFO:
{
BOLTMAP_OBJ_INTERFACE.Pack_BoltsInfo p = new BOLTMAP_OBJ_INTERFACE.Pack_BoltsInfo();
if (!p.TryParse(infodata))
break;
LastBoltNo = p.LastBoltNo;
PosBegin = p.PosBegin;
PosEnd = p.PosEnd;
BoltInterval = p.BoltInterval;
BoltWidth = p.BoltWidth;
}break;
}
}
public override void PushInfo(IFConn from, uint srcid, ushort infoid, byte[] infodata)
{
PushGetValue(from, srcid, infoid, infodata);
}
}
}
......@@ -51,7 +51,6 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Client\BoltMapServiceClient.cs" />
<Compile Include="Client\BorderSearchServiceClient.cs" />
<Compile Include="Client\CoatingSegmentServiceClient.cs" />
<Compile Include="Client\CurveServiceClient.cs" />
......@@ -111,14 +110,12 @@
<Compile Include="OBJ_INTERFACE\GAGEINFO_OBJ_INTERFACE.cs" />
<Compile Include="OBJ_INTERFACE\GETSAMPLE_OBJ_INTERFACE.cs" />
<Compile Include="OBJ_INTERFACE\INITPARAM_OBJ_INTERFACE.cs" />
<Compile Include="OBJ_INTERFACE\OBJ_INTERFACE_ID.cs" />
<Compile Include="OBJ_INTERFACE\PASSWORD_OBJ_INTERFACE.cs" />
<Compile Include="OBJ_INTERFACE\PROFILE_OBJ_INTERFACE.cs" />
<Compile Include="OBJ_INTERFACE\REJECT_OBJ_INTERFACE.cs" />
<Compile Include="OBJ_INTERFACE\SCANCORR_OBJ_INTERFACE.cs" />
<Compile Include="OBJ_INTERFACE\TDGAGE_OBJ_INTERFACE.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Server.OBJProxy\BoltMap_OBJProxy.cs" />
<Compile Include="Server.OBJProxy\BorderSearch_OBJProxy.cs" />
<Compile Include="Server.OBJProxy\CoatingSegmentSearch_OBJProxy.cs" />
<Compile Include="Server.OBJProxy\Curve_OBJProxy.cs" />
......
......@@ -10,7 +10,7 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
{
public class BOLTMAP_OBJ_INTERFACE
{
public const UInt32 ID = OBJ_INTERFACE_ID.BOLTMAP_ID;
#region Pack
public class Pack_Params : IPack
{
......
......@@ -9,7 +9,6 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
{
public class COATINGSEGMENT_OBJ_INTERFACE
{
public const UInt32 ID = OBJ_INTERFACE_ID.COATINGSEGMENT_ID;
#region Pack
public class Pack_Params : IPack
{
......
......@@ -8,7 +8,6 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
{
public class GAGEINFO_OBJ_INTERFACE
{
public const UInt32 ID = OBJ_INTERFACE_ID.GAGEINFO_ID;
#region Pack
public class Pack_State : IPack
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FLY.Thick.Base.OBJ_INTERFACE
{
public class OBJ_INTERFACE_ID
{
//public const UInt32 BULKDATA_ID = 0x003c0001;
public const UInt32 BORDERSEARCH_ID = 0x30010001;
public const UInt32 CURVE_ID = 0x30020001;
public const UInt32 GET_SAMPLE_ID = 0x30030001;
public const UInt32 REJECT_ID = 0x30040001;
public const UInt32 BOLTCREATEINFO_ID = 0x30050001;
public const UInt32 BOLTMAP_ID = 0x30060001;
public const UInt32 INITPARAM_ID = 0x30070001;
public const UInt32 WARNING_ID = 0x30080001;
public const UInt32 SCANWARNING_ID = 0x30090001;
public const UInt32 REMOTEHISTORY_ID = 0x300b0001;
public const UInt32 COATINGSEGMENT_ID = 0x300c0001;
public const UInt32 CS_HISTORY_ID = 0x300d0001;
public const UInt32 GAGEINFO_ID = 0x300e0001;
public const UInt32 FLYAD_ID = 0x300f0001;
public const UInt32 FIX_ID = 0x30100001;
public const UInt32 PROFILE_ID = 0x30110001;
public const UInt32 PASSWORD_ID = 0x30120001;
public const UInt32 SCANCORR_ID = 0x00220001;
public const UInt32 TDGAGE_ID = 0x00140001;
public const UInt32 DYNAREA_ID = 0x003B0001;
}
}
......@@ -8,7 +8,6 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
{
public class PROFILE_OBJ_INTERFACE
{
public const UInt32 ID = OBJ_INTERFACE_ID.PROFILE_ID;
#region Pack
public class Pack_StringList : IPack
{
......
......@@ -10,7 +10,6 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
{
public class TDGAGE_OBJ_INTERFACE
{
public const UInt32 ID = OBJ_INTERFACE_ID.TDGAGE_ID;
#region Pack
public class Pack_CallStart2 : IPack
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Misc;
using FObjBase;
using FLY.Thick.Base.Common;
using FLY.Thick.Base.IService;
using FLY.Thick.Base.OBJ_INTERFACE;
namespace FLY.Thick.Base.Server.OBJProxy
{
public class BoltMap_OBJProxy : FObj
{
#region 延时推送 MARKNO
const int MARKNO_PUSH_PARAMS = 1;
const int MARKNO_PUSH_BORDER = 2;
const int MARKNO_PUSH_INFO = 3;
#endregion
IBoltMapService mBoltMapService;
public BoltMap_OBJProxy(int objsys_idx, IBoltMapService boltMapService) :base(objsys_idx)
{
ID = BOLTMAP_OBJ_INTERFACE.ID;
mBoltMapService = boltMapService;
mBoltMapService.PropertyChanged += new PropertyChangedEventHandler(mBoltMapService_PropertyChanged);
mBoltMapService.ActiveEvent += new ActiveEventHandler(mBoltMapService_ActiveEvent);
}
void mBoltMapService_ActiveEvent(object sender)
{
FObjBase.PollModule.Current.Poll_JustOnce(
new PollModule.PollHandler(delegate()
{
byte[] buf;
GetValue(null, 0, BOLTMAP_OBJ_INTERFACE.GET_PARAMS, out buf);
CurrObjSys.PushObjInfoEx(
this, BOLTMAP_OBJ_INTERFACE.PUSH_PARAMS,
buf);
}), this, MARKNO_PUSH_PARAMS);
}
void mBoltMapService_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
//if ((e.PropertyName == "FirstBoltNo")||
// (e.PropertyName == "Bolts")
// )
//{
//}
//else
if ((e.PropertyName == "BorderBoltNo_B") ||
(e.PropertyName == "BorderBoltNo_E") ||
(e.PropertyName == "BorderType") ||(e.PropertyName == "Smooth") )
{
FObjBase.PollModule.Current.Poll_JustOnce(
new PollModule.PollHandler(delegate()
{
byte[] buf;
GetValue(null, 0, BOLTMAP_OBJ_INTERFACE.GET_BORDERPARAMS, out buf);
CurrObjSys.PushObjInfoEx(
this, BOLTMAP_OBJ_INTERFACE.PUSH_BORDERPARAMS,
buf);
}), this, MARKNO_PUSH_BORDER);
}
else if ((e.PropertyName == "LastBoltNo") ||
(e.PropertyName == "BoltInterval") ||
(e.PropertyName == "BoltWidth") ||
(e.PropertyName == "PosBegin") ||
(e.PropertyName == "PosEnd"))
{
FObjBase.PollModule.Current.Poll_JustOnce(
new PollModule.PollHandler(delegate()
{
byte[] buf;
GetValue(null, 0, BOLTMAP_OBJ_INTERFACE.GET_BOLTSINFO, out buf);
CurrObjSys.PushObjInfoEx(
this, BOLTMAP_OBJ_INTERFACE.PUSH_BOLTSINFO,
buf);
}), this, MARKNO_PUSH_INFO);
}
}
public override void GetValue(IFConn from, uint srcid, ushort memid, out byte[] infodata)
{
switch (memid)
{
case BOLTMAP_OBJ_INTERFACE.GET_PARAMS:
{
BOLTMAP_OBJ_INTERFACE.Pack_Params p = new BOLTMAP_OBJ_INTERFACE.Pack_Params()
{
boltNo1st = mBoltMapService.FirstBoltNo,
bolts = mBoltMapService.Bolts.ToArray(),
};
infodata = p.ToBytes();
} break;
case BOLTMAP_OBJ_INTERFACE.GET_BORDERPARAMS:
{
BOLTMAP_OBJ_INTERFACE.Pack_BorderParams p = new BOLTMAP_OBJ_INTERFACE.Pack_BorderParams()
{
bordertype = mBoltMapService.BorderType,
borderboltno_b = mBoltMapService.BorderBoltNo_B,
borderboltno_e = mBoltMapService.BorderBoltNo_E,
smooth = mBoltMapService.Smooth
};
infodata = p.ToBytes();
} break;
case BOLTMAP_OBJ_INTERFACE.GET_BOLTSINFO:
{
BOLTMAP_OBJ_INTERFACE.Pack_BoltsInfo p = new BOLTMAP_OBJ_INTERFACE.Pack_BoltsInfo()
{
LastBoltNo = mBoltMapService.LastBoltNo,
BoltInterval = mBoltMapService.BoltInterval,
BoltWidth = mBoltMapService.BoltWidth,
PosBegin = mBoltMapService.PosBegin,
PosEnd = mBoltMapService.PosEnd
};
infodata = p.ToBytes();
}break;
default:
infodata = null;
break;
}
}
public override void SetValue(IFConn from, uint srcid, ushort memid, byte[] infodata)
{
switch (memid)
{
case BOLTMAP_OBJ_INTERFACE.SET_PARAMS:
{
BOLTMAP_OBJ_INTERFACE.Pack_Params p = new BOLTMAP_OBJ_INTERFACE.Pack_Params();
if (p.TryParse(infodata))
{
mBoltMapService.FirstBoltNo = p.boltNo1st;
mBoltMapService.Bolts.Clear();
for(int i=0;i<p.bolts.Length;i++)
{
Range r = p.bolts[i];
mBoltMapService.Bolts.Add(
new Range(){
Begin = r.Begin,
End = r.End});
}
mBoltMapService.Apply();
}
} break;
case BOLTMAP_OBJ_INTERFACE.SET_BORDERPARAMS:
{
BOLTMAP_OBJ_INTERFACE.Pack_BorderParams p = new BOLTMAP_OBJ_INTERFACE.Pack_BorderParams();
if (p.TryParse(infodata))
{
mBoltMapService.BorderType = p.bordertype;
mBoltMapService.BorderBoltNo_B = p.borderboltno_b;
mBoltMapService.BorderBoltNo_E = p.borderboltno_e;
mBoltMapService.Smooth = p.smooth;
mBoltMapService.ApplyBorder();
}
} break;
}
}
}
}
......@@ -15,11 +15,7 @@ namespace FLY.Thick.BulkDataModule
IBulkDataService mBulkData;
public BulkDataService_OBJProxy(int objsys_idx, IBulkDataService bulkdata)
: this(objsys_idx, BULKDATA_OBJ_INTERFACE.ID, bulkdata)
{
}
public BulkDataService_OBJProxy(int objsys_idx, UInt32 id, IBulkDataService bulkdata)
: base(objsys_idx)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment