|
@@ -0,0 +1,38 @@
|
|
|
+using SAGA.Models;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace SAGA.GplotRelationComputerManage
|
|
|
+{
|
|
|
+ public interface IElectricalRelationHandler
|
|
|
+ {
|
|
|
+ string ElectricalRelationType { get; }
|
|
|
+ List<DataNode> GetViewData(PowerComputerContext context);
|
|
|
+ List<DataNode> GetComputeData(PowerComputerContext context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public class ElectricalRelationHandlerFactory
|
|
|
+ {
|
|
|
+ static ElectricalRelationHandlerFactory()
|
|
|
+ {
|
|
|
+ IElectricalRelationHandler handler = new DistributionRelationshipHandler();
|
|
|
+ m_Handlers[handler.ElectricalRelationType] = handler;
|
|
|
+ handler = new EquipPowerRelationshipHandler();
|
|
|
+ m_Handlers[handler.ElectricalRelationType] = handler;
|
|
|
+ handler = new ObjectControlRelationshipHandler();
|
|
|
+ m_Handlers[handler.ElectricalRelationType] = handler;
|
|
|
+ }
|
|
|
+ private static Dictionary<string, IElectricalRelationHandler> m_Handlers = new Dictionary<string, IElectricalRelationHandler>();
|
|
|
+ public static IElectricalRelationHandler Create(string electricalRelationType)
|
|
|
+ {
|
|
|
+ if (m_Handlers.TryGetValue(electricalRelationType, out IElectricalRelationHandler handler))
|
|
|
+ {
|
|
|
+ return handler;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|