89 ZOOM_FACTORS = [math.sqrt(2) ** x for x in xrange(-6, MAX_ZOOMIN)] |
89 ZOOM_FACTORS = [math.sqrt(2) ** x for x in xrange(-6, MAX_ZOOMIN)] |
90 |
90 |
91 |
91 |
92 def GetVariableCreationFunction(variable_type): |
92 def GetVariableCreationFunction(variable_type): |
93 def variableCreationFunction(viewer, id, specific_values): |
93 def variableCreationFunction(viewer, id, specific_values): |
94 return FBD_Variable(viewer, variable_type, |
94 return FBD_Variable(viewer, |
95 specific_values.name, |
95 variable_type, |
96 specific_values.value_type, |
96 specific_values.name, |
97 id, |
97 specific_values.value_type, |
98 specific_values.execution_order) |
98 id, |
|
99 specific_values.execution_order) |
99 return variableCreationFunction |
100 return variableCreationFunction |
100 |
101 |
101 |
102 |
102 def GetConnectorCreationFunction(connector_type): |
103 def GetConnectorCreationFunction(connector_type): |
103 def connectorCreationFunction(viewer, id, specific_values): |
104 def connectorCreationFunction(viewer, id, specific_values): |
104 return FBD_Connector(viewer, connector_type, |
105 return FBD_Connector(viewer, |
105 specific_values.name, id) |
106 connector_type, |
|
107 specific_values.name, |
|
108 id) |
106 return connectorCreationFunction |
109 return connectorCreationFunction |
107 |
110 |
108 |
111 |
109 def commentCreationFunction(viewer, id, specific_values): |
112 def commentCreationFunction(viewer, id, specific_values): |
110 return Comment(viewer, specific_values.content, id) |
113 return Comment(viewer, specific_values.content, id) |
111 |
114 |
112 |
115 |
113 def GetPowerRailCreationFunction(powerrail_type): |
116 def GetPowerRailCreationFunction(powerrail_type): |
114 def powerRailCreationFunction(viewer, id, specific_values): |
117 def powerRailCreationFunction(viewer, id, specific_values): |
115 return LD_PowerRail(viewer, powerrail_type, id, |
118 return LD_PowerRail(viewer, |
116 specific_values.connectors) |
119 powerrail_type, |
|
120 id, |
|
121 specific_values.connectors) |
117 return powerRailCreationFunction |
122 return powerRailCreationFunction |
118 |
123 |
119 |
124 |
120 def NEGATED_VALUE(x): |
125 def NEGATED_VALUE(x): |
121 return x if x is not None else False |
126 return x if x is not None else False |
151 COIL_NORMAL) |
156 COIL_NORMAL) |
152 return LD_Coil(viewer, coil_type, specific_values.name, id) |
157 return LD_Coil(viewer, coil_type, specific_values.name, id) |
153 |
158 |
154 |
159 |
155 def stepCreationFunction(viewer, id, specific_values): |
160 def stepCreationFunction(viewer, id, specific_values): |
156 step = SFC_Step(viewer, specific_values.name, |
161 step = SFC_Step(viewer, |
157 specific_values.initial, id) |
162 specific_values.name, |
|
163 specific_values.initial, |
|
164 id) |
158 if specific_values.action is not None: |
165 if specific_values.action is not None: |
159 step.AddAction() |
166 step.AddAction() |
160 connector = step.GetActionConnector() |
167 connector = step.GetActionConnector() |
161 connector.SetPosition(wx.Point(*specific_values.action.position)) |
168 connector.SetPosition(wx.Point(*specific_values.action.position)) |
162 return step |
169 return step |
163 |
170 |
164 |
171 |
165 def transitionCreationFunction(viewer, id, specific_values): |
172 def transitionCreationFunction(viewer, id, specific_values): |
166 transition = SFC_Transition(viewer, specific_values.condition_type, |
173 transition = SFC_Transition(viewer, |
167 specific_values.condition, |
174 specific_values.condition_type, |
168 specific_values.priority, id) |
175 specific_values.condition, |
|
176 specific_values.priority, |
|
177 id) |
169 return transition |
178 return transition |
170 |
179 |
171 |
180 |
172 divergence_types = [SELECTION_DIVERGENCE, |
181 divergence_types = [SELECTION_DIVERGENCE, |
173 SELECTION_CONVERGENCE, SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE] |
182 SELECTION_CONVERGENCE, SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE] |
174 |
183 |
175 |
184 |
176 def GetDivergenceCreationFunction(divergence_type): |
185 def GetDivergenceCreationFunction(divergence_type): |
177 def divergenceCreationFunction(viewer, id, specific_values): |
186 def divergenceCreationFunction(viewer, id, specific_values): |
178 return SFC_Divergence(viewer, divergence_type, |
187 return SFC_Divergence(viewer, divergence_type, |
179 specific_values.connectors, id) |
188 specific_values.connectors, id) |
180 return divergenceCreationFunction |
189 return divergenceCreationFunction |
181 |
190 |
182 |
191 |
183 def jumpCreationFunction(viewer, id, specific_values): |
192 def jumpCreationFunction(viewer, id, specific_values): |
184 return SFC_Jump(viewer, specific_values.target, id) |
193 return SFC_Jump(viewer, specific_values.target, id) |