Hello !! In this post I will be describing my latest progress in the Geogebra Filter that we are creating for Kig.
After a lot of hiccups, it finally seems that we have found a proper implementation which smartly handles both Geogebra worksheets and Geogebra tools.
Although the planning had been done a long time ago and a draft implementation which successfully read geogebra’s tools into Kig had been done, David (David Narvaez , my mentor ) was not happy with it ( and neither was I .. ) since the code looked dirty ( with a lots if-else’s scattered everywhere. Reading Geogebra worksheets and tool-files both require very similar XSLT manipulation and parsing and the challenge was to smartly create an implementation which could handle both ( Geogebra worksheets and Tools ) with the least code duplication and with a flexible and sensible design.
A lot of attempts were made by both David and me in reaching the implementation that we have today. In my first attempt I was able to create an implementation which read tools correctly but the tool file ( .ggt file ) had to be opened from the open-file Dialog ( and not from the Types Dialog in Kig ) . Again in my second attempt I was able to enable the opening of tool files from the Types Dialog instead of the file dialog. This was more accurate in behaviour since in Kig ( and also in Geogebra ) tools are maintained from a separate dialog and not from the file dialog.
Previously we had just one class to handle Geogebra files- KigFilterGeogebra class which inherited from both KigFilter and QAbstractXMLReceiver class. The problem that created was that if we extended the class to read tools, a lot of complicacy was introduced in the functions. Then we separated the QAbstractXMLReceiver part of the KigFlterGeogebra class and moved it to a new class – GeogebraTransformer class which reads the transformed XML file and generates the object-tree of the document. Both The GogebraFilter and the GeogebraToolFilter classes use an instance of this Transformer class to get the object-tree. This way the code duplicacy issue was solved and also simplified the Filter classes.
After just a little polishing, our filter will enable Kig to read Geogebra tools !!