The DWG Viewer explains how to embed the framework into a stand alone application and covers basic viewing and editing capabilities.
Features
Viewer object
Load drawing
Close drawing
Change viewing modes
Change layout background color
Switch between model and sheets
...
DWG Viewer - Close active drawingJava
Status | ||
---|---|---|
|
The active drawing is closed with the CLOSE command. When the document is closed the CFxARESDelegate triggers documentDestroyed() , the drawing is removed from the memory and the CFxARESDocumentView can become invisible. The application can set up the user interface for a new drawing.
...
DWG Viewer - Change viewing modesJava
Status | ||
---|---|---|
|
It is not necessary to implement viewing gestures. The framework comes with a set of basic finger gestures to change the active view of the drawing. It supports zooming in and out but has to know if it runs in Pan or Orbit mode. The viewing mode can be switched with a Diesel expression that can be executed with the runCommand() method of the singleton CFxARESInstance.instance().
...
DWG Viewer - Java Native InterfaceJava
Status | ||
---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Executing core commands is a good approach to quickly achieve results but in some cases it is necessary to access directly the drawing content or system relevant parameters. The JNI, the Java Native Interface , allows to exchange data between Java and C++ or to directly manipulate drawing content. The synergy works with a combination of native Java methods and a matching C++ implementation that follows the JNI specifications. The C++ code is managed with CMake and compiled with the NDK. The created shared library (*.so) must be loaded using System.loadLibrary(). The JNI supports executing code in both directions.
...
DWG Viewer - Change layout background colorJava
Status | ||
---|---|---|
|
Status | ||||
---|---|---|---|---|
|
The DWG Viewer uses a native method SetBackgroundColor() to change the background color of the active model or sheet. The offered color indexes are linked to a button. The native method is called when the button is tapped. The native method SetBackgroundColor() manipulates the C++ part of the application and must be executed from the working thread. A suitable method runOnWorkingThread() is provided by CFxARESInstance.instance().
...
DWG Vewer - Switch between model and sheetsJava
Status | ||
---|---|---|
|
Status | ||||
---|---|---|---|---|
|
The DWG Viewer uses a native method GetLayoutNames() to get all available sheets of the drawing when documentActivated() is triggered. All layouts are passed to the method DocumentActivated() of the main activity and a corresponding button is created for each layout. The button is linked with a command expression that is executed when tapped. The command _SHEET_CONTROL handles the layout switch. The native method GetLayoutNames() manipulates the UI of the application and must be executed from the ui thread of the host application. A suitable method runOnUiThread() is provided by CFxARESInstance.instance().
...