Subsystem for Interactively Drawing Synoptic Chart in MICAPS
-
摘要: 该文详细讨论了MICAPS中天气图交互制作子系统主要功能的实现技术与方法,包括使用组合设计模式定义图形对象,得到的类结构体现了图形对象之间的联系,不仅使代码可复用性较高,而且便于新类型图形对象的加入;使用状态设计模式设计了图形对象交互绘制过程的程序结构,既为用户提供了自定义手势事件功能,又增加了程序代码的可读性和可维护性;提出了修改曲线型图形对象的算法;使用命令设计模式实现了编辑图形对象的撤销/重做功能和软件系统运行日志,提高了软件系统的易用性和可靠性;讨论了编辑文档的自动保存功能的实现方法。通过以上功能的实现,天气图交互制作子系统方便用户操作,具有较高的运行效率和可靠性。Abstract: A subsystem is developed for interactively drawing synoptic chart to solve issues in previous versions of MICAPS and meet new user requirements. First of all, the composite design pattern is used to define the class hierarchy that describes graphical objects. This class hierarchy fits well with the relation among different graphical objects and therefore reduces the spatial complexity of the program, making manipulations to graphical objects much easier to implement. Thanks to the polymorphism feature provided by modern object-oriented programming languages, clients manipulating the graphical objects can treat all objects in this composite structure uniformly. The consequential benefit of this design advantage in practice is that the client code does not need to be modified when new types of graphical objects are introduced. This is especially useful for developers to define customized graphical object in their own applications. Above all, the proposed class hierarchy not only promotes code reusability, but also makes it easy to add new types of graphical objects. The code that draws rubber band graphical objects is constructed using the state design pattern, in which the behavior of drawing a particular type of graphical object is implemented in the corresponding class. The advantage of this approach is that introducing new types of graphical objects only require deriving new subclass and does not affect existing code. In addition, the gesture event class is proposed to represent the start, continue and end gestures in the rubber band drawing. In this way, the gestures can be customized at runtime by users. On the contrary, if the conventional code structure using large conditional statements is employed for rubber band drawing as in the previous implementation, the code complexity will increase dramatically when new types of graphical objects are introduced and the code defining the gestures has to be modified when user changes these gestures. The disadvantage makes it difficult to extend, debug and maintain the code. An algorithm to modify linestrip-type graphical objects, in particular isolines, is proposed. By taking advantage of the smoothness constraint, the proposed algorithm is able to solve the ambiguity in isolines modification and make the modified result meet the user expectation. The command design pattern is employed to implement undo/redo and runtime logging. The former feature facilitates users manipulation and the latter feature can restore the program session to the last successful state after the program quits abnormally. These two features enhance usability and reliability of the program. The implementation of automatically saving edited document which ensures the integrity of the documents is discussed. With all these features implemented, the proposed system not only facilitates users manipulation but provides good performance and reliability as well.
-
表 1 描述7种绘图状态的mDrawState子类
Table 1 The subclasses of mDrawState represent seven drawing states
类名称 绘图状态 被操作的图形对象 mDrawNullOperation 空操作,即不绘制任何图形,对应于用户没有选择任何图形对象的情况 mDrawSingleElement 绘制一个单点型图形对象,用户绘制此类对象一般需要在视图中单击1次鼠标左键 所有的天气符号(如雨,雪,台风等) mDrawDualElement 绘制一个单点型图形对象,但该对象的具体标识与所使用的鼠标键有关 (用户单击左键时,生成高压中心;点击右键时,生成低压中心) 高低压中心,冷暖中心 mDrawMultipointElement 绘制曲线型图形对象,用户绘制时需要多次单击鼠标键来确定曲线上点的位置 等值线,槽线,各种类型的锋面,霜冻线,降水区等 mDrawVector 绘制矢量型图形对象,用户首先通过单击鼠标确定图形对象位置,然后移动鼠标调整图形对象方向和长度 风向杆 mDrawModifyLinestrip 修改已绘制的线条型图形对象 曲线型图形对象 mDrawDeleteObject 删除选中的图形对象 所有的图形对象 -
[1] 李月安, 曹莉, 沃伟峰, 等.强天气监测和潜势预报系统.应用气象学报, 2006, 17(4): 141-146. http://www.cnki.com.cn/Article/CJFDTOTAL-YYQX2006S1020.htm [2] 李月安, 曹莉, 高嵩, 等. MICAPS预报业务平台现状与发展.气象, 2010, 26(7):50-55. doi: 10.7519/j.issn.1000-0526.2010.07.010 [3] Yu L, Cao L, Li Y, et al. Introduce on Typhoon Forecast Operational System//Proceedings of 27th IIPS for Meteorology, Oceanography, and Hydrology. 2011. [4] 郑卫江, 吴焕萍, 罗兵, 等. GIS技术在台风预报服务产品制作系统中的应用.应用气象学报, 2010, 21(2): 250-255. http://qikan.camscma.cn/jams/ch/reader/view_abstract.aspx?file_no=20100216&flag=1 [5] 孙利华, 吴焕萍, 郑金伟, 等.基于Flex的气象信息网络发布平台设计与实现.应用气象学报, 2010, 21(6): 754-761. http://qikan.camscma.cn/jams/ch/reader/view_abstract.aspx?file_no=20100613&flag=1 [6] 吴焕萍, 罗兵, 王维国, 等. GIS技术在决策气象服务系统建设中的应用.应用气象学报, 2008, 19(3): 380-384. http://qikan.camscma.cn/jams/ch/reader/view_abstract.aspx?file_no=20080362&flag=1 [7] 吴焕萍, 罗兵, 曹莉.地理信息服务及基于服务的气象业务系统框架探讨.应用气象学报, 2006, 17(增刊): 135-140. http://www.cnki.com.cn/Article/CJFDTOTAL-YYQX2006S1019.htm [8] Hopkins T, Henry R, Mandel E, et al. AWIPS Ⅱ Migration Status//Proceedings of 27th IIPS for Meteorology, Oceanography, and Hydrology. 2011. [9] Griffith F. AWIPS-Ⅱ Into the Future//Proceedings of 27th IIPS for Meteorology, Oceanography, and Hydrology. 2011. [10] Daabeck J. Overview of Meteorological Workstation Development in Europe//Proceedings of 21st International Conference on Interactive Information Processing Systems (IIPS) for Meteorology, Oceanography, and Hydrology. 2005. [11] Gamma E, Helm R, Johnson R, et al. Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley Professional, 1994. https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 [12] Moran J M, Morgan M D, Pauley P M. Meteorology: The Atmosphere and Science of Weather. New Jersey: Prentice Hall, 1996. [13] 寿绍文.天气学分析.北京:气象出版社, 2002. [14] Boor C de. A Practical Guide to Splines, Revised Edition. New York: Springer-Verlag, 2001. [15] Stroustrup B. The C++ Programming Language. Boston: Addison-Wesley Professional, 2000.