GLG Extended API是GLG工具包的一款可選控件,它可提供在運行時的高級動態配置與編輯功能。
GLG Extended API為應用程序提供了基于當前配置數據制作繪畫的功能。它同樣可用來在運行時動態地為繪畫添加圖片對象,該對象對于能顯示不同動態圖標(如在地圖上移動飛機圖標)的應用程序具有非常重要的作用。使用Extended API的另一個例子是能基于用戶輸入而創建對象的自定義圖表應用程序。
除了創建與刪除對象的功能外,Extended API同樣能提供可用于在運行時在圖形繪制中遍歷對象以及動態決定繪制內容的高級內窺功能。Extended API能使您訪問圖片創建程序中的所有操作,不管您選擇的部署選項是C/C++、Java還是ActiveX
GLG Extended API is an optional component of the GLG Toolkit, which provides advanced dynamic configuration and editing features at run time.
The GLG Extended API provides an application with capabilities to create drawings on the fly based on the current configuration data. It may be also used to add graphical objects to the drawing dynamically at run time, which is important for applications that display variable number of dynamic icons, such as moving airplane icons on the map. Another example of using the Extended API is a custom diagramming application that creates objects?interactively based on user input.
In addition to the methods for creating and deleting objects, the Extended API also provides advanced introspection capabilities, which can be used to traverse objects in the drawing and dynamically determine the drawing's content at run time. The Extended API provides programming access to all operations available in the Graphics Builder, regardless of the chosen deployment option: C/C++, Java or ActiveX.
動態配置與編輯應用程序編程接口(API)
GLG 擴展應用程序編程接口(API)是 GLG 工具包的一個可選組件,它在運行時提供高級的動態配置和編輯功能。
GLG 擴展 API 使應用程序能夠根據當前配置數據即時創建圖形。它還可用于在運行時動態地向圖形中添加圖形對象,這對于顯示數量可變的動態圖標(例如地圖上移動的飛機圖標)的應用程序來說非常重要。使用擴展 API 的另一個例子是自定義圖表繪制應用程序,它可以根據用戶輸入以交互方式創建對象。
除了用于創建和刪除對象的方法外,擴展 API 還提供高級的內省功能,可用于遍歷圖形中的對象,并在運行時動態確定圖形的內容。無論選擇哪種部署選項(C/C++、Java 或 ActiveX),擴展 API 都提供對圖形構建器中所有可用操作的編程訪問權限。
以下列出了需要擴展應用程序編程接口(API)的應用程序類型。
這是一個圖表編輯器,用戶在運行時通過從選項板中選擇一個節點并將其放置在繪圖中,來創建圖表節點。
這是一個基于地理信息系統的應用程序,它需要在運行時創建動態圖標來表示需要可視化的移動物體的位置。由于在設計時圖標數量是未知的,因此這些圖標是在運行時通過復制一個或多個圖標模板來創建的。可以使用幾個模板來表示不同類型的被監測對象。
這是一個網絡監測或可視化應用程序,它需要根據其數據庫中的信息在運行時創建一些節點和連接。擴展 API 用于根據數據庫查詢創建節點,并根據接收到的連接信息用連接將它們連接起來。
一個過程控制應用程序可以讀取一個描述特定工廠設備的配置文件,并在運行時通過復制代表各種過程控制設備的預構建模板并將它們放置在繪圖中來生成圖形。
如果可以使用圖形構建器提前構建圖形,那么 GLG 標準 API 就足以顯示該圖形并用實時數據對其進行更新。
Programming API
While the Graphics Builder is used for interactive design of drawings, the Programming API provides a way for the program to interact with the drawing from a program. The API is the second crucial element of the Toolkit, and provides programming access to objects created in the Builder when the drawing is embedded into an application.
The Toolkit provides a number of native programming containers for deploying the Toolkit's graphics in an application, both C/C++ and Java, Unix, Linux and Windows: a Motif/Gtk/Qt widget, an MFC class, Windows custom control, a Java bean and class library, an ActiveX Control and more. Click here for more information on available programming containers and deployment options.
A developer will only need to use a single SetResource function call or method to set any of the drawing's resources, which is a result of the resource based Programming API. The programmer needs to know only the name of a given resource, either an intuitive default such as FillColor, or any custom name given to the resource.
The Programming API may be used to modify resources of the drawing at run-time and supply dynamic data for real-time updates. The application needs to concern itself only with supplying new resource values, and the Toolkit's engine handles all details of the low-level graphics and damage repair. The updates are data-driven, so no CPU time is consumed if the data does not change. Click here for more information.
The API may also be used to handle user interaction, such as object selection or interaction with buttons, sliders and other controls. The object selection is handled transparently by the Toolkit, regardless of the screen size or zooming state, and the program's callback is invoked with all selection information every time an object of interest is selected. Click here for more information.