@@ -8,7 +8,7 @@ import '../Monxiv/GOBJStyle.dart' as gStyle;
88
99import 'GMKCommand.dart' ;
1010import 'GMKStructure.dart' ;
11- import 'GMKError .dart' ;
11+ import 'GMKLib .dart' as g_lib ;
1212
1313import '../../Linear/Vector.dart' ;
1414import '../../Conic/Circle.dart' ;
@@ -157,14 +157,21 @@ GMKStructure goCompiler(String source) {
157157 String label = subStringBetween (line, '@' , ' is ' ).trim ();
158158 String method = subStringBetween (line, ' is ' , ' of ' ).trim ();
159159 List <dynamic > factor = str2Factor (extractAfter (line, ' of ' ));
160- structure.addStep (GMKCommand (method, label, factor));
160+ //
161+ GMKCommand cmd = GMKCommand (method, label, factor);
162+ cmd.type = g_lib.method2type[method] ?? '?unType' ;
163+ gStyle.GOBJStyle style = gStyle.GOBJStyle .apply (cmd.type);
164+ cmd.style = style;
165+ structure.addStep (cmd);
161166 } catch (e, stackTrace) {
162167 Exception ('错误: $e ' );
163168 Exception ('堆栈跟踪: $stackTrace ' );
164169 }
165170 } else if (line.startsWith ('#' )) {
166- gStyle.GOBJStyle style = styleCompiler (line);
167171 String label = subStringBetween (line, '#' , ' ' ).trim ();
172+ gStyle.GOBJStyle ? oldStyle = structure.step[label]? .style;
173+ gStyle.GOBJStyle style = styleCompiler (oldStyle! , line);
174+
168175 structure.step[label]? .style = style;
169176 if (kDebugMode) {
170177 print ('set style<$label >:${style .toString ()}' );
@@ -241,20 +248,26 @@ String gmkCommand2Str(GMKCommand gc) {
241248}
242249
243250
244- gStyle.GOBJStyle styleCompiler (String sCode) {
245- gStyle.GOBJStyle result = gStyle. GOBJStyle . none () ;
251+ gStyle.GOBJStyle styleCompiler (gStyle. GOBJStyle oldStyle, String sCode) {
252+ gStyle.GOBJStyle result = oldStyle ;
246253 String label = subStringBetween (sCode, '#' , ' ' ).trim ();
247254 String sFactor = extractAfter (sCode, '#$label ' );
248255 List <dynamic > factor = str2Factor (sFactor);
249256 for (int i = 0 ; i < factor.length; i++ ) {
250257 dynamic itemFactor = factor[i];
251- print (itemFactor.runtimeType);
258+ // print(itemFactor.runtimeType);
252259 if (gStyle.color.contains (itemFactor)) {
253260 result.color = gStyle.colors[itemFactor]! ;
254261 } else if (gStyle.shape.contains (itemFactor)) {
255262 result.shape = itemFactor;
256263 } else if (itemFactor.runtimeType == double || itemFactor.runtimeType == int ) {
257264 result.size = itemFactor;
265+ } else if (gStyle.show.contains (itemFactor)) {
266+ result.show = (itemFactor == 'show' );
267+ } else if (gStyle.labelShow.contains (itemFactor)) {
268+ result.labelShow = (itemFactor == 'labelShow' );
269+ } else if (gStyle.fertileWaveLink.contains (itemFactor)) {
270+ result.fertileWaveLink = (itemFactor == 'fertileWaveLink' );
258271 }
259272 }
260273 return result;
0 commit comments