Changes for Xylem Nanjing, ver. 3.1.1676

This commit is contained in:
Milan Hanajik
2021-06-18 15:35:46 +02:00
parent f1ef16e1a3
commit 827a9f7c58
837 changed files with 46518 additions and 5851 deletions
@@ -0,0 +1,27 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using log4net;
namespace TBF.Rig.Various.EmergencyStop
{
public class Component : ComponentBase, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly Configuration myCfg;
public SchematicDrawing.IDrawingItem DrawingItem { get { return myCfg as SchematicDrawing.IDrawingItem; } }
public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as Configuration;
log.Warn(this.ToString());
}
public override void Initialize() { }
}
}
@@ -0,0 +1,104 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using SchematicDrawing;
using TBF.Rig.Generic;
namespace TBF.Rig.Various.EmergencyStop
{
public class Configuration : ComponentCfgBase, IComponentCfg, IParamsProvider, IRouteBasedDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
{
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
}
///
/// Serialized parameters
///
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public Sz Sz { get; set; }
public Orient Orient { get; set; }
public bool Flip { get; set; }
public int LblX { get; set; }
public int LblY { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public int BitNr { get { return 81; } } /// Bit-position
[XmlIgnore]
public bool Inverted { get { return false; } } /// When true the valve function is inverted: 0 = open, 1 = closed
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
public Configuration()
{
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public Configuration(string name, IComponentFactory factory)
: this()
{
Shape = Shape.EmergencyStop;
Sz = Sz.XL;
Name = name;
ParentName = string.Empty;
Factory = factory;
LblX = 43;
LblY = 22;
}
public string ComponentName { get { return Name; } }
public void InitializeAll() { }
string[] paramNames = new string[0] { };
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public ICollection<string> ParamValues(int i) { return null; }
public string ToString(int i)
{
return string.Format("name={0} x={1} y={2} sz={3} orient={4}", Name, X, Y, Sz, Orient);
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
return CfgUpdateFlags.None;
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = "Invalid index";
return false;
}
void CopyContentTo(Configuration prms) { }
public IParamsProvider Clone()
{
Configuration pars = new Configuration();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}
+26
View File
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.Resources;
using TBF.Rig.Generic;
namespace TBF.Rig.Various.EmergencyStop
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new Configuration(Strings.Emergency_STOP, this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(Configuration.Serializer, component, this);
}
}
}